:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --panel-muted: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-border: rgba(148, 163, 184, 0.16);
  --text: #1e293b;
  --muted: #64748b;
  --line: #dbe3ef;
  --accent: #0f5dd7;
  --accent-soft: #e8f0ff;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success-soft: #dcfce7;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 93, 215, 0.12), transparent 24%),
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

button {
  border: 0;
}

.layout {
  min-height: 100vh;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, calc(100vw - 32px));
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94)),
    var(--sidebar);
  color: #f8fafc;
  transform: translateX(calc(-100% - 24px));
  transition: transform 0.24s ease;
  z-index: 40;
  box-shadow: var(--shadow);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 22px 18px 18px;
}

body.sidebar-open .sidebar {
  transform: translateX(0);
}

body.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.sidebar__header,
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sidebar__eyebrow,
.topbar__eyebrow {
  margin: 0 0 4px;
  color: #93c5fd;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar__header h2,
.topbar__title {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
}

.sidebar__close,
.menu-toggle {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
}

.menu-toggle {
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar__nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  padding: 12px 14px;
  border-radius: 14px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.sidebar__button {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}

.sidebar__link:hover,
.sidebar__link.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 18px;
}

.page {
  padding: 24px;
}

.topbar {
  margin-bottom: 20px;
}

.topbar__meta {
  min-width: 0;
}

.topbar__title {
  font-size: 22px;
  font-weight: 700;
}

.content {
  display: block;
}

.card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid rgba(219, 227, 239, 0.72);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1,
.card h1,
.card h2 {
  margin-top: 0;
}

.page-header p {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section-head__eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head__title {
  margin: 0;
}

.section-head__copy p:last-child {
  margin-bottom: 0;
}

.section-head__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--success-soft);
  color: #166534;
  border: 1px solid rgba(22, 101, 52, 0.12);
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.metric {
  background: linear-gradient(180deg, var(--accent-soft), #f8fbff);
  border-radius: 16px;
  padding: 18px;
  border: 1px solid rgba(15, 93, 215, 0.12);
}

.metric strong {
  font-size: 28px;
}

.table-shell {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--text);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

input,
textarea,
select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #cfd8e3;
  border-radius: 12px;
  margin-bottom: 14px;
  background: #fff;
}

textarea {
  resize: vertical;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.field-group label {
  margin-bottom: 8px;
}

.field-group input,
.field-group textarea,
.field-group select {
  margin-bottom: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 16px;
  font-weight: 500;
}

.checkbox input {
  width: auto;
  margin: 0;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 42px;
  text-align: center;
}

.button-secondary {
  background: #edf2ff;
  color: #1e40af;
}

.button-muted {
  background: #e2e8f0;
  color: var(--text);
}

.button-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.button-full {
  width: 100%;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

.editor-panel,
.helper-card {
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 18px;
  padding: 18px;
}

.editor-panel {
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.editor-panel h2,
.helper-card h3,
.table-header h2 {
  margin: 0 0 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-group--wide {
  grid-column: 1 / -1;
}

.settings-group {
  margin: 16px 0;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  overflow: hidden;
}

.settings-group summary {
  cursor: pointer;
  padding: 16px 18px;
  list-style: none;
}

.settings-group summary::-webkit-details-marker {
  display: none;
}

.settings-group summary span {
  display: grid;
  gap: 4px;
}

.settings-group summary small {
  color: var(--muted);
  font-weight: 500;
}

.settings-group__grid {
  padding: 0 18px 18px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.form-hint {
  max-width: 420px;
}

.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.helper-card {
  background: linear-gradient(180deg, #f8fbff, #f3f7fe);
}

.helper-points {
  display: grid;
  gap: 12px;
}

.helper-point {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(15, 93, 215, 0.08);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 12px 0 18px;
}

.image-card {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 14px;
  border-radius: 16px;
  background: var(--panel-muted);
  border: 1px solid rgba(219, 227, 239, 0.9);
}

.image-card p {
  margin: 6px 0 0;
}

.table-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.table-header__copy p {
  margin: 0;
}

.table-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 16px;
  background: var(--panel-muted);
  border: 1px dashed var(--line);
}

.preview {
  width: 88px;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.preview-large {
  width: 240px;
}

.login-shell {
  max-width: 440px;
  margin: 80px auto;
}

.login-shell h1 {
  margin-top: 0;
}

.sortable-row {
  cursor: grab;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.sortable-row:hover {
  background: #f8fbff;
}

.sortable-row.is-dragging {
  opacity: 0.55;
  background: #eef4ff;
  transform: scale(0.995);
  box-shadow: 0 12px 24px rgba(15, 93, 215, 0.10);
}

.sortable-row.is-selected {
  background: #f0f6ff;
}

.drag-cell {
  width: 54px;
}

.drag-handle {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, #e8f0ff);
  color: var(--accent);
  cursor: grab;
  border: 1px solid rgba(15, 93, 215, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.sortable-row:hover .drag-handle {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 93, 215, 0.12);
}

.sortable-row.is-dragging .drag-handle {
  cursor: grabbing;
}

.sortable-status {
  min-height: 20px;
  margin: 12px 0 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--text);
  font-size: 13px;
}

.pill-success {
  background: var(--success-soft);
  color: #166534;
}

.pill-muted {
  background: #e2e8f0;
  color: var(--muted);
}

.detail-list p {
  margin: 0 0 10px;
}

.broadcast-message {
  white-space: normal;
  line-height: 1.55;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel-muted);
  border: 1px solid var(--line);
}

@media (max-width: 768px) {
  .page {
    padding: 16px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .topbar__title {
    font-size: 18px;
  }

  th,
  td {
    padding: 10px 8px;
  }

  .editor-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .table-hint {
    width: 100%;
    justify-content: center;
  }
}
