:root {
  --blue-50: #f0f9ff;
  --blue-100: #e0f2fe;
  --blue-200: #bae6fd;
  --blue-400: #38bdf8;
  --blue-500: #0ea5e9;
  --blue-600: #0284c7;
  --blue-700: #0369a1;
  --ink: #102a43;
  --muted: #64748b;
  --line: #dceaf3;
  --white: #fff;
  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 10px 35px rgba(14, 116, 164, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #f7fbfe; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.55rem, 5vw, 2.1rem); line-height: 1.18; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.eyebrow { color: var(--blue-600); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 8px; }
.text-right { text-align: right; }
.full { width: 100%; }
.hide-mobile { display: none; }

.auth-body { min-height: 100vh; background: radial-gradient(circle at 0 0, #dff5ff, transparent 45%), linear-gradient(145deg, #fafdff, #eef9ff); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(100%, 430px); background: rgba(255,255,255,.96); border: 1px solid var(--blue-100); border-radius: 24px; box-shadow: 0 25px 70px rgba(3,105,161,.14); padding: 28px 22px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: .85rem; color: var(--blue-700); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; color: white; font-weight: 900; letter-spacing: -.05em; font-size: 1.15rem; margin-bottom: 20px; background: linear-gradient(135deg, var(--blue-400), var(--blue-700)); box-shadow: 0 10px 22px rgba(14,165,233,.25); }
.success-state { text-align: center; }
.success-icon { width: 66px; height: 66px; display: grid; place-items: center; margin: 10px auto 18px; border-radius: 50%; color: white; background: var(--green); font-size: 2rem; }

.stack-form { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #334155; font-size: .79rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfe2ee; border-radius: 11px; color: var(--ink); background: white; outline: 0; padding: 12px 13px; transition: border .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-400); box-shadow: 0 0 0 4px rgba(56,189,248,.12); }
input.field-error, select.field-error { border-color: var(--red); box-shadow: 0 0 0 4px rgba(239,68,68,.1); }
input[readonly] { color: #526a7d; background: #f3f8fb; }
textarea { min-height: 90px; resize: vertical; }
.password-field { position: relative; }
.password-field input { padding-right: 58px; }
.password-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--blue-600); font-size: .72rem; font-weight: 800; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 0; border-radius: 11px; padding: 10px 15px; cursor: pointer; font-weight: 750; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .52; transform: none; box-shadow: none; }
.btn.primary { color: white; background: linear-gradient(135deg, var(--blue-500), var(--blue-700)); box-shadow: 0 7px 18px rgba(2,132,199,.2); }
.btn.secondary { color: var(--blue-700); background: var(--blue-100); }
.btn.ghost { color: #52667a; background: #f1f5f9; }
.btn.danger { color: #b91c1c; background: #fee2e2; }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: .75rem; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); cursor: pointer; }

.layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: 258px; padding: 22px 15px; color: #d8effb; background: linear-gradient(180deg, #075985, #0c4a6e); transform: translateX(-105%); transition: transform .25s ease; overflow-y: auto; }
.sidebar-open .sidebar { transform: translateX(0); }
.sidebar-overlay { position: fixed; inset: 0; z-index: 35; visibility: hidden; opacity: 0; background: rgba(15,23,42,.38); transition: .2s; }
.sidebar-open .sidebar-overlay { visibility: visible; opacity: 1; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand .brand-mark { flex: 0 0 auto; width: 42px; height: 42px; margin: 0; border-radius: 12px; }
.sidebar-brand strong { display: block; color: white; font-size: .94rem; }
.sidebar-brand small { color: #a8d7ed; }
.nav-label { margin: 22px 12px 8px; color: #87c6e4; font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-links { display: grid; gap: 5px; }
.nav-link { display: flex; align-items: center; gap: 12px; border-radius: 11px; padding: 11px 12px; font-weight: 650; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.13); }
.nav-icon { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-user { margin-top: 25px; border-radius: 13px; padding: 13px; background: rgba(255,255,255,.09); }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span { color: #a8d7ed; font-size: .75rem; margin-top: 3px; }

.main-content { min-width: 0; padding-bottom: 78px; }
.topbar { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; height: 66px; padding: 0 16px; border-bottom: 1px solid rgba(220,234,243,.85); background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
.topbar-title strong { display: block; font-size: .93rem; }
.topbar-title span { color: var(--muted); font-size: .71rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-content { max-width: 1450px; margin: auto; padding: 18px 14px 30px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-heading > * { min-width: 0; }
.page-heading h1 { margin: 0 0 5px; }
.page-heading p { margin: 0; }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.bottom-nav { position: fixed; inset: auto 8px 8px; z-index: 30; display: grid; grid-template-columns: repeat(5,1fr); padding: 7px 4px; border: 1px solid var(--blue-100); border-radius: 17px; background: rgba(255,255,255,.96); box-shadow: 0 8px 30px rgba(15,91,128,.16); backdrop-filter: blur(14px); }
.bottom-nav a { display: grid; justify-items: center; gap: 3px; color: #728396; font-size: .61rem; font-weight: 700; }
.bottom-nav a span:first-child { font-size: 1.03rem; }
.bottom-nav a.active { color: var(--blue-600); }

.grid { display: grid; gap: 14px; }
.stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 16px; }
.stat-card { position: relative; overflow: hidden; min-height: 126px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.stat-card::after { content: ''; position: absolute; width: 70px; height: 70px; border-radius: 50%; right: -25px; top: -25px; background: var(--blue-100); }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--blue-700); background: var(--blue-100); font-size: 1rem; }
.stat-label { display: block; margin: 13px 0 4px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.stat-value { display: block; overflow: hidden; font-size: clamp(1rem, 4vw, 1.35rem); font-weight: 850; text-overflow: ellipsis; }
.stat-foot { margin-top: 4px; color: #8a9baa; font-size: .66rem; }

.card { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px; border-bottom: 1px solid #edf4f8; }
.card-header h2 { margin: 0; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: .75rem; }
.card-body { padding: 16px; }
.content-grid { display: grid; gap: 16px; }
.content-grid > *, .grid > * { min-width: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-link { display: grid; gap: 7px; min-height: 92px; padding: 14px; border: 1px solid var(--blue-100); border-radius: 14px; background: var(--blue-50); }
.quick-link span { font-size: 1.2rem; }
.quick-link strong { font-size: .78rem; }

.progress-wrap { margin-top: 10px; }
.progress-head { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; margin-bottom: 7px; }
.progress { height: 8px; overflow: hidden; border-radius: 20px; background: #e8f2f7; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-400), var(--blue-600)); }
.summary-list { display: grid; gap: 13px; }
.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #edf4f8; }
.summary-row:last-child { padding-bottom: 0; border: 0; }
.summary-row span { color: var(--muted); }

.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { color: #63788a; background: #f6fafc; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; text-align: left; }
th, td { padding: 12px 13px; border-bottom: 1px solid #edf3f7; }
td { font-size: .78rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }
tbody tr.new-row { background: #ecfdf5; animation: new-row-pulse 1.8s ease; }
@keyframes new-row-pulse { 0% { background: #a7f3d0; } 100% { background: #ecfdf5; } }
.table-user { display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--blue-700); background: var(--blue-100); font-weight: 850; }
.table-user strong, .table-user span { display: block; }
.table-user span { color: var(--muted); font-size: .7rem; margin-top: 2px; }
.actions { display: flex; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 30px; padding: 5px 8px; font-size: .67rem; font-weight: 750; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { color: #047857; background: #d1fae5; }
.badge.inactive { color: #64748b; background: #e2e8f0; }
.badge.info { color: #0369a1; background: var(--blue-100); }
.empty-state { text-align: center; padding: 38px 18px; }
.empty-icon { width: 55px; height: 55px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 16px; background: var(--blue-100); font-size: 1.35rem; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.filter-bar label { min-width: 150px; flex: 1; }
.form-grid { display: grid; gap: 15px; }
.form-section { margin-bottom: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); overflow: hidden; }
.form-section-title { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: var(--blue-700); background: var(--blue-50); border-bottom: 1px solid var(--blue-100); }
.form-section-title span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: white; background: var(--blue-500); }
.form-section-title h2 { margin: 0; }
.form-section-body { padding: 16px; }
.form-actions { position: sticky; bottom: 70px; z-index: 15; display: flex; justify-content: flex-end; gap: 8px; padding: 12px; border: 1px solid var(--blue-100); border-radius: 14px; background: rgba(255,255,255,.94); box-shadow: 0 -5px 25px rgba(3,105,161,.08); backdrop-filter: blur(12px); }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; visibility: hidden; opacity: 0; padding-top: 30px; background: rgba(15,23,42,.48); transition: .2s; }
.modal.open { visibility: visible; opacity: 1; }
.modal-panel { width: 100%; max-height: 92vh; overflow-y: auto; padding: 21px; border-radius: 22px 22px 0 0; background: white; transform: translateY(25px); transition: .25s; }
.modal.open .modal-panel { transform: translateY(0); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.modal-close { width: 35px; height: 35px; border: 0; border-radius: 10px; background: #eef4f7; cursor: pointer; }
.modal-active { overflow: hidden; }

.alert, .flash-message { border-radius: 12px; padding: 12px 14px; margin: 15px 0; font-size: .82rem; }
.alert.danger, .flash-message.danger { color: #991b1b; border: 1px solid #fecaca; background: #fef2f2; }
.alert.success, .flash-message.success { color: #065f46; border: 1px solid #a7f3d0; background: #ecfdf5; }
.alert.info, .flash-message.info { color: #075985; border: 1px solid var(--blue-200); background: var(--blue-50); }
.flash-message { position: fixed; top: 75px; right: 12px; left: 12px; z-index: 90; box-shadow: var(--shadow); transition: .4s; }
.flash-message.fade { visibility: hidden; opacity: 0; transform: translateY(-8px); }
.section-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.section-tabs a { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; font-size: .76rem; font-weight: 700; }
.section-tabs a.active { color: white; border-color: var(--blue-500); background: var(--blue-500); }
.danger-zone { border-color: #fecaca; }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 9px; }
.inline-form label { flex: 1; min-width: 170px; }
.metric-strip { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--line); }
.metric-strip > div { padding: 14px; background: white; }
.metric-strip span, .metric-strip strong { display: block; }
.metric-strip span { color: var(--muted); font-size: .7rem; margin-bottom: 5px; }
.metric-strip strong { font-size: 1rem; }

@media (max-width: 639px) {
  .page-heading { flex-direction: column; }
  .heading-actions { width: 100%; justify-content: flex-start; }
}

@media (min-width: 640px) {
  .page-content { padding: 24px; }
  .auth-card { padding: 36px; }
  .stats-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .form-grid.two { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .modal { place-items: center; padding: 25px; }
  .modal-panel { max-width: 590px; border-radius: 22px; }
  .flash-message { right: 24px; left: auto; min-width: 320px; }
  .metric-strip { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); }
}

@media (min-width: 1024px) {
  body { font-size: 15px; }
  .sidebar { transform: none; }
  .sidebar-overlay, .bottom-nav { display: none; }
  .main-content { margin-left: 258px; padding-bottom: 0; }
  .topbar { height: 72px; padding: 0 28px; }
  [data-sidebar-toggle] { display: none; }
  .page-content { padding: 27px 28px 45px; }
  .content-grid.two-thirds { grid-template-columns: minmax(0,1.55fr) minmax(300px,.75fr); }
  .content-grid.equal { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .form-actions { bottom: 15px; }
  .hide-mobile { display: initial; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .form-actions, .no-print, .heading-actions { display: none !important; }
  .main-content { margin: 0; }
  .page-content { max-width: none; padding: 0; }
  .card, .form-section { box-shadow: none; break-inside: avoid; }
  body { background: white; }
}

/* Public landing page */
.landing-body { min-height: 100vh; background: #f8fcff; }
.landing-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1200px; height: 72px; margin: auto; padding: 0 16px; background: rgba(248,252,255,.9); backdrop-filter: blur(14px); }
.landing-logo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.landing-logo .brand-mark { flex: 0 0 auto; width: 42px; height: 42px; margin: 0; border-radius: 13px; }
.landing-logo strong, .landing-logo small { display: block; }
.landing-logo strong { overflow: hidden; font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.landing-logo small { color: var(--muted); font-size: .62rem; margin-top: 2px; }
.landing-nav { display: flex; align-items: center; gap: 10px; }
.landing-nav > a:first-child { display: none; color: var(--muted); font-weight: 700; }
.landing-nav .secondary { display: none; }
.landing-hero { position: relative; display: grid; align-items: center; gap: 38px; max-width: 1200px; min-height: calc(100vh - 72px); margin: auto; padding: 54px 18px 70px; overflow: hidden; }
.landing-hero::before { content: ''; position: absolute; z-index: -1; width: 520px; height: 520px; top: -160px; right: -280px; border-radius: 50%; background: radial-gradient(circle, rgba(56,189,248,.22), rgba(224,242,254,0) 67%); }
.hero-copy { max-width: 660px; }
.hero-copy h1 { max-width: 650px; margin-bottom: 18px; font-size: clamp(2.2rem, 9vw, 4.6rem); letter-spacing: -.045em; }
.hero-copy > p:not(.eyebrow) { max-width: 610px; color: var(--muted); font-size: 1rem; line-height: 1.75; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 27px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 13px 20px; margin-top: 24px; color: #48667a; font-size: .76rem; font-weight: 750; }
.hero-points span::first-letter { color: var(--green); }
.hero-panel { width: 100%; max-width: 520px; margin: auto; overflow: hidden; border: 1px solid var(--blue-100); border-radius: 23px; background: rgba(255,255,255,.93); box-shadow: 0 30px 80px rgba(3,105,161,.17); transform: rotate(1deg); }
.hero-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: .78rem; }
.hero-panel-head > span { display: flex; gap: 5px; }
.hero-panel-head i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-200); }
.hero-panel-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; background: var(--line); }
.hero-panel-grid > div { padding: 15px; background: white; }
.hero-panel-grid span, .hero-panel-grid strong, .hero-panel-grid small { display: block; }
.hero-panel-grid span { color: var(--muted); font-size: .66rem; }
.hero-panel-grid strong { margin: 6px 0 3px; font-size: .98rem; }
.hero-panel-grid small { color: #8aa0b0; font-size: .58rem; }
.hero-chart { height: 130px; display: flex; align-items: end; justify-content: space-around; gap: 9px; padding: 20px 22px; background: linear-gradient(180deg,#f9fdff,#eef9ff); }
.hero-chart span { flex: 1; max-width: 35px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg,var(--blue-400),var(--blue-600)); }
.hero-chart span:nth-child(1) { height: 42%; }
.hero-chart span:nth-child(2) { height: 62%; }
.hero-chart span:nth-child(3) { height: 54%; }
.hero-chart span:nth-child(4) { height: 77%; }
.hero-chart span:nth-child(5) { height: 69%; }
.hero-chart span:nth-child(6) { height: 88%; }
.hero-chart span:nth-child(7) { height: 82%; }
.landing-features { padding: 70px 16px; background: white; }
.landing-section-title { max-width: 630px; margin: 0 auto 35px; text-align: center; }
.landing-section-title h2 { margin-bottom: 12px; font-size: clamp(1.8rem,6vw,3rem); }
.landing-section-title > p:last-child { color: var(--muted); line-height: 1.7; }
.feature-grid { display: grid; gap: 13px; max-width: 1120px; margin: auto; }
.feature-grid article { padding: 23px; border: 1px solid var(--line); border-radius: 18px; background: #fbfdff; }
.feature-grid article > span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 12px; color: var(--blue-700); background: var(--blue-100); font-size: 1.15rem; }
.feature-grid h3 { margin-bottom: 8px; }
.feature-grid p { margin: 0; color: var(--muted); font-size: .83rem; line-height: 1.65; }
.landing-cta { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 24px; max-width: 1120px; margin: 65px auto; padding: 30px 22px; border-radius: 24px; color: white; background: linear-gradient(135deg,#075985,#0284c7); box-shadow: 0 25px 60px rgba(3,105,161,.2); }
.landing-cta .eyebrow { color: var(--blue-200); }
.landing-cta h2 { margin-bottom: 7px; font-size: clamp(1.5rem,5vw,2.3rem); }
.landing-cta p { margin-bottom: 0; color: #d7f0fc; }
.landing-cta .hero-actions { margin: 0; }
.landing-cta .primary { color: var(--blue-700); background: white; }
.landing-cta .secondary { color: white; background: rgba(255,255,255,.13); }
.landing-footer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .72rem; }
.landing-footer strong { color: var(--ink); font-size: .9rem; }

@media (min-width: 640px) {
  .landing-header { padding: 0 24px; }
  .landing-nav > a:first-child, .landing-nav .secondary { display: inline-flex; }
  .landing-hero { padding-inline: 28px; }
  .feature-grid { grid-template-columns: repeat(2,1fr); }
  .landing-cta { flex-direction: row; align-items: center; padding: 38px; }
}

@media (min-width: 1024px) {
  .landing-hero { grid-template-columns: 1.15fr .85fr; padding-block: 70px 90px; }
  .feature-grid { grid-template-columns: repeat(3,1fr); }
  .landing-footer { flex-direction: row; justify-content: space-between; padding-inline: max(30px,calc((100% - 1120px)/2)); }
}
