:root {
  --bg: #f7f4ed;
  --panel: #ffffff;
  --ink: #14110d;
  --muted: #746b5f;
  --line: #e8dfce;
  --gold: #c79a2b;
  --gold-soft: #f3dfab;
  --black: #0d0c0a;
  --danger: #b42318;
  --ok: #127a43;
  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(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  background: var(--black);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 34px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--gold), #f2d783);
  color: #111;
  border-radius: 8px;
  font-weight: 900;
}
.brand strong, .brand small { display: block; }
.brand small { color: #a9a39a; margin-top: 2px; }
.nav { display: grid; gap: 8px; }
.nav a {
  padding: 14px 16px;
  border-radius: 8px;
  color: #e8e2d7;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-user {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid rgba(255,255,255,.14);
}
.sidebar-user span, .sidebar-user small { display: block; }
.sidebar-user small { color: var(--gold-soft); margin-top: 4px; }

.main { padding: 30px 36px 60px; min-width: 0; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: 34px; margin-bottom: 0; letter-spacing: 0; }
h2 { font-size: 24px; margin-bottom: 10px; letter-spacing: 0; }
.eyebrow {
  margin-bottom: 7px;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.hero-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  background: #111;
  color: #fff;
  border-radius: 8px;
  margin-bottom: 22px;
}
.hero-band h2 { max-width: 690px; font-size: 32px; margin-bottom: 0; }
.primary, .secondary, .icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 46px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.primary { background: var(--gold); color: #111; }
.secondary, .icon-button { background: #fff; color: #15110b; border: 1px solid var(--line); }
.full { width: 100%; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric-grid article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(26, 20, 12, .05);
}
.metric-grid article { padding: 22px; }
.metric-grid span { color: var(--muted); display: block; margin-bottom: 10px; }
.metric-grid strong { font-size: 30px; }
.compact { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.panel { padding: 26px; margin-bottom: 22px; }
.narrow { max-width: 760px; }
.section-head, .analytics-placeholder, .contact-panel {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
}
.bitrix-form-panel {
  min-height: 520px;
}
.bars {
  height: 150px;
  min-width: 260px;
  display: flex;
  align-items: end;
  gap: 12px;
}
.bars span {
  flex: 1;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--gold), #111);
}
.bars span:nth-child(1) { height: 35%; }
.bars span:nth-child(2) { height: 72%; }
.bars span:nth-child(3) { height: 52%; }
.bars span:nth-child(4) { height: 88%; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; color: var(--muted); font-size: 13px; }
th, td { padding: 15px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
td small { display: block; color: var(--muted); margin-top: 4px; }
.pill {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f6ecd3;
  color: #5f4310;
  font-weight: 800;
  font-size: 13px;
}
.empty { color: var(--muted); text-align: center; }

.form { display: grid; gap: 16px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 48px;
  border-radius: 8px;
  padding: 12px 13px;
}
input[readonly] {
  background: #f7f4ed;
  color: var(--muted);
  cursor: not-allowed;
}
textarea { resize: vertical; }
.table-action {
  min-height: 38px;
  padding: 9px 12px;
  white-space: nowrap;
}
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}
.flash-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.flash {
  padding: 13px 15px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.flash.error { color: var(--danger); border-color: #f1c6c1; }
.flash.success { color: var(--ok); border-color: #bfe3cf; }
.profile-card { text-align: center; }
.avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #111;
  color: var(--gold-soft);
  margin: 0 auto 16px;
  font-size: 26px;
  font-weight: 900;
}
dl { display: grid; grid-template-columns: 120px 1fr; gap: 12px; text-align: left; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 800; }
.widget-placeholder {
  min-height: 180px;
  min-width: 280px;
  display: grid;
  place-items: center;
  border: 1px dashed #c8b98e;
  border-radius: 8px;
  color: var(--muted);
  background: #fffaf0;
}
.notice-secret {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: center;
  gap: 16px;
  background: #111;
  color: #fff;
  padding: 18px;
  border-radius: 8px;
  margin-bottom: 22px;
}
.notice-secret code {
  background: var(--gold-soft);
  color: #111;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 900;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(rgba(13,12,10,.70), rgba(13,12,10,.75)),
    radial-gradient(circle at top left, #d4a63d, transparent 28%),
    #111;
}
.login-panel {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 30px 80px rgba(0,0,0,.32);
}
.login-brand { color: var(--ink); margin-bottom: 28px; }
.login-panel h1 { margin-bottom: 10px; }
.login-panel p { color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    gap: 18px;
  }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 22px 16px 44px; }
  .topbar, .hero-band, .section-head, .analytics-placeholder, .contact-panel { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters, .grid-form { grid-template-columns: 1fr; }
  .notice-secret { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  h1 { font-size: 28px; }
  .hero-band h2 { font-size: 24px; }
  .metric-grid { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr; }
  .bars, .widget-placeholder { min-width: 0; width: 100%; }
}
