/* Bot dashboard — black/white brand, Inter, green and red only as status signals. */
@font-face { font-family: Inter; font-weight: 400; src: url(Inter_400Regular.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: Inter; font-weight: 600; src: url(Inter_600SemiBold.ttf) format('truetype'); font-display: swap; }
:root {
  --bg: #0B0C0D; --panel: #131313; --line: #232427; --fg: #F4F4F5; --mute: #8C8C92; --dim: #5A5B61;
  --ok: #5FD39A; --down: #FF6B5A; --empty: #26272B;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); font: 400 14px/1.5 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }

/* top bar */
.bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 20px; padding: 0 24px; height: 56px; background: rgba(11, 12, 13, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; letter-spacing: .01em; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; }
.tab { background: none; border: 0; padding: 6px 12px; border-radius: 8px; color: var(--mute); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--panel); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.tab:disabled { cursor: default; color: var(--dim); }
.tab small { color: var(--dim); margin-left: 6px; }
.bar .state { color: var(--mute); font-size: 13px; white-space: nowrap; }
.btn { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn:focus-visible, .tab:focus-visible, input:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.btn.primary { background: var(--fg); color: #0B0C0D; border-color: var(--fg); font-weight: 600; }

main { max-width: 1240px; margin: 0 auto; padding: 24px; display: grid; gap: 16px; }
.notice { border: 1px solid var(--line); border-left: 3px solid var(--down); border-radius: 10px; padding: 12px 16px; background: var(--panel); }
.notice[hidden] { display: none; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.tile .label { color: var(--mute); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.tile .value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { color: var(--mute); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); margin-right: 8px; vertical-align: 2px; }
.dot.ok { background: var(--ok); } .dot.down { background: var(--down); }

.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card h2 { font-size: 14px; font-weight: 600; }
.card .body { padding: 6px 16px 12px; }
.empty { color: var(--mute); padding: 14px 0 6px; }

/* services */
.svc { display: grid; grid-template-columns: 170px minmax(0, 1fr) 64px; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.svc:last-child { border-bottom: 0; }
.svc .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc .note { color: var(--mute); font-size: 12px; }
.blocks { display: grid; grid-template-columns: repeat(48, 1fr); gap: 2px; height: 22px; }
.blocks i { border-radius: 2px; background: var(--empty); }
.blocks i.ok { background: var(--ok); } .blocks i.down { background: var(--down); }
.svc .pct { text-align: right; font-weight: 600; }

/* key/value rows */
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--mute); }
.kv span:last-child { text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--mute); font-weight: 400; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 10px 12px 8px 0; white-space: nowrap; }
td { padding: 10px 12px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
td.nowrap, th.nowrap { white-space: nowrap; }
td .code { font-weight: 600; letter-spacing: .04em; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 12px; color: var(--mute); white-space: nowrap; }
.tag.warn { color: var(--fg); border-color: var(--dim); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 4px 10px; color: var(--mute); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--fg); color: #0B0C0D; font-weight: 600; }

.log { font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--mute); max-height: 320px; overflow: auto; padding: 12px 16px; white-space: pre-wrap; word-break: break-word; }
.log time { color: var(--dim); margin-right: 10px; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin form { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.signin h1 { font-size: 20px; font-weight: 600; }
.signin label { display: grid; gap: 6px; color: var(--mute); font-size: 13px; }
.signin input { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--fg); }
.signin .msg { min-height: 20px; color: var(--down); font-size: 13px; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .svc { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .svc .blocks { grid-column: 1 / -1; grid-row: 2; }
  .svc .pct { grid-column: 2; grid-row: 1; }
  main { padding: 16px; }
  .bar { padding: 0 16px; gap: 10px; }
  .bar .state { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .tile .value, .blocks i { transition: background-color .2s, color .2s; } }

/* stage 2: forms, actions, dialog, toast */
.form { display: grid; gap: 12px; padding-top: 14px; padding-bottom: 16px; }
.form label { display: grid; gap: 6px; color: var(--mute); font-size: 13px; }
.form label .mute { color: var(--dim); font-size: 12px; }
.form input:not([type=checkbox]), .form textarea, .form select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; color: var(--fg); width: 100%; font: inherit; }
.form textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.form select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form textarea:focus-visible, .form select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.form label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); }
.form label.check[hidden] { display: none; }
.form .btn { justify-self: start; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn.danger { color: var(--down); }
.btn.danger:hover { border-color: var(--down); }
.btn.danger.solid { background: var(--down); border-color: var(--down); color: #0B0C0D; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
td.actions { text-align: right; padding-right: 0; }
td.actions .btn + .btn { margin-left: 6px; }
.kv.with { align-items: center; }
.kv.with span:last-of-type { margin-left: auto; }
.list { max-height: 330px; overflow-y: auto; }

dialog { background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog form { display: grid; gap: 14px; padding: 22px; }
dialog h2 { font-size: 17px; font-weight: 600; }
dialog #cBody { display: grid; gap: 10px; }
.preview { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--bg); max-height: 320px; overflow: auto; }
.preview h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.preview pre { margin: 0; font: inherit; white-space: pre-wrap; word-break: break-word; color: var(--fg); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 5; background: var(--fg); color: #0B0C0D; border-radius: 10px; padding: 10px 16px; font-weight: 600; max-width: calc(100vw - 32px); box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.toast.bad { background: var(--down); }
.toast[hidden] { display: none; }
