/* EagleIQ Tracker — light + dark, sidebar on desktop, tab bar on phones */
:root {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #f8f9fc; --ink: #0f172a; --ink-2: #334155; --muted: #64748b;
  --line: #e7e9f0; --line-2: #d6dae4;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-soft: #eef0ff; --accent-ink: #3730a3;
  --good: #059669; --good-soft: #e7f8f1; --warn: #d97706; --warn-soft: #fff5e6; --danger: #dc2626; --danger-soft: #fdecec;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.10);
  --r: 16px; --r-sm: 10px;
  --side: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f1a; --surface: #131a2a; --surface-2: #182033; --ink: #e8ecf5; --ink-2: #c3cad8; --muted: #8b95a9;
    --line: #232c40; --line-2: #2e3850;
    --accent: #818cf8; --accent-2: #6366f1; --accent-soft: #1e2246; --accent-ink: #c7cbff;
    --good: #34d399; --good-soft: #0f2a23; --warn: #fbbf24; --warn-soft: #2d2311; --danger: #f87171; --danger-soft: #2f1517;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 1rem; letter-spacing: -.01em; margin: 0; font-weight: 600; }
small { color: var(--muted); display: block; font-size: .8rem; }
.muted { color: var(--muted); margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: .82rem; }
.list .body small.by { font-size: .72rem; opacity: .8; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.row-actions { display: flex; align-items: center; gap: 2px; }
.ic { flex: none; display: block; }
.good-t { color: var(--good); } .warn-t { color: var(--warn); } .danger-t { color: var(--danger); }

/* ---------- Shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; padding: 0 8px; }
.mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--accent-2), #8b5cf6); box-shadow: 0 4px 12px rgba(99,102,241,.35); }
.sidenav { display: flex; flex-direction: column; gap: 2px; margin-top: 28px; }
.sidenav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.sidenav a:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a.on { background: var(--accent-soft); color: var(--accent-ink); }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.side-foot .who { flex: 1; font-weight: 500; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.mtop, .tabbar { display: none; }
.app main { margin-left: var(--side); max-width: calc(1120px + var(--side)); padding: 32px 40px 64px; }
.auth main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }

/* ---------- Page head ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.pagehead .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .85rem; font-weight: 500; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
.ph-title { display: flex; align-items: center; gap: 14px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); font-size: .88rem; margin-top: 6px; }
.meta span, .meta a { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head .count { color: var(--muted); font-size: .8rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 8px; border-radius: 99px; }
.card.flush { padding: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: start; }
.grid2 > .card, .grid-side > .card, .grid2 > form, .grid-side > form { margin-top: 0; min-width: 0; }
@media (max-width: 1180px) { .grid2 { grid-template-columns: 1fr; } .grid-side { grid-template-columns: 1fr; } }
@media (max-width: 1180px) and (min-width: 861px) { .app main { padding: 28px 28px 56px; } }
.mt { margin-top: 20px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); }
.stat .lbl { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; font-weight: 500; }
.stat .chip-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.stat.good .chip-ic { background: var(--good-soft); color: var(--good); }
.stat.warn .chip-ic { background: var(--warn-soft); color: var(--warn); }
.stat b { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.stat small { margin-top: 2px; }
.stat.hero { color: #fff; border: 0; background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); box-shadow: 0 10px 30px rgba(79,70,229,.3); }
.stat.hero .lbl, .stat.hero small { color: rgba(255,255,255,.8); }
.stat.hero .chip-ic { background: rgba(255,255,255,.18); color: #fff; }
.stat.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.08); }

/* ---------- Progress ---------- */
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #10b981, #34d399); transition: width .6s ease; }
.bar.lg { height: 10px; }
.progress-card .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.progress-card .pct { font-size: 1.25rem; font-weight: 700; }
.progress-card .dates { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; color: var(--muted); font-size: .85rem; }
.progress-card .dates span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li > a, .list > li.static { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: inherit; transition: background .15s; }
.list > li > a:hover { background: var(--surface-2); }
.list > li + li { border-top: 1px solid var(--line); }
.list .body { flex: 1; min-width: 0; }
.list .body b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .body .bar { margin-top: 8px; max-width: 260px; }
.list .end { text-align: right; white-space: nowrap; }
.list .end b { font-weight: 600; font-variant-numeric: tabular-nums; }
.list .chev { color: var(--line-2); }
.list > li > a:hover .chev { color: var(--muted); }

.av { --h: 250; display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: hsl(var(--h) 85% 95%); color: hsl(var(--h) 55% 40%); font-weight: 600; font-size: .85rem; letter-spacing: .02em; }
.av.sm { width: 32px; height: 32px; border-radius: 10px; font-size: .75rem; }
.av.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 1.1rem; }
@media (prefers-color-scheme: dark) { .av { background: hsl(var(--h) 40% 20%); color: hsl(var(--h) 80% 78%); } }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .75rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.p-completed { background: var(--good-soft); color: var(--good); }
.pill.p-onhold { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill.p-late { background: var(--warn-soft); color: var(--warn); }
.mode { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .em-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 12px; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

/* ---------- Forms ---------- */
label { display: block; font-size: .82rem; font-weight: 500; color: var(--ink-2); margin-bottom: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; font-size: .95rem; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.section-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 14px; }
.money { position: relative; }
.money::before { content: "₹"; position: absolute; left: 13px; bottom: 12px; color: var(--muted); font-weight: 500; }
.money input { padding-left: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.money.big input { font-size: 1.35rem; padding-top: 12px; padding-bottom: 12px; }
.money.big::before { font-size: 1.35rem; bottom: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .9rem;
  cursor: pointer; white-space: nowrap; transition: background .15s, transform .05s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent-2), #7c3aed); box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.btn.primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); filter: brightness(1.05); }
.btn.block { width: 100%; padding: 13px; }
.btn.ghost-danger { color: var(--danger); border-color: transparent; background: none; }
.btn.ghost-danger:hover { background: var(--danger-soft); }
.link { background: none; border: 0; padding: 4px 6px; font: inherit; cursor: pointer; color: var(--accent); }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.chip { margin: 0; position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span { display: block; text-align: center; padding: 9px 4px; border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: .85rem; transition: all .15s; }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { margin: 0; padding-left: 40px; background: var(--surface); }
.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: .85rem; white-space: nowrap; }
.seg a .n { margin-left: 4px; font-size: .75rem; opacity: .7; }
.seg a.on { background: var(--accent-soft); color: var(--accent-ink); }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: .9rem;
  animation: drop .3s ease; transition: opacity .4s, transform .4s; max-width: calc(100% - 32px); }
.toast .ic { color: #34d399; }
.toast.hide { opacity: 0; transform: translate(-50%, -12px); pointer-events: none; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -12px); } }
.err { display: flex; gap: 8px; background: var(--danger-soft); color: var(--danger); padding: 11px 14px; border-radius: var(--r-sm); margin: 0 0 16px; font-weight: 500; font-size: .9rem; }

/* ---------- Auth ---------- */
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { justify-content: center; font-size: 1.1rem; margin-bottom: 24px; }
.auth-card .mark { width: 40px; height: 40px; border-radius: 12px; }
.auth-card .card { padding: 28px; }
.auth-card h1 { font-size: 1.35rem; }
.auth-card .muted { margin: 4px 0 20px; }
.auth { background: radial-gradient(1000px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }

/* ---------- Payments timeline ---------- */
.pay-list li.static { padding: 12px 6px; }
.pay-ic { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--good-soft); color: var(--good); flex: none; }
.users li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.users li + li { border-top: 1px solid var(--line); }
.users li span.u { flex: 1; font-weight: 500; }
.danger-zone { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }

/* ---------- Phone ---------- */
@media (max-width: 860px) {
  .side { display: none; }
  .app main { margin: 0; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .mtop { display: flex; align-items: center; position: sticky; top: 0; z-index: 20; height: 56px; padding: 0 16px;
    background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .mtop .brand { padding: 0; }
  .mtop .mark { width: 28px; height: 28px; border-radius: 9px; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--muted); font-size: .7rem; font-weight: 600; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.fab .ic { box-sizing: content-box; padding: 7px; margin-top: -4px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--accent-2), #7c3aed); box-shadow: 0 4px 12px rgba(99,102,241,.4); width: 18px; height: 18px; }
  .hide-sm { display: none !important; }
  h1 { font-size: 1.35rem; }
  .pagehead { margin-bottom: 18px; align-items: center; }
  .grid2, .grid-side, .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .stat b { font-size: 1.3rem; margin-top: 10px; }
  .stats .stat:first-child b { font-size: 1.7rem; }
  .card { padding: 18px; }
  .card.flush { padding: 4px; }
  .list .body .bar { max-width: none; }
  .search { flex-basis: 100%; }
  .toast { top: 66px; }
}
