:root {
  --accent: #f43f5e;
  --accent-d: #e11d48;
  --accent-soft: #ffe4e9;
  --accent-grad: linear-gradient(135deg, #fb7185, #f43f5e 70%, #e11d48);
  --ink: #1b2138;
  --ink-2: #6b7385;
  --ink-3: #a3aab9;
  --line: #eef0f5;
  --line-2: #f5f6f9;
  --bg: #f6f7fb;
  --card: #ffffff;
  --r-card: 20px;
  --r-md: 14px;
  --r-sm: 11px;
  --sh-sm: 0 4px 18px rgba(34,41,71,.05);
  --sh-md: 0 10px 30px rgba(34,41,71,.08);
  --sh-lg: 0 24px 60px rgba(34,41,71,.16);
  --ease: cubic-bezier(.4,0,.2,1);
  --c-blue: #3b82f6; --c-blue-s: #e7f0ff;
  --c-violet: #7c5cfc; --c-violet-s: #f1ecff;
  --c-pink: #ec4899; --c-pink-s: #fde7f3;
  --c-amber: #f59e0b; --c-amber-s: #fef3df;
  --c-emerald: #10b981; --c-emerald-s: #e3f7f0;
  --c-coral: #f43f5e; --c-coral-s: #ffe4e9;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: "Plus Jakarta Sans", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-visual { background: var(--accent-grad); color: #fff; padding: 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-visual::after { content: ""; position: absolute; width: 480px; height: 480px; border-radius: 50%; background: rgba(255,255,255,.1); top: -160px; right: -160px; }
.auth-visual .brand { display: flex; align-items: center; gap: 12px; position: relative; }
.auth-visual .mark { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 800; font-size: 23px; }
.auth-visual .brand strong { display: block; font-size: 17px; } .auth-visual .brand span { font-size: 13px; opacity: .82; }
.auth-visual h1 { font-size: 31px; margin: 0 0 10px; line-height: 1.13; position: relative; }
.auth-visual p { opacity: .9; max-width: 430px; position: relative; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 52px; max-width: 440px; }
.auth-panel small { color: var(--ink-3); }
@media (max-width: 820px) { .auth-wrap { grid-template-columns: 1fr; } .auth-visual { display: none; } }

/* Shell */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; }
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 18px; }
.sb-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; box-shadow: var(--sh-sm); }
.sb-brandtxt b { display: block; font-size: 14.5px; } .sb-brandtxt small { color: var(--ink-3); font-size: 12px; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-2); cursor: pointer; font-weight: 600; text-decoration: none; border: none; background: none; font: inherit; width: 100%; text-align: left; position: relative; transition: background .16s, color .16s; }
.sb-link:hover { background: var(--line-2); color: var(--ink); }
.sb-link.active { background: var(--accent-soft); color: var(--accent-d); }
.sb-link.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.sb-link .ic { width: 22px; height: 22px; display: grid; place-items: center; }
.sb-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sb-foot { margin-top: auto; }
.content { display: flex; flex-direction: column; min-width: 0; }
.appbar { display: flex; align-items: center; gap: 14px; padding: 15px 28px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.appbar h1 { font-size: 19px; margin: 0; }
.appbar .spacer { flex: 1; }
.ab-user { display: flex; align-items: center; gap: 9px; }
.ab-ava { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-grad); color: #fff; display: grid; place-items: center; font-weight: 700; }
.ab-id b { display: block; font-size: 13px; } .ab-id small { color: var(--ink-3); font-size: 12px; }
.ab-logout { border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); width: 38px; height: 38px; cursor: pointer; display: grid; place-items: center; }
.ab-logout svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ab-logout:hover { border-color: #fecaca; } .ab-logout:hover svg { stroke: #dc2626; }
.burger { display: none; }
.main { padding: 26px 28px; max-width: 1240px; width: 100%; animation: fadeUp .25s var(--ease); }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .22s var(--ease); width: 256px; box-shadow: var(--sh-lg); }
  .sidebar.open { transform: none; }
  .burger { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); cursor: pointer; font-size: 17px; }
  .sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(19,26,46,.4); z-index: 30; } .sb-backdrop.show { display: block; }
}

/* Primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: var(--r-sm); padding: 9px 15px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .16s, border-color .16s, background .16s; white-space: nowrap; }
.btn:hover { border-color: #d3d9e6; box-shadow: var(--sh-sm); } .btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-d); border-color: var(--accent-d); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); } .btn.ghost:hover { background: var(--line-2); box-shadow: none; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.danger { color: #dc2626; border-color: #fbd5d5; } .btn.danger:hover { background: #fef2f2; }
.row { display: flex; gap: 12px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh-sm); padding: 22px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; } .card-head b { flex: 1; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; } .page-head h2 { margin: 0; font-size: 23px; } .page-head .spacer { flex: 1; }
.muted { color: var(--ink-2); }
.empty { text-align: center; color: var(--ink-3); padding: 46px 20px; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }

/* Stat cards (Fillow) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; box-shadow: var(--sh-sm); transition: transform .18s, box-shadow .18s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.fstat { display: flex; align-items: flex-start; gap: 14px; }
.fstat .tile { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: none; }
.fstat .tile svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fstat .n { font-size: 27px; font-weight: 800; line-height: 1.1; } .fstat .l { color: var(--ink-2); font-size: 13px; margin-top: 1px; }
.t-coral { background: var(--c-coral-s); color: var(--c-coral); } .t-blue { background: var(--c-blue-s); color: var(--c-blue); }
.t-violet { background: var(--c-violet-s); color: var(--c-violet); } .t-amber { background: var(--c-amber-s); color: var(--c-amber); }
.t-emerald { background: var(--c-emerald-s); color: var(--c-emerald); }
.dash-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; align-items: start; }
@media (max-width: 920px) { .dash-grid { grid-template-columns: 1fr; } }

/* Tables */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 11px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.clk { cursor: pointer; transition: background .14s; } .tbl tr.clk:hover td { background: var(--accent-soft); }
.tbl .ref { font-weight: 700; color: var(--accent-d); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.b-wait { background: #fef3c7; color: #b45309; } .b-ok { background: #dcfce7; color: #15803d; }
.pts { font-weight: 800; color: var(--accent-d); }

/* Forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d5dbe8; border-radius: var(--r-sm); padding: 10px 12px; font: inherit; background: #fff; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Detail */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; } .kv dt { color: var(--ink-3); font-size: 13px; } .kv dd { margin: 0; font-weight: 600; }
.jrow { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; } .jrow:last-child { border: 0; }

/* Modal */
.ov { position: fixed; inset: 0; background: rgba(19,26,46,.5); display: grid; place-items: center; z-index: 60; padding: 20px; animation: fadeUp .16s; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 20px; width: 100%; max-width: 660px; max-height: 92vh; overflow-y: auto; box-shadow: var(--sh-lg); animation: pop .22s var(--ease); }
.modal.wide { max-width: 940px; }
.modal-head { display: flex; align-items: center; padding: 20px 26px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; } .modal-head h3 { margin: 0; font-size: 18px; flex: 1; }
.modal-body { padding: 26px; }
.modal-foot { padding: 16px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; }
.x { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--ink-3); }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 12px; z-index: 100; box-shadow: var(--sh-lg); font-weight: 600; animation: pop .2s var(--ease); }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linkbox input { flex: 1; min-width: 200px; border: 1px solid #d5dbe8; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 12.5px; }
