:root{
  --bg:#f6f7f9;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --shadow:0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.04);
  --sidebar:#ffffff;
  --sidebar2:#f9fafb;
  --sidebar-border:#e5e7eb;
  --sidebar-text:#374151;
  --sidebar-muted:#9ca3af;
  --sidebar-accent:#166534;
  --sidebar-accent-bg:#f0fdf4;
  --sidebar-accent-outline:#bbf7d0;
  --accent:#2563eb;
  --good:#16a34a;
  --bad:#dc2626;
  --warn:#d97706;
  --radius:12px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--text);
  background:var(--bg);
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }

.app{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width:260px;
  background:var(--sidebar);
  border-right:1px solid var(--sidebar-border);
  color:var(--sidebar-text);
  padding:18px 14px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px 16px 10px;
  border-bottom:1px solid var(--sidebar-border);
  margin-bottom:14px;
}

.brand .logo{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  padding:4px 0;
  background:none;        /* remove square badge */
}

.brand .logo img{
  height:34px;            /* controls visual size */
  width:auto;             /* KEEP aspect ratio */
  max-width:180px;        /* prevents overflow */
  display:block;
}
.brand .title{
  line-height:1.1;
}
.brand .title strong{ display:block; font-size:14px; letter-spacing:.2px; color:var(--sidebar-text); }
.brand .title span{ display:block; font-size:12px; color:var(--sidebar-muted); }

.nav{ margin-top:10px; flex:1; }
.sidebar{ display:flex; flex-direction:column; }
.nav .section{
  margin:14px 8px 8px;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--sidebar-muted);
}
.nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:10px;
  color:var(--sidebar-text);
}
.nav a:hover{ background:#f3f4f6; text-decoration:none; }
.nav a.active{ background:var(--sidebar-accent-bg); color:var(--sidebar-accent); outline:1px solid var(--sidebar-accent-outline); font-weight:600; }

.main{
  flex:1;
  padding:22px;
}

.topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:18px;
}

.page-title h1{
  margin:0;
  font-size:20px;
}
.page-title p{
  margin:6px 0 0 0;
  color:var(--muted);
  font-size:13px;
}

.pills{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.pill{
  font-size:12px;
  padding:6px 10px;
  border-radius:999px;
  background:#fff;
  border:1px solid var(--border);
  color:var(--muted);
}

.grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap:16px;
}
.col-12{ grid-column: span 12; }
.col-8{ grid-column: span 8; }
.col-6{ grid-column: span 6; }
.col-4{ grid-column: span 4; }

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
}

.card h2{ margin:0 0 10px 0; font-size:16px; }
.card h3{ margin:0 0 10px 0; font-size:14px; color:var(--muted); font-weight:600; }
.small{ font-size:12px; color:var(--muted); }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  cursor:pointer;
  font-weight:600;
  font-size:13px;
}
.btn:hover{ filter:brightness(.98); }
.btn-primary{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
}
.btn-danger{
  background:var(--bad);
  border-color:var(--bad);
  color:#fff;
}
.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
}

.input, select{
  width:100%;
  padding:10px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:#fff;
  font-size:13px;
}
.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.row > *{ flex:1; min-width:140px; }

.alert{
  border-radius:12px;
  padding:12px 12px;
  border:1px solid var(--border);
  background:#fff;
  margin-bottom:14px;
  font-size:13px;
}
.alert.good{ border-color:rgba(22,163,74,.35); background:rgba(22,163,74,.06); }
.alert.bad{ border-color:rgba(220,38,38,.35); background:rgba(220,38,38,.06); }
.alert.warn{ border-color:rgba(217,119,6,.35); background:rgba(217,119,6,.06); }

.table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.table th, .table td{
  border-top:1px solid var(--border);
  padding:10px 8px;
  text-align:left;
}
.table th{ color:var(--muted); font-weight:700; font-size:12px; }

.footer-note{
  margin-top:14px;
  color:var(--muted);
  font-size:12px;
}

.nav-footer{
  padding:12px 10px;
  border-top:1px solid var(--sidebar-border);
  margin-top:auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.nav-user{ font-size:13px; font-weight:600; color:var(--sidebar-text); }
.nav-role{
  display:inline-block;
  font-size:11px;
  padding:2px 8px;
  border-radius:999px;
  background:#f3f4f6;
  color:var(--muted);
  width:fit-content;
  margin-bottom:4px;
}
.nav-role.admin{ background:#fef3c7; color:#92400e; }
.nav-role.readonly{ background:#f0f4ff; color:#3730a3; }
.nav-footer .a{ font-size:12px; color:var(--muted); padding:4px 0; }
.nav-footer .a:hover{ color:var(--bad); text-decoration:none; }

@media (max-width: 980px){
  .sidebar{ position:static; height:auto; width:100%; }
  .app{ flex-direction:column; }
  .grid{ grid-template-columns:1fr; }
  .col-8,.col-6,.col-4,.col-12{ grid-column: span 12; }
}

