@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --bg-0: #071018;
  --bg-1: #0d1b26;
  --bg-2: #132735;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f8ff;
  --muted: rgba(226, 236, 248, 0.62);
  --accent: #00c6fb;
  --accent-2: #f7971e;
  --accent-soft: rgba(0, 198, 251, 0.14);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.16);
  --danger: #ff6b7a;
  --danger-soft: rgba(255, 107, 122, 0.16);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --focus: 0 0 0 3px rgba(0, 198, 251, 0.28);
  --font: "Plus Jakarta Sans", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(1100px 520px at 8% -10%, rgba(0, 198, 251, 0.18), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(247, 151, 30, 0.14), transparent 50%),
    linear-gradient(160deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
  min-height: 100vh;
  letter-spacing: -0.01em;
}

::selection {
  background: rgba(0, 198, 251, 0.28);
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card, .panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(420px, 100%);
  padding: 30px;
}

.auth-card form .btn,
.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 4px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 18px rgba(0, 198, 251, 0.22));
}

.admin-header .brand-lockup {
  margin-bottom: 0;
}

.admin-header .brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 16, 24, 0.55);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.admin-header h1 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.muted { color: var(--muted); margin: 0; font-size: 0.86rem; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.header-actions, .editor-actions, .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 22px 36px;
  --projects-pane-width: 32%;
}

.site-settings-panel {
  width: 100%;
}

.workspace-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  width: 100%;
}

.projects-panel {
  flex: 0 0 var(--projects-pane-width);
  width: var(--projects-pane-width);
  max-width: calc(100% - 340px);
  min-width: 260px;
  min-height: 0;
  overflow: auto;
}

.pane-resizer {
  flex: 0 0 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: col-resize;
  touch-action: none;
  user-select: none;
  margin: 0 2px;
  border-radius: 999px;
  background: transparent;
}

.pane-resizer:hover,
.pane-resizer:focus-visible,
.workspace-row.is-resizing .pane-resizer {
  background: rgba(0, 198, 251, 0.12);
  outline: none;
}

.workspace-row.is-resizing,
.workspace-row.is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.editor-panel {
  flex: 1 1 auto;
  min-width: 320px;
  min-height: 0;
  overflow: auto;
  overflow-x: auto;
}

.editor-panel-head {
  margin-bottom: 14px;
}

.editor-panel .editor-form,
.editor-panel .section-editor,
.editor-panel label,
.editor-panel input,
.editor-panel textarea,
.editor-panel select {
  min-width: 0;
  max-width: 100%;
}

.editor-panel .editor-form {
  overflow-x: hidden;
}

.editor-panel textarea,
.editor-panel input[type="text"],
.editor-panel input:not([type]),
.editor-panel input[type="number"],
.editor-panel input[type="search"],
.editor-panel input[type="password"] {
  width: 100%;
  box-sizing: border-box;
}

.logo-preview-wrap {
  display: grid;
  gap: 8px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.logo-preview {
  display: block;
  height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22));
}

.brand-assets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 8px 0 14px;
}

.obs-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.obs-stat {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.obs-stat.accent {
  border-color: rgba(247, 151, 30, 0.35);
  background: rgba(247, 151, 30, 0.12);
}

.obs-stat-value {
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.obs-stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.obs-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}

.obs-tab {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 650;
  cursor: pointer;
}

.obs-tab.is-active {
  background: linear-gradient(135deg, rgba(0, 198, 251, 0.28), rgba(247, 151, 30, 0.2));
  border-color: rgba(0, 198, 251, 0.35);
}

#obsMessageRows tr.is-unread td {
  background: rgba(247, 151, 30, 0.08);
}

#obsCommentRows tr.is-hidden-row td {
  opacity: 0.55;
}

.brand-asset-card {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-asset-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 72px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
}

.brand-asset-preview-wrap.is-favicon {
  min-height: 56px;
}

.brand-asset-preview {
  display: block;
  height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.brand-asset-preview-wrap.is-favicon .brand-asset-preview {
  height: 32px;
  width: 32px;
}

.sync-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sync-panel h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
}

.sync-status-log {
  margin-top: 12px;
}

.panel { padding: 18px; }
.panel > h2,
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.45;
}

.order-cell {
  width: 1%;
  white-space: nowrap;
}

.order-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-input {
  width: 52px;
  min-width: 52px;
  text-align: center;
  padding: 6px 4px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
}

.order-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.order-btn:disabled:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
}

.search-wrap {
  position: relative;
  min-width: min(260px, 100%);
}

.search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  opacity: 0.55;
  pointer-events: none;
}

.search-wrap input {
  padding-left: 36px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(243, 248, 255, 0.82);
}

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

input, textarea, select {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  padding: 9px 12px;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

input:hover, textarea:hover, select:hover {
  border-color: var(--border-strong);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(0, 198, 251, 0.55);
  box-shadow: var(--focus);
  background: rgba(0, 0, 0, 0.36);
}

textarea { resize: vertical; min-height: 72px; }

.btn {
  --btn-pad-y: 9px;
  --btn-pad-x: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transition: transform 0.16s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
}

.btn:active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071018;
  box-shadow: 0 8px 22px rgba(0, 198, 251, 0.18);
}

.btn.primary:hover {
  box-shadow: 0 10px 26px rgba(0, 198, 251, 0.28);
  background: linear-gradient(135deg, #19d2ff, #ffa53a);
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--border);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
}

.btn.compact {
  --btn-pad-y: 6px;
  --btn-pad-x: 12px;
  font-size: 0.8rem;
  min-height: 32px;
}

.btn.small {
  --btn-pad-y: 6px;
  --btn-pad-x: 10px;
  font-size: 0.78rem;
  min-height: 30px;
}

.btn.danger {
  background: var(--danger-soft);
  color: #ffd2d7;
  border-color: rgba(255, 107, 122, 0.28);
}

.btn.danger:hover {
  background: rgba(255, 107, 122, 0.26);
}

.btn.icon-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.icon-btn svg {
  width: 15px;
  height: 15px;
}

.btn.icon-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--border-strong);
}

.btn.icon-btn.edit:hover {
  color: var(--accent);
  border-color: rgba(0, 198, 251, 0.35);
  background: var(--accent-soft);
}

.btn.icon-btn.toggle:hover {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.35);
  background: var(--warning-soft);
}

.btn.icon-btn.reimport:hover {
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(125, 211, 252, 0.12);
}

.btn.icon-btn.danger {
  color: #ffc4cb;
  background: var(--danger-soft);
  border-color: rgba(255, 107, 122, 0.28);
}

.btn.icon-btn.danger:hover {
  background: rgba(255, 107, 122, 0.28);
}

.actions {
  gap: 6px;
  justify-content: flex-start;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 210px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

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

th, td {
  border-bottom: 1px solid var(--border);
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 0.86rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(10, 22, 32, 0.94);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tbody tr {
  transition: background 0.15s var(--ease);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

tbody tr:last-child td { border-bottom: none; }

td code {
  font-size: 0.78rem;
  color: rgba(186, 230, 253, 0.92);
  background: rgba(0, 198, 251, 0.08);
  border: 1px solid rgba(0, 198, 251, 0.12);
  padding: 3px 7px;
  border-radius: 8px;
}

.thumb {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.94);
  padding: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.pill.on {
  background: var(--success-soft);
  color: #a7f3d0;
  border-color: rgba(52, 211, 153, 0.22);
}

.pill.off {
  background: var(--danger-soft);
  color: #ffc4cb;
  border-color: rgba(255, 107, 122, 0.22);
}

.pill.warn {
  background: var(--warning-soft);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.22);
}

.status-log {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.78rem;
  line-height: 1.5;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.editor-panel h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-panel h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(0, 198, 251, 0.55);
}

.content-editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
}

.content-editor-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 750;
}

.editor-mode-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
}

.editor-mode-toggle .btn {
  min-height: 28px;
  --btn-pad-y: 5px;
  --btn-pad-x: 11px;
  border: none;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.editor-mode-toggle .btn:hover {
  transform: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.editor-mode-toggle .btn.active {
  background: linear-gradient(135deg, rgba(0, 198, 251, 0.28), rgba(247, 151, 30, 0.22));
  color: #fff;
}

.section-editor {
  display: grid;
  gap: 12px;
}

.section-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
  min-width: 0;
  overflow: hidden;
}

.section-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.section-card-head strong {
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.section-card-actions {
  display: flex;
  gap: 5px;
}

.section-card .btn.icon-btn {
  width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: 9px;
}

.btn.add-section {
  width: 100%;
  min-height: 34px;
  --btn-pad-y: 7px;
  border-style: dashed;
  border-color: rgba(0, 198, 251, 0.28);
  background: rgba(0, 198, 251, 0.06);
  color: #b8ecff;
  font-size: 0.82rem;
}

.btn.add-section:hover {
  background: rgba(0, 198, 251, 0.12);
  border-color: rgba(0, 198, 251, 0.45);
}

.editor-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.editor-actions .btn {
  min-height: 34px;
  --btn-pad-y: 7px;
  --btn-pad-x: 14px;
  font-size: 0.82rem;
}

.content-preview-wrap {
  margin-top: 16px;
}

.content-preview-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.24);
  max-height: 480px;
  overflow: auto;
}

.error { color: #ffb4b4; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .workspace-row {
    flex-direction: column;
  }
  .projects-panel,
  .editor-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .pane-resizer {
    display: none;
  }
  .grid-3 { grid-template-columns: 1fr; }
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .table-wrap { max-height: none; }
}

@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .brand-assets-grid { grid-template-columns: 1fr; }
  .obs-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrap { min-width: 0; }
}
