:root {
  --blue: #1473e6;
  --blue-dark: #0d5fca;
  --ink: #172033;
  --muted: #6b7280;
  --line: #e4e8ef;
  --soft: #f5f7fa;
  --panel: #fff;
  --sidebar: #111827;
  --success: #15803d;
  --warning: #b45309;
  --danger: #c2413a;
  --radius: 12px;
  --shadow: 0 16px 50px rgba(25, 40, 70, .13);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--soft); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.login-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; padding: 34px 48px 24px; background: radial-gradient(circle at 70% 20%, #eef6ff 0, #f7f9fc 34%, #edf1f7 100%); }
.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 750; letter-spacing: -.4px; }
.brand-mark { display: inline-grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: #fff; background: var(--blue); font-weight: 800; }
.login-card { align-self: center; justify-self: center; width: min(100%, 420px); padding: 38px; background: rgba(255,255,255,.92); border: 1px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-card h1 { margin: 5px 0 8px; font-size: 30px; letter-spacing: -.8px; }
.eyebrow, .breadcrumbs, .workspace-label { color: #8490a4; font-size: 10px; font-weight: 800; letter-spacing: 1.45px; }
.muted { color: var(--muted); line-height: 1.5; }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: #4b5563; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; color: var(--ink); background: #fff; border: 1px solid #d8dee8; border-radius: 8px; outline: none; transition: .15s; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,115,230,.12); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 700; cursor: pointer; transition: .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--blue); }
.button.primary:hover { background: var(--blue-dark); }
.button.subtle { background: #fff; border-color: var(--line); }
.button.danger { color: var(--danger); background: #fff; border-color: #f1c9c5; }
.button.wide { width: 100%; }
.form-error { min-height: 18px; margin: -4px 0 0; color: var(--danger); font-size: 12px; }
.login-foot { align-self: end; margin: 0; color: #8490a4; text-align: center; font-size: 11px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 235px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 16px 15px; color: #e8edf6; background: var(--sidebar); }
.sidebar-brand { padding: 0 8px 28px; }
.workspace-label { padding: 0 10px 9px; color: #667085; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; color: #9aa5b5; background: transparent; border: 0; border-radius: 8px; text-align: left; font-weight: 650; cursor: pointer; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: #243044; }
.nav-icon { width: 19px; color: #7f8ca0; font-size: 18px; text-align: center; }
.nav-item.active .nav-icon { color: #65aaff; }
.sidebar-bottom { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 14px 6px 0; border-top: 1px solid #283346; }
.admin-identity { min-width: 0; display: flex; align-items: center; gap: 9px; flex: 1; }
.admin-identity > span:last-child { min-width: 0; display: grid; }
.admin-identity strong, .admin-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity strong { font-size: 12px; }
.admin-identity small { margin-top: 2px; color: #7f8ca0; font-size: 10px; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #dceaff; background: #30405a; font-size: 12px; font-weight: 800; }
.icon-button, .mobile-menu { display: grid; place-items: center; width: 34px; height: 34px; color: inherit; background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.icon-button:hover, .mobile-menu:hover { background: rgba(127,140,160,.14); }
.main { min-width: 0; }
.topbar { height: 91px; display: flex; align-items: center; gap: 18px; padding: 0 30px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 3px 0 0; font-size: 22px; letter-spacing: -.45px; }
.breadcrumbs { margin: 0; }
.top-actions { display: flex; align-items: center; gap: 15px; margin-left: auto; }
.live-status { display: flex; align-items: center; gap: 7px; color: #637083; font-size: 11px; font-weight: 650; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: #24a060; box-shadow: 0 0 0 3px #dcf7e8; }
.mobile-menu { display: none; }
.content { padding: 27px 30px 50px; }
.loading-state, .empty-state { min-height: 380px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid #dce3ed; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 0 0 16px; }
.section-heading h2 { margin: 0; font-size: 16px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-card { position: relative; min-height: 126px; padding: 18px; overflow: hidden; }
.metric-card .metric-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-card strong { display: block; margin-top: 13px; font-size: 28px; letter-spacing: -1px; }
.metric-card small { display: block; margin-top: 8px; color: #8a94a5; font-size: 10px; }
.metric-card .accent { position: absolute; right: -13px; bottom: -18px; width: 70px; height: 70px; border: 13px solid #edf5ff; border-radius: 50%; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 18px; }
.panel { min-width: 0; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 14px; }
.panel-body { padding: 18px; }
.chart { position: relative; height: 210px; display: flex; align-items: end; gap: 5px; padding: 16px 5px 24px; border-bottom: 1px solid var(--line); }
.chart-bar { flex: 1; min-width: 3px; height: var(--height); background: linear-gradient(180deg, #57a3f6, #1473e6); border-radius: 3px 3px 0 0; opacity: .85; }
.chart-bar:hover { opacity: 1; }
.chart-empty { margin: auto; color: var(--muted); }
.status-stack { display: grid; gap: 14px; }
.status-row { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 10px; font-size: 11px; }
.progress { height: 7px; overflow: hidden; background: #edf0f4; border-radius: 8px; }
.progress i { display: block; height: 100%; width: var(--width); background: var(--blue); border-radius: inherit; }
.split-panels { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-top: 18px; }
.mini-list { display: grid; }
.mini-row { display: flex; align-items: center; gap: 11px; padding: 12px 18px; border-top: 1px solid #edf0f4; cursor: pointer; }
.mini-row:first-child { border-top: 0; }
.mini-row:hover { background: #fafbfc; }
.mini-row .grow { min-width: 0; flex: 1; }
.mini-row strong, .mini-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row strong { font-size: 12px; }
.mini-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 3px 8px; border-radius: 20px; color: #4b5563; background: #edf1f5; font-size: 10px; font-weight: 750; white-space: nowrap; }
.badge.blue { color: #0b5bb8; background: #e6f1ff; }
.badge.green { color: #10713a; background: #e5f7ec; }
.badge.orange { color: #9a4b09; background: #fff0dc; }
.badge.red { color: #a83731; background: #ffe9e6; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search { position: relative; width: min(420px, 100%); }
.search input { padding-left: 35px; }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 9px; color: #8792a4; font-size: 18px; z-index: 1; }
.toolbar .result-count { margin-left: auto; color: var(--muted); font-size: 11px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 14px; color: #7d8796; background: #fafbfc; border-bottom: 1px solid var(--line); text-align: left; font-size: 9px; letter-spacing: .8px; text-transform: uppercase; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f9fbfd; }
.data-table tr:last-child td { border-bottom: 0; }
.cell-main { font-size: 12px; font-weight: 750; }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: 10px; }
.number { font-variant-numeric: tabular-nums; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 9px; padding: 13px 16px; border-top: 1px solid var(--line); }
.pagination span { color: var(--muted); font-size: 11px; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(12,18,28,.28); backdrop-filter: blur(1px); }
.drawer { position: fixed; top: 0; right: 0; z-index: 21; width: min(780px, 96vw); height: 100vh; background: #f7f9fb; box-shadow: -18px 0 45px rgba(23,32,51,.18); overflow-y: auto; }
.drawer > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 18px 22px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.drawer h2 { margin: 4px 0 0; font-size: 21px; }
.drawer-body { padding: 20px; }
.detail-section { margin-bottom: 16px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: 11px; }
.detail-section h3 { margin: 0 0 15px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.check-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 7px 9px; background: #f7f9fb; border-radius: 7px; font-size: 11px; font-weight: 650; }
.check input { width: 15px; min-height: 15px; margin: 0; }
.member-list { display: grid; gap: 8px; }
.member-row { display: grid; grid-template-columns: 1fr 110px auto; align-items: center; gap: 8px; padding: 9px; background: #f7f9fb; border-radius: 8px; }
.member-row select { min-height: 34px; padding: 5px 8px; }
.usage-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.usage-tile { padding: 12px; background: #f7f9fb; border-radius: 8px; }
.usage-tile small, .usage-tile strong { display: block; }
.usage-tile small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.usage-tile strong { margin-top: 6px; font-size: 16px; }
.form-spacer { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.operation-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 11px 0; border-top: 1px solid #edf0f4; }
.operation-row:first-child { border-top: 0; }
.operation-row .grow { flex: 1 1 240px; min-width: 0; }
.operation-row strong, .operation-row small { display: block; }
.operation-row small { margin-top: 4px; color: var(--muted); overflow-wrap: anywhere; }
.operation-row select { width: auto; min-width: 145px; }
.hygiene-group { margin-top: 13px; padding: 13px; background: #f7f9fb; border: 1px solid var(--line); border-radius: 9px; }
.hygiene-group h4 { margin: 0; font-size: 12px; }
.audit-row { display: grid; grid-template-columns: 145px 170px 1fr; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); font-size: 11px; }
.audit-row:last-child { border: 0; }
.audit-row time, .audit-row small { color: var(--muted); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 30; display: grid; gap: 9px; }
.toast { min-width: 270px; max-width: 410px; padding: 12px 14px; color: #fff; background: #1d2939; border-radius: 9px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }
.toast.error { background: #9f342f; }
.notice { margin-bottom: 12px; padding: 11px 14px; border: 1px solid #b9d8f7; border-radius: 8px; color: #164e7a; background: #edf7ff; font-size: 11px; }
.notice.warning { color: #854d0e; background: #fff8e7; border-color: #f1d394; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -245px; z-index: 40; width: 235px; transition: left .2s; }
  body.menu-open .sidebar { left: 0; box-shadow: 12px 0 40px rgba(0,0,0,.25); }
  .mobile-menu { display: grid; }
  .topbar { height: 78px; padding: 0 15px; }
  .top-actions .live-status { display: none; }
  .content { padding: 18px 15px 40px; }
  .metric-grid, .split-panels, .form-grid { grid-template-columns: 1fr; }
  .data-table th:nth-child(n+4), .data-table td:nth-child(n+4) { display: none; }
  .login-shell { padding: 25px 18px; }
  .login-card { padding: 28px 22px; }
  .audit-row { grid-template-columns: 1fr; gap: 4px; }
}
