:root {
  color-scheme: light;
  --bg: #f5efe6;
  --panel: #fffaf4;
  --panel-strong: #fffdf9;
  --line: #e1d6c6;
  --text: #1f1a17;
  --muted: #6b6158;
  --accent: #b4451d;
  --accent-dark: #8b3213;
  --accent-soft: rgba(180, 69, 29, 0.12);
  --success: #225a36;
  --shadow: 0 22px 60px rgba(71, 46, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(180, 69, 29, 0.08), transparent 22%),
    radial-gradient(circle at top right, rgba(70, 102, 59, 0.08), transparent 18%),
    linear-gradient(180deg, #f9f4ed 0%, var(--bg) 100%);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid rgba(160, 132, 97, 0.18);
  background: rgba(255, 249, 242, 0.78);
  backdrop-filter: blur(16px);
}

.brand-card,
.auth-card,
.status-card,
.toolbar-card,
.bulk-card,
.panel-card,
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.brand-card,
.auth-card,
.status-card {
  padding: 20px;
  margin-bottom: 18px;
}

.brand-eyebrow,
.section-eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-card h1,
.section-header h2 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.05;
  font-weight: 800;
}

.brand-card p,
.section-copy,
.muted-text,
.summary-box {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.nav-tabs {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.nav-tab,
button,
select,
input,
textarea {
  font: inherit;
}

.nav-tab,
button {
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.nav-tab {
  padding: 14px 16px;
  text-align: left;
  background: rgba(180, 69, 29, 0.06);
  color: var(--text);
  font-weight: 700;
}

.nav-tab.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, #cc6432 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(180, 69, 29, 0.25);
}

.content {
  padding: 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

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

.panel-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 18px;
}

.panel-card,
.toolbar-card,
.bulk-card,
.table-card {
  padding: 20px;
  margin-bottom: 18px;
}

.panel-card h3,
.bulk-card h3 {
  margin: 0 0 14px;
  font-size: 19px;
}

.import-toolbar-grid-secondary {
  margin-top: 14px;
}

.compact-field-stack {
  margin-top: 12px;
}

.compact-button-row {
  flex-wrap: wrap;
}

.field-stack,
.field-grid label,
.toolbar-grid label {
  display: grid;
  gap: 8px;
}

.field-stack {
  margin-top: 16px;
}

.field-grid,
.toolbar-grid {
  display: grid;
  gap: 14px;
}

.field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.toolbar-grid {
  grid-template-columns: 1.6fr minmax(180px, 220px) minmax(160px, 220px);
  align-items: end;
}

.users-toolbar-grid {
  grid-template-columns: 1.2fr 1.2fr 180px 140px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(180, 69, 29, 0.18);
  border-color: rgba(180, 69, 29, 0.4);
}

button {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #cc6432 100%);
  color: #fff;
  font-weight: 700;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-button,
.small-button {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid rgba(180, 69, 29, 0.28);
}

.small-button {
  padding: 10px 12px;
}

.button-row,
.inline-row,
.toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button-row {
  margin-top: 16px;
}

.selection-summary {
  color: var(--muted);
  font-size: 14px;
}

.row-action-stack {
  display: grid;
  gap: 8px;
  min-width: 160px;
}

.switch-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
}

.choice-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.summary-box {
  min-height: 88px;
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(180, 69, 29, 0.28);
  background: rgba(255, 255, 255, 0.64);
}

.json-preview {
  min-height: 420px;
  margin: 16px 0 0;
  padding: 16px;
  overflow: auto;
  border-radius: 18px;
  background: #1d1a18;
  color: #ece6de;
  font: 13px/1.55 "SFMono-Regular", "Menlo", monospace;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.status-line:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
}

.table-toolbar {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(160, 132, 97, 0.16);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(160, 132, 97, 0.16);
  vertical-align: top;
  text-align: left;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
  font-size: 13px;
  color: var(--muted);
}

.checkbox-col {
  width: 44px;
}

.primary-cell {
  font-weight: 700;
}

.secondary-cell {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.labels-cell,
.chat-titles-cell {
  color: var(--muted);
  line-height: 1.45;
}

.platform-cell {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.mono-text,
.user-id-cell {
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 12px;
}

.empty-state-cell {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 40;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #1f1a17;
  color: #fff7f0;
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.18);
}

.toast.success {
  background: var(--success);
}

@media (max-width: 1100px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(160, 132, 97, 0.18);
  }

  .panel-grid,
  .toolbar-grid,
  .users-toolbar-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    align-items: start;
    flex-direction: column;
  }
}
