:root {
  --bg: #100d0b;
  --panel: #17110d;
  --card: #241a13;
  --input: #120e0b;
  --text: #f5eadb;
  --muted: #bda98f;
  --line: rgba(255,255,255,.12);
  --gold: #c9963a;
  --gold-soft: #342514;
  --danger: #e16666;
  --shadow: 0 14px 42px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #2b1e13 0, #100d0b 40%, #0b0a09 100%);
  color: var(--text);
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
.hidden { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 18px; }

.login-card {
  width: min(390px, 100%);
  background: rgba(23,17,13,.94);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 26px;
  font-weight: 900;
}

.brand-mark.small { width: 36px; height: 36px; border-radius: 13px; font-size: 19px; }

h1, h2, h3, p { margin-top: 0; }
.login-card h1, .topbar h1, .section-header h2, .card h3 { margin-bottom: 4px; }
.login-card p, .topbar p, .section-header p, .helper { color: var(--muted); line-height: 1.35; margin-bottom: 10px; }

label { display: grid; gap: 5px; color: var(--muted); font-weight: 700; font-size: 13px; }

input, select, textarea {
  width: 100%;
  color: var(--text);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 250px;
  resize: vertical;
  line-height: 1.28;
  font-family: "Cascadia Mono", "Consolas", "Courier New", monospace;
  font-size: 14px;
  white-space: pre;
  overflow-wrap: normal;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(201,150,58,.8);
  box-shadow: 0 0 0 3px rgba(201,150,58,.12);
}

.primary-button, .secondary-button, .ghost-button, .nav-button, .mini-button, .danger-button {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 13px;
}

.primary-button { background: var(--gold); color: #1b1208; }
.secondary-button { background: #2b2017; color: var(--text); border: 1px solid var(--line); }
.ghost-button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.danger-button { background: rgba(225,102,102,.14); color: #ffb0b0; border: 1px solid rgba(225,102,102,.38); }
.mini-button { padding: 6px 9px; background: #2b2017; color: var(--text); border: 1px solid var(--line); }

.message { min-height: 20px; color: var(--danger); margin-bottom: 0; }

.dashboard { min-height: 100vh; display: grid; grid-template-columns: 230px 1fr; }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
  background: rgba(16,12,9,.92);
  border-right: 1px solid var(--line);
}

.sidebar-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.sidebar-brand h2 { margin: 0; font-size: 18px; }
.sidebar-brand span, .sidebar-footer p { color: var(--muted); font-size: 12px; }
.nav-button { text-align: left; background: transparent; color: var(--muted); }
.nav-button.active { color: #1b1208; background: var(--gold); }
.sidebar-footer { margin-top: auto; }

.content { padding: 18px; }

.topbar, .section-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.topbar h1 { font-size: 24px; }
.section-header h2 { font-size: 20px; }
.panel-section { margin-top: 16px; }

.card {
  background: rgba(36,26,19,.94);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,.16);
}

.card-list { display: grid; gap: 9px; margin-top: 12px; }

.item-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: rgba(36,26,19,.9);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 13px;
}

.item-card h3 { margin: 0 0 4px; font-size: 16px; }
.item-card p { margin: 0; color: var(--muted); font-size: 12px; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.form-grid { display: grid; gap: 10px; align-items: end; }
.form-grid.two { grid-template-columns: repeat(2, minmax(150px, 1fr)); }

.category-form { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; }

.check-row { display: flex; gap: 8px; align-items: center; }
.check-row input { width: auto; }

.editor-layout { display: grid; grid-template-columns: minmax(430px, 1fr) 520px; gap: 14px; align-items: start; }
.editor-column { display: grid; gap: 12px; }
.preview-column { position: sticky; top: 14px; }

.phone-preview {
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 12px;
  background: #0b0908;
  box-shadow: var(--shadow);
}

.phone-top { display: flex; justify-content: space-between; color: var(--text); padding: 5px 5px 10px; font-weight: 800; font-size: 13px; }

iframe { width: 100%; height: 650px; border: 0; border-radius: 20px; background: #18130f; }

.html-card summary { cursor: pointer; font-weight: 800; }
.html-card textarea { margin-top: 10px; min-height: 180px; }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--gold);
  color: #1b1208;
  padding: 10px 13px;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

code { color: #f3c76d; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .editor-layout { grid-template-columns: 1fr; }
  .preview-column { position: static; }
}

@media (max-width: 980px) {
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .form-grid.two, .category-form { grid-template-columns: 1fr; }
  .topbar, .section-header { align-items: flex-start; flex-direction: column; }
}
