:root {
    --navy-950: #071c25;
    --navy-900: #0b2530;
    --navy-850: #102f3b;
    --navy-800: #173b49;
    --line: rgba(255,255,255,.09);
    --text: #f6f8f9;
    --muted: #9fb0b7;
    --mint: #67d7b4;
    --amber: #f8b746;
    --red: #ff7878;
    --shadow: 0 24px 60px rgba(0,0,0,.22);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--navy-950); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 22px; display: flex; flex-direction: column; background: #081f29; border-right: 1px solid var(--line); }
.brand { display: flex; gap: 13px; align-items: center; }
.brand-mark { width: 46px; height: 46px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 15px; background: var(--amber); color: var(--navy-950); font-weight: 900; letter-spacing: -.04em; box-shadow: 0 10px 30px rgba(248,183,70,.18); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 3px; font-size: 12px; color: var(--muted); }
.nav { margin-top: 44px; display: grid; gap: 8px; }
.nav a { padding: 13px 15px; border-radius: 12px; color: var(--muted); font-weight: 700; transition: .18s ease; }
.nav a:hover { color: var(--text); background: rgba(255,255,255,.04); }
.nav a.active { color: var(--navy-950); background: var(--mint); }
.sidebar-footer { margin-top: auto; padding: 18px 14px 4px; border-top: 1px solid var(--line); }
.sidebar-footer span, .sidebar-footer small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer span { font-weight: 800; }
.sidebar-footer small { margin-top: 4px; color: var(--muted); }
.link-button { margin: 14px 0 0; padding: 0; border: 0; background: transparent; color: var(--amber); font-weight: 800; }

.content { min-width: 0; padding: 36px clamp(24px, 4vw, 64px) 70px; }
.topbar { max-width: 1440px; margin: 0 auto 30px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 5px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--mint); font-size: 11px; font-weight: 900; letter-spacing: .18em; }
h2 { margin: 4px 0 0; font-size: 21px; letter-spacing: -.02em; }
p { color: var(--muted); }

.button { min-height: 42px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 12px; font-weight: 850; transition: transform .15s ease, opacity .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--amber); color: var(--navy-950); }
.button.secondary { background: var(--navy-800); color: var(--text); border-color: var(--line); }
.button.danger { color: #ffdada; background: rgba(255,120,120,.1); border-color: rgba(255,120,120,.35); }
.button.tiny { min-height: 32px; padding: 6px 10px; border-radius: 9px; font-size: 12px; }
.button.full { width: 100%; }

.alert { max-width: 1440px; margin: 0 auto 22px; padding: 15px 18px; border-radius: 13px; border: 1px solid; }
.alert.success { color: #b5f7e3; background: rgba(103,215,180,.09); border-color: rgba(103,215,180,.3); }
.alert.error { color: #ffd1d1; background: rgba(255,120,120,.09); border-color: rgba(255,120,120,.3); }
.alert ul { margin-bottom: 0; }

.stat-grid, .panel-grid, .profile-strip, .panel { max-width: 1440px; margin-left: auto; margin-right: auto; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.stat-grid.compact { margin-top: 20px; }
.stat-card { min-height: 145px; padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, var(--navy-850), var(--navy-900)); box-shadow: var(--shadow); }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 10px 0 7px; font-size: 38px; line-height: 1; }
.stat-card.mint { border-color: rgba(103,215,180,.28); }
.stat-card.mint strong { color: var(--mint); }
.stat-card.amber { border-color: rgba(248,183,70,.28); }
.stat-card.amber strong { color: var(--amber); }
.stat-card strong.date-value { font-size: 27px; }

.panel-grid { margin-top: 22px; display: grid; gap: 22px; }
.panel-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.panel-grid.top-align { align-items: start; }
.panel { margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--navy-900); box-shadow: var(--shadow); }
.panel-grid .panel { margin-top: 0; }
.panel-heading { padding: 22px 24px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.panel-heading p:not(.eyebrow) { margin: 7px 0 0; font-size: 13px; }
.panel-heading.toolbar { align-items: end; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td { font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.table-subtitle { display: block; margin-top: 4px; color: var(--muted); }
.empty { padding: 28px; color: var(--muted); text-align: center; }
.text-link { color: var(--mint); font-weight: 800; }
.delta { font-weight: 900; }
.delta.positive { color: var(--mint); }
.delta.negative { color: var(--red); }

.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.badge.active { color: #b9f9e6; background: rgba(103,215,180,.14); }
.badge.inactive { color: #ffd1d1; background: rgba(255,120,120,.13); }
.badge.neutral { color: #c3d0d5; background: rgba(255,255,255,.07); }

.search { display: flex; gap: 9px; }
input, textarea { width: 100%; padding: 12px 13px; color: var(--text); background: #071e27; border: 1px solid rgba(255,255,255,.13); border-radius: 11px; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(103,215,180,.1); }
textarea { resize: vertical; }
label > span { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 800; }
label > small { display: block; margin-top: 7px; color: var(--muted); }
.form-panel { max-width: 820px; }
.form-grid { padding: 24px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 19px; }
.form-grid .span-2 { grid-column: span 2; }
.form-stack { padding: 22px 24px 25px; display: grid; gap: 17px; }
.form-actions { padding-top: 4px; }
.check-row { display: flex; align-items: center; gap: 9px; }
.check-row input { width: 17px; height: 17px; }
.check-row span { margin: 0; color: var(--muted); font-weight: 600; }

.activity-list, .stack-list { padding: 9px 22px 18px; }
.activity-row, .stack-row { padding: 14px 2px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); }
.activity-row:last-child, .stack-row:last-child { border-bottom: 0; }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px rgba(103,215,180,.09); }
.activity-row strong, .activity-row small, .stack-row strong, .stack-row small { display: block; }
.activity-row small, .stack-row small { margin-top: 5px; color: var(--muted); }
.stack-row { justify-content: space-between; }

.profile-strip { padding: 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(120deg, var(--navy-850), var(--navy-900)); border: 1px solid var(--line); border-radius: 20px; }
.profile-main { display: flex; align-items: center; gap: 17px; }
.avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: var(--mint); color: var(--navy-950); font-size: 24px; font-weight: 950; }
.profile-title { display: flex; align-items: center; gap: 10px; }
.profile-title h2 { margin: 0; }
.profile-main p, .profile-main small { margin: 5px 0 0; color: var(--muted); }
.pagination { padding: 17px 20px; display: flex; justify-content: center; gap: 17px; color: var(--muted); border-top: 1px solid var(--line); }
.pagination a { color: var(--mint); font-weight: 800; }

.login-body { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0%, #174252 0, var(--navy-950) 45%); }
.login-card { width: min(100%, 440px); padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: rgba(11,37,48,.96); box-shadow: 0 35px 90px rgba(0,0,0,.38); }
.login-brand { text-align: center; }
.login-brand .brand-mark { margin: 0 auto 20px; }
.login-brand h1 { margin: 7px 0 0; font-size: 31px; }
.login-brand p:not(.eyebrow) { margin: 10px 0 0; line-height: 1.55; }
.login-card .form-stack { padding: 24px 0 0; }
.login-card .alert { margin: 20px 0 0; }
.login-foot { margin: 24px 0 0; text-align: center; font-size: 12px; }

@media (max-width: 1000px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; padding: 17px 20px; flex-direction: row; align-items: center; gap: 20px; }
    .nav { margin: 0 0 0 auto; display: flex; }
    .sidebar-footer { margin: 0; padding: 0 0 0 18px; border: 0; border-left: 1px solid var(--line); }
    .sidebar-footer span, .sidebar-footer small { display: none; }
    .link-button { margin: 0; }
    .content { padding-top: 26px; }
}

@media (max-width: 760px) {
    .sidebar { align-items: flex-start; flex-wrap: wrap; }
    .brand { width: 100%; }
    .nav { margin-left: 0; }
    .sidebar-footer { margin-left: auto; }
    .brand strong { font-size: 13px; }
    .stat-grid, .panel-grid.two { grid-template-columns: 1fr; }
    .topbar, .profile-strip, .panel-heading.toolbar { align-items: stretch; flex-direction: column; }
    .topbar .button { width: 100%; }
    .search { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: span 1; }
    .profile-main { align-items: flex-start; }
    .profile-title { align-items: flex-start; flex-direction: column; }
    .stack-row { align-items: flex-start; }
}
