/* Layout: KiteNexus brand — Deep Ink header band with logo and live counts, filter bar, four status lanes, activity feed on the right (below when narrow).
   Brand: Nexus Blue #073C8A (primary), Kite Orange #F28C28 (accent), Slate Grey #6D6E71, White, Deep Ink #061226. Poppins + Noto Sans Tamil. */
:root {
  --brand-ink: #061226; --brand-blue: #073C8A; --kite: #F28C28; --brand-mist: #B8C4D9;
  --bg: #f3f6fb; --surface: #ffffff; --sunken: #e6ecf5; --ink: #061226; --muted: #555b68;
  --line: #d3dbe8; --accent: #073C8A; --accent-ink: #ffffff; --accent-soft: #e0e9f7;
  --btn: #073C8A; --btn-ink: #ffffff;
  --urgent: #c0282d; --high: #a35a00; --ok: #1d7a46;
  --shadow: 0 1px 2px rgba(6, 18, 38, .06), 0 3px 10px rgba(6, 18, 38, .05);
  --overlay: rgba(6, 18, 38, .45);
  --font-display: "Poppins", "Noto Sans Tamil", "Segoe UI", system-ui, sans-serif;
  --font-body: "Poppins", "Noto Sans Tamil", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Poppins", "Segoe UI", system-ui, sans-serif;
  --r: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #061226; --surface: #0e1e3a; --sunken: #0a1830; --ink: #eaf0fa; --muted: #a3b0c8;
    --line: #213558; --accent: #8fb3f0; --accent-ink: #061226; --accent-soft: #15294b;
    --btn: #F28C28; --btn-ink: #061226;
    --urgent: #ff8a80; --high: #f6b35f; --ok: #6fd39a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --overlay: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #061226; --surface: #0e1e3a; --sunken: #0a1830; --ink: #eaf0fa; --muted: #a3b0c8;
  --line: #213558; --accent: #8fb3f0; --accent-ink: #061226; --accent-soft: #15294b;
  --btn: #F28C28; --btn-ink: #061226;
  --urgent: #ff8a80; --high: #f6b35f; --ok: #6fd39a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
.app { max-width: 1480px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 22px 40px; display: flex; flex-direction: column; gap: 18px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; background: var(--brand-ink); color: #ffffff; border-radius: 14px; padding: 18px 22px; border-bottom: 3px solid var(--kite); }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand img { height: 44px; width: auto; flex: none; }
.brand-text { min-width: 0; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .16); }
.top h1 { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; letter-spacing: -.02em; line-height: 1.15; margin: 0; text-wrap: balance; }
.top h1 span { color: var(--kite); }
.top p { margin: 2px 0 0; color: var(--brand-mist); font-size: .85rem; max-width: 46rem; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { display: flex; align-items: baseline; gap: 6px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(255, 255, 255, .06); }
.stat b { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #ffffff; }
.stat span { color: var(--brand-mist); font-size: .8rem; }
.top .stat.alert { border-color: #ff8a80; }
.top .stat.alert b { color: #ff8a80; }
.top .stat.waiting { border-color: var(--kite); }
.top .stat.waiting b { color: var(--kite); }
@media (max-width: 560px) { .brand { flex-wrap: wrap; } .brand-text { padding-left: 0; border-left: 0; } }

.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar .grow { flex: 1 1 200px; min-width: 0; }
.field { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 10px; min-width: 0; }
.bar select.field { max-width: 12rem; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 7px 14px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--urgent); }
.btn.danger.solid { background: var(--urgent); border-color: var(--urgent); color: var(--surface); }
.readonly-note { color: var(--muted); font-size: .85rem; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .main { grid-template-columns: minmax(0, 1fr); } }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--sunken); border-radius: 10px; padding: 10px; min-height: 340px; display: flex; flex-direction: column; gap: 8px; border: 1px dashed transparent; }
.lane.over { border-color: var(--accent); background: var(--accent-soft); }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; }
.lane-head h2 { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.lane-head .count { margin-left: auto; color: var(--muted); font-family: var(--font-mono); font-size: .78rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.todo { background: var(--muted); } .dot.doing { background: var(--kite); } .dot.review { background: var(--high); } .dot.done { background: var(--ok); }
.lane-empty { color: var(--muted); font-size: .85rem; padding: 14px 6px; text-align: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.card:hover { border-color: var(--muted); }
.card.dragging { opacity: .45; }
.card.is-done .card-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.card-top { display: flex; align-items: center; gap: 8px; }
.type { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prio { margin-left: auto; font-size: .7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.prio.urgent { color: var(--urgent); } .prio.high { color: var(--high); } .prio.low { color: var(--muted); border-style: dashed; }
.card-row { display: flex; align-items: flex-start; gap: 8px; }
.card-title { font-weight: 500; overflow-wrap: anywhere; flex: 1; min-width: 0; }
.check { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; cursor: pointer; padding: 0; display: grid; place-items: center; }
.check:hover { border-color: var(--ok); }
.check.on { background: var(--ok); border-color: var(--ok); }
.check.on::after { content: ""; width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .8rem; color: var(--muted); }
.client { background: var(--sunken); border-radius: 4px; padding: 0 6px; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due { font-family: var(--font-mono); font-size: .75rem; }
.due.late { color: var(--urgent); font-weight: 500; }
.who { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; min-width: 0; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: .65rem; font-weight: 600; display: grid; place-items: center; flex: none; }

.feed { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.feed h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0 0 10px; }
.feed ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 70vh; overflow-y: auto; }
.feed li { font-size: .85rem; display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 8px; }
.feed li .dot { margin-top: 6px; }
.feed li p { margin: 0; overflow-wrap: anywhere; }
.feed li b { font-weight: 600; }
.feed li time { display: block; color: var(--muted); font-family: var(--font-mono); font-size: .72rem; }
.feed .empty { color: var(--muted); font-size: .85rem; }

.notice { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 10px 14px; color: var(--muted); }

.overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; padding: 16px; z-index: 20; }
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: min(560px, 100%); max-height: calc(100% - 32px); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .2); }
.sheet h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.sheet label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 500; color: var(--muted); min-width: 0; }
.sheet .field { color: var(--ink); font-size: .95rem; width: 100%; box-sizing: border-box; }
.sheet textarea.field { min-height: 80px; resize: vertical; }
.sheet .err { color: var(--urgent); font-size: .85rem; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .spacer { flex: 1; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border: 1px solid var(--urgent); border-radius: var(--r); }
.confirm p { margin: 0; flex: 1 1 160px; }
.stamp { color: var(--muted); font-size: .78rem; margin: 0; }

a.btn { text-decoration: none; display: inline-block; }
.btn.sm { padding: 4px 10px; font-size: .8rem; }
.files { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.files h3 { font-family: var(--font-display); font-weight: 600; font-size: 1rem; margin: 0; }
.fgroups { display: flex; flex-direction: column; gap: 14px; }
.fgroup { display: flex; flex-direction: column; gap: 6px; }
.fgroup-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fgroup-head h4 { margin: 0; font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.fgroup-head .count { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }
.fgroup-head .tools { margin-left: auto; display: flex; gap: 6px; }
.frow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.fkind { font-family: var(--font-mono); font-size: .65rem; text-transform: uppercase; padding: 2px 5px; border-radius: 4px; background: var(--sunken); color: var(--muted); }
.fname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname a { color: var(--accent); }
.fsub { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.factions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.fpreview { grid-column: 1 / -1; }
.fpreview video, .fpreview img { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: 6px; background: var(--sunken); }
.fnone { color: var(--muted); font-size: .8rem; margin: 0; }
.fmsg { font-size: .8rem; margin: 0; color: var(--urgent); }
.fmsg.info { color: var(--muted); }
.linkform { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; gap: 6px; }
.chip-file { font-family: var(--font-mono); font-size: .7rem; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line); }
.chip-file.final { border-color: var(--ok); color: var(--ok); }
.chip-file.ready { border-color: var(--ok); color: var(--ok); }
.chip-file.wait { border-color: var(--high); color: var(--high); border-style: dashed; }
a.foot-link { font-size: .78rem; color: var(--accent); font-weight: 500; text-decoration: none; }
a.foot-link:hover { text-decoration: underline; }
.footrow { display: flex; gap: 6px; align-items: center; }
.footrow .field { flex: 1; }
.staffadd { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 6px; }
.stafflist { display: flex; flex-direction: column; gap: 6px; }
.srow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.sinfo { flex: 1 1 140px; min-width: 0; }
.sname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sload { color: var(--muted); font-size: .75rem; }
.srow select.field { width: auto; font-size: .85rem; padding: 4px 8px; }
.hint { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 520px) { .staffadd { grid-template-columns: minmax(0, 1fr); } }
.stat.waiting { border-color: var(--high); }
.stat.waiting b { color: var(--high); }
@media (max-width: 520px) {
  .linkform { grid-template-columns: minmax(0, 1fr); }
  .frow { grid-template-columns: auto minmax(0, 1fr); }
  .factions { grid-column: 1 / -1; justify-content: flex-start; }
}
.mode-chip { font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.notify { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 25; width: min(370px, calc(100% - 32px)); box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--kite); border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .18); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.notify p { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.notify .sub { color: var(--muted); font-size: .8rem; font-weight: 400; }
.nrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nrow .spacer { flex: 1; }
.btn.wa { background: #1f7a4d; border-color: #1f7a4d; color: #ffffff; font-weight: 600; }
.notify-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); }
.scontact { flex-basis: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 6px; }
.scontact .field, .slink .field { font-size: .85rem; padding: 5px 8px; }
.slink { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; }
.sresults { display: flex; flex-direction: column; gap: 4px; }
.sresult { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.sresult span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linked { color: var(--ok); } .unlinked { color: var(--high); }
.mgr-contact { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.mgr-contact h3 { margin: 0; font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.contactrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 6px; }
@media (max-width: 520px) { .contactrow, .scontact { grid-template-columns: minmax(0, 1fr); } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r); max-width: calc(100% - 32px); z-index: 30; font-size: .9rem; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: border-color .15s, opacity .15s; }
  .toast { animation: rise .2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
}

/* ---------- standalone app additions ---------- */
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
.top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
@media (max-width: 760px) { .top-right { align-items: flex-start; } }
.acct { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acct .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.22); }
.acct .btn.kite { background: var(--kite); border-color: var(--kite); color: var(--brand-ink); font-weight: 600; }
.who-me { color: var(--brand-mist); font-size: .85rem; }
.who-me b { color: #fff; font-weight: 600; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); white-space: nowrap; cursor: pointer; }
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.sync.off::before { background: var(--high); }
.sync.busy::before { background: var(--kite); }
.sync.err::before { background: var(--urgent); }
.brand-word { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-word span { color: var(--kite); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; box-sizing: border-box; background: var(--brand-ink); }
.login { width: min(400px, 100%); background: var(--surface); border-radius: 14px; padding: 26px 22px; box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; border-bottom: 4px solid var(--kite); }
.login h1 { margin: 0; font-family: var(--font-display); font-size: 1.4rem; }
.login h1 span { color: var(--kite); }
.login p { margin: 0; color: var(--muted); font-size: .9rem; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 500; color: var(--muted); }
.login .field { font-size: 1rem; padding: 10px 12px; }
.login .btn.primary { padding: 11px; font-size: 1rem; }
.login .err { color: var(--urgent); font-size: .88rem; margin: 0; }
.ulist { display: flex; flex-direction: column; gap: 6px; }
.urow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.urow.inactive { opacity: .6; }
.urow .sinfo { flex: 1 1 160px; min-width: 0; }
.badge { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.owner { background: var(--kite); color: var(--brand-ink); }
.uform { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg); }
.uform h3 { margin: 0; font-family: var(--font-display); font-size: 1rem; }
.chk { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ink) !important; }
.chk input { width: auto !important; }
.pending-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--kite); display: inline-block; margin-left: 4px; vertical-align: middle; }
.card .pending-dot { margin-left: auto; }
.statusbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .board { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); overflow-x: visible; }
  .lane { min-height: 0; }
  .top h1 { font-size: 1.3rem; }
}
