/* ==========================================================================
   Anantam Operations — components.
   Fewer boxes, bigger hit areas, and detail hidden until it is asked for.
   ========================================================================== */

/* ── card ──────────────────────────────────────────────────────────────── */
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.card > header { display: flex; align-items: center; gap: 12px; padding: 16px 18px 0; }
.card > header h3 { flex: 0 1 auto; }
.card > header .right-slot { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card > .body { padding: 14px 18px 18px; }
.card > .body.flush { padding: 0; }
.card > header + .body { padding-top: 12px; }
.card.quiet { background: var(--bg-2); border-color: transparent; }
.card.urgent { border-color: rgba(255,107,107,.42); }
.card .card-sub { font-size: .85rem; color: var(--ink-mute); margin-top: 4px; }

/* ── stat ──────────────────────────────────────────────────────────────── */
.stat { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.stat .value { font-family: var(--font-ui); font-weight: 700; font-size: 2.1rem; line-height: 1.05; color: #fff; font-variant-numeric: tabular-nums; }
.stat .label { font-size: .88rem; font-weight: 600; color: var(--ink-soft); margin-top: 8px; }
.stat .sub { font-size: .82rem; color: var(--ink-faint); margin-top: 4px; line-height: 1.45; }
.stat.good .value { color: var(--ok); }
.stat.bad .value { color: var(--danger); }
.stat.warn .value { color: var(--warn); }
.stat.red .value { color: var(--red-bright); }
.stat.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.stat.clickable:hover { border-color: var(--line-strong); background: var(--bg-2); }

/* ── chips ─────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line-2);
  font-size: .78rem; font-weight: 500; color: var(--ink-mute); background: var(--bg-2);
}
.chip .bullet { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { color: var(--ok); border-color: rgba(74,222,128,.34); background: var(--ok-dim); }
.chip.bad { color: var(--danger); border-color: rgba(255,107,107,.36); background: var(--danger-dim); }
.chip.warn { color: var(--warn); border-color: rgba(251,191,36,.36); background: var(--warn-dim); }
.chip.info, .chip.live { color: var(--info); border-color: rgba(96,197,250,.34); background: var(--info-dim); }
.chip.idle { color: var(--ink-faint); background: transparent; }
.chip.crit { color: #fff; border-color: var(--red); background: var(--red-mid); font-weight: 600; }
.chip.red { color: #ff8a7a; border-color: var(--line-red); background: var(--red-dim); }
.chip.ghost { background: transparent; }
.chip.lg { font-size: .85rem; padding: 5px 13px; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 6px; background: var(--bg-3); font-size: .8rem; color: var(--ink-mute); }

/* ── buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--bg-3); color: var(--ink); font-size: .9rem; font-weight: 500;
  transition: background .14s, border-color .14s, color .14s;
}
.btn:hover { background: var(--bg-4); border-color: var(--line-strong); }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--red-bright); border-color: var(--red-bright); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-mute); }
.btn.ghost:hover { background: var(--bg-3); color: var(--ink); }
.btn.sm { padding: 5px 11px; font-size: .82rem; }
.btn.lg { padding: 12px 22px; font-size: .98rem; }
.btn.ok { border-color: rgba(74,222,128,.45); color: var(--ok); background: transparent; }
.btn.ok:hover { background: var(--ok-dim); }
.btn.no { border-color: rgba(255,107,107,.45); color: var(--danger); background: transparent; }
.btn.no:hover { background: var(--danger-dim); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.on { background: var(--red-dim); border-color: var(--line-red); color: #fff; font-weight: 600; }
.btn.block { width: 100%; }

.link { color: var(--red-bright); font-size: .88rem; font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ── help "?" ──────────────────────────────────────────────────────────── */
.help {
  display: inline-grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px;
  border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-faint);
  font-size: .68rem; font-weight: 700; cursor: help; vertical-align: 1px; position: relative;
}
.help:hover { border-color: var(--red); color: var(--red-bright); }
.help > span {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 260px; padding: 9px 12px; border-radius: var(--r);
  background: var(--bg-4); color: var(--ink); border: 1px solid var(--line-2);
  font-size: .8rem; font-weight: 400; line-height: 1.45; text-align: left;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 40;
}
.help:hover > span, .help:focus > span { opacity: 1; }
.help > span b { color: var(--red-bright); font-weight: 600; display: block; margin-bottom: 3px; }

/* ── progressive disclosure ────────────────────────────────────────────── */
.detail { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-1); overflow: hidden; }
.detail > summary {
  padding: 14px 18px; display: flex; align-items: center; gap: 10px;
  font-size: .92rem; font-weight: 500; color: var(--ink-mute);
}
.detail > summary:hover { background: var(--bg-2); color: var(--ink); }
.detail > summary::before { content: '▸'; color: var(--red); font-size: .8rem; transition: transform .15s; }
.detail[open] > summary::before { transform: rotate(90deg); }
.detail[open] > summary { border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.detail > summary .caption { margin-left: auto; }
.detail > .inner { padding: 16px 18px 18px; }
.detail > .inner.flush { padding: 0; }

/* ── inputs ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: .85rem; font-weight: 500; color: var(--ink-soft); }
.field .hint { font-size: .8rem; color: var(--ink-faint); }
input[type=text], input[type=search], input[type=email], input[type=date], select, textarea {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 10px 12px; font-size: .92rem; color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(212,0,0,.18); }
select { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
textarea { resize: vertical; min-height: 84px; }
label.check { display: flex; align-items: center; gap: 9px; font-size: .9rem; color: var(--ink-soft); cursor: pointer; padding: 3px 0; }
input[type=checkbox] { accent-color: var(--red); width: 16px; height: 16px; }

.searchbox { position: relative; flex: 0 1 340px; min-width: 160px; }
.searchbox input { padding-left: 36px; }
.searchbox .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }

/* ── filter bar ────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select, .filters input[type=search] { width: auto; min-width: 130px; font-size: .86rem; padding: 7px 11px; }
.filters select { padding-right: 28px; }
.filters .count { margin-left: auto; font-size: .85rem; color: var(--ink-faint); }

/* ── table ─────────────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th {
  text-align: left; padding: 11px 14px; background: var(--bg-2);
  font-size: .8rem; font-weight: 600; color: var(--ink-faint);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--bg-2); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.group-row td { background: var(--bg-3); font-size: .85rem; font-weight: 600; color: var(--ink-soft); padding: 9px 14px; }
.tbl tr.crit td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow: auto; max-height: 68vh; }

/* ── list rows (used instead of tables wherever a table was overkill) ──── */
.rows { display: flex; flex-direction: column; }
.rowitem {
  display: flex; align-items: center; gap: 14px; padding: 13px 0;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.rows > .rowitem:last-child { border-bottom: 0; }
.rowitem:hover .rowitem-title { color: #fff; }
.rowitem-main { min-width: 0; flex: 1; }
.rowitem-title { font-size: .95rem; font-weight: 500; color: var(--ink-soft); }
.rowitem-sub { font-size: .82rem; color: var(--ink-faint); margin-top: 3px; }
.rowitem-end { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* ── avatar ────────────────────────────────────────────────────────────── */
.av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 700; background: var(--bg-4); color: var(--ink-soft);
  border: 1px solid var(--line-2); flex: 0 0 auto; }
.av.lead { background: var(--red-mid); color: #fff; border-color: var(--red); }
.av.sm { width: 24px; height: 24px; font-size: .62rem; }
.av.lg { width: 46px; height: 46px; font-size: .95rem; }
.av.xl { width: 64px; height: 64px; font-size: 1.2rem; }
.avs { display: flex; align-items: center; }
.avs .av + .av { margin-left: -8px; }

/* ── progress ──────────────────────────────────────────────────────────── */
.bar { height: 7px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--red); border-radius: 99px; }
.bar > i.good { background: var(--ok); }
.bar > i.warn { background: var(--warn); }
.bar > i.white { background: var(--cream); }
.bar.tall { height: 11px; }
.bar-pair { display: grid; gap: 6px; }
.bar-pair .lbl { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-mute); }

/* ── empty ─────────────────────────────────────────────────────────────── */
.empty { padding: 40px 24px; text-align: center; color: var(--ink-faint); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.empty .t { font-size: 1rem; font-weight: 600; color: var(--ink-mute); margin-bottom: 6px; }
.empty p { font-size: .88rem; max-width: 48ch; margin: 0 auto; line-height: 1.55; }

/* ── key/value ─────────────────────────────────────────────────────────── */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; align-items: baseline; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-mute); }
.kv .v { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.defs { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; font-size: .9rem; align-items: baseline; }
.defs dt { font-size: .85rem; color: var(--ink-faint); }
.defs dd { color: var(--ink-soft); min-width: 0; }

/* ── attention items ───────────────────────────────────────────────────── */
.attn { display: flex; gap: 14px; padding: 15px 16px; border-radius: var(--r-lg); background: var(--bg-1); border: 1px solid var(--line); align-items: flex-start; cursor: pointer; transition: border-color .14s; }
.attn:hover { border-color: var(--line-strong); }
.attn.urgent { border-color: rgba(255,107,107,.32); }
.attn .mark { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; font-size: .95rem; background: var(--bg-3); }
.attn.urgent .mark { background: var(--danger-dim); color: var(--danger); }
.attn.warning .mark { background: var(--warn-dim); color: var(--warn); }
.attn.normal .mark { background: var(--info-dim); color: var(--info); }
.attn .t { font-size: .95rem; font-weight: 600; color: #fff; line-height: 1.35; }
.attn .d { font-size: .85rem; color: var(--ink-mute); margin-top: 4px; line-height: 1.5; }
.attn .go { margin-left: auto; color: var(--ink-ghost); flex: 0 0 auto; }
.attn:hover .go { color: var(--red-bright); }

/* ── overlays ──────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(3px); z-index: 90; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(660px, 100vw);
  background: var(--bg-1); border-left: 1px solid var(--line-2); z-index: 91;
  display: grid; grid-template-rows: auto 1fr auto; box-shadow: var(--shadow);
  animation: slide .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
.drawer > header { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); position: relative; }
.drawer > .body { overflow-y: auto; padding: 20px 22px 28px; }
.drawer > footer { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--bg-2); display: flex; gap: 10px; flex-wrap: wrap; }
.drawer .close { position: absolute; top: 16px; right: 18px; color: var(--ink-faint); font-size: 1.5rem; line-height: 1; width: 32px; height: 32px; border-radius: 50%; }
.drawer .close:hover { color: #fff; background: var(--bg-3); }
.drawer-section { margin-top: 26px; }
.drawer-section > h4 { font-size: .88rem; font-weight: 600; color: var(--red-bright); margin-bottom: 12px; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 91; padding: 20px; pointer-events: none; }
.modal > .box { pointer-events: auto; width: min(580px, 100%); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); max-height: 88vh; display: grid; grid-template-rows: auto 1fr auto; animation: pop .16s ease; }
@keyframes pop { from { transform: scale(.98); opacity: 0; } }
.modal .box > header { padding: 20px 22px 14px; }
.modal .box > .body { padding: 6px 22px 20px; overflow-y: auto; display: grid; gap: 16px; }
.modal .box > footer { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px); z-index: 120; background: var(--bg-4); border: 1px solid var(--line-2); border-radius: 99px; padding: 11px 20px; font-size: .9rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── search overlay ────────────────────────────────────────────────────── */
.omni { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.66); backdrop-filter: blur(4px); padding-top: 12vh; }
.omni .box { width: min(640px, calc(100vw - 32px)); margin: 0 auto; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); overflow: hidden; }
.omni input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 18px 20px; font-size: 1rem; background: var(--bg-2); }
.omni input:focus { box-shadow: none; }
.omni .results { max-height: 54vh; overflow-y: auto; }
.omni .res { display: flex; align-items: center; gap: 14px; padding: 12px 18px; cursor: pointer; border-bottom: 1px solid var(--line); }
.omni .res:hover, .omni .res.sel { background: var(--red-dim); }
.omni .res .kind { font-size: .75rem; font-weight: 600; color: var(--red-bright); flex: 0 0 104px; }
.omni .res .t { font-size: .92rem; color: #fff; }
.omni .res .s { font-size: .8rem; color: var(--ink-faint); margin-left: auto; text-align: right; }

/* ── source / note ─────────────────────────────────────────────────────── */
.src { font-size: .8rem; color: var(--ink-faint); margin-top: 10px; line-height: 1.5; }
.note { font-size: .88rem; color: var(--ink-mute); background: var(--bg-2); border-left: 3px solid var(--line-red); padding: 13px 16px; border-radius: 0 var(--r) var(--r) 0; line-height: 1.55; }
.note.warn { border-left-color: var(--warn); }
.note.good { border-left-color: var(--ok); }
.hr { height: 1px; background: var(--line); margin: 18px 0; }
.scroll-x { overflow-x: auto; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-mute); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 5px; border-radius: 3px; display: block; }

/* ── account menu ──────────────────────────────────────────────────────── */
.who-btn { display: flex; align-items: center; gap: 10px; padding: 5px 12px 5px 6px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); }
.who-btn:hover { border-color: var(--line-strong); }
.who-btn .nm { font-size: .88rem; }
.who-btn .ro { font-size: .75rem; color: var(--red-bright); }
.who-menu { position: absolute; right: var(--gutter); top: calc(var(--header-h) - 6px); width: 296px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: 80; overflow: hidden; }
.who-menu .head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.who-menu .opt { display: flex; align-items: center; gap: 11px; padding: 11px 16px; cursor: pointer; }
.who-menu .opt:hover { background: var(--bg-3); }
.who-menu .opt.on { background: var(--red-dim); }
.who-menu .foot { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
