:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }

/* ── LOGIN ── */
#login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}
.login-card { background: white; border-radius: 20px; padding: 48px; width: 100%; max-width: 420px; box-shadow: 0 30px 60px rgba(0,0,0,0.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-badge { display: inline-flex; align-items: center; gap: 6px; background: #eff6ff; color: var(--primary); padding: 5px 14px; border-radius: 20px; font-size: 12px; font-weight: 600; margin-bottom: 12px; }
.login-logo h1 { font-size: 24px; font-weight: 800; color: var(--text); }
.login-logo p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.fgroup { margin-bottom: 18px; }
.fgroup label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.fgroup select, .fgroup input { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--text); outline: none; transition: border-color 0.15s; background: white; }
.fgroup select:focus, .fgroup input:focus { border-color: var(--primary); }
.btn-login { width: 100%; padding: 13px; background: var(--primary); color: white; border: none; border-radius: 9px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background 0.15s; }
.btn-login:hover { background: var(--primary-dark); }
.login-error { color: var(--danger); font-size: 13px; text-align: center; margin-top: 12px; display: none; }
.login-hint { text-align: center; font-size: 11px; color: #b0b7c3; margin-top: 18px; }

/* ── APP LAYOUT ── */
#app { display: flex; min-height: 100vh; }
#sidebar { width: 245px; background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; height: 100vh; left: 0; top: 0; overflow-y: auto; }
.sb-header { padding: 22px 20px; border-bottom: 1px solid #1e293b; }
.sb-header h2 { color: white; font-size: 16px; font-weight: 800; }
.sb-header p { color: var(--sidebar-text); font-size: 11px; margin-top: 2px; }
.sb-user { padding: 14px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #1e293b; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.uinfo span { display: block; color: white; font-size: 13px; font-weight: 600; }
.uinfo small { color: var(--sidebar-text); font-size: 11px; }
.sb-nav { padding: 10px; flex: 1; }
.nav-label { color: #475569; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 10px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text); cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; margin-bottom: 2px; }
.nav-item:hover { background: #1e293b; color: white; }
.nav-item.active { background: var(--primary); color: white; }
.sb-footer { padding: 14px 10px; border-top: 1px solid #1e293b; }
.btn-logout { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; background: none; border: 1px solid #334155; border-radius: 8px; color: var(--sidebar-text); font-size: 13px; cursor: pointer; transition: all .15s; }
.btn-logout:hover { background: #1e293b; color: white; }

/* ── CONTENT ── */
#main-content { margin-left: 245px; flex: 1; }
.page-header { background: white; border-bottom: 1px solid var(--border); padding: 20px 32px; display: flex; align-items: center; justify-content: space-between; }
.page-header h1 { font-size: 20px; font-weight: 800; }
.page-header p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-body { padding: 24px 32px; }

/* ── CARDS ── */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; color: var(--text); }
.card-title small { font-weight: 400; color: var(--muted); }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: white; border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); border-top: 3px solid transparent; }
.stat.blue { border-color: var(--primary); }
.stat.green { border-color: var(--success); }
.stat.amber { border-color: var(--warning); }
.stat.slate { border-color: #64748b; }
.stat-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.stat-val { font-size: 26px; font-weight: 800; }
.stat.blue .stat-val { color: var(--primary); }
.stat.green .stat-val { color: var(--success); }
.stat.amber .stat-val { color: var(--warning); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ── TABLES ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #f8fafc; padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tr.highlight td { background: #fffbeb; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.bg-green { background: #dcfce7; color: #15803d; }
.bg-amber { background: #fef3c7; color: #92400e; }
.bg-red   { background: #fee2e2; color: #b91c1c; }
.bg-blue  { background: #dbeafe; color: #1d4ed8; }
.bg-gray  { background: #f1f5f9; color: #475569; }
.bg-purple{ background: #f3e8ff; color: #7e22ce; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }
.btn-blue { background: var(--primary); color: white; }
.btn-blue:hover { background: var(--primary-dark); }
.btn-green { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.btn-green:hover { background: #bbf7d0; }
.btn-outline { background: white; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fecaca; }

/* ── MODAL ── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(2px); }
.overlay.open { display: flex; }
.modal { background: white; border-radius: 16px; padding: 32px; width: 100%; max-width: 500px; box-shadow: 0 25px 60px rgba(0,0,0,.25); max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.modal .sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.mfooter { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── VIEWS ── */
.view { display: none; }
.view.active { display: block; }

/* ── FORMS ── */
.fg { margin-bottom: 16px; }
.fg label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.fg input, .fg select, .fg textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 7px; font-size: 13px; color: var(--text); outline: none; transition: border-color .15s; background: white; }
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--primary); }
.fg input:disabled { background: #f8fafc; color: var(--muted); }

/* ── YEAR CARDS ── */
.year-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 16px; transition: box-shadow .15s; }
.year-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.yc-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.yc-head h3 { font-size: 16px; font-weight: 800; }
.yc-head .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.calc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.calc-item label { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.calc-item .cval { font-size: 20px; font-weight: 800; }
.calc-item .csub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.split-box { border-radius: 10px; padding: 16px; }
.split-box.cash { background: #f0fdf4; }
.split-box.ltip { background: #eff6ff; }
.split-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.split-box.cash .split-label { color: #15803d; }
.split-box.ltip .split-label { color: #1d4ed8; }
.split-val { font-size: 22px; font-weight: 800; }
.split-box.cash .split-val { color: #15803d; }
.split-box.ltip .split-val { color: #1d4ed8; }
.split-sub { font-size: 12px; margin-top: 8px; }
.split-box.cash .split-sub { color: #15803d; }
.split-box.ltip .split-sub { color: #1d4ed8; }
.vest-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.vest-pill { flex: 1; min-width: 110px; background: #f8fafc; border-radius: 8px; padding: 11px; text-align: center; border: 1.5px solid var(--border); }
.vest-pill.vested { border-color: #bfdbfe; background: #eff6ff; }
.vest-pill.paid { border-color: #bbf7d0; background: #f0fdf4; }
.vest-pill .vp-num { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.vest-pill .vp-amt { font-size: 15px; font-weight: 800; margin: 4px 0; }
.vest-pill .vp-date { font-size: 11px; color: var(--muted); }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content:''; position:absolute; left:7px; top:6px; bottom:6px; width:2px; background:var(--border); }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-item::before { content:''; position:absolute; left:-18px; top:4px; width:10px; height:10px; border-radius:50%; border:2px solid var(--border); background:white; }
.tl-item.past::before { background:#34d399; border-color:#34d399; }
.tl-item.soon::before { background:var(--primary); border-color:var(--primary); }
.tl-date { font-size:11px; color:var(--muted); font-weight:600; }
.tl-text { font-size:13px; }

/* ── ALERTS ── */
.alert { padding:12px 16px; border-radius:8px; font-size:13px; margin-bottom:16px; }
.alert-blue { background:#eff6ff; color:#1d4ed8; border-left:3px solid var(--primary); }
.alert-amber { background:#fffbeb; color:#92400e; border-left:3px solid var(--warning); }
.alert-green { background:#f0fdf4; color:#15803d; border-left:3px solid var(--success); }

/* ── TOAST ── */
.toast { position:fixed; bottom:24px; right:24px; background:#1e293b; color:white; padding:12px 20px; border-radius:10px; font-size:14px; font-weight:500; z-index:2000; display:none; animation:slideUp .25s ease; }
@keyframes slideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }

/* ── MISC ── */
.grid2 { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.divider { height:1px; background:var(--border); margin:16px 0; }
.row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; font-size:13px; border-bottom:1px solid var(--border); }
.row:last-child { border-bottom:none; }
.empty { text-align:center; padding:40px; color:var(--muted); font-size:13px; }
.section-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:10px; }
.chart-wrap { position:relative; height:270px; }
.pay-item { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--border); }
.pay-item:last-child { border-bottom:none; }
.pay-item .pi-label { font-weight:600; font-size:13px; }
.pay-item .pi-sub { font-size:11px; color:var(--muted); margin-top:2px; }
.pay-item .pi-amt { font-weight:800; font-size:15px; }
.totals-row { display:flex; justify-content:space-between; font-size:13px; padding:6px 0; }
@media (max-width:1100px) { .stats-grid{grid-template-columns:repeat(2,1fr)} .grid2{grid-template-columns:1fr} .calc-grid{grid-template-columns:repeat(2,1fr)} }

/* ── ADDED FOR THE HOSTED VERSION ── */
[hidden] { display: none !important; }
.nav-item .tag { margin-left: auto; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 10px; background: #334155; color: #cbd5e1; text-transform: uppercase; letter-spacing: .04em; }
.nav-item.active .tag { background: rgba(255,255,255,.22); color: white; }
.sb-footer .btn-logout + .btn-logout { margin-top: 6px; }
.ph-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.score-row { border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.score-row .sr-name { font-weight: 700; font-size: 13px; }
.score-row .sr-what { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.score-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.score-opts label { display: block; border: 1.5px solid var(--border); border-radius: 8px; padding: 7px 9px; font-size: 11px; cursor: pointer; color: var(--muted); line-height: 1.35; }
.score-opts label strong { display: block; font-size: 12px; color: var(--text); }
.score-opts input { position: absolute; opacity: 0; pointer-events: none; }
.score-opts label.on.full { border-color: #86efac; background: #f0fdf4; }
.score-opts label.on.partial { border-color: #fcd34d; background: #fffbeb; }
.score-opts label.on.miss { border-color: #fca5a5; background: #fef2f2; }
.preview-box { background: #f8fafc; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.preview-box .totals-row strong { font-weight: 800; }
.modal.wide { max-width: 640px; }
.sc-table td, .sc-table th { font-size: 12px; }
.tpl-row { display: grid; grid-template-columns: 1fr; gap: 6px; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.tpl-row .three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tpl-row input { width: 100%; padding: 7px 9px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; }
.linkish { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 12px; font-weight: 600; padding: 0; }
.pending-box { max-width: 520px; margin: 80px auto; text-align: center; }
.audit-item { font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--muted); word-break: break-word; }
.audit-item strong { color: var(--text); }
@media (max-width: 820px) {
  #app { display: block; }
  #sidebar { position: static; width: 100%; height: auto; }
  #main-content { margin-left: 0; }
  .page-header { padding: 16px; flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-body { padding: 16px; }
  .stats-grid, .split-grid, .calc-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px; margin: 16px; }
  .score-opts { grid-template-columns: 1fr; }
}

