:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --ink: #171a1f;
  --muted: #6f7580;
  --muted-strong: #535963;
  --line: #e7e9ed;
  --line-strong: #d9dde3;
  --sidebar: #121417;
  --sidebar-soft: #1c1f24;
  --accent: #e5a72a;
  --accent-dark: #9a6500;
  --accent-soft: #fff5dc;
  --blue: #5576d8;
  --blue-soft: #eef2ff;
  --green: #2f8a61;
  --green-soft: #eaf7f0;
  --red: #c34f57;
  --red-soft: #fff0f1;
  --slate: #7b818a;
  --slate-soft: #f0f1f3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 12px 36px rgba(18, 22, 30, .07);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-width: 256px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button, input, textarea, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid rgba(85, 118, 216, .24);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 15% 0, rgba(229, 167, 42, .13), transparent 31%),
    var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 7px 28px;
  color: #fff;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  color: #241b09;
  background: linear-gradient(145deg, #f5c85a, #c88312);
  box-shadow: 0 10px 30px rgba(229, 167, 42, .23);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.03em;
}

.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 13px; line-height: 1.25; letter-spacing: -.01em; }
.brand-copy small { margin-top: 4px; color: #8d929b; font-size: 10px; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 11px;
  color: #9ca1aa;
  text-decoration: none;
  font-size: 13px;
  font-weight: 650;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.nav a svg { width: 19px; height: 19px; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .055); }
.nav a:active { transform: scale(.99); }
.nav a.active { color: #f6bf4b; background: rgba(229, 167, 42, .115); }

.nav-divider { height: 1px; margin: 13px 10px; background: #292d33; }

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 17px 7px 0;
  border-top: 1px solid #292d33;
}

.admin-profile { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.admin-profile:hover strong { color: #f6bf4b; }
.admin-profile > span:last-child { min-width: 0; }
.admin-profile strong, .admin-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-profile strong { font-size: 12px; }
.admin-profile small { color: #7f858e; font-size: 10px; }

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  color: #201807;
  background: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.avatar.small { width: 31px; height: 31px; flex-basis: 31px; font-size: 10px; }
.avatar.soft { color: #5f6269; background: #eef0f3; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--muted-strong);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover { background: #eef0f3; color: var(--ink); }
.logout-button { color: #777d86; }
.logout-button:hover { color: #fff; background: rgba(255, 255, 255, .07); }

.main { min-height: 100vh; margin-left: var(--sidebar-width); }
.page-container { width: min(100%, 1480px); margin: 0 auto; padding: 38px 42px 64px; }

.mobile-header { display: none; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
}

.breadcrumbs a { color: var(--muted-strong); text-decoration: none; }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs svg { width: 13px; height: 13px; color: #adb1b8; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}

.page-header h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); line-height: 1.16; letter-spacing: -.035em; }
.page-header p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }

.content { min-width: 0; }

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.button svg { width: 16px; height: 16px; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { color: #fff; background: #1c2026; box-shadow: 0 6px 16px rgba(18, 22, 28, .12); }
.button.primary:hover { background: #090b0e; }
.button.secondary { color: #333842; background: #fff; border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.button.secondary:hover { border-color: #c4c8cf; background: #fbfbfc; }
.button.danger { color: #fff; background: var(--red); }
.button.danger-outline { color: var(--red); background: transparent; border-color: #efc9cc; }
.button.danger-outline:hover { background: var(--red-soft); }
.button.quiet { color: var(--muted-strong); background: transparent; }
.button.quiet:hover { color: var(--ink); background: #eef0f3; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.full-width, .full-width { width: 100%; }

.button.loading { color: transparent !important; pointer-events: none; }
.button.loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #8f949d;
  animation: spin .7s linear infinite;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-dark);
  text-decoration: none;
  font-size: 11px;
  font-weight: 750;
}

.text-link svg { width: 14px; height: 14px; transition: transform .15s; }
.text-link:hover svg { transform: translateX(2px); }

.card, .rows-card, .table-shell, .metric-card, .resource-card, .summary-strip, .result-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card { padding: 24px; border-radius: var(--radius); }

.card-header, .section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.card-header { margin-bottom: 20px; }
.card-header h2, .section-header h2, .subsection-title h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.025em; }
.section-header p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.overline { color: var(--accent-dark); font-size: 9px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card { display: flex; align-items: center; gap: 14px; padding: 20px; border-radius: var(--radius); }
.metric-card > span:last-child { min-width: 0; }
.metric-card small, .metric-card strong, .metric-card em { display: block; }
.metric-card small { color: var(--muted); font-size: 10px; font-weight: 700; }
.metric-card strong { margin-top: 2px; font-size: 27px; line-height: 1.15; letter-spacing: -.04em; }
.metric-card em { margin-top: 3px; color: #92969e; font-size: 10px; font-style: normal; }
.metric-icon { display: grid; place-items: center; width: 43px; height: 43px; flex: 0 0 43px; border-radius: 13px; }
.metric-icon svg { width: 20px; height: 20px; }
.metric-icon.amber { color: var(--accent-dark); background: var(--accent-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.green { color: var(--green); background: var(--green-soft); }
.metric-icon.red { color: var(--red); background: var(--red-soft); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 16px; }
.result-breakdown { display: grid; gap: 22px; }
.result-label { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.result-label span:last-child { margin-left: auto; color: var(--muted); font-weight: 750; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.amber { background: var(--accent); }
.dot.slate { background: var(--slate); }
.dot.blue { background: var(--blue); }
.progress { display: block; width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 100px; background: #eff0f2; }
.progress::-webkit-progress-bar { background: #eff0f2; }
.progress::-webkit-progress-value { border-radius: 100px; }
.progress::-moz-progress-bar { border-radius: 100px; }
.progress.amber::-webkit-progress-value { background: var(--accent); }
.progress.amber::-moz-progress-bar { background: var(--accent); }
.progress.slate::-webkit-progress-value { background: var(--slate); }
.progress.slate::-moz-progress-bar { background: var(--slate); }
.progress.blue::-webkit-progress-value { background: var(--blue); }
.progress.blue::-moz-progress-bar { background: var(--blue); }

.feed-list { display: grid; }
.feed-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.feed-item:first-child { border-top: 0; }
.feed-item:hover .feed-copy strong { color: var(--accent-dark); }
.feed-copy { min-width: 0; }
.feed-copy strong, .feed-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-copy strong { font-size: 11px; }
.feed-copy small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.chevron { width: 17px; height: 17px; color: #b0b4bb; }

.status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status.new { color: var(--red); background: var(--red-soft); }
.status.in_progress { color: var(--accent-dark); background: var(--accent-soft); }
.status.answered { color: var(--green); background: var(--green-soft); }
.status.closed { color: var(--slate); background: var(--slate-soft); }

.resource-grid { display: grid; gap: 12px; }
.resource-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  padding: 22px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.resource-card:hover { transform: translateY(-2px); border-color: #d8dbe1; box-shadow: var(--shadow-md); }
.resource-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; color: var(--accent-dark); background: var(--accent-soft); }
.resource-icon svg { width: 22px; height: 22px; }
.resource-copy { min-width: 0; }
.resource-copy > strong { display: block; margin-top: 11px; font-size: 17px; letter-spacing: -.02em; }
.resource-copy > p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.resource-topline, .resource-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.resource-topline small { color: #969aa2; font-size: 9px; }
.resource-meta { margin-top: 13px; color: var(--muted-strong); font-size: 10px; font-weight: 700; }
.resource-meta span + span::before { content: "·"; margin-right: 10px; color: #b6bac1; }

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 28px;
  border-radius: var(--radius);
}
.summary-strip > div { padding: 19px 22px; border-left: 1px solid var(--line); }
.summary-strip > div:first-child { border-left: 0; }
.summary-strip small, .summary-strip strong { display: block; }
.summary-strip small { margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.summary-strip strong { font-size: 14px; }

.section-block + .section-block { margin-top: 32px; }
.section-header { margin: 0 2px 13px; }
.rows-card { overflow: hidden; border-radius: var(--radius); }
.content-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 15px;
  min-height: 77px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: background .15s ease;
}
.content-row:first-child { border-top: 0; }
.content-row:hover { background: #fcfbf8; }
.row-number { color: #b18327; font-size: 16px; font-weight: 850; }
.row-copy { min-width: 0; }
.row-copy strong, .row-copy small { display: block; }
.row-copy strong { font-size: 12px; }
.row-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.row-action { display: inline-flex; align-items: center; gap: 6px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.row-action svg { width: 14px; height: 14px; }

.result-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.result-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  min-height: 168px;
  padding: 21px;
  overflow: hidden;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}
.result-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; }
.result-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.result-card.accent-amber::before { background: var(--accent); }
.result-card.accent-slate::before { background: var(--slate); }
.result-card.accent-blue::before { background: var(--blue); }
.result-code { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #f1f2f4; font-weight: 900; }
.result-card strong { display: block; margin: 4px 0 7px; font-size: 14px; }
.result-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.result-card .chevron { margin-top: 7px; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.editor-card { display: grid; gap: 26px; }
.editor-aside { display: grid; gap: 12px; }
.field-group > label, .field-group > p { display: block; }
.field-group > label { margin-bottom: 6px; color: #343941; font-size: 12px; font-weight: 780; }
.field-group > p { margin: -1px 0 9px; color: var(--muted); font-size: 10px; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input, select { min-height: 43px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; line-height: 1.58; }
input::placeholder, textarea::placeholder { color: #a7abb2; }
input:hover, textarea:hover, select:hover { border-color: #c6cad1; }
input:focus, textarea:focus, select:focus { border-color: #8ba0df; box-shadow: 0 0 0 4px rgba(85, 118, 216, .1); }

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.toggle-row > span { min-width: 0; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row strong { font-size: 12px; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-row i { position: relative; width: 42px; height: 24px; flex: 0 0 42px; border-radius: 100px; background: #cfd3d9; transition: .2s; }
.toggle-row i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.toggle-row input:checked + i { background: var(--green); }
.toggle-row input:checked + i::after { transform: translateX(18px); }
.toggle-row input:focus-visible + i { box-shadow: 0 0 0 4px rgba(85, 118, 216, .15); }

.info-card { display: flex; gap: 11px; padding: 16px; border: 1px solid #e1e5ef; border-radius: 13px; color: #485266; background: #f5f7fc; }
.info-card > svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--blue); }
.info-card strong, .info-card p { display: block; }
.info-card strong { font-size: 11px; }
.info-card p { margin: 4px 0 0; color: #747d8f; font-size: 10px; line-height: 1.55; }
.sticky-actions { position: sticky; top: 18px; display: flex; justify-content: flex-end; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.94); box-shadow: var(--shadow-md); backdrop-filter: blur(12px); }

.options-editor { display: grid; gap: 12px; padding-top: 23px; border-top: 1px solid var(--line); }
.subsection-title { margin-bottom: 2px; }
.option-field { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 11px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.option-field label { min-width: 0; }
.option-field label > span { display: block; margin-bottom: 7px; color: var(--muted-strong); font-size: 10px; font-weight: 750; }
.option-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 900; }
.code-a { color: var(--accent-dark); background: var(--accent-soft); }
.code-b { color: var(--slate); background: var(--slate-soft); }
.code-v { color: var(--blue); background: var(--blue-soft); }
.result-identity { display: flex; align-items: center; gap: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.result-identity > span { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 13px; font-size: 20px; font-weight: 900; }
.result-identity small, .result-identity strong { display: block; }
.result-identity small { color: var(--muted); font-size: 9px; }
.result-identity strong { margin-top: 3px; font-size: 15px; }
.result-identity.accent-amber > span { color: var(--accent-dark); background: var(--accent-soft); }
.result-identity.accent-slate > span { color: var(--slate); background: var(--slate-soft); }
.result-identity.accent-blue > span { color: var(--blue); background: var(--blue-soft); }

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 13px; }
.filter { padding: 8px 12px; border: 1px solid transparent; border-radius: 999px; color: var(--muted-strong); background: #e9ebef; text-decoration: none; font-size: 10px; font-weight: 750; }
.filter:hover { color: var(--ink); }
.filter.active { color: #fff; background: #20242a; }

.table-shell { overflow: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th { padding: 13px 16px; color: #8a9099; background: #fafbfc; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 14px 16px; border-top: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
tbody tr[data-href] { cursor: pointer; transition: background .14s ease; }
tbody tr[data-href]:hover { background: #fcfbf8; }
.table-message { max-width: 430px; color: var(--muted-strong); }
.nowrap { white-space: nowrap; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person > span:last-child { min-width: 0; }
.person strong, .person small { display: block; }
.person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.person small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.person.large { padding-bottom: 18px; border-bottom: 1px solid var(--line); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .65fr); gap: 16px; align-items: start; }
.detail-grid.balanced { grid-template-columns: 1fr 1fr; }
.conversation-card { padding-bottom: 20px; }
.message-bubble { width: min(82%, 720px); margin: 28px 0; padding: 17px 18px; border-radius: 4px 15px 15px 15px; background: #f0f2f5; }
.message-bubble p { margin: 0; white-space: pre-wrap; }
.message-bubble time { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; }
.reply-form { padding-top: 21px; border-top: 1px solid var(--line); }
.form-footer { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 11px; }
.form-footer small { color: var(--muted); font-size: 9px; }
.compact-form { gap: 18px; }

.search-bar { position: relative; display: flex; gap: 8px; max-width: 560px; margin-bottom: 13px; }
.search-bar > svg { position: absolute; left: 13px; top: 13px; width: 17px; height: 17px; color: #9ca1a9; }
.search-bar input { padding-left: 39px; }

.simple-list { display: grid; }
.simple-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 64px; padding: 10px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.simple-row:first-child { border-top: 0; }
.simple-row strong, .simple-row small { display: block; }
.simple-row strong { font-size: 11px; }
.simple-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.empty-state { display: grid; place-items: center; min-height: 260px; padding: 36px; color: var(--muted); text-align: center; }
.empty-state > svg { width: 34px; height: 34px; margin-bottom: 12px; color: #b3b8c0; }
.empty-state h2 { margin: 0; color: var(--ink); font-size: 16px; }
.empty-state p { margin: 6px 0 0; font-size: 11px; }
.empty-state.compact { min-height: 135px; padding: 20px; }

.settings-form { max-width: 880px; }
.settings-section { display: grid; gap: 22px; }
.settings-field { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.settings-field:last-child { padding-bottom: 0; border-bottom: 0; }
.settings-field label, .settings-field small { display: block; }
.settings-field label { margin-bottom: 3px; font-size: 12px; font-weight: 750; }
.settings-field small { margin-bottom: 9px; color: var(--muted); font-size: 9px; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 14px; }

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(390px, calc(100vw - 32px));
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 12px;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: none; }
.toast.success { border-color: #326147; background: #193729; }
.toast.error { border-color: #7b353b; background: #4a2024; }
.toast svg { width: 18px; height: 18px; flex: 0 0 18px; }
.toast.success svg { color: #76dda5; }
.toast.error svg { color: #ff9fa7; }

.confirm-dialog { width: min(410px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.confirm-dialog::backdrop { background: rgba(10, 12, 15, .58); backdrop-filter: blur(4px); }
.confirm-dialog form { position: relative; padding: 29px; text-align: center; }
.dialog-close { position: absolute; top: 12px; right: 12px; }
.dialog-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px; color: var(--red); background: var(--red-soft); }
.dialog-symbol svg { width: 21px; height: 21px; }
.confirm-dialog h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.confirm-dialog p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: center; gap: 8px; margin-top: 22px; }

[data-tooltip] { position: relative; }
[data-tooltip]::after { content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 7px); z-index: 90; padding: 5px 7px; border-radius: 6px; color: #fff; background: #16191d; font-size: 9px; white-space: nowrap; opacity: 0; transform: translate(-50%, 4px); transition: .15s; pointer-events: none; }
[data-tooltip]:hover::after { opacity: 1; transform: translate(-50%, 0); }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgba(229, 167, 42, .13), transparent 34%),
    radial-gradient(circle at 80% 90%, rgba(85, 118, 216, .09), transparent 30%),
    #111318;
}
.login-card { position: relative; z-index: 2; width: min(430px, 100%); padding: 38px; border: 1px solid rgba(255,255,255,.12); border-radius: 22px; background: rgba(255,255,255,.97); box-shadow: 0 32px 100px rgba(0,0,0,.38); }
.login-brand { margin-bottom: 25px; }
.login-brand span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #251c08; background: linear-gradient(145deg,#f5c85a,#c88312); font-weight: 900; }
.login-card h1 { margin: 4px 0 8px; font-size: 27px; letter-spacing: -.04em; }
.login-copy { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.login-card .overline, .login-card .eyebrow { margin: 0; color: var(--accent-dark); font-size: 9px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.stack-form { display: grid; gap: 15px; }
.stack-form label { display: grid; gap: 6px; color: #3f444c; font-size: 11px; font-weight: 750; }
.login-note { display: block; margin-top: 19px; color: #999da5; font-size: 9px; text-align: center; }
.form-error { margin-bottom: 15px; padding: 11px 13px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 10px; font-weight: 750; }
.login-glow { display: none; }

.sidebar-backdrop { display: none; }

.onboarding-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 16px; align-items: start; }
.onboarding-card { padding: 32px; }
.resource-icon.large { width: 58px; height: 58px; margin-bottom: 20px; }
.onboarding-card h2, .telegram-map h2 { margin: 6px 0 0; font-size: 21px; letter-spacing: -.03em; }
.onboarding-card > p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.steps-list { display: grid; gap: 0; margin: 27px 0 0; padding: 0; list-style: none; }
.steps-list li { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 13px; padding: 0 0 22px; }
.steps-list li:last-child { padding-bottom: 0; }
.steps-list li::before { content: ""; position: absolute; top: 33px; bottom: 0; left: 16px; width: 1px; background: var(--line-strong); }
.steps-list li:last-child::before { display: none; }
.steps-list li > span { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; font-weight: 850; }
.steps-list strong, .steps-list p { display: block; }
.steps-list strong { padding-top: 1px; font-size: 12px; }
.steps-list p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.telegram-map dl { display: grid; gap: 0; margin: 23px 0 0; }
.telegram-map dl > div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); }
.telegram-map dt { font-size: 11px; font-weight: 750; }
.telegram-map dd { margin: 0; color: var(--muted); font-size: 10px; text-align: right; }

.notice-panel { display: flex; gap: 13px; margin-bottom: 16px; padding: 17px 18px; border: 1px solid; border-radius: 14px; }
.notice-panel > svg { width: 19px; height: 19px; flex: 0 0 19px; margin-top: 1px; }
.notice-panel strong { display: block; font-size: 12px; }
.notice-panel p { margin: 4px 0 0; font-size: 10px; line-height: 1.6; }
.notice-panel .text-link { margin-top: 10px; }
.notice-panel.warning { color: #74530e; border-color: #efdcad; background: #fff9ea; }
.notice-panel.warning > svg { color: var(--accent-dark); }
.notice-panel.error { color: #74343a; border-color: #efc9cc; background: var(--red-soft); }

.publication-editor { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.publication-fields { display: grid; gap: 16px; }
.publication-sidebar { position: sticky; top: 18px; display: grid; gap: 12px; }
.editor-section-title h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.025em; }
.field-label-line { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.field-label-line label { margin: 0; color: #343941; font-size: 12px; font-weight: 780; }
.field-label-line span { color: var(--muted); font-size: 9px; font-weight: 750; }
.field-label-line span.over-limit { color: var(--red); }
.upload-zone { display: grid; place-items: center; min-height: 164px; padding: 24px; border: 1px dashed #cfd3da; border-radius: 14px; color: var(--muted); background: var(--surface-soft); text-align: center; cursor: pointer; transition: .15s; }
.upload-zone:hover { color: var(--ink); border-color: #b6bbc4; background: #f7f8fa; }
.upload-zone svg { width: 25px; height: 25px; margin-bottom: 9px; color: var(--accent-dark); }
.upload-zone strong { color: var(--ink); font-size: 12px; }
.upload-zone span { margin-top: 4px; font-size: 9px; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.check-row { display: flex; align-items: center; gap: 9px; color: var(--muted-strong); font-size: 10px; cursor: pointer; }
.check-row input { width: 17px; height: 17px; min-height: 0; }
.info-card.visible { display: flex; }

.telegram-preview-card { overflow: hidden; border: 1px solid #dfe3e9; border-radius: 18px; background: #fff; box-shadow: var(--shadow-md); }
.telegram-preview-card > header { display: flex; align-items: center; gap: 10px; padding: 15px 16px 12px; }
.preview-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #241b09; background: linear-gradient(145deg, #f5c85a, #c88312); font-size: 10px; font-weight: 900; }
.telegram-preview-card header strong, .telegram-preview-card header small { display: block; }
.telegram-preview-card header strong { font-size: 11px; }
.telegram-preview-card header small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.preview-media { width: 100%; max-height: 380px; overflow: hidden; background: #edf0f4; }
.preview-media img, .preview-media video { display: block; width: 100%; max-height: 380px; object-fit: cover; }
.hidden { display: none !important; }
.telegram-preview-card > p { margin: 0; padding: 15px 16px; min-height: 70px; color: #22262c; font-size: 11px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-button { display: block; width: calc(100% - 32px); min-height: 38px; margin: 0 16px 14px; border: 0; border-radius: 9px; color: #286ca8; background: #eef6fd; font-size: 10px; font-weight: 800; }
.telegram-preview-card > footer { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); color: #989da6; font-size: 8px; }
.schedule-card { padding: 17px; }
.publication-actions { display: grid; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.95); box-shadow: var(--shadow-md); }
.danger-zone { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 22px; padding: 18px 20px; border: 1px solid #efd8da; border-radius: 14px; background: #fffafa; }
.danger-zone strong, .danger-zone p { display: block; }
.danger-zone strong { color: var(--red); font-size: 11px; }
.danger-zone p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: minmax(0, 1fr) 280px; }
  .detail-grid { grid-template-columns: 1fr; }
  .publication-editor { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 24px 0 70px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 25; display: block; background: rgba(10,12,15,.48); opacity: 0; pointer-events: none; transition: opacity .2s ease; backdrop-filter: blur(2px); }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  body.navigation-open { overflow: hidden; }
  .main { margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.88); backdrop-filter: blur(16px); }
  .mobile-brand { text-decoration: none; font-size: 12px; font-weight: 800; }
  .page-container { padding: 25px 20px 50px; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-aside { order: -1; }
  .info-card { display: none; }
  .sticky-actions { position: static; justify-content: flex-end; }
  .detail-grid.balanced { grid-template-columns: 1fr; }
  .onboarding-layout, .publication-editor { grid-template-columns: 1fr; }
  .publication-sidebar { position: static; }
}

@media (max-width: 620px) {
  .page-container { padding: 22px 14px 42px; }
  .page-header { align-items: stretch; flex-direction: column; margin-bottom: 22px; }
  .page-header h1 { font-size: 26px; }
  .page-actions { justify-content: flex-start; }
  .page-actions .button { width: 100%; }
  .metrics-grid { grid-template-columns: 1fr; gap: 9px; }
  .metric-card { padding: 15px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip > div { border-top: 1px solid var(--line); }
  .summary-strip > div:nth-child(-n+2) { border-top: 0; }
  .summary-strip > div:nth-child(odd) { border-left: 0; }
  .content-row { grid-template-columns: 34px minmax(0, 1fr) auto; padding: 12px 13px; }
  .row-action span { display: none; }
  .content-row > .status { display: none; }
  .resource-card { grid-template-columns: minmax(0, 1fr) auto; padding: 17px; }
  .resource-icon { display: none; }
  .resource-copy > strong { font-size: 15px; }
  .card { padding: 18px; }
  .feed-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .feed-item .status { display: none; }
  .result-card { min-height: 0; }
  .form-footer { align-items: stretch; flex-direction: column; }
  .form-footer .button { width: 100%; }
  .message-bubble { width: 94%; }
  .table-shell { border-radius: 12px; }
  table { min-width: 760px; }
  .search-bar { max-width: none; }
  .search-bar .button { padding-inline: 12px; }
  .login-card { padding: 28px 23px; }
  .toast { top: auto; right: 16px; bottom: 16px; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone .button { width: 100%; }
}
