:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #6f7888;
  --line: #e6e9ef;
  --panel: #ffffff;
  --canvas: #f4f6f9;
  --nav: #161b24;
  --red: #e32636;
  --red-dark: #b61524;
  --green: #1aa36f;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink); display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: var(--nav); color: #fff; padding: 28px 18px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.15; padding: 0 10px 30px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--red); font: 800 24px Georgia, serif; }
.brand b { font-size: 18px; }
nav { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #aeb6c5; text-align: left; border-radius: 9px; padding: 12px 14px; font-size: 14px; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: #262d39; color: #fff; }
.nav-item.active { border-left: 3px solid var(--red); }
.safety-card { margin-top: auto; background: #222936; padding: 14px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; }
.safety-card small { display: block; color: #aeb6c5; margin-top: 4px; line-height: 1.3; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-top: 5px; box-shadow: 0 0 0 4px rgba(26,163,111,.16); }
main { padding: 34px 42px 60px; min-width: 0; }
header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
h1 { margin: 3px 0 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -1.2px; }
h2 { margin: 3px 0 16px; font-size: 21px; }
.eyebrow { color: var(--red); font-size: 11px; text-transform: uppercase; font-weight: 800; letter-spacing: 1.3px; margin: 0; }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; border: 0; background: transparent; color: inherit; text-align: left; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 50%; font-weight: 800; }
.notice { background: #fff4f5; border: 1px solid #ffd4d8; color: #7a2029; padding: 14px 16px; border-radius: 12px; margin-bottom: 18px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metrics article, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 4px 18px rgba(20,31,48,.04); }
.metrics article { padding: 18px; }
.metrics span, .metrics small { color: var(--muted); font-size: 12px; }
.metrics strong { display: block; font-size: 28px; margin: 9px 0 3px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { padding: 22px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.channels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.channel { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.channel b { display: block; margin-bottom: 5px; }
.channel small { color: var(--muted); }
.channel-state { display: inline-block; margin-top: 12px; padding: 4px 7px; border-radius: 20px; font-size: 10px; background: #f0f2f6; color: #677184; }
.primary, .secondary, .icon { appearance: none; border: 0; border-radius: 9px; padding: 10px 14px; font-weight: 700; cursor: pointer; font-size: 13px; text-decoration: none; display: inline-block; }
.primary { background: var(--red); color: #fff; }
.primary:hover { background: var(--red-dark); }
.secondary { background: #f0f2f6; color: var(--ink); }
.secondary:disabled { opacity: .5; cursor: not-allowed; }
.icon { background: transparent; font-size: 22px; padding: 0 4px; }
.muted { color: var(--muted); line-height: 1.55; }
.pill { border: 1px solid #b9e3d3; background: #effaf6; color: #117a54; border-radius: 20px; padding: 6px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill.warning { border-color: #f2d8a8; background: #fff8e9; color: #8b5b10; }
.budget-ring { width: 124px; height: 124px; margin: 8px auto 18px; border-radius: 50%; background: conic-gradient(var(--red) 0deg, #edf0f4 0deg); display: grid; place-items: center; }
.budget-ring > div { width: 92px; height: 92px; background: #fff; border-radius: 50%; display: grid; place-content: center; text-align: center; }
.budget-ring strong { font-size: 25px; }
.budget-ring small { color: var(--muted); }
.client-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 12px; align-items: center; margin: 18px 0; }
.client-flow div { background: #f7f8fa; border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 10px; }
.client-flow b { width: 27px; height: 27px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.hidden { display: none !important; }
.login-panel { max-width: 520px; background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 28px; }
dialog { border: 0; border-radius: 16px; width: min(520px, calc(100vw - 30px)); padding: 24px; box-shadow: 0 20px 80px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(12,18,28,.55); }
form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; margin: 13px 0; }
input, select, textarea { width: 100%; border: 1px solid #ccd2dc; border-radius: 9px; padding: 11px 12px; background: #fff; color: var(--ink); font: inherit; resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.view { display: none; }
.view.active { display: block; }
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.toolbar h2 { font-size: 28px; margin-bottom: 0; }
.records { display: grid; gap: 10px; margin-top: 14px; }
.record { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 17px 19px; display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.5fr); gap: 22px; align-items: start; }
.record b, .record small { display: block; }
.record small { color: var(--muted); margin-top: 6px; line-height: 1.45; }
.record p { margin: 0; color: #465063; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.empty { background: #fff; border: 1px dashed #ccd2dc; border-radius: 13px; padding: 28px; text-align: center; color: var(--muted); }
.status-list { display: grid; gap: 9px; }
.status-list div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-list div:last-child { border-bottom: 0; }
.status-list span { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; font-weight: 500; }
.check input { width: auto; }
.toast { position: fixed; z-index: 30; right: 26px; top: 24px; max-width: 420px; border-radius: 11px; padding: 13px 16px; background: #163d2f; color: #fff; box-shadow: 0 14px 45px rgba(0,0,0,.18); }
.toast.error { background: #7a2029; }
@media (max-width: 980px) {
  body { grid-template-columns: 78px 1fr; }
  .sidebar { padding: 20px 10px; }
  .brand span:not(.brand-mark), .nav-item, .safety-card div { font-size: 0; }
  .nav-item { height: 42px; }
  .channels, .metrics { grid-template-columns: repeat(2, 1fr); }
  main { padding: 26px 20px; }
}
@media (max-width: 680px) {
  body { display: block; }
  .sidebar { position: static; min-height: auto; }
  nav { grid-template-columns: repeat(4, 1fr); }
  .safety-card { margin-top: 14px; }
  .metrics, .grid, .channels { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .client-flow { grid-template-columns: 1fr; }
  .client-flow i { display: none; }
  .record, .form-grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
}
