:root{--ink:#26223e;--muted:#625c75;--purple:#7656c9;--line:#e3dbea;--surface:#fbf9ff;--shadow:0 12px 35px #49366c12;font-family:Segoe UI,system-ui,sans-serif;color:var(--ink);font-size:15px}*{box-sizing:border-box}body{margin:0;min-height:100dvh;background:radial-gradient(ellipse at 0 0,#c5b5fa,transparent 65%),radial-gradient(ellipse at 100% 70%,#f4c2e2,transparent 65%),#eee9f8}a{color:inherit;text-decoration:none}button,input,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:not-allowed}button,a,input,select{outline-offset:3px} :focus-visible{outline:2px solid var(--purple)}[hidden]{display:none!important}h1,h2,p{margin:0}h1{font-size:clamp(1.65rem,2.4vw,2.25rem);letter-spacing:-.045em;line-height:1.2}h2{font-size:1.1rem;letter-spacing:-.02em}p,small{color:var(--muted)}.shell,.login-page{padding:18px clamp(14px,2.3vw,36px);max-width:1700px;margin:auto}.shell{height:100dvh;display:flex;flex-direction:column;gap:16px}.topbar,.panel{background:#ffffffd9;border:1px solid #fff;border-radius:23px;box-shadow:var(--shadow)}.topbar{display:flex;align-items:center;justify-content:space-between;padding:12px 20px;gap:12px;flex:none}.brand{display:flex;align-items:center;gap:12px;font-weight:750;font-size:1.4rem;letter-spacing:-.04em;min-width:0}.brand img{object-fit:contain}.brand small{display:block;font-size:.72rem;font-weight:400;letter-spacing:0}.header-actions{display:flex;gap:12px;align-items:center}.header-actions time{color:var(--muted);font-size:.85rem}.avatar{display:grid;place-items:center;width:38px;height:38px;background:#e8defa;border-radius:50%;color:#6744b6;font-weight:700}.account{font-size:.85rem}.workspace{display:grid;grid-template-columns:205px minmax(0,1fr);gap:16px;flex:1;min-height:0}.sidebar{padding:14px;display:flex;flex-direction:column;justify-content:space-between;gap:12px}.sidebar nav{display:grid;gap:8px}.nav-link{display:flex;gap:12px;align-items:center;padding:13px 12px;border-radius:14px;font-weight:600;font-size:.94rem;transition:background .18s,transform .18s}.nav-link:hover{background:#eee6fa;transform:translateX(2px)}.nav-link[aria-current]{background:var(--ink);color:white}.icon{width:21px;height:21px;flex:none}.main{min-width:0;min-height:0;display:flex;flex-direction:column;gap:12px;overflow:auto}.page-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:3px 2px}.page-heading p{font-size:.9rem;margin-top:5px}.primary,.secondary,.danger,.pill{border:0;border-radius:13px;padding:11px 18px;min-height:44px;font-weight:650;white-space:nowrap;transition:background .18s,box-shadow .18s,transform .18s}.primary,.pill{background:var(--ink);color:white}.primary:hover:not(:disabled){background:#49376b;box-shadow:0 5px 12px #38245225;transform:translateY(-1px)}.secondary{background:#eee8f6;color:var(--ink)}.secondary:hover{background:#e2d7f1}.danger{color:white;background:#a93654}.danger:hover{background:#8b2844}.menu{display:none}.message{background:#fff2f4;border:1px solid #edc4ce;color:#9b2341;padding:10px 14px;border-radius:12px;font-size:.88rem;overflow-wrap:anywhere}.message.good{background:#e8f6ed;color:#276741;border-color:#c0e5cf}#content{flex:1;min-height:0;display:flex;flex-direction:column;gap:12px}.metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.metric{padding:15px 17px;display:grid;gap:4px;transition:transform .2s}.metric:hover{transform:translateY(-3px)}.metric .icon{color:var(--purple);width:23px;height:23px}.metric span{font-size:.86rem;color:var(--muted)}.metric strong{font-size:2rem;line-height:1.1;color:var(--purple)}.metric small{font-size:.75rem}.charts,.lower{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:12px;min-height:0}.charts{flex:1}.lower{flex:1}.chart-panel,.recent,.quick{padding:16px;min-width:0;display:flex;flex-direction:column;gap:9px;min-height:0}.section-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.section-head a{color:var(--purple);font-size:.85rem;font-weight:650}.bars{display:flex;align-items:stretch;justify-content:space-around;gap:8px;flex:1;min-height:110px}.bar-col{display:flex;flex-direction:column;align-items:center;gap:4px;flex:1;font-size:.78rem;color:var(--muted)}.bar-track{flex:1;background:#f0e9f8;border-radius:7px;width:min(42px,75%);display:flex;align-items:flex-end}.bar-fill{width:100%;border-radius:7px;background:linear-gradient(#ad91f3,#7656c9)}.donut-area{display:flex;align-items:center;justify-content:center;gap:15px;flex:1;min-height:0}.donut{width:clamp(80px,10vw,140px);aspect-ratio:1;border-radius:50%;display:grid;place-items:center;flex:none;background:#e9e2f0}.donut>div{width:70%;aspect-ratio:1;border-radius:50%;background:#fff;display:grid;place-content:center;text-align:center}.donut strong{font-size:1.5rem}.legend{display:grid;gap:5px;font-size:.77rem}.legend span{display:flex;align-items:center;gap:6px}.swatch{width:10px;height:10px;border-radius:3px;flex:none}.actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;flex:1;align-content:center}.actions a{background:#eee7f8;border-radius:12px;padding:11px;font-weight:650;font-size:.85rem;display:flex;gap:8px;align-items:center}.actions a:hover{background:#e1d4f5}.records{display:flex;flex-direction:column;flex:1;min-height:0;padding:18px;gap:14px}.toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap}.toolbar input{width:min(360px,100%)}input,select{border:1px solid var(--line);background:#f8f4fc;border-radius:11px;padding:12px 14px;min-height:46px;min-width:0;width:100%;color:var(--ink)}input:focus,select:focus{border-color:var(--purple);background:white;outline:2px solid #d9caf7}label{display:grid;gap:7px;font-weight:600;font-size:.9rem;min-width:0}.table-wrap{overflow:auto;min-height:0;flex:1;border:1px solid var(--line);border-radius:13px}table{width:100%;border-collapse:collapse;text-align:left;font-size:.87rem}th,td{padding:12px 14px;border-bottom:1px solid #ebe5f1;vertical-align:middle;overflow-wrap:anywhere}th{background:#eee8f7;position:sticky;top:0;z-index:1;color:#514765;font-weight:650;white-space:nowrap}tbody tr:hover{background:#f8f4fc}.row-actions{display:flex;gap:6px;white-space:nowrap}.row-actions button{border:0;background:#eee7fa;color:#594395;border-radius:8px;padding:7px 10px;font-weight:600}.row-actions button:last-child{color:#a42d49;background:#fae9ed}.empty{text-align:center;color:var(--muted);padding:25px}.pagination{display:flex;justify-content:space-between;align-items:center;gap:8px;font-size:.85rem;color:var(--muted);flex-wrap:wrap}.pagination div{display:flex;gap:8px}.pagination button{min-height:38px;padding:7px 13px}dialog{border:1px solid #fff;background:#fdfbff;border-radius:24px;box-shadow:0 25px 90px #25173e44;padding:25px;width:min(660px,calc(100% - 28px));max-height:90dvh;overflow:auto;color:var(--ink)}dialog::backdrop{background:#2c224a55;backdrop-filter:blur(4px)}dialog h2{font-size:1.5rem}dialog p{font-size:.9rem;margin-top:5px}.dialog-head,.dialog-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.dialog-actions{justify-content:flex-end;margin-top:20px}.fields{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:22px 0}.login-page{display:flex;flex-direction:column;gap:22px;min-height:100dvh}.login-layout{display:grid;grid-template-columns:1.12fr 1fr;gap:22px;width:min(1120px,100%);margin:auto;align-items:stretch}.welcome,.login-card{padding:clamp(24px,3.5vw,46px)}.welcome{background:#ffffff9e;display:flex;flex-direction:column;gap:16px}.welcome h1{font-size:clamp(2rem,3.4vw,3.1rem)}em{font-style:normal;color:var(--purple)}.illustration{flex:1;min-height:200px;display:grid;place-items:center}.illustration img{max-width:100%;max-height:280px;object-fit:contain}.tags{display:flex;gap:8px;flex-wrap:wrap}.tags span{background:#ffffffbd;padding:7px 12px;border-radius:30px;font-size:.82rem}.login-card{display:grid;align-content:center}.login-card h2{font-size:2rem}.login-card p{margin:8px 0 24px}.login-card form{display:grid;gap:18px}.password{position:relative}.password input{padding-right:78px}.password button{position:absolute;right:8px;top:5px;bottom:5px;background:transparent;color:var(--purple);border:0;padding:0 10px;font-weight:650}.login-card .message{margin:0}footer{text-align:center;color:var(--muted);font-size:.8rem;padding:8px}.panel,.topbar{animation:appear .25s ease both}@keyframes appear{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}@media(min-width:1000px) and (max-height:850px){.shell{padding-top:12px;padding-bottom:12px;gap:12px}.topbar{padding:8px 16px}.metric{padding:10px 13px}.metric strong{font-size:1.7rem}.charts,.lower{gap:10px}.chart-panel,.recent,.quick{padding:12px}.main{gap:8px}#content{gap:9px}th,td{padding:8px 12px}}@media(max-width:1000px){.workspace{grid-template-columns:165px minmax(0,1fr)}.metrics{grid-template-columns:repeat(2,1fr)}.charts,.lower{grid-template-columns:1fr}.shell{height:auto;min-height:100dvh}.main{overflow:visible}.sidebar{align-self:start;position:sticky;top:10px}.table-wrap{max-height:58vh}.bars{min-height:150px}.donut-area{min-height:150px}.login-layout{grid-template-columns:1fr;max-width:600px}.login-card{order:-1}.welcome{padding:26px}}@media(max-width:700px){.shell,.login-page{padding:12px;gap:12px}.topbar{padding:10px 12px;border-radius:18px}.brand{font-size:1.2rem;gap:8px}.brand img{width:34px;height:34px}.brand small,.header-actions time,.account,.avatar{display:none}.menu{display:block}.workspace{display:flex;flex-direction:column}.sidebar{display:none;position:static;width:100%}.sidebar.open{display:flex}.sidebar nav{grid-template-columns:1fr 1fr}.page-heading{align-items:flex-start}.page-heading p{font-size:.82rem}.page-heading button{padding:10px 12px}.metric{padding:13px}.records{padding:12px}.table-wrap{max-height:60vh}table{min-width:570px}.recent table{min-width:380px}.fields{grid-template-columns:1fr}.toolbar input{width:100%}.login-card,.welcome{padding:23px}.login-layout{gap:14px}.illustration{min-height:100px}.dialog-head{align-items:start}.dialog-actions{flex-wrap:wrap}}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* Dashboard: keep cards and their contents in the same layout flow. */
@media (min-width: 1001px) {
  html { scrollbar-gutter: stable; }
  .main { scrollbar-gutter: stable; }
  body[data-page="dashboard"] #content { flex: 1 0 auto; }
  body[data-page="dashboard"] .charts { flex: 1 0 175px; }
  body[data-page="dashboard"] .lower { flex: 1 0 165px; }
  body[data-page="dashboard"] .chart-panel { min-height: 175px; }
  body[data-page="dashboard"] .recent,
  body[data-page="dashboard"] .quick { min-height: 165px; }
  body[data-page="dashboard"] .bars { min-height: 90px; }
  body[data-page="dashboard"] .donut-area { min-height: 100px; }
  body[data-page="dashboard"] .donut { width: clamp(80px, 8vw, 110px); }
  body[data-page="dashboard"] .actions { align-content: start; }
  body[data-page="dashboard"] .actions a { min-width: 0; padding: 9px; }
  body[data-page="dashboard"] .page-heading { flex-shrink: 0; }
}
body[data-page="dashboard"] .charts,
body[data-page="dashboard"] .lower { grid-auto-rows: minmax(min-content, 1fr); }
body[data-page="dashboard"] .bar-track { min-height: 35px; }
body[data-page="dashboard"] .bar-col { min-width: 0; }
body[data-page="dashboard"] .bar-col span { white-space: nowrap; font-size: .72rem; }
body[data-page="dashboard"] .donut-area { flex-wrap: wrap; }
body[data-page="dashboard"] .legend { min-width: 0; max-width: 100%; }
body[data-page="dashboard"] .chart-panel,
body[data-page="dashboard"] .recent,
body[data-page="dashboard"] .quick { overflow: hidden; }
@media (max-width: 1000px) {
  body[data-page="dashboard"] #content,
  body[data-page="dashboard"] .charts,
  body[data-page="dashboard"] .lower { flex: none; }
  body[data-page="dashboard"] .chart-panel { min-height: 200px; }
}
@media (max-width: 400px) {
  body[data-page="dashboard"] .actions { grid-template-columns: 1fr; }
  body[data-page="dashboard"] .bar-col span { font-size: .63rem; }
  body[data-page="dashboard"] .bars { gap: 3px; }
  body[data-page="dashboard"] .page-heading { flex-wrap: wrap; }
}
