:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --soft: #eef1f8;
  --text: #141820;
  --muted: #5a6472;
  --accent: #1f6fff;
  --accent-soft: rgba(31, 111, 255, .1);
  --border: rgba(20, 24, 32, .12);
  --ok: #0f7a56;
  --ok-soft: #e1f5ec;
  --warn: #9a5800;
  --warn-soft: #fff2dc;
  --bad: #c22f3a;
  --bad-soft: #fde7e9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }

.tb-banner {
  background: #141820;
  color: #d9dfeb;
  font-size: 13px;
  padding: 9px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.tb-banner a { color: #fff; font-weight: 700; text-decoration: none; }
.tb-banner a:hover { text-decoration: underline; }
.tb-banner a.tb-cta { background: var(--accent); padding: 4px 12px; border-radius: 999px; }
.tb-banner a.tb-cta:hover { text-decoration: none; filter: brightness(1.08); }

.app { width: min(1120px, calc(100% - 32px)); margin: 24px auto 48px; }
.app-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.app-head h1 { margin: 0; font-size: 22px; letter-spacing: -.4px; line-height: 1.25; }
.app-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.tabs { display: inline-flex; background: #e3e8f2; border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: -.1px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid2 > * { min-width: 0; }

label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }
.field { margin-bottom: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.muted { background: var(--soft); color: var(--muted); }
.muted { color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.5px; margin-top: 2px; }
.kpi .d { font-size: 12px; font-weight: 700; color: var(--muted); }
.up { color: var(--ok) !important; }
.down { color: var(--bad) !important; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: #141820;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 50;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

.tb-foot {
  margin: 28px auto 0;
  max-width: 760px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.tb-foot a { color: var(--accent); font-weight: 700; text-decoration: none; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-head h1 { font-size: 19px; }
}
