:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #687386;
  --line: #e2e7ef;
  --primary: #1463d8;
  --primary-dark: #0f4fb2;
  --success: #087f5b;
  --danger: #c23535;
  --warning: #986400;
  --shadow: 0 10px 30px rgba(29, 48, 82, .07);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .5; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 236px; flex: 0 0 236px; background: #101a2c; color: #d8e1f0; display: flex; flex-direction: column; padding: 22px 14px; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 10px 26px; }
.brand strong { display: block; color: #fff; font-size: 14px; }
.brand small { display: block; color: #8ea0bc; margin-top: 4px; font-size: 11px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: #2a72df; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; letter-spacing: .5px; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { color: #aebbd0; padding: 11px 12px; border-radius: 6px; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar nav a.active { background: #245bb4; color: #fff; font-weight: 650; }
.sidebar-foot { margin-top: auto; padding: 18px 12px 2px; border-top: 1px solid rgba(255,255,255,.1); color: #9aaac0; }
.sidebar-foot a:hover { color: #fff; }
.main-content { min-width: 0; flex: 1; padding: 28px clamp(18px, 4vw, 56px) 56px; }
.topbar { display: flex; align-items: center; gap: 14px; min-height: 62px; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: 0; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.status-dot { margin-left: auto; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.status-dot i { width: 7px; height: 7px; border-radius: 50%; background: #19a974; display: block; }
.menu-button { display: none; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 8px 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stats-grid article { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 17px 18px; box-shadow: var(--shadow); }
.stats-grid span { display: block; color: var(--muted); font-size: 12px; }
.stats-grid strong { display: block; margin-top: 8px; font-size: 27px; letter-spacing: 0; }
.section-block { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading h2, .tool-panel h2, .generated-panel h2 { margin: 0; font-size: 16px; }
.section-heading p, .tool-panel > p { color: var(--muted); margin: 6px 0 0; font-size: 12px; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 24px; align-items: start; }
.tool-panel { background: var(--panel-soft); border: 1px solid var(--line); border-radius: 7px; padding: 18px; }
.generated-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 1.5fr) auto; align-items: center; gap: 16px; background: #eef6ff; border: 1px solid #b9d7ff; border-radius: 7px; padding: 16px; margin-bottom: 18px; }
.generated-panel p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.generated-panel textarea { min-height: 74px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; min-width: 650px; }
th, td { padding: 12px 13px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel-soft); color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 4px; font-size: 11px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-size: 11px; color: #365174; word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.row-actions { display: flex; gap: 10px; white-space: nowrap; }
.product-name-form { display: flex; align-items: center; gap: 8px; min-width: 260px; }
.product-name-form input { min-width: 0; padding: 7px 9px; }
.product-name-form .button { padding: 7px 10px; }

.form-stack { display: grid; gap: 13px; }
label { display: grid; gap: 6px; color: #3c4759; font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #d5dce7; border-radius: 5px; background: #fff; color: var(--text); padding: 9px 10px; outline: 0; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: #6c9ee8; box-shadow: 0 0 0 3px rgba(20,99,216,.1); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.check-row { display: flex; flex-wrap: wrap; gap: 16px; }
.check-row label { display: flex; align-items: center; gap: 7px; font-weight: 500; }
.check-row input { width: auto; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 5px; padding: 9px 13px; cursor: pointer; font-weight: 650; white-space: nowrap; }
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; color: #2c4c76; border-color: #cbd6e5; }
.button.secondary:hover { border-color: #8ca8ce; }
.link-button { background: none; border: 0; color: var(--primary); padding: 0; cursor: pointer; font-size: 12px; }
.link-button.danger { color: var(--danger); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 11px; white-space: nowrap; }
.badge.success { color: var(--success); background: #e3f7ef; }
.badge.danger { color: var(--danger); background: #fde9e9; }
.badge.muted { color: #64748b; background: #eef1f5; }
.alert { border-radius: 6px; padding: 11px 13px; margin-bottom: 16px; font-size: 13px; }
.alert-success { color: #096c4d; background: #e5f7ef; border: 1px solid #b9ead6; }
.alert-error { color: #9b2c2c; background: #fff0f0; border: 1px solid #facaca; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.or-line::before, .or-line::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.or-line span { flex: 0; }

.auth-body { min-height: 100vh; display: grid; place-items: center; background: #edf2f8; }
.auth-shell { width: min(100% - 32px, 430px); }
.auth-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 30px; box-shadow: var(--shadow); }
.auth-panel .brand-mark { margin-bottom: 18px; }
.auth-panel h1 { margin: 0; font-size: 21px; }
.auth-panel .muted { margin: 7px 0 22px; }
.muted { color: var(--muted); }
.requirements { border: 1px solid var(--line); border-radius: 6px; margin: 20px 0; }
.requirements div { display: flex; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.requirements div:last-child { border-bottom: 0; }
.requirements strong.ok { color: var(--success); }.requirements strong.bad { color: var(--danger); }
.docs-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px; }
.docs-grid > div { min-width: 0; }.docs-grid h2 { margin: 0 0 10px; font-size: 16px; }
.endpoint-list { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.endpoint-list div { display: grid; grid-template-columns: minmax(220px, 1fr) 1fr; gap: 12px; padding: 11px; border-bottom: 1px solid var(--line); }
.endpoint-list div:last-child { border-bottom: 0; }.endpoint-list span { color: var(--muted); font-size: 12px; }
pre { overflow-x: auto; background: #101a2c; color: #d8e7fb; border-radius: 6px; padding: 15px; line-height: 1.6; font-size: 11px; }

@media (max-width: 980px) {
  .sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 12px 0 30px rgba(0,0,0,.16); }
  .sidebar.open { transform: translateX(0); }.menu-button { display: inline-block; }.main-content { padding: 20px 16px 40px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }.split-layout, .docs-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar h1 { font-size: 19px; }.status-dot { display: none; }.section-block { padding: 16px; }
  .generated-panel { grid-template-columns: 1fr; }.form-grid { grid-template-columns: 1fr; }
  .endpoint-list div { grid-template-columns: 1fr; gap: 5px; }
}
