:root{
  --bg:#f9fafb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --accent:#3b82f6;
  --accent2:#2563eb;
  --ring:rgba(59,130,246,.35);
  --radius:14px;
  --radius-sm:12px;
  --shadow:0 1px 2px rgba(0,0,0,.05),0 8px 24px rgba(0,0,0,.06);
  --shadow-sm:0 1px 2px rgba(0,0,0,.05);
}


.badge{
  display:inline-flex;
  align-items:center;
  padding:0 8px;
  font-size:12px;
  line-height:20px;
  font-weight:600;
  border-radius:999px;
  border:0;
  background:#f3f4f6;
  color:#374151;
}
.badge--green{ background:#dcfce7; color:#166534; }   /* green-100 / green-800-ish */
.badge--yellow{ background:#fef3c7; color:#92400e; }  /* yellow-100 / yellow-800 */
.badge--red{ background:#fee2e2; color:#991b1b; }     /* red-100 / red-800 */
.badge--blue{ background:#dbeafe; color:#1e40af; }    /* blue-100 / blue-800 */
.badge--gray{ background:#f3f4f6; color:#374151; }    /* gray-100 / gray-700 */


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

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

code{ padding:2px 6px; border:1px solid var(--border); background:rgba(15,23,42,.03); border-radius:10px; font-size:12px; }

.container{ max-width:1100px; margin:0 auto; padding:18px; }
.small{ color:var(--muted); font-size:13px; }

/* Public topbar */
.topbar{ position:sticky; top:0; z-index:50; background:#fff; border-bottom:1px solid var(--border); }
.topbar .container{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.brand a{ text-decoration:none; font-weight:800; color:var(--text); letter-spacing:-.01em; }
nav a{ margin-left:14px; font-weight:600; color:var(--text); text-decoration:none; }
nav a:hover{ color:var(--accent); text-decoration:none; }
.linkbtn{ border:none; background:none; color:var(--accent); cursor:pointer; padding:0; margin-left:14px; font-weight:600; }

/* Controls */
label{ display:block; font-size:12px; font-weight:700; color:var(--muted); margin:0 0 6px 0; }
input,select,textarea{
  width:100%; padding:10px 12px;
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  background:#fff;
  outline:none;
}
input:focus,select:focus,textarea:focus{ box-shadow:0 0 0 4px var(--ring); border-color:rgba(37,99,235,.55); }

button,.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:10px 14px;
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  cursor:pointer;
  font-weight:700;
}
button:hover,.btn:hover{ box-shadow:var(--shadow-sm); text-decoration:none; }
button:focus-visible,.btn:focus-visible{ outline:none; box-shadow:0 0 0 4px var(--ring); }

.btn.primary, button.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover, button.primary:hover{ background:var(--accent2); border-color:var(--accent2); box-shadow:var(--shadow); }
.btn.ghost{ background:rgba(15,23,42,.02); }

.grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:14px; }
.row{ display:flex; gap:12px; }
.row > div{ flex:1; }

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

.table{ width:100%; border-collapse:separate; border-spacing:0; min-width:100%; }
.table th, .table td{ padding:14px 16px; border-bottom:1px solid var(--border); text-align:left; vertical-align:top; background:#fff; }
.table th{ padding:12px 16px; text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); background:#fff; border-bottom:1px solid var(--border); }
.table tr:hover td{ background:rgba(37,99,235,.03); }


.footer{ border-top:1px solid var(--border); margin-top:24px; background:#fff; }

/* ------------------------- */
/* Admin layout (pro UI) */
/* ------------------------- */
body.admin{ background:var(--bg); }

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

.sidebar{
  width:270px;
  background:#fff;
  border-right:1px solid var(--border);
  padding:18px;
  position:sticky;
  top:0;
  height:100vh;
}

.sidebar-brand{ margin-bottom:16px; }
.brand-link{ display:block; font-size:18px; font-weight:900; letter-spacing:-.02em; color:var(--text); }
.brand-sub{ margin-top:2px; font-size:12px; color:var(--muted); }

.sidebar-nav{ display:flex; flex-direction:column; gap:6px; margin-top:14px; }
.nav-sep{ height:1px; background:var(--border); margin:10px 0; }

.navlink{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px;
  border-radius:14px;
  color:var(--text);
  text-decoration:none;
  border:1px solid transparent;
}
.navlink:hover{ background:rgba(59,130,246,.06); border-color:rgba(59,130,246,.12); text-decoration:none; }
.navlink.active{ background:rgba(59,130,246,.10); border-color:rgba(59,130,246,.20); }

.nav-ico{ width:18px; height:18px; flex:0 0 18px; color:rgba(15,23,42,.75); }
.navlink.active .nav-ico{ color:var(--accent); }

.sidebar-footer{
  position:absolute;
  left:18px;
  right:18px;
  bottom:16px;
}

.user-pill{ display:flex; gap:10px; align-items:center; padding:10px 12px; border:1px solid var(--border); border-radius:14px; background:rgba(15,23,42,.02); }
.user-dot{ width:10px; height:10px; border-radius:999px; background:var(--accent); box-shadow:0 0 0 4px rgba(59,130,246,.18); }
.user-name{ font-weight:800; font-size:13px; }
.user-sub{ font-size:12px; color:var(--muted); }

.user-pill--flat{ border:none; padding:0; background:transparent; }

.btn.sm, button.sm{ padding:8px 10px; font-size:12px; border-radius:12px; }

/* Admin user card (DentalLab-like) */
.user-corner{
  position:fixed;
  left:18px;
  bottom:16px;
  z-index:1000;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:var(--shadow-sm);
}

.mobile-only{ display:none; }


.admin-main{ flex:1; min-width:0; }

.admin-top{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:14px;
  padding:20px 24px 10px 24px;
}

.admin-top-actions{ display:flex; gap:10px; flex-wrap:wrap; }

.admin-content{ padding:0 24px 24px 24px; }

.page-title h1{ margin:0; font-size:26px; letter-spacing:-.02em; }
.page-sub{ margin-top:4px; font-size:13px; color:var(--muted); }

/* Dashboard blocks */
.kpi-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:14px; margin-top:10px; }
.kpi-card{ background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow-sm); }
.kpi-head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.kpi-label{ font-size:12px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.kpi-chip{ font-size:12px; color:var(--muted); padding:4px 10px; border:1px solid var(--border); border-radius:999px; background:rgba(15,23,42,.02); }
.kpi-value{ font-size:34px; font-weight:900; margin:8px 0 4px 0; letter-spacing:-.02em; }
.kpi-foot a{ font-weight:700; }

.dash-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap:14px; margin-top:14px; }
.panel{ background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow-sm); }
.panel-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:12px; }
.panel-head h2{ margin:0; font-size:16px; letter-spacing:-.01em; }
.panel-head p{ margin:4px 0 0 0; }

.action-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap:12px; }
.action-card{
  display:block;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px;
  background:linear-gradient(180deg, rgba(37,99,235,.05) 0%, rgba(15,23,42,.00) 80%);
  color:var(--text);
  text-decoration:none;
}
.action-card:hover{ box-shadow:var(--shadow); text-decoration:none; border-color:rgba(37,99,235,.22); }
.action-title{ font-weight:900; margin-bottom:6px; }

.stack{ display:flex; flex-direction:column; gap:10px; }
.hint{ margin-top:12px; padding:10px 12px; border-radius:14px; border:1px solid var(--border); background:rgba(15,23,42,.02); color:var(--muted); }
.empty{ padding:12px; border:1px dashed rgba(15,23,42,.18); border-radius:14px; color:var(--muted); background:rgba(255,255,255,.7); }

/* Responsive admin */
@media (max-width: 980px){
  .mobile-only{ display:block; }
  .user-corner{ display:none; }

  .admin-shell{ flex-direction:column; }
  .sidebar{ width:auto; height:auto; position:relative; border-right:none; border-bottom:1px solid var(--border); }
  .sidebar-footer{ position:relative; left:auto; right:auto; bottom:auto; margin-top:14px; }
  .sidebar-nav{ flex-direction:row; flex-wrap:wrap; }
  .admin-top, .admin-content{ padding-left:18px; padding-right:18px; }
}

.table tbody tr:hover td{ background:#f9fafb; }
