/* typest.app "Mint" theme – the same tokens as renderer/styles.css of the app */
@font-face { font-family: 'DM Sans'; src: url('/static/fonts/DMSans-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/static/fonts/DMSans-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'DM Sans'; src: url('/static/fonts/DMSans-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/static/fonts/JetBrainsMono-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }

:root {
  --bg: #111416; --sidebar: #101214; --panel: #181d20; --raised: #14181b; --field: #0e1113; --hover: #1a1d1f; --active: #202425;
  --line: #2b3435; --line-strong: #454e4d;
  --text: #edf2ef; --text-soft: #d3d7d5; --muted: #8c9894; --muted-2: #6a7471;
  --accent: #72e9b7; --accent-hover: #9aefcb; --on-accent: #0c1913; --accent-tint: #192523; --accent-line: #417964; --accent-deep: #213831;
  --danger: #d6453d; --danger-text: #f0a4a0; --danger-tint: #26191c; --danger-line: #512427; --warn: #f2bc84; --info: #7fb6f2;
  --font: 'DM Sans', system-ui, sans-serif; --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); display: flex; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin-bottom: 12px; }
code, pre { font-family: var(--mono); font-size: 13px; }
code { background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.danger-text { color: var(--danger-text) !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- buttons & inputs ---- */
.button { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--raised); color: var(--text); font: 500 14px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,.05); }
.button:hover { background: var(--hover); border-color: var(--line-strong); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { color: var(--danger-text); }
.button.danger:hover { background: var(--danger-tint); border-color: var(--danger-line); }
.button.discord { background: #5865f2; border-color: #5865f2; color: #fff; height: 46px; justify-content: center; width: 100%; font-size: 15px; }
.button.discord:hover { background: #4752c4; }
.button.discord svg { width: 22px; height: 22px; }
.button.small { height: 30px; padding: 0 10px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 500 13px var(--font); cursor: pointer; }
.link:hover { text-decoration: underline; }
input[type=text], input[type=password], input[type=search] { width: 100%; height: 38px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--field); color: var(--text); font: 14px var(--font); }
input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px #72e9b726; }
input[readonly] { color: var(--text-soft); }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 6px 0; color: var(--text-soft); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 36px; height: 20px; border-radius: 10px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked + span { background: var(--accent-deep); }
.toggle input:checked + span::after { transform: translateX(16px); background: var(--accent); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- login ---- */
body.login { padding: 24px; overflow-y: auto; background-color: var(--bg); background-image: radial-gradient(circle at 80% 0%, #72e9b729, transparent 55%), radial-gradient(rgba(255,255,255,.05) 1px, transparent 1px); background-size: 100% 100%, 24px 24px; }
.login-card { margin: auto; width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 36px 32px; box-shadow: 0 18px 48px -12px rgba(0,0,0,.7); }
.login-logo { height: 30px; display: block; margin-bottom: 28px; }
.login-card h1 { font-size: 26px; }
.login-card .muted { margin: 6px 0 24px; }
.login-error { background: var(--danger-tint); border: 1px solid var(--danger-line); color: var(--danger-text); border-radius: var(--r-sm); padding: 10px 12px; margin: 0 0 18px; font-size: 14px; }
.login-error:empty { display: none; }
.login-hint { color: var(--muted-2); font-size: 12.5px; margin: 20px 0 0; line-height: 1.6; }
.login-hint code { font-size: 11.5px; word-break: break-all; }

/* ---- layout ---- */
.sidebar { width: 240px; flex: none; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 0 10px 22px; }
.brand img { height: 22px; width: auto; align-self: flex-start; }
.brand span { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-soft); font: 500 14.5px var(--font); cursor: pointer; text-align: left; }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav[data-tab=overview] svg { fill: currentColor; stroke: none; }
.nav:hover { background: var(--hover); color: var(--text); }
.nav.active { background: var(--accent-tint); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.me img { width: 34px; height: 34px; border-radius: 50%; background: var(--panel); }
.me strong { display: block; font-size: 14px; line-height: 1.2; }
.me form { margin: 0; }

.main { flex: 1; min-width: 0; padding: 26px clamp(18px, 2.4vw, 40px) 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar > div:first-child { display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 24px; }
.actions { display: flex; gap: 8px; }

.status { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 14px; font-size: 13px; font-weight: 500; background: var(--raised); border: 1px solid var(--line); color: var(--muted); }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.running { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); }
.status.starting, .status.stopping { color: var(--warn); }
.status.crashed { color: var(--danger-text); border-color: var(--danger-line); background: var(--danger-tint); }
.status.running::before { box-shadow: 0 0 0 4px #72e9b733; animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px #72e9b700; } }

.banner { border-radius: var(--r-md); padding: 12px 16px; margin-bottom: 18px; border: 1px solid var(--danger-line); background: var(--danger-tint); color: var(--danger-text); font-size: 14px; }
.banner.info { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent); }

.grid { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; min-width: 0; }
.stack .card, .tab > .card { margin: 0; }
.tab > .card + .card, .tab > .grid + .card { margin-top: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row h3 { margin: 0; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.row.wrap { flex-wrap: wrap; justify-content: flex-start; }
.card > header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card > header h3 { margin: 0; }

.bot-card { display: flex; align-items: center; gap: 16px; }
.bot-card img { width: 56px; height: 56px; border-radius: 50%; background: var(--raised); border: 2px solid var(--accent); flex: none; }
.bot-card h2 { font-size: 19px; }
.bot-card p { margin: 2px 0 0; font-size: 13.5px; }
.tile { display: flex; flex-direction: column; justify-content: center; }
.tile span { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 500; }
.tile strong { font-size: 24px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.chart-card header strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 140px; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-card p { margin: 6px 0 0; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }

/* ---- console ---- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; flex: 1 1 200px; max-width: 360px; }
.chips { display: flex; gap: 6px; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--raised); color: var(--text-soft); font: 500 13px var(--font); cursor: pointer; }
.chip.active { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent); }
.console { background: var(--field); border: 1px solid var(--line); border-radius: var(--r-md); font: 12.5px/1.6 var(--mono); padding: 12px 14px; height: calc(100vh - 210px); min-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.console.mini { height: 210px; min-height: 0; }
.console .l { padding: 0 2px; border-radius: 3px; }
.console .l.warn { color: var(--warn); }
.console .l.error { color: var(--danger-text); background: #d6453d14; }
.console .l.panel { color: var(--accent); }
.console .l.debug { color: var(--muted-2); }
.console .l mark { background: #72e9b740; color: inherit; border-radius: 2px; }
.console[data-level=info] .l:not(.info), .console[data-level=warn] .l:not(.warn), .console[data-level=error] .l:not(.error), .console[data-level=panel] .l:not(.panel) { display: none; }
.console .l.nomatch { display: none; }
.deploy-log { height: 260px; margin: 14px 0 0; }

/* ---- updates ---- */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 150px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--raised); cursor: pointer; text-align: center; padding: 20px; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-tint); }
.dropzone input { display: none; }
.dropzone strong { font-size: 16px; }
.dropzone .muted { font-size: 13px; }
pre.code { background: var(--field); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 12px 0; color: var(--text); white-space: pre-wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; 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.actions-cell { text-align: right; white-space: nowrap; }
td.actions-cell .button + .button { margin-left: 6px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 500; background: var(--raised); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.current { background: var(--accent-tint); border-color: var(--accent-line); color: var(--accent); }
.badge.failed { background: var(--danger-tint); border-color: var(--danger-line); color: var(--danger-text); }
.mono { font-family: var(--mono); font-size: 13px; }

/* ---- settings ---- */
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.field label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; margin-bottom: 6px; }
.field small { display: block; color: var(--muted-2); font-size: 12.5px; margin-top: 5px; }
.source { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 8px; background: var(--raised); border: 1px solid var(--line); color: var(--muted); }
.source.panel { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); }
.token-row { display: flex; gap: 8px; margin-bottom: 10px; }
.token-row input { font-family: var(--mono); font-size: 13px; }

/* ---- toasts ---- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast { background: var(--panel); border: 1px solid var(--accent-line); color: var(--text); border-radius: var(--r-md); padding: 10px 14px; font-size: 14px; box-shadow: 0 18px 48px -12px rgba(0,0,0,.7); max-width: 380px; animation: toast-in .18s ease-out; }
.toast.error { border-color: var(--danger-line); color: var(--danger-text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1200px) { .grid { grid-template-columns: repeat(2, 1fr); } .bot-card { grid-column: 1 / -1; } }
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { position: static; width: auto; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0; }
  nav { flex-direction: row; overflow-x: auto; order: 3; width: 100%; }
  .nav { flex: none; }
  .me { margin: 0 0 0 auto; border: 0; padding: 0; }
  .grid, .grid.two { grid-template-columns: 1fr; }
  .main { padding: 18px 16px 40px; }
  .console { height: 60vh; }
}
