@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg: #0E1014; --panel: #161A20; --panel-2: #12151A; --line: #23272F; --line-2: #2E333C;
  --text: #E8EBF0; --muted: #9AA3B2; --soft: #C3C9D3;
  --accent: #3DD6C4; --good: #5BD48A; --warn: #F5B54A; --bad: #FF8A7A; --info: #9DB4FF;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, sans-serif; }
a { color: var(--accent); } a:hover { color: #8BEADF; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* Top bar */
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-name { font-weight: 700; font-size: 17px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.btn { min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: #1A1E25; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #444B57; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #0E1014; }
.btn-primary:hover { background: #5FE0D1; }
.btn-danger { color: var(--bad); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.icon-btn { min-width: 32px; min-height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { border-color: var(--line-2); color: var(--text); }

/* Layout */
.layout { display: flex; flex-wrap: wrap; }
.sidenav { flex: 1 1 210px; max-width: 100%; padding: 20px 14px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.tab { text-align: left; min-height: 44px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { border-color: var(--accent); background: #1A2A2A; color: var(--text); }
.content { flex: 999 1 560px; min-width: 0; padding: 24px 24px 48px; display: flex; flex-direction: column; gap: 22px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.up { color: var(--good) !important; } .down { color: var(--bad) !important; } .amber { color: var(--warn) !important; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.sub { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }

/* Chart */
.chart { height: 180px; display: flex; align-items: flex-end; gap: 8px; border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.bar-wrap { flex: 1 1 0; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; border-radius: 4px 4px 0 0; background: #2F4A4A; min-height: 2px; }
.bar.last { background: var(--accent); }
.chart-axis { display: flex; justify-content: space-between; font: 11px var(--mono); color: var(--muted); margin-top: 6px; }

/* Alerts */
.alerts { display: flex; flex-direction: column; gap: 10px; }
.alert { display: flex; gap: 12px; align-items: flex-start; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.dot.good { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); }
.alert-title { font-weight: 600; font-size: 13px; }
.alert-detail { font-size: 12px; color: var(--muted); }

/* Pills */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #2A2F38; color: var(--soft); white-space: nowrap; }
.pill.Live, .pill.Online, .pill.up-pill { background: #14302A; color: var(--good); }
.pill.Scheduled, .pill.Beta { background: #1B2540; color: var(--info); }
.pill.Editing, .pill.Building { background: #33270F; color: var(--warn); }
.pill.down-pill { background: #3A1C1A; color: var(--bad); }

/* Platform & app cards */
.metric-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-label { font-size: 11px; color: var(--muted); }
.metric-value { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.big { font-family: var(--mono); font-size: 22px; font-weight: 700; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Filters */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--soft); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #0E1014; }

/* Table */
.table-box { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line-2); }
td { padding: 11px 8px; border-bottom: 1px solid #1F232A; }
td.num, th.num { text-align: right; font-family: var(--mono); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.input { height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); width: 100%; }
select.input { padding-right: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; }

dialog { border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); color: var(--text); padding: 22px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5, 6, 8, 0.7); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 10px; }
.result { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--accent); margin: 4px 0; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #1A1E25; border: 1px solid var(--line-2); padding: 12px 16px; border-radius: 10px; z-index: 50; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); }

@media (max-width: 720px) {
  .sidenav { border-right: 0; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; }
  .tab { flex: 1 1 auto; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
