/* ============================================================
   TVS CONTROL ROOM — Pride Educare light theme
   Light gray canvas · white cards · green primary · navy accents
   ============================================================ */

:root {
  --bg:        #eef1f4;
  --bg-2:      #ffffff;
  --surface:   #ffffff;
  --surface-2: #f6f8fa;
  --line:      #e4e9ef;
  --line-2:    #d2dbe4;
  --ink:       #0a0d12;   /* main text — almost black */
  --ink-dim:   #1f2731;   /* secondary text — black-ish */
  --ink-faint: #3f4956;   /* labels/hints — dark gray */
  --rec:       #22a94b;                 /* primary green (Apply) */
  --rec-soft:  rgba(34, 169, 75, .12);
  --amber:     #d98d00;
  --green:     #1f9d4d;
  --green-soft:rgba(31, 157, 77, .12);
  --red:       #d64545;
  --red-soft:  rgba(214, 69, 69, .10);
  --blue:      #1d4e89;                 /* navy (Refresh/CSV/Excel) */
  --blue-soft: rgba(29, 78, 137, .10);
  --font-ui:   'Archivo', system-ui, -apple-system, sans-serif;
  --font-disp: 'Bricolage Grotesque', 'Archivo', sans-serif;
  --font-mono: 'Spline Sans Mono', 'Consolas', monospace;
  --shadow:    0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.55;
  min-height: 100vh;
}

.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ------------------------------------------------ sidebar */
.sidebar {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 22px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 11px; align-items: center; padding: 2px 8px 20px; border-bottom: 1px solid var(--line); }
.brand-name { font-family: var(--font-disp); font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-name::first-letter { color: var(--rec); }
.brand-sub { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 2.6px; color: var(--ink-faint); margin-top: 1px; }

.rec-dot {
  width: 11px; height: 11px; border-radius: 50%; background: var(--rec); flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--rec-soft);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }

.sidebar nav { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  color: var(--ink-dim); text-decoration: none; border-radius: 8px;
  font-weight: 500; font-size: 13.5px; letter-spacing: .1px;
  border: 1px solid transparent; transition: all .15s;
}
.sidebar nav a:hover { color: var(--ink); background: var(--surface-2); }
.sidebar nav a.active {
  color: #157a38; background: var(--rec-soft);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--rec);
}
.nav-ico { font-size: 13px; width: 16px; text-align: center; color: var(--ink-faint); }
.sidebar nav a.active .nav-ico { color: var(--rec); }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--rec-soft); color: #157a38; border: 1px solid rgba(34,169,75,.3);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-disp); font-weight: 700; font-size: 14px;
}
.u-name { font-size: 13px; font-weight: 600; }
.u-role { font-size: 11px; color: var(--ink-faint); }
.logout { display: block; margin-top: 10px; padding: 0 6px; font-size: 12px; color: var(--red); text-decoration: none; }
.logout:hover { text-decoration: underline; }

/* ------------------------------------------------ main */
.main { flex: 1; padding: 28px 32px 60px; max-width: 1280px; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-disp); font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.page-head .sub { color: var(--ink-dim); font-size: 13px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.flash {
  background: var(--green-soft); border: 1px solid rgba(31,157,77,.35); color: #157a38;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 13.5px; font-weight: 500;
  animation: fadeUp .3s ease both;
}

/* ------------------------------------------------ cards & grids */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g23 { grid-template-columns: 2fr 1.1fr; }
@media (max-width: 1000px) { .g2, .g3, .g23 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  box-shadow: var(--shadow);
  animation: fadeUp .4s ease both;
}
.card:nth-child(2) { animation-delay: .04s } .card:nth-child(3) { animation-delay: .08s }
.card:nth-child(4) { animation-delay: .12s } .card:nth-child(5) { animation-delay: .16s }
.card:nth-child(6) { animation-delay: .2s }
@keyframes fadeUp { from { opacity: 0; transform: translateY(7px) } to { opacity: 1; transform: none } }

.card h3 {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--ink-dim);
  margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card h3 .more { font-family: var(--font-ui); letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--blue); }

.kpi .val { font-family: var(--font-mono); font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; }
.kpi .lbl { font-size: 11.5px; color: var(--ink-dim); font-weight: 600; letter-spacing: .3px; margin-top: 5px; text-transform: uppercase; }
.kpi .delta { font-family: var(--font-mono); font-size: 12px; margin-top: 7px; font-weight: 500; }

.up   { color: var(--green); } .down { color: var(--red); } .flat { color: var(--ink-faint); }
.good { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }

.chip {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  padding: 2.5px 8px; border-radius: 20px; border: 1px solid var(--line-2);
  white-space: nowrap; background: var(--surface);
}
.chip.up   { color: #157a38; border-color: rgba(31,157,77,.4); background: var(--green-soft); }
.chip.down { color: var(--red); border-color: rgba(214,69,69,.4); background: var(--red-soft); }
.chip.flat { color: var(--ink-faint); background: var(--surface-2); }

/* status pills */
.pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .3px; white-space: nowrap; }
.pill.planned   { background: #eceff3; color: var(--ink-dim); }
.pill.scripting { background: var(--blue-soft); color: var(--blue); }
.pill.editing   { background: var(--red-soft); color: var(--red); }
.pill.thumbnail { background: rgba(217,141,0,.13); color: #9a6700; }
.pill.ready     { background: var(--green-soft); color: #157a38; }
.pill.published { background: var(--rec); color: #fff; }
.pill.short { background: var(--red-soft); color: var(--red); }
.pill.long  { background: var(--blue-soft); color: var(--blue); }

/* ------------------------------------------------ score meter */
.meter { display: flex; gap: 2.5px; align-items: flex-end; height: 18px; }
.meter i { flex: 1; min-width: 4px; max-width: 9px; height: 100%; border-radius: 1.5px; background: var(--line); transition: background .3s; }
.meter.good i.lit { background: linear-gradient(180deg, #2fc463, #1f9d4d); }
.meter.warn i.lit { background: linear-gradient(180deg, #f0b429, #d98d00); }
.meter.bad  i.lit { background: linear-gradient(180deg, #e46a6a, #d64545); }
.meter.empty { align-items: center; }
.meter-label { font-family: var(--font-mono); font-size: 10px; color: var(--ink-faint); letter-spacing: 1px; }

.score-big { font-family: var(--font-mono); font-weight: 700; font-size: 34px; letter-spacing: -1px; line-height: 1; }
.score-grade {
  font-family: var(--font-disp); font-weight: 800; font-size: 15px;
  padding: 3px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2);
}
.score-grade.good { background: var(--green-soft); border-color: rgba(31,157,77,.35); color: #157a38; }
.score-grade.warn { background: rgba(217,141,0,.13); border-color: rgba(217,141,0,.35); color: #9a6700; }
.score-grade.bad  { background: var(--red-soft); border-color: rgba(214,69,69,.35); color: var(--red); }

/* ------------------------------------------------ tables */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-dim);
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-weight: 500; color: var(--ink); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f7f9fb; }
td.num, th.num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.t-title { font-weight: 700; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-title a { color: var(--ink); text-decoration: none; }
.t-title a:hover { color: var(--rec); }
.t-sub { font-size: 11.5px; color: var(--ink-dim); margin-top: 2px; font-weight: 500; }

/* ------------------------------------------------ forms & buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--blue); color: #fff; border: 1px solid var(--blue);
  padding: 8px 15px; border-radius: 8px; font-family: var(--font-ui);
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: all .15s; letter-spacing: .1px;
}
.btn:hover { background: #16406f; transform: translateY(-1px); }
.btn.primary { background: var(--rec); border-color: var(--rec); color: #fff; box-shadow: 0 3px 10px rgba(34,169,75,.28); }
.btn.primary:hover { background: #1d9341; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.ghost { background: var(--surface); color: var(--ink-dim); border-color: var(--line-2); box-shadow: none; }
.btn.ghost:hover { color: var(--ink); border-color: var(--ink-faint); background: var(--surface); }
.btn.danger { background: var(--surface); color: var(--red); border-color: rgba(214,69,69,.45); }
.btn.danger:hover { background: var(--red-soft); }

label { display: block; font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--ink-dim); margin: 14px 0 5px; }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], input[type=password], input[type=url], select, textarea {
  width: 100%; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 12px;
  font-family: var(--font-ui); font-size: 13.5px; outline: none; transition: border .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--rec); box-shadow: 0 0 0 3px var(--rec-soft); }
textarea { resize: vertical; min-height: 70px; }
select { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; }
.checkrow { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13.5px; color: var(--ink-dim); }
.checkrow input { width: 16px; height: 16px; accent-color: var(--rec); }

/* filter bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 130px; padding: 7px 10px; font-size: 12.5px; }

/* ------------------------------------------------ insight body */
.insight-body h3, .insight-body h4 {
  font-family: var(--font-disp); margin: 16px 0 8px; font-size: 15px;
}
.insight-body ul { margin: 6px 0 6px 18px; display: grid; gap: 6px; }
.insight-body li { color: var(--ink-dim); }
.insight-body li strong { color: var(--ink); }
.insight-body p { color: var(--ink-dim); margin: 6px 0; }

.insight-meta { display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); }
.src-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1.5px; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; }
.src-tag.claude { background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(29,78,137,.3); }
.src-tag.auto   { background: #eceff3; color: var(--ink-dim); border: 1px solid var(--line-2); }

/* ------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; width: 100%; background: var(--bg); }
.login-card { width: 380px; max-width: 92vw; padding: 34px; }
.login-card .brand { border: none; padding-bottom: 8px; }
.login-title { font-family: var(--font-disp); font-size: 22px; font-weight: 700; margin: 14px 0 2px; }
.login-sub { color: var(--ink-faint); font-size: 13px; margin-bottom: 8px; }

/* misc */
.muted { color: var(--ink-dim); font-size: 12.5px; }
.muted a { color: var(--blue); }
.mono { font-family: var(--font-mono); }
.mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.demo-banner {
  background: #fff7e6; border: 1px solid rgba(217,141,0,.35); color: #9a6700;
  padding: 9px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 12.5px;
}
.demo-banner a { color: #9a6700; font-weight: 600; }
.comp-row { display: grid; grid-template-columns: 150px 1fr 78px; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.comp-row:last-child { border: none; }
.comp-label { font-size: 12.5px; color: var(--ink-dim); }
.comp-detail { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); text-align: right; }
.bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; transition: width .6s cubic-bezier(.22,1,.36,1); }
.bar.good > span { background: linear-gradient(90deg, #2fc463, #1f9d4d); }
.bar.warn > span { background: linear-gradient(90deg, #f0b429, #d98d00); }
.bar.bad  > span { background: linear-gradient(90deg, #e46a6a, #d64545); }

/* ✅ Aaj Ka Kaam — highlighted card */
.card.today-card {
  border: 1.5px solid rgba(34, 169, 75, .45);
  background: linear-gradient(135deg, #eefaf2 0%, #ffffff 60%);
  box-shadow: 0 6px 22px rgba(34, 169, 75, .14);
  position: relative;
  overflow: hidden;
}
.card.today-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--rec), #157a38);
}
.card.today-card h3 {
  color: #157a38; font-size: 12px; letter-spacing: 2.2px; font-weight: 700;
}
.today-count {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  background: var(--rec); color: #fff; padding: 4px 14px; border-radius: 20px;
  letter-spacing: 0; text-transform: none;
  box-shadow: 0 3px 10px rgba(34, 169, 75, .3);
}
.card.today-card .comp-row { border-bottom-color: rgba(34, 169, 75, .15); }
.card.today-card .t-title { font-size: 13.5px !important; }

/* kaam nahi hua → RED alert look */
.card.today-card.empty {
  border-color: rgba(214, 69, 69, .55);
  background: linear-gradient(135deg, #fdeeee 0%, #ffffff 60%);
  box-shadow: 0 6px 22px rgba(214, 69, 69, .16);
}
.card.today-card.empty::before { background: linear-gradient(180deg, var(--red), #a83232); }
.card.today-card.empty h3 { color: #b3261e; }
.card.today-card.empty .today-count { background: var(--red); box-shadow: 0 3px 10px rgba(214, 69, 69, .35); }
.today-alert {
  color: #b3261e; font-weight: 600; font-size: 13.5px;
  display: flex; align-items: center; gap: 8px;
}

/* modal popups */
.modal-ovl { position: fixed; inset: 0; background: rgba(16,24,40,.55); display: none; align-items: center; justify-content: center; z-index: 60; padding: 20px; }
.modal-ovl.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; padding: 24px 26px; width: 520px; max-width: 94vw; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 50px rgba(16,24,40,.28); animation: fadeUp .18s ease both; }
.modal h2 { font-family: var(--font-disp); font-size: 17px; margin: 0; }
.modal .m-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal .close-x { cursor: pointer; color: var(--ink-faint); font-size: 20px; border: none; background: none; line-height: 1; padding: 2px 6px; }
.modal .close-x:hover { color: var(--red); }

/* advanced/optional fields collapse */
details.adv { margin-top: 12px; }
details.adv summary { cursor: pointer; list-style: none; font-size: 12px; color: var(--blue); font-weight: 600; user-select: none; }
details.adv summary::before { content: '▸ '; }
details.adv[open] summary::before { content: '▾ '; }

.pipeline { display: flex; gap: 8px; flex-wrap: wrap; }
.stage { flex: 1; min-width: 90px; text-align: center; padding: 12px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.stage .n { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.stage .s { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-faint); margin-top: 3px; }

.rank { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); width: 26px; }
.rank.r1 { color: #9a6700; font-weight: 700; }

canvas { max-width: 100%; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 14px; gap: 10px; overflow-x: auto; }
  .sidebar nav { flex-direction: row; margin: 0; }
  .sidebar nav a { padding: 7px 10px; white-space: nowrap; }
  .brand-sub, .sidebar-foot { display: none; }
  .main { padding: 18px 14px 50px; }
}
