/* Core layout and theme styles. */
:root {
  --bg-1: #0f1417;
  --bg-2: #101c22;
  --ink: #f5f1e8;
  --muted: #9fb0b9;
  --accent: #e08a2e;
  --accent-strong: #c46b18;
  --accent-soft: rgba(224, 138, 46, 0.2);
  --line: #22303a;
  --panel: #131b20;
  --panel-strong: #1b2630;
  --panel-soft: #162028;
  --glow: rgba(224, 138, 46, 0.18);
  --sidebar-width: 260px;
  --bottom-height: 150px;
  --status-height: 46px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  position: relative;
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -20% 0 0 0;
  background: radial-gradient(circle at 10% 20%, rgba(224, 138, 46, 0.18), transparent 55%),
    radial-gradient(circle at 85% 10%, rgba(79, 127, 150, 0.2), transparent 48%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(255, 255, 255, 0.04) 0%, transparent 35%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 120px);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

body.resizing-col {
  cursor: col-resize;
  user-select: none;
}

body.resizing-row {
  cursor: row-resize;
  user-select: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 18px 30px;
  background: rgba(16, 23, 29, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(19, 28, 34, 0.9);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
  color: var(--ink);
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(224, 138, 46, 0.6);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  font-size: 1.1rem;
  text-transform: uppercase;
}

.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  display: grid;
  place-items: center;
  color: #1c1b17;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.brand-badge svg {
  width: 32px;
  height: 32px;
}

.menu {
  display: flex;
  gap: 18px;
  font-weight: 600;
  position: relative;
}

.menu button {
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.menu button.active,
.menu button:hover {
  background: rgba(224, 138, 46, 0.16);
  color: #ffffff;
  border-color: rgba(224, 138, 46, 0.35);
}

.menu-group {
  position: relative;
}

.menu-dropdown {
  position: absolute;
  top: 42px;
  left: 0;
  background: #111a20;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  min-width: 220px;
  display: none;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.menu-dropdown.show {
  display: flex;
}

.menu-dropdown button {
  background: rgba(22, 32, 40, 0.95);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  border: 1px solid transparent;
}

.menu-dropdown button:hover {
  border-color: rgba(224, 138, 46, 0.4);
  color: #ffffff;
}

.menu-dropdown button:active {
  transform: translateY(1px);
}

.settings-dropdown {
  right: 0;
  left: auto;
  min-width: 200px;
}

.app {
  flex: 1;
  display: grid;
  grid-template-columns: var(--sidebar-width) 2px 1fr;
  gap: 0;
  padding: 0;
  align-items: stretch;
  position: relative;
  z-index: 1;
}

body.sidebar-hidden .app {
  grid-template-columns: 1fr;
}

body.sidebar-hidden .sidebar,
body.sidebar-hidden .divider {
  display: none;
}

.sidebar {
  background: rgba(17, 26, 32, 0.96);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.sidebar h3 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(22, 32, 40, 0.9);
  cursor: pointer;
  font-weight: 600;
  color: #ffffff;
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.action:hover {
  transform: translateY(-1px);
  border-color: rgba(224, 138, 46, 0.5);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.action.secondary {
  background: rgba(24, 36, 44, 0.9);
}

.resizer {
  background: var(--line);
  touch-action: none;
}

.divider {
  width: 2px;
  cursor: col-resize;
  margin: 0;
  user-select: none;
}

.panel {
  background: rgba(19, 27, 32, 0.96);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  overflow: hidden;
  border: none;
}

.panel h1 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.02em;
}

.right-pane {
  display: grid;
  grid-template-rows: 1fr 2px var(--bottom-height);
  gap: 0;
  min-width: 0;
  min-height: 0;
  padding-bottom: var(--status-height);
}

.view-content {
  height: 100%;
  overflow: auto;
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.view-title {
  margin: 0;
  font-size: 1.7rem;
}

.view-lead {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 1.05rem;
}

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

.view-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(19, 28, 35, 0.9);
}

.view-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.view-value {
  margin-top: 8px;
  font-size: 17px;
  color: var(--ink);
}

.view-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.panel-body.hidden {
  display: none;
}

.view-content.hidden {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 24, 30, 0.7);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  width: fit-content;
}

.wizard-shell {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 18px;
}

.wizard-steps {
  background: rgba(16, 24, 30, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.wizard-steps button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wizard-steps button.active {
  background: rgba(224, 138, 46, 0.16);
  color: #ffffff;
  border-color: rgba(224, 138, 46, 0.35);
}

.wizard-steps button:hover {
  border-color: rgba(224, 138, 46, 0.35);
  color: #ffffff;
}

.step-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.step-pill.ready {
  background: rgba(120, 178, 133, 0.2);
  color: #b8f5c2;
  border-color: rgba(120, 178, 133, 0.4);
}

.step-pill.pending {
  background: rgba(224, 138, 46, 0.16);
  color: #ffd7ab;
  border-color: rgba(224, 138, 46, 0.3);
}

.step-pill.missing {
  background: rgba(210, 83, 83, 0.2);
  color: #ffb6b6;
  border-color: rgba(210, 83, 83, 0.4);
}

.wizard-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wizard-alerts {
  display: grid;
  gap: 8px;
}

.alert {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(20, 31, 38, 0.85);
  font-size: 0.95rem;
}

.alert strong {
  color: var(--accent);
}

.alert.warning {
  border-color: rgba(210, 83, 83, 0.4);
  background: rgba(46, 20, 20, 0.5);
}

.alert.info {
  border-color: rgba(224, 138, 46, 0.3);
}

.wizard-step {
  display: none;
  background: rgba(18, 27, 33, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.wizard-step.active {
  display: block;
}

.wizard-step h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
}

.wizard-step .step-meta {
  color: var(--muted);
  margin-bottom: 12px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field input,
.field select,
.field textarea {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: rgba(16, 24, 30, 0.95);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

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

.inline-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(16, 24, 30, 0.85);
  cursor: pointer;
}

.option-chip input {
  margin: 0;
}

.rule-hint {
  background: rgba(224, 138, 46, 0.1);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.step-actions button {
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  background: rgba(20, 31, 38, 0.9);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.step-actions .primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1c1b17;
  border: none;
}

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

.summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  background: rgba(16, 24, 30, 0.85);
}

.summary-card h4 {
  margin: 0 0 8px;
  color: var(--accent);
}

.list-grid {
  display: grid;
  gap: 8px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(20, 30, 38, 0.85);
}

.list-item span {
  color: var(--muted);
}

.command-bar {
  padding: 16px 20px;
  background: rgba(14, 21, 26, 0.96);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-end;
  z-index: 4;
  pointer-events: auto;
}

.command-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.command-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
}

.command-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.command-chip {
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.command-resizer {
  height: 2px;
  cursor: row-resize;
  width: 100%;
  user-select: none;
}

.command-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  margin: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(18, 27, 34, 0.9);
  flex: 1;
  min-height: 60px;
  pointer-events: auto;
}

.command-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-family: "Rajdhani", "Segoe UI", sans-serif;
  outline: none;
  height: 100%;
  resize: none;
  padding: 0;
  cursor: text;
  caret-color: var(--ink);
  pointer-events: auto;
}

.command-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.command-input::placeholder {
  color: var(--muted);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 22px;
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: 0.82rem;
  background: rgba(13, 18, 22, 0.98);
  color: var(--ink);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--status-height);
  align-items: center;
  z-index: 6;
  border-top: 1px solid var(--line);
}

.status-link {
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.status-link:hover {
  color: #ffffff;
}

.bell-indicator {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  color: #ffffff;
  vertical-align: middle;
}

.bell-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.bell-indicator.active .bell-icon {
  fill: currentColor;
  stroke: currentColor;
}

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

.card {
  border-radius: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(18, 26, 32, 0.85);
}

.card strong {
  display: block;
  margin-bottom: 6px;
}

.content {
  line-height: 1.6;
  font-size: 1.02rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none;
}

body[data-theme="light"] {
  --bg-1: #f5f0e8;
  --bg-2: #ded6c9;
  --ink: #1e2428;
  --muted: #5e6a72;
  --accent: #d06c1c;
  --accent-strong: #a75715;
  --line: #c7c0b6;
  --panel: #fdfaf5;
  --panel-strong: #f4efe6;
  --panel-soft: #efe9df;
  --glow: rgba(208, 108, 28, 0.16);
}

body[data-theme="light"] .topbar,
body[data-theme="light"] .sidebar,
body[data-theme="light"] .panel,
body[data-theme="light"] .command-bar,
body[data-theme="light"] .status-bar {
  background: rgba(249, 245, 238, 0.95);
  color: var(--ink);
}

body[data-theme="light"] .menu-dropdown,
body[data-theme="light"] .wizard-steps,
body[data-theme="light"] .wizard-step,
body[data-theme="light"] .view-card,
body[data-theme="light"] .summary-card,
body[data-theme="light"] .list-item,
body[data-theme="light"] .card,
body[data-theme="light"] .command-form {
  background: rgba(255, 255, 255, 0.95);
}

body[data-theme="light"] .icon-button {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

body[data-theme="light"] .action,
body[data-theme="light"] .action.secondary,
body[data-theme="light"] .option-chip {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

body[data-theme="light"] .menu button.active,
body[data-theme="light"] .menu button:hover,
body[data-theme="light"] .wizard-steps button.active {
  color: var(--ink);
}

.fade-in {
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .wizard-steps {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .wizard-steps button {
    flex: 1 1 160px;
  }
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: 1fr;
  }

  .divider {
    display: none;
  }
}

@media (max-width: 820px) {
  .top-left {
    flex-wrap: wrap;
  }

  .menu {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 6px 2px;
    scrollbar-width: none;
  }

  .menu::-webkit-scrollbar {
    display: none;
  }

  .menu-group {
    flex: 0 0 auto;
  }

  .menu button {
    font-size: 0.92rem;
    padding: 6px 10px;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .menu {
    flex-wrap: wrap;
  }

  .command-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
