:root {
  color-scheme: light;
  --navy: #10233f;
  --navy-2: #183454;
  --blue: #2c69e8;
  --blue-soft: #eaf1ff;
  --ink: #162033;
  --muted: #657086;
  --line: #e3e8f0;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --success: #137a50;
  --danger: #b42318;
  --warning: #9a6700;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 255px 1fr; }
.sidebar { background: var(--navy); color: #dfe9f7; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; color: white; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(145deg, #4a88ff, #1e5bd0); }
.nav-label { color: #91a5bf; font-size: .75rem; font-weight: 700; letter-spacing: .08em; margin: 18px 10px 8px; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 3px 0; border-radius: 9px; color: #ccdaeb; font-size: .92rem; }
.nav-link:hover, .nav-link.active { background: var(--navy-2); color: white; }
.main { min-width: 0; }
.topbar { height: 70px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; position: sticky; top: 0; z-index: 5; }
.mobile-toggle { display: none; border: 0; background: transparent; font-size: 1.4rem; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 800; }
.content { padding: 30px; max-width: 1500px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.page-header h1 { margin: 0 0 4px; font-size: 1.75rem; letter-spacing: -.035em; }
.page-header p { margin: 0; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two-columns { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 18px rgba(22,32,51,.035); }
.card-body { padding: 22px; }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { margin: 0; font-size: 1rem; }
.metric-label { color: var(--muted); font-size: .88rem; }
.metric-value { font-size: 2rem; font-weight: 800; letter-spacing: -.045em; margin-top: 8px; }
.metric-detail { color: var(--success); font-size: .8rem; margin-top: 7px; }

.button { border: 1px solid transparent; border-radius: 9px; padding: 9px 15px; cursor: pointer; font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button-primary { background: var(--blue); color: white; }
.button-secondary { background: white; border-color: var(--line); color: var(--ink); }
.button-danger { color: var(--danger); background: #fff; border-color: #f2c9c5; }
.button-small { padding: 6px 10px; font-size: .8rem; }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(44,105,232,.2); outline-offset: 2px; }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: .86rem; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #ccd4e0; background: white; border-radius: 9px; padding: 10px 12px; color: var(--ink); }
.field small { color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox-grid { display: grid; gap: 9px; }
.checkbox { display: flex; gap: 9px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.checkbox input { margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
td { font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: .76rem; font-weight: 800; background: #edf1f6; color: #475467; }
.badge-active, .badge-success { background: #e8f7f0; color: var(--success); }
.badge-disabled, .badge-error { background: #fff0ee; color: var(--danger); }
.badge-warning { background: #fff7dc; color: var(--warning); }
.empty { padding: 38px 22px; text-align: center; color: var(--muted); }
.flash { border-radius: 10px; padding: 12px 15px; margin-bottom: 20px; font-weight: 650; }
.flash-success { background: #e8f7f0; color: var(--success); }
.flash-error { background: #fff0ee; color: var(--danger); }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 520px) 1fr; background: white; }
.auth-panel { padding: 7vh clamp(28px, 6vw, 78px); display: flex; flex-direction: column; justify-content: center; }
.auth-panel h1 { font-size: 2rem; letter-spacing: -.04em; margin: 28px 0 8px; }
.auth-panel > p { color: var(--muted); margin: 0 0 30px; }
.auth-visual { background: radial-gradient(circle at 70% 25%, #2f73f0 0, #143665 38%, #0d203a 75%); color: white; padding: 10vh 8vw; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-visual h2 { font-size: clamp(2rem, 4vw, 4.5rem); max-width: 780px; letter-spacing: -.055em; line-height: 1.03; margin: 0; }
.auth-visual p { max-width: 620px; color: #cbdcf3; font-size: 1.1rem; }

@media (max-width: 1000px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .two-columns { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; transform: translateX(-100%); z-index: 20; width: 255px; transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .mobile-toggle { display: block; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 16px; }
  .metrics { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .page-header { flex-direction: column; }
}

