:root {
  --bg: #f0f2f9;
  --bg2: #ffffff;
  --bg3: #f5f7ff;
  --bg4: #eaecf8;
  --bg5: #e3e8f5;
  --border: #d0d6ee;
  --border2: #b8c3e8;
  --text: #0f1628;
  --text2: #4a5880;
  --text3: #8a98c0;
  --accent: #3b78f0;
  --accent2: #6840f5;
  --aGlow: rgba(59, 120, 240, 0.12);
  --green: #18a87a;
  --gDim: rgba(24, 168, 122, 0.1);
  --amber: #d4890a;
  --aDim: rgba(212, 137, 10, 0.1);
  --red: #e03040;
  --rDim: rgba(224, 48, 64, 0.1);
  --r: 10px;
  --r-sm: 6px;
  --sh: 0 4px 24px rgba(0, 0, 0, 0.08);
  --sh-lg: 0 8px 48px rgba(0, 0, 0, 0.16);
  --sw: 260px;
  --hh: 56px;
  --font: "Outfit", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] {
  --bg: #080c14;
  --bg2: #0d1220;
  --bg3: #131929;
  --bg4: #1a2135;
  --bg5: #212843;
  --border: #1e2840;
  --border2: #28345a;
  --text: #dde4f5;
  --text2: #8898c4;
  --text3: #4a587a;
  --accent: #4f8eff;
  --accent2: #7c5cfc;
  --aGlow: rgba(79, 142, 255, 0.15);
  --green: #2ec99a;
  --gDim: rgba(46, 201, 154, 0.12);
  --amber: #f5a623;
  --aDim: rgba(245, 166, 35, 0.12);
  --red: #f0545a;
  --rDim: rgba(240, 84, 90, 0.12);
  --sh: 0 4px 32px rgba(0, 0, 0, 0.5);
  --sh-lg: 0 8px 64px rgba(0, 0, 0, 0.7);
}
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font);
}
input,
textarea,
select {
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  border: none;
}
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 9px;
}
.hidden {
  display: none !important;
}

/* AUTH */
#auth-wrap {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--sh-lg);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 32px;
}
.auth-brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.auth-brand .wm {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.auth-brand .wm span {
  color: var(--accent);
}
.auth-h {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-sub {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 28px;
}
.fld {
  margin-bottom: 15px;
}
.fld label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 6px;
}
.fld input,
.fld select {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  color: var(--text);
  transition: border-color 0.2s;
}
.fld input:focus,
.fld select:focus {
  border-color: var(--accent);
}
.auth-btn {
  width: 100%;
  padding: 11px;
  margin-top: 6px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  transition:
    opacity 0.2s,
    transform 0.15s;
}
.auth-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.auth-err {
  color: var(--red);
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}
.auth-demo {
  margin-top: 16px;
  padding: 10px 12px;
  background: var(--bg3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text3);
  line-height: 1.9;
  font-family: var(--mono);
}

/* SHELL */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}
@media (max-width: 768px) {
  #sb-overlay.vis {
    display: block;
  }
}

/* SIDEBAR */
#sidebar {
  width: var(--sw);
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
  transition: transform 0.28s var(--ease);
}
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }
}
.sb-logo {
  height: var(--hh);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.sb-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.sb-wm {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.sb-wm span {
  color: var(--accent);
}
.sb-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.sb-sec {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 14px 18px 6px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text2);
  font-weight: 500;
  font-size: 13.5px;
  transition:
    background 0.15s,
    color 0.15s;
}
.sb-item:hover {
  background: var(--bg3);
  color: var(--text);
}
.sb-item.active {
  background: var(--aGlow);
  color: var(--accent);
  font-weight: 600;
}
.sb-item svg {
  opacity: 0.65;
  flex-shrink: 0;
}
.sb-item.active svg {
  opacity: 1;
}
.sb-bottom {
  flex-shrink: 0;
  padding: 10px 8px;
  border-top: 1px solid var(--border);
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.sb-user:hover {
  background: var(--bg3);
}
.ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.sb-un {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}
.sb-ur {
  font-size: 11px;
  color: var(--text3);
}

/* MAIN */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
#hdr {
  height: var(--hh);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.hdr-menu {
  display: none;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  color: var(--text2);
  transition: background 0.15s;
  flex-shrink: 0;
}
.hdr-menu:hover {
  background: var(--bg3);
}
@media (max-width: 768px) {
  .hdr-menu {
    display: flex;
  }
}
.hdr-title {
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdr-acts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}
.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
}
.btn-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  box-shadow: 0 2px 12px rgba(59, 120, 240, 0.2);
}
.btn-accent:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.btn-ghost {
  border: 1.5px solid var(--border);
  color: var(--text2);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--bg3);
  color: var(--text);
  border-color: var(--border2);
}
.btn-danger {
  background: var(--rDim);
  color: var(--red);
  border: 1.5px solid rgba(224, 48, 64, 0.2);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: transparent;
}
.btn-green {
  background: var(--gDim);
  color: var(--green);
  border: 1.5px solid rgba(24, 168, 122, 0.2);
}
.btn-green:hover {
  background: var(--green);
  color: #fff;
  border-color: transparent;
}
.btn-amber {
  background: var(--aDim);
  color: var(--amber);
  border: 1.5px solid rgba(212, 137, 10, 0.2);
}
.btn-amber:hover {
  background: var(--amber);
  color: #fff;
  border-color: transparent;
}
.btn-ai {
  background: linear-gradient(
    135deg,
    rgba(59, 120, 240, 0.1),
    rgba(104, 64, 245, 0.1)
  );
  border: 1.5px solid rgba(59, 120, 240, 0.22);
  color: var(--accent);
}
.btn-ai:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border-color: transparent;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* CONTENT */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}
@media (max-width: 480px) {
  #content {
    padding: 14px;
  }
}
.view {
  display: none;
}
.view.active {
  display: block;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}
.b-idea {
  background: var(--aDim);
  color: var(--amber);
}
.b-spec {
  background: var(--aGlow);
  color: var(--accent);
}
.b-ready {
  background: var(--gDim);
  color: var(--green);
}
.b-admin {
  background: rgba(104, 64, 245, 0.15);
  color: #7c5cfc;
}
.b-editor {
  background: var(--aGlow);
  color: var(--accent);
}
.b-viewer {
  background: var(--bg5);
  color: var(--text2);
}
.b-neutral {
  background: var(--bg5);
  color: var(--text2);
}

/* PROJECTS */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 13px;
  transition: border-color 0.18s;
}
.search-wrap:focus-within {
  border-color: var(--accent);
}
.search-wrap input {
  background: none;
  color: var(--text);
  flex: 1;
  font-size: 13px;
}
.search-wrap input::placeholder {
  color: var(--text3);
}
.flt-sel {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text2);
  font-family: var(--font);
  font-size: 13px;
}
.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}
.proj-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}
.proj-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.18s;
}
.proj-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--sh);
}
.proj-card:hover::after {
  opacity: 1;
}
.proj-card-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 5px;
}
.proj-card-desc {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.proj-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.proj-card-acts {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* DETAIL */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.bc-link {
  cursor: pointer;
  transition: color 0.15s;
}
.bc-link:hover {
  color: var(--text);
}
.bc-sep {
  color: var(--text3);
}
.bc-cur {
  color: var(--text);
  font-weight: 600;
}
.status-banner {
  border-radius: var(--r);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.status-banner.idea {
  background: var(--aDim);
  border: 1.5px solid rgba(212, 137, 10, 0.2);
}
.status-banner.spec {
  background: var(--aGlow);
  border: 1.5px solid rgba(59, 120, 240, 0.2);
}
.status-banner.ready {
  background: var(--gDim);
  border: 1.5px solid rgba(24, 168, 122, 0.2);
}
.sb-icon {
  font-size: 20px;
}
.sb-text {
  flex: 1;
  min-width: 0;
}
.sb-lbl {
  font-size: 13px;
  font-weight: 700;
}
.sb-sub {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 1px;
}
.pd-hdr {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.pd-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 5px;
}
.pd-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
}
.pd-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pd-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg5);
  color: var(--text2);
  border: 1px solid var(--border);
}
.chip.on {
  background: var(--gDim);
  color: var(--green);
  border-color: rgba(24, 168, 122, 0.2);
}
.pd-acts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* En móvil, botones en columna vertical */
@media (max-width: 768px) {
  .pd-acts {
    flex-direction: column;
    gap: 6px;
  }

  .pd-acts .btn {
    width: 100%;
    box-sizing: border-box;
  }

  /* Hacer que el contenedor padre se comporte como columna */
  .pd-hdr > div {
    flex-direction: column !important;
  }

  .pd-acts {
    width: 100% !important;
  }
}
.ai-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 11px 15px;
  margin-bottom: 16px;
  background: linear-gradient(
    135deg,
    rgba(59, 120, 240, 0.06),
    rgba(104, 64, 245, 0.06)
  );
  border: 1.5px solid rgba(59, 120, 240, 0.14);
  border-radius: var(--r);
}
.ai-bar-lbl {
  font-size: 12px;
  color: var(--text2);
  font-weight: 600;
}
/* existing project info box */
.existing-box {
  background: linear-gradient(
    135deg,
    rgba(212, 137, 10, 0.07),
    rgba(212, 137, 10, 0.03)
  );
  border: 1.5px solid rgba(212, 137, 10, 0.25);
  border-radius: var(--r);
  padding: 14px 16px;
  margin-top: 10px;
}
.existing-box-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.existing-box-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* GROUPS */
.grp-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.grp-card {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.grp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.grp-name {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}
.grp-desc-inline {
  font-size: 11px;
  color: var(--text3);
  font-style: italic;
  max-width: 280px;
  /*overflow: hidden;*/
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grp-count {
  font-size: 11px;
  color: var(--text3);
  background: var(--bg5);
  padding: 2px 7px;
  border-radius: 99px;
  flex-shrink: 0;
}
.grp-btns {
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.grp-head:hover .grp-btns {
  opacity: 1;
}
.specs-list {
  padding: 8px;
  min-height: 40px;
  transition: background 0.15s;
}
.specs-list.dz {
  background: var(--aGlow);
  border-radius: 0 0 var(--r) var(--r);
}
.spec-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  border: 1.5px solid transparent;
  margin-bottom: 3px;
  transition: all 0.13s;
}
.spec-row:hover {
  background: var(--bg3);
  border-color: var(--border);
}
.spec-row.dragging {
  opacity: 0.4;
  border-style: dashed;
  border-color: var(--accent);
}
.spec-handle {
  color: var(--text3);
  padding-top: 2px;
  cursor: grab;
  flex-shrink: 0;
}
.spec-handle:active {
  cursor: grabbing;
}
.spec-txt {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}
.spec-acts {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.13s;
}
.spec-row:hover .spec-acts {
  opacity: 1;
}
.icon-btn {
  width: 27px;
  height: 27px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: all 0.13s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg4);
  color: var(--text);
}
.icon-btn.del:hover {
  background: var(--rDim);
  color: var(--red);
}
.add-spec-row {
  padding: 6px 10px 10px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.add-spec-ta {
  flex: 1;
  background: var(--bg3);
  border: 1.5px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text);
  resize: none;
  min-height: 38px;
  max-height: 120px;
  transition:
    border-color 0.15s,
    background 0.15s;
  overflow: hidden;
  line-height: 1.5;
  font-size: 13px;
}
.add-spec-ta:focus {
  border-color: var(--accent);
  border-style: solid;
  background: var(--bg2);
}
.add-spec-ta::placeholder {
  color: var(--text3);
}

/* EMPTY */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text3);
}
.empty-icon {
  font-size: 44px;
  margin-bottom: 14px;
  opacity: 0.5;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text2);
  margin-bottom: 6px;
}
.empty-txt {
  font-size: 13px;
  max-width: 300px;
  margin: 0 auto 18px;
}

/* AI PANEL */
#ai-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transform: translateX(110%);
  transition: transform 0.27s var(--ease);
  box-shadow: var(--sh-lg);
}
#ai-panel.open {
  transform: translateX(0);
}
.ai-ph {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ai-ph-title {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}
.ai-pb {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.ai-card {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 13px;
  margin-bottom: 10px;
}
.ai-card-grp {
  font-size: 11px;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.ai-card-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}
.ai-card-txt {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 10px;
}
.ai-card-acts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  gap: 14px;
}
.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.ai-err {
  background: var(--rDim);
  border: 1.5px solid rgba(224, 48, 64, 0.2);
  border-radius: var(--r);
  padding: 16px;
  text-align: center;
}
.ai-err-txt {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 10px;
}
.ai-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text3);
}
.export-pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text2);
  white-space: pre-wrap;
  max-height: 380px;
  overflow-y: auto;
}
.ai-regen-bar {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ai-regen-bar .ai-regen-note {
  font-size: 11px;
  color: var(--text3);
  flex: 1;
}

/* MODALS */
.m-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.m-box {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--sh-lg);
  animation: mIn 0.2s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.m-box.lg {
  max-width: 680px;
}
@keyframes mIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}
.m-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.m-title {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
}
.m-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
.field {
  margin-bottom: 15px;
}
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  margin-bottom: 6px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 13px;
  color: var(--text);
  transition: border-color 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  background: var(--bg2);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}
.field select option {
  background: var(--bg2);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 400px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}
.chk-grp {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.chk-item.on {
  background: var(--aGlow);
  border-color: rgba(59, 120, 240, 0.3);
}
.chk-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.chk-item-lbl {
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}
.ci {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--rDim);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.info-box {
  background: var(--aDim);
  border: 1.5px solid rgba(212, 137, 10, 0.25);
  border-radius: var(--r);
  padding: 12px 15px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.7;
}

/* SETTINGS */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
}
.stg-section {
  margin-bottom: 26px;
}
.stg-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text3);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.models-tip {
  background: linear-gradient(
    135deg,
    rgba(59, 120, 240, 0.08),
    rgba(104, 64, 245, 0.08)
  );
  border: 1.5px solid rgba(59, 120, 240, 0.18);
  border-radius: var(--r);
  padding: 13px 15px;
  margin-top: 10px;
}
.models-tip-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 7px;
}
.models-tip-list {
  font-size: 12px;
  color: var(--text2);
  line-height: 2;
}
.models-tip-list code {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}
.theme-row {
  display: flex;
  gap: 10px;
}
.theme-opt {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.theme-opt.on {
  border-color: var(--accent);
  background: var(--aGlow);
}
.theme-opt-icon {
  font-size: 22px;
  margin-bottom: 5px;
}
.theme-opt-lbl {
  font-size: 13px;
  font-weight: 600;
}

/* TABLE */
.tbl {
  width: 100%;
  border-collapse: collapse;
}
.tbl th {
  text-align: left;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.tbl tr:last-child td {
  border-bottom: none;
}
.tbl tr:hover td {
  background: var(--bg3);
}

/* AUDIT */
.audit-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.audit-flt-input {
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  color: var(--text2);
  font-family: var(--font);
  font-size: 12px;
  min-width: 150px;
}
.audit-flt-input:focus {
  border-color: var(--accent);
  outline: none;
}
.audit-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.audit-item:last-child {
  border-bottom: none;
}
.audit-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.audit-action {
  font-size: 13px;
  font-weight: 600;
}
.audit-res {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}
.audit-meta {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}
.audit-proj {
  font-size: 11px;
  color: var(--text3);
  margin-top: 1px;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}
.page-btn:hover {
  background: var(--bg3);
  color: var(--text);
}
.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.page-info {
  font-size: 12px;
  color: var(--text3);
}

/* TOAST */
#toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh);
  animation: tIn 0.2s var(--ease);
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 230px;
  max-width: 320px;
  transition: opacity 0.3s;
}
@keyframes tIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}
.toast.success {
  border-left: 3px solid var(--green);
}
.toast.error {
  border-left: 3px solid var(--red);
}
.toast.info {
  border-left: 3px solid var(--accent);
}
.page-loading {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
#modals {
  position: relative;
  z-index: 80;
}
