/* ===== Reset ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }

/* ===== Theme Tokens ===== */
:root{
  --bg:#0b1220;
  --panel:#101b2d;
  --panel2:#0d1627;
  --text:#e6eefc;
  --muted:#91a4c7;
  --primary:#4f8cff;
  --primary2:#7c4dff;
  --border:rgba(255,255,255,.08);
  --shadow:0 10px 30px rgba(0,0,0,.45);
  --radius:14px;
  --ring: 0 0 0 3px rgba(79,140,255,.25);
}

[data-theme="light"]{
  --bg:#f5f7fb;
  --panel:#ffffff;
  --panel2:#ffffff;
  --text:#0e1726;
  --muted:#5e6b84;
  --primary:#2d6cff;
  --primary2:#7c4dff;
  --border:rgba(15,23,42,.12);
  --shadow:0 10px 30px rgba(15,23,42,.12);
  --ring: 0 0 0 3px rgba(45,108,255,.18);
}

/* ===== Layout ===== */
body{ background: var(--bg); color: var(--text); }
.app{ display:flex; height:100vh; }

.sidebar{
  width: 260px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-right: 1px solid var(--border);
  display:flex;
  flex-direction:column;
  padding: 18px 14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px 18px;
}
.brandLogo{
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(79,140,255,.15);
  border: 1px solid var(--border);
}
.brandName{ font-weight: 700; letter-spacing: .2px; }

.nav{ display:flex; flex-direction:column; gap: 8px; padding: 6px 6px; }
.navItem{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px solid transparent;
}
.navItem:hover{ background: rgba(255,255,255,.04); border-color: var(--border); color: var(--text); }
.navItem.active{ background: rgba(79,140,255,.14); color: var(--text); border-color: rgba(79,140,255,.25); }
.navIcon{ width: 20px; text-align:center; }

.navDivider{ height: 1px; background: var(--border); margin: 10px 6px; }

.sidebarFooter{
  margin-top:auto;
  padding: 10px 6px;
}
.hint{ margin-top: 10px; color: var(--muted); font-size: 12px; }

/* ===== Main ===== */
.main{ flex: 1; display:flex; flex-direction:column; }
.topbar{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.04);
  backdrop-filter: blur(10px);
}
.pageTitle{ font-weight: 800; font-size: 16px; }
.crumb{ color: var(--muted); font-size: 12px; margin-top: 4px; }

.contentGrid{
  display:grid;
  grid-template-columns: 360px 1.2fr 420px;
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 64px);
}

/* ===== Panels ===== */
.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.panelTitle{
  font-weight: 800;
  font-size: 14px;
  padding: 14px 16px 6px;
}
.panelDesc{
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.panelHead{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.panelHeadBtns{ display:flex; gap: 8px; padding: 14px 14px 0 0; }

/* ===== Form ===== */
.form{ padding: 0 16px 14px; display:flex; flex-direction:column; gap: 12px; }
.row{ display:flex; flex-direction:column; gap: 6px; }
label{ font-size: 12px; color: var(--muted); }
.subHint{ font-size: 11px; color: var(--muted); opacity: .9; }

input, select, textarea{
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  outline: none;
}
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea{
  background: rgba(15,23,42,.03);
}
input:focus, select:focus, textarea:focus{ box-shadow: var(--ring); border-color: rgba(79,140,255,.6); }

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

.toggles{ display:flex; flex-direction:column; gap: 8px; padding-top: 4px; }
.toggle{
  display:flex;
  align-items:center;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
}
.toggle input{ width: 16px; height: 16px; }

/* ===== Buttons ===== */
.btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}
.btn:hover{ background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border-color: rgba(79,140,255,.35);
}
.btn.ghost{ background: transparent; }
.btn.small{ padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.btn.full{ width: 100%; }
.btn.danger{ border-color: rgba(255,80,80,.35); color: #ffb4b4; }

/* ===== Actions ===== */
.actions{ padding: 0 16px 16px; display:flex; flex-direction:column; gap: 10px; }
.actionsRow{ display:flex; gap: 10px; }
.actionsRow .btn{ flex: 1; }

.miniStatus{
  padding: 0 16px 16px;
  display:flex;
  flex-direction:column;
  gap: 8px;
}
.badge{
  display:inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(79,140,255,.12);
  font-weight: 700;
  font-size: 12px;
}
.muted{ color: var(--muted); font-size: 12px; }

/* ===== Editor ===== */
.editor textarea{
  flex: 1;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 14px 16px;
  resize:none;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  background: rgba(0,0,0,.08);
}
[data-theme="light"] .editor textarea{
  background: rgba(15,23,42,.03);
}

.editorFooter{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 10px 14px;
}

/* ===== Suggestions ===== */
.suggestions input, .suggestions textarea{
  width: calc(100% - 32px);
  margin: 0 16px 12px;
}
.suggestBlock{
  border-top: 1px solid var(--border);
  padding: 12px 0;
}
.suggestTitle{
  font-size: 12px;
  color: var(--muted);
  padding: 0 16px 8px;
  font-weight: 700;
}
.suggestBody{
  padding: 0 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.suggestBody.empty{ color: var(--muted); }

/* ===== Toast ===== */
.toast{
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 260px;
  max-width: 520px;
  opacity: 0;
  pointer-events:none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 9999;
}
.toast.show{
  opacity: 1;
  pointer-events:auto;
  transform: translateX(-50%) translateY(2px);
}
.toastTitle{ font-weight: 800; margin-bottom: 4px; }
.toastMsg{ color: var(--muted); font-size: 12px; }

/* ===== Fix native select dropdown colors (Dark theme) ===== */
select {
  color-scheme: dark; /* hint browsers to render native controls for dark */
}

[data-theme="dark"] select,
[data-theme="dark"] option {
  background-color: #101b2d;
  color: #e6eefc;
}

[data-theme="light"] select,
[data-theme="light"] option {
  background-color: #ffffff;
  color: #0e1726;
}

/* Some browsers need this too */
select:focus {
  outline: none;
}

