/* ACT (Agrosahas Control Tower). Built from the approved design of 27 Nov 2026. */
:root {
  --bg: #f3f5f4; --panel: #ffffff; --panel-2: #f8faf9; --text: #15201a; --muted: #5f6d65; --line: #e1e7e3;
  --brand: #1d6b42; --brand-soft: #e3f1e9;
  --ok: #1f8a4c; --ok-soft: #e4f4ea; --warn: #b26b00; --warn-soft: #fdf1dc; --down: #c4302b; --down-soft: #fbe5e4;
  --none: #7d8882; --none-soft: #eceeed; --chart: #2f855a; --chart-2: #90cdb0;
  --shadow: 0 1px 2px rgba(20,32,26,.06), 0 4px 14px rgba(20,32,26,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411; --panel: #171e1a; --panel-2: #1c2520; --text: #e6ece8; --muted: #9aa8a0; --line: #29342e;
    --brand: #5ccf8e; --brand-soft: #1d3326;
    --ok: #5ccf8e; --ok-soft: #1b3325; --warn: #f0b74a; --warn-soft: #3a2e15; --down: #ff7b72; --down-soft: #3d1f1d;
    --none: #8d9993; --none-soft: #252d29; --chart: #5ccf8e; --chart-2: #2f6b49;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411; --panel: #171e1a; --panel-2: #1c2520; --text: #e6ece8; --muted: #9aa8a0; --line: #29342e;
  --brand: #5ccf8e; --brand-soft: #1d3326;
  --ok: #5ccf8e; --ok-soft: #1b3325; --warn: #f0b74a; --warn-soft: #3a2e15; --down: #ff7b72; --down-soft: #3d1f1d;
  --none: #8d9993; --none-soft: #252d29; --chart: #5ccf8e; --chart-2: #2f6b49;
  --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

/* App shell: menu on the left on large screens */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.app > * { min-width: 0; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; }
.logo .mark { width: 34px; height: 34px; font-size: 12px; font-weight: 800; letter-spacing: .02em; border-radius: 8px; background: var(--brand); display: grid; place-items: center; color: var(--panel); }
.logo small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; background: var(--down); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.nav .tag { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }
.nav .phone-only { display: none; }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: grid; gap: 8px; }
.side .foot form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; }
.apphead { display: none; }

/* Main */
.main { padding: 20px 24px 40px; min-width: 0; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.top h1 { font-size: 22px; margin: 0; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px 4px 4px; font-size: 13px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--none-soft); color: var(--muted); font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.down { background: var(--down-soft); color: var(--down); }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.down { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 30%, transparent); }
.banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.banner strong { display: block; }
.banner .icon { font-size: 20px; font-weight: 800; width: 20px; text-align: center; }

.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .right { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }

.kpi { position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 28px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.kpi .value.soft { font-size: 16px; font-weight: 600; color: var(--muted); padding: 8px 0 5px; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.kpi.warn::before { background: var(--warn); } .kpi.down::before { background: var(--down); } .kpi.none::before { background: var(--none); }

.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: inline-block; flex: none; }
.dot.warn { background: var(--warn); } .dot.down { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); } .dot.none { background: var(--none); }

.attention { display: grid; gap: 0; }
.attention .item { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.attention .item:first-child { border-top: 0; padding-top: 0; }
.attention .what { font-weight: 600; }
.attention .why { grid-column: 2 / 4; color: var(--muted); font-size: 13px; }
.attention .when { color: var(--muted); font-size: 12px; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel-2); }
.tablewrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.group-row td { background: var(--panel-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.name small { display: block; color: var(--muted); font-size: 12px; }

.meter { height: 8px; background: var(--none-soft); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ok); border-radius: 4px; }
.meter.warn > span { background: var(--warn); } .meter.down > span { background: var(--down); }
.metric { display: grid; grid-template-columns: 90px 1fr 120px; gap: 10px; align-items: center; padding: 6px 0; }
.metric .v { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.metric .k { color: var(--muted); font-size: 13px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: start; }
.timeline li:first-child { border-top: 0; padding-top: 0; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 4px 12px; color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: var(--panel); }
.tabs a .n { opacity: .7; margin-left: 4px; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: var(--panel); border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); }
.field input, .field select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); width: 100%; font-size: 16px; }

.empty { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; padding: 6px 0; }
.note { background: var(--panel-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; color: var(--muted); font-size: 13px; margin-top: 18px; }
.alert { background: var(--down-soft); color: var(--down); border-radius: 8px; padding: 8px 12px; font-size: 13px; margin: 0 0 12px; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.morelist a, .morelist button { display: flex; align-items: center; gap: 12px; padding: 14px 4px; border: 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; width: 100%; background: none; text-align: left; cursor: pointer; }
.morelist > :first-child, .morelist > form:first-child button { border-top: 0; }
.morelist form { margin: 0; }
.morelist span.t { flex: 1; }
.morelist small { display: block; color: var(--muted); }

/* Offline and install */
.offline { display: flex; gap: 10px; align-items: center; background: var(--none-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.installbar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(520px, calc(100% - 32px)); z-index: 20; display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.installbar .mark { width: 44px; height: 44px; border-radius: 11px; background: var(--brand); color: var(--panel); display: grid; place-items: center; font-weight: 800; flex: none; }
.installbar .t { flex: 1; min-width: 0; }

/* Sign in */
.signin-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 30% 10%, var(--brand-soft), var(--bg) 60%); }
.signin { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.signin .logo { padding: 0 0 18px; }
.signin h1 { font-size: 22px; margin: 0 0 4px; }
.signin .google { width: 100%; justify-content: center; background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 10px; margin-top: 18px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 18px 0; font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn.full { width: 100%; justify-content: center; padding: 10px; }

/* Large screens */
@media (min-width: 1500px) { .main { max-width: 1480px; } }

/* Phones: header on top, 5 tabs at the bottom, like an installed app */
@media (max-width: 760px) {
  .app { display: flex; flex-direction: column; }
  .apphead { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; font-weight: 700; order: 0; }
  .apphead .mark { width: 30px; height: 26px; border-radius: 7px; background: var(--brand); color: var(--panel); display: grid; place-items: center; font-size: 10px; font-weight: 800; }
  .apphead .grow { flex: 1; }
  .main { order: 1; flex: 1; padding: 14px 16px 30px; }
  .side { order: 2; position: sticky; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 6; }
  .side .logo, .side .foot, .nav .desk-only, .nav .tag { display: none; }
  .nav { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; }
  .nav .phone-only { display: flex; }
  .nav a { flex-direction: column; gap: 2px; padding: 4px 0; font-size: 11px; position: relative; }
  .nav a.active { background: none; }
  .nav .count { position: absolute; top: 0; right: 18%; margin: 0; font-size: 10px; padding: 0 5px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .top .chip { display: none; }
  .kpi .value { font-size: 24px; }
  .metric { grid-template-columns: 64px 1fr 104px; }
  .installbar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.mt { margin-top: 14px; }
a.avatar { text-decoration: none; }
/* Settings */
form.inline { display: inline; margin: 0; }
.addperson { display: grid; grid-template-columns: 1fr 1fr 120px auto; gap: 8px 10px; align-items: end; margin-top: 14px; }
.addperson .field { margin: 0; }
.secret { display: block; margin-top: 6px; font: 15px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; user-select: all; word-break: break-all; }
.inline-fields { display: grid; grid-template-columns: 1fr 90px 90px; gap: 8px 12px; align-items: center; }
.inline-fields input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); width: 100%; text-align: right; font-size: 16px; }
.inline-fields .h { font-size: 12px; color: var(--muted); text-align: right; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; }
@media (max-width: 760px) { .addperson { grid-template-columns: 1fr 1fr; } }
/* Servers and alerts */
.row-flex.line { padding: 4px 0; } .row-flex .grow { flex: 1; }
.chart { display: block; width: 100%; height: 60px; }
.legend { display: flex; gap: 14px; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--chart); }
.nowrap { white-space: nowrap; }
.span-all { grid-column: 1 / -1; }
.addperson { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 130px auto; max-width: 860px; }
@media (max-width: 760px) { .addperson { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .addperson .field:nth-child(3) { grid-column: 1 / -1; } }
/* Users and system detail */
.tabs.flat { margin: 0; }
.chart30 { display: block; width: 100%; height: 200px; }
.legend i.second { background: var(--chart-2); }
.name a { color: var(--text); text-decoration: none; font-weight: 600; }
.bars .row { display: grid; grid-template-columns: 140px 1fr 56px; gap: 10px; align-items: center; padding: 5px 0; color: var(--text); text-decoration: none; }
.bars .bar { display: block; height: 10px; border-radius: 5px; background: var(--chart); }
.bars .n { text-align: right; font-variant-numeric: tabular-nums; }
.bars .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-spark { position: absolute; right: 12px; bottom: 12px; }
@media (max-width: 760px) { .kpi-spark { display: none; } .bars .row { grid-template-columns: 100px 1fr 48px; } }
.kpi .value.mid { font-size: 22px; }
.meter-gap { margin: 8px 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
