:root {
  /* Next Levels brand palette (from logo): navy #202868, light blue #93bce4 */
  --navy: #202868; --navy-2: #2e3a8c; --gold: #93bce4; --bg: #f4f6fa;
  --card: #ffffff; --text: #1c2733; --muted: #6b7a8c; --line: #e3e8ee;
  --green: #1e8e5a; --red: #c0392b; --amber: #b7791f; --blue: #2563a8;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1 { font-size: 22px; } h2 { font-size: 18px; margin-bottom: 12px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #182052, var(--navy) 55%, #2e3a8c); }
.login-card { background: var(--card); padding: 40px; border-radius: 14px; width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.login-card h1 { margin: 12px 0 4px; color: var(--navy); }
.login-card form { margin-top: 22px; text-align: left; }
.brand-mark { width: 54px; height: 54px; border-radius: 12px; background: var(--navy); color: var(--gold);
  font-weight: 800; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; }
.brand-mark.small { width: 30px; height: 30px; font-size: 12px; border-radius: 8px; margin-right: 8px; }

label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
input, select, textarea { width: 100%; padding: 9px 11px; margin-top: 5px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37,99,168,.35); border-color: var(--blue); }
textarea { min-height: 70px; resize: vertical; }

.btn { padding: 9px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 700; }
.btn.gold:hover { background: #a7c9ec; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--red); }
.btn.full { width: 100%; margin-top: 6px; }
.error { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 18px; background: var(--navy); color: #fff;
  padding: 10px 22px; position: sticky; top: 0; z-index: 50; flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; white-space: nowrap; }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a { color: rgba(255,255,255,.75); text-decoration: none; padding: 7px 12px; border-radius: 7px;
  font-size: 14px; font-weight: 600; }
#nav a:hover { color: #fff; }
#nav a.active { background: rgba(147,188,228,.22); color: #cfe2f5; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.whoami { font-size: 13px; color: rgba(255,255,255,.85); }
.bell { position: relative; background: none; border: none; font-size: 19px; cursor: pointer; color: #fff; }
.bell-count { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 1px 5px; }

.notif-panel { position: fixed; right: 18px; top: 56px; width: 380px; max-height: 65vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 48px rgba(0,0,0,.2); z-index: 60; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.notif-item.unread { background: #eef5fc; }
.notif-item .when { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

main { padding: 24px; max-width: 1280px; margin: 0 auto; }

/* Cards & tables */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.card-head h2 { margin: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 2px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #f8fafc; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Status pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.pill.gray { background: #eceff3; color: var(--muted); }
.pill.blue { background: #e3edf8; color: var(--blue); }
.pill.amber { background: #fbf0da; color: var(--amber); }
.pill.green { background: #e2f4ea; color: var(--green); }
.pill.navy { background: #e2e8f2; color: var(--navy); }
.pill.red { background: #f9e5e2; color: var(--red); }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat .value { font-size: 26px; font-weight: 800; color: var(--navy); margin-top: 6px; }
.stat .value.green { color: var(--green); }

/* Forms grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,36,64,.5); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 640px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.modal h2 { color: var(--navy); }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy);
  color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; z-index: 200; box-shadow: 0 8px 30px rgba(0,0,0,.3); }

.timeline { font-size: 13px; line-height: 1.9; }
.timeline .done { color: var(--green); }
.timeline .todo { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 13.5px; margin: 10px 0; }
.detail-grid div b { color: var(--muted); font-weight: 600; font-size: 12px; display: block; }

/* v2 additions */
.ball-banner { display:flex; align-items:center; gap:14px; background:#eef5fc; border:1px solid #c6dcf1;
  border-radius:12px; padding:14px 18px; margin-bottom:16px; flex-wrap:wrap; }
.ball-banner .who { font-weight:800; color:var(--navy); }
.ball-banner .gate { color:var(--red); font-weight:600; font-size:13px; }
.tracks { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:10px; margin:14px 0; }
.track { border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:#fff; }
.track .t-label { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:5px; }
.tabs { display:flex; gap:4px; border-bottom:2px solid var(--line); margin:16px 0 14px; flex-wrap:wrap; }
.tabs button { border:none; background:none; padding:9px 14px; font-size:13.5px; font-weight:700; color:var(--muted); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; }
.tabs button.active { color:var(--navy); border-bottom-color:var(--gold); }
.comment { border-left:3px solid var(--line); padding:6px 12px; margin:8px 0; font-size:13.5px; }
.comment .who { font-weight:700; font-size:12.5px; }
.comment .when { color:var(--muted); font-size:11.5px; }
.task-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); font-size:13.5px; flex-wrap:wrap; }
.ledger td:last-child { text-align:right; font-variant-numeric:tabular-nums; }
.chip-row { display:flex; gap:8px; flex-wrap:wrap; margin:6px 0; }
.file-row { display:flex; gap:10px; align-items:center; padding:6px 0; font-size:13.5px; border-bottom:1px solid var(--line); }
.subhead { font-size:14px; font-weight:800; color:var(--navy); margin:16px 0 8px; }
.two-col { display:grid; grid-template-columns:1fr 1fr; gap:18px; } @media (max-width:900px){ .two-col{grid-template-columns:1fr;} }
.tree-doc { border:1px solid var(--line); border-radius:10px; padding:14px 16px; margin-bottom:10px; background:#fff; }
.tree-prac { margin:8px 0 4px 14px; padding-left:12px; border-left:2px solid var(--line); }
.overdue { color: var(--red); font-weight:700; }

/* Jessica's finance dashboard */
.mtile-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px; margin-bottom:18px; }
.mtile { border-radius:14px; padding:22px 18px; cursor:pointer; color:#fff; min-height:120px; display:flex;
  flex-direction:column; justify-content:center; align-items:center; text-align:center; font-weight:700;
  transition:transform .12s, box-shadow .12s; border:none; }
.mtile:hover { transform:translateY(-3px); box-shadow:0 10px 26px rgba(32,40,104,.25); }
.mtile .mtile-num { font-size:40px; font-weight:800; line-height:1.1; }
.mtile .mtile-label { font-size:13.5px; margin-top:6px; opacity:.92; }
.mtile.navy { background:linear-gradient(135deg,#202868,#2e3a8c); }
.mtile.blue { background:linear-gradient(135deg,#4a7fb5,#93bce4); }
.mtile.amber { background:linear-gradient(135deg,#b7791f,#dba94e); }
.mtile.red { background:linear-gradient(135deg,#a63325,#c0392b); }
.mtile.green { background:linear-gradient(135deg,#166b44,#1e8e5a); }
.cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-head { font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); text-align:center; padding:4px 0; font-weight:700; }
.cal-cell { border:1px solid var(--line); border-radius:10px; min-height:92px; padding:6px 7px; background:#fff;
  cursor:pointer; font-size:11.5px; transition:border-color .1s; overflow:hidden; }
.cal-cell:hover { border-color:var(--navy); }
.cal-cell.other { background:#f6f8fb; opacity:.55; }
.cal-cell.today { outline:2px solid var(--gold); }
.cal-cell .dnum { font-weight:800; font-size:12.5px; color:var(--navy); margin-bottom:3px; }
.cal-ev { display:block; border-radius:5px; padding:1px 5px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:600; }
.cal-ev.inflow { background:#e2f4ea; color:#166b44; }
.cal-ev.outflow { background:#f9e5e2; color:#a63325; }
.cal-ev.prod { background:#e3edf8; color:#2563a8; }
.cal-ev.home { background:#eef5fc; color:#202868; }
