:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #647089;
  --line: #dfe4ef;
  --brand: #1f5eff;
  --good: #0f7b45;
  --warn: #a86b00;
  --bad: #a82020;
  --soft: #eef3ff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
.topbar {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  background: #111827;
  color: white;
}
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.topbar p { margin: 3px 0 0; color: #b7c0d8; }
.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  font-weight: 700;
}
.shell { display: flex; min-height: calc(100vh - 76px); width: 100%; overflow-x: hidden; }
.sidebar {
  width: 230px;
  padding: 16px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: calc(100vh - 76px);
  overflow: auto;
}
.sidebar a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 10px;
  font-weight: 650;
}
.sidebar a.active, .sidebar a:hover { background: var(--soft); color: var(--brand); }
.content { flex: 1; padding: 22px; max-width: 1500px; min-width: 0; overflow-x: hidden; }
.page-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.page-title h2 { margin: 0; font-size: 26px; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(20, 32, 55, 0.04);
}
.card h3 { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
.metric { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row + .row { margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
label { font-size: 12px; font-weight: 750; color: var(--muted); display: block; margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
}
textarea { min-height: 72px; resize: vertical; }
button, .button {
  border: 0;
  background: var(--brand);
  color: white;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary, .button.secondary { background: #e8edf8; color: var(--ink); }
button.warn { background: var(--warn); }
button.bad { background: var(--bad); }
button.good { background: var(--good); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; background: #fbfcff; }
tr:hover td { background: #fbfcff; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 8px; font-weight: 800; font-size: 12px; background: #e8edf8; color: var(--ink); }
.badge.good { background: #dff5ea; color: var(--good); }
.badge.warn { background: #fff0d3; color: var(--warn); }
.badge.bad { background: #ffe0e0; color: var(--bad); }
.badge.brand { background: var(--soft); color: var(--brand); }
.small { font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; background: #111827; color: #d7e0ff; padding: 12px; border-radius: 12px; max-height: 360px; overflow: auto; max-width: 100%; }
.small-button { padding: 4px 7px; border-radius: 7px; font-size: 11px; margin-top: 6px; }
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.22);
  max-width: 520px;
  z-index: 20;
}
.toast.good { background: var(--good); }
.toast.warn { background: var(--warn); }
.toast.bad { background: var(--bad); }
.hidden { display: none; }
.file-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; min-width: 280px; }
.notice { padding: 12px 14px; border-radius: 12px; background: #fff8e8; border: 1px solid #ffe1a1; color: #6f4500; margin-bottom: 14px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
@media (max-width: 850px) {
  .shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; display: flex; overflow: auto; gap: 4px; }
  .sidebar a { white-space: nowrap; }
}
.profit-details { margin-top: 8px; }
.profit-details summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.metric-lines { margin-top: 8px; display: grid; gap: 4px; }
.metric-line { font-size: 12px; line-height: 1.35; }
.link-button { background: transparent; border: 0; padding: 0; cursor: pointer; }
.small-button { padding: 4px 8px; font-size: 12px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: inherit; }
details summary { cursor: pointer; font-weight: 700; }
td pre { max-height: 160px; overflow: auto; white-space: pre-wrap; }

.table-wrap td { max-width: 420px; overflow-wrap: anywhere; }
.buttonlike {
  display: inline-block;
  background: var(--brand);
  color: white;
  border-radius: 8px;
  padding: 5px 8px;
  font-weight: 800;
  text-decoration: none;
  font-size: 12px;
}
