/* KPI dashboard. Same palette as the tracker's styles.css. */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
}
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: #64748b; }

.topbar { background: white; border-bottom: 1px solid #eef1f5; }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 14px 16px 6px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.topbar h1 { margin: 2px 0 0; font-size: 22px; letter-spacing: -0.01em; }
.back { font-size: 12.5px; color: #94a3b8; font-weight: 600; }
.feeds { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: #64748b; }
.feeds .stale { color: #b45309; font-weight: 600; }
.tabs { max-width: 1400px; margin: 0 auto; padding: 0 10px; display: flex; gap: 2px; overflow-x: auto; }
.tabs a { padding: 10px 12px; font-size: 14px; font-weight: 600; color: #475569; border-bottom: 2px solid transparent; white-space: nowrap; cursor: pointer; }
.tabs a:hover { text-decoration: none; color: #0f172a; }
.tabs a.active { color: #1d4ed8; border-bottom-color: #2563eb; }

.filters { max-width: 1400px; margin: 0 auto; padding: 12px 16px; display: flex; gap: 10px 14px; flex-wrap: wrap; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #475569; }
.filters label.custom-dates { flex-direction: row; align-items: center; gap: 6px; }
.filters select, .filters input { padding: 7px 10px; border: 1px solid #dde3ea; border-radius: 9px; font-size: 14px; background: white; color: #0f172a; font-family: inherit; max-width: 100%; }
.mode { display: flex; border: 1px solid #dde3ea; border-radius: 9px; overflow: hidden; background: white; }
.mode button { border: 0; background: white; padding: 8px 12px; font-size: 13.5px; font-weight: 600; color: #475569; cursor: pointer; font-family: inherit; }
.mode button.active { background: #2563eb; color: white; }

.notice { max-width: 1368px; margin: 0 16px 10px; padding: 9px 13px; border-radius: 10px; font-size: 13px; background: #fef3c7; color: #92400e; }
@media (min-width: 1400px) { .notice { margin: 0 auto 10px; } }
.notice.error { background: #fee2e2; color: #991b1b; }

.page { max-width: 1400px; margin: 0 auto; padding: 0 16px 40px; }
.card { background: white; border: 1px solid #eef1f5; border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); padding: 16px; margin-bottom: 14px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 15px; }
.card h2 .muted { font-weight: 500; font-size: 13px; }
.card h2.with-action { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dl-btn { flex: none; border: 1px solid #cbd5e1; background: white; color: #1d4ed8; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.dl-btn:hover { background: #eff6ff; border-color: #93c5fd; }
.row { display: grid; gap: 10px; margin-bottom: 10px; }
.row-5 { grid-template-columns: repeat(5, 1fr); }
.row-6 { grid-template-columns: repeat(6, 1fr); }
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .row-5, .row-6 { grid-template-columns: repeat(3, 1fr); } .cols-2, .cols-even { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .row-5, .row-6 { grid-template-columns: repeat(2, 1fr); } }

.tile { background: white; border: 1px solid #eef1f5; border-radius: 12px; padding: 12px 13px; cursor: pointer; text-align: left; font-family: inherit; color: inherit; min-width: 0; }
.tile:hover { border-color: #bfd3fb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08); }
.tile .label { font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.tile .value { font-size: clamp(19px, 2.2vw, 25px); font-weight: 700; overflow-wrap: anywhere; }
.tile .sub { font-size: 11.5px; color: #64748b; margin-top: 4px; }
.tile .approx { color: #b45309; font-weight: 700; margin-right: 2px; }
.delta { font-size: 11.5px; font-weight: 600; margin-top: 4px; }
.delta.up { color: #15803d; }
.delta.down { color: #b91c1c; }
.delta.flat { color: #64748b; }

.funnel { display: grid; gap: 6px; }
.funnel-step { display: grid; grid-template-columns: 140px 1fr 70px; gap: 10px; align-items: center; font-size: 13px; cursor: pointer; }
.funnel-step .bar { height: 22px; background: #dbeafe; border-radius: 6px; position: relative; }
.funnel-step .bar span { position: absolute; left: 8px; top: 3px; font-weight: 700; font-size: 12.5px; color: #1e3a8a; }
.funnel-step .rate { color: #64748b; font-size: 12px; text-align: right; }
@media (max-width: 560px) { .funnel-step { grid-template-columns: 96px 1fr 52px; } }

.chart svg { width: 100%; height: auto; max-height: 300px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: #475569; margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 9px; border-bottom: 1px solid #f1f5f9; text-align: left; white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; color: #64748b; font-weight: 700; background: #f8fafc; }
td.num, th.num { text-align: right; }
tr.total td { font-weight: 700; border-top: 2px solid #e2e8f0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fafc; }
.flag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.flag.red { background: #fee2e2; color: #991b1b; }
.flag.amber { background: #fef3c7; color: #92400e; }
.flag.ok { background: #dcfce7; color: #166534; }
.big { font-size: 26px; font-weight: 700; }
.seg { display: inline-flex; border: 1px solid #dde3ea; border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.seg button { border: 0; background: white; padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: #475569; cursor: pointer; font-family: inherit; }
.seg button.active { background: #eff6ff; color: #1d4ed8; }

.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; z-index: 50; overflow-y: auto; }
.modal-box { background: white; border-radius: 14px; width: 100%; max-width: 980px; padding: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.close { border: 0; background: #f1f5f9; border-radius: 8px; width: 32px; height: 32px; font-size: 20px; cursor: pointer; }
.list-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin: 12px 0 6px; flex-wrap: wrap; }
.list-head h3 { margin: 0; font-size: 14px; }
.formula { background: #f8fafc; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
@media (max-width: 560px) { .row-5 .tile:last-child { grid-column: span 2; } }

/* My Dashboard (me.html) */
.row-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .row-4 { grid-template-columns: repeat(2, 1fr); } }
.stage-flow { margin-top: 14px; }
.stage-flow .tile .value { font-size: clamp(24px, 3vw, 32px); }
.viewing { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #475569; }
.viewing select { padding: 7px 10px; border: 1px solid #dde3ea; border-radius: 9px; font-size: 14px; background: white; color: #0f172a; font-family: inherit; }
tr.me td { background: #eff6ff; font-weight: 700; }
.row-7 { grid-template-columns: repeat(7, 1fr); }
.row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .row-3 { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .row-7 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .row-7 { grid-template-columns: repeat(2, 1fr); } }
