/* NXP Strategy Map & Tracker
   Design: operator tool. Varda-inspired — deep navy paper, dashed hairline grid,
   orange primary accent, red tertiary. Cards are transparent panels bounded by rules.
*/

:root {
  /* Palette — Varda: deep navy paper, orange primary, dashed hairline rules */
  --paper: #1e2a4a;       /* Varda deep navy background */
  --paper-2: #26325a;     /* card surface (slightly lighter navy) */
  --paper-3: #2f3d6e;     /* hover / raised */
  --ink: #f2f0ea;         /* warm off-white primary text */
  --ink-2: #dcdac9;
  --ink-3: #b8b6a6;
  --ink-mute: #8f8e88;
  --rule: rgba(242, 240, 234, 0.18);   /* hairline for dashed borders */
  --rule-2: rgba(242, 240, 234, 0.32); /* stronger hairline */
  --card: #26325a;
  --card-hi: #2f3d6e;

  /* Accents — 3-color story: navy paper + orange primary + red tertiary */
  --rust: #f68c39;        /* Varda orange — primary accent, vivid on navy */
  --rust-2: #ffa25a;
  --terracotta: #f68c39;
  --olive: #f2f0ea;       /* off-white for fund/lane marks */
  --slate: #f2f0ea;
  --gold: #f68c39;
  --moss: #f2f0ea;
  --plum: #d94441;        /* red tertiary */
  --wine: #d94441;

  /* Fund pillar colors — all off-white on navy, distinguished by label */
  --c-nxp: #f2f0ea;
  --c-fof: #f2f0ea;
  --c-gt: #f2f0ea;
  --c-18: #f2f0ea;
  --c-caf: #f2f0ea;
  --c-air: #f2f0ea;
  --c-cvc: #f2f0ea;
  --c-cn: #f2f0ea;
  --c-jack: #f2f0ea;
  --c-cmg: #f2f0ea;

  /* Status — semantic only: success=off-white, warn=orange, risk=red */
  --ok: #f2f0ea;
  --warn: #f68c39;
  --risk: #d94441;
  --neutral: #8f8e88;

  --shadow-1: none;
  --shadow-2: none;

  --radius-s: 4px;
  --radius: 6px;
  --radius-l: 10px;

  --font-sans: "General Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Light theme (Varda-in-daylight) ---------- */
.theme-light {
  --paper: #f5f2ea;       /* warm off-white paper */
  --paper-2: #ece8dd;     /* subtle raised */
  --paper-3: #e3dfd0;     /* hover surface */
  --ink: #1e2a4a;         /* deep navy ink */
  --ink-2: #2f3d6e;
  --ink-3: #5a6480;
  --ink-mute: #8a92a8;
  --rule: rgba(30, 42, 74, 0.18);
  --rule-2: rgba(30, 42, 74, 0.32);
  --card: transparent;
  --card-hi: rgba(30, 42, 74, 0.04);

  --rust: #d96518;        /* slightly deeper orange for AA on cream */
  --rust-2: #b95210;
  --terracotta: #d96518;
  --olive: #1e2a4a;
  --slate: #1e2a4a;
  --gold: #d96518;
  --moss: #1e2a4a;
  --plum: #b02b28;
  --wine: #b02b28;

  --c-nxp: #1e2a4a; --c-fof: #1e2a4a; --c-gt: #1e2a4a;
  --c-18: #1e2a4a; --c-caf: #1e2a4a; --c-air: #1e2a4a;
  --c-cvc: #1e2a4a; --c-cn: #1e2a4a; --c-jack: #1e2a4a;
  --c-cmg: #1e2a4a;

  --ok: #1e2a4a;
  --warn: #d96518;
  --risk: #b02b28;
  --neutral: #8a92a8;
}

/* Light-mode overrides for elements that used hardcoded off-white rgba */
.theme-light .nav-item:hover { background: rgba(30, 42, 74, 0.06); }
.theme-light .btn:hover { background: rgba(30, 42, 74, 0.06); }
.theme-light .tbl tr:hover td { background: rgba(30, 42, 74, 0.04); }
.theme-light .bar-track { background: rgba(30, 42, 74, 0.12); }
.theme-light .btn-primary { color: #ffffff; }
.theme-light .btn-primary:hover { color: #ffffff; }
.theme-light .pw-form button { color: #ffffff; }
.theme-light .main::before,
.theme-light .pw-gate {
  background-image:
    linear-gradient(to right, rgba(30, 42, 74, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 42, 74, 0.05) 1px, transparent 1px);
}
.theme-light .ai-populate-status-err { background: rgba(176, 43, 40, 0.06); }
.theme-light .ai-populate-status-info { background: rgba(217, 101, 24, 0.06); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--paper);
  min-height: 100vh;
}

/* Varda-style dashed grid overlay on main content area */
.main {
  position: relative;
}
.main::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(242, 240, 234, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 240, 234, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
}
.main > * { position: relative; z-index: 1; }

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}

a { color: var(--rust); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout shell ---------- */

.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px dashed var(--rule);
  background: transparent;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(26, 22, 19, 0.08);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.brand-title {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: -0.3px;
}
.brand-sub {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 4px;
}

.nav-group {
  margin-bottom: 18px;
}
.nav-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 0 6px 6px;
  font-weight: 500;
}
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.nav-toggle:hover { color: var(--ink-2); }
.nav-toggle-chevron {
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1;
  color: var(--ink-mute);
  padding-right: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
  transition: background 120ms ease;
}
.nav-item:hover { background: rgba(242, 240, 234, 0.06); color: var(--ink); }
.nav-item.active {
  background: transparent;
  color: var(--rust);
  border-left: 2px solid var(--rust);
  padding-left: 8px;
}
.nav-item-external {
  text-decoration: none;
  cursor: pointer;
}
.nav-item-external:hover {
  color: var(--rust);
}
.nav-item-arrow {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  opacity: 0.7;
}
.nav-item-external:hover .nav-item-arrow {
  color: var(--rust);
  opacity: 1;
}
.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.footer-mini {
  margin-top: auto;
  padding-top: 14px;
  font-size: 11px;
  color: var(--ink-mute);
  border-top: 1px solid var(--rule);
}

/* ---------- Main ---------- */

.main {
  padding: 0;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px dashed var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 20px;
}

.crumbs {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.crumb-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.crumb-title {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: -0.3px;
  line-height: 1.1;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  border: 1px solid var(--rule-2);
  background: transparent;
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: rgba(242, 240, 234, 0.06); border-color: var(--ink); }
.btn-primary {
  background: var(--rust);
  color: #1e2a4a;
  border-color: var(--rust);
}
.btn-primary:hover { background: var(--rust-2); border-color: var(--rust-2); color: #1e2a4a; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--paper-3); }
.btn-sm { padding: 4px 8px; font-size: 11.5px; }

.section {
  padding: 24px 28px 40px;
}

/* ---------- Cards ---------- */

.card {
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 0;
  box-shadow: none;
  position: relative;
}
.card::after {
  /* Varda-style corner arrow */
  content: "↗";
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 12px;
  color: var(--ink-mute);
  pointer-events: none;
}
.card-head {
  padding: 14px 16px 10px;
  border-bottom: 1px dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-title {
  font-family: var(--font-serif);
  font-size: 17px;
  letter-spacing: -0.2px;
}
.card-sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.card-body { padding: 14px 16px; }

/* ---------- KPI strip ---------- */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 0;
  padding: 14px 16px;
}
.kpi-label {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.5px;
}
.kpi-delta {
  font-size: 11.5px;
  margin-top: 6px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--risk); }

/* ---------- Strategy map ---------- */

.map-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}

.map-canvas {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 22px 20px;
  position: relative;
  min-height: 720px;
  overflow: auto;
}

.tier {
  margin-bottom: 22px;
}
.tier-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tier-label::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--rule-2);
}
.tier-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule-2);
}

.node-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.node {
  border: 1px solid var(--rule-2);
  background: var(--card-hi);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-width: 148px;
  cursor: pointer;
  transition: all 140ms ease;
  position: relative;
  box-shadow: var(--shadow-1);
}
.node:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.node.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(26,22,19,0.08), var(--shadow-2);
}
.node-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.node-tag {
  width: 6px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
}
.node-kind {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.node-title {
  font-family: var(--font-serif);
  font-size: 16px;
  letter-spacing: -0.2px;
  line-height: 1.15;
}
.node-meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
  font-family: var(--font-mono);
}
.node-status {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.node-status.active { background: var(--ok); }
.node-status.build { background: var(--warn); }
.node-status.concept { background: var(--neutral); }
.node-status.raising { background: var(--rust); }

.tier-nxp .node { border-width: 1.5px; }
.tier-nxp .node-title { font-size: 20px; }

/* Node kind variants */
.n-fund { background: linear-gradient(180deg, var(--card-hi), #fbf5e6); }
.n-init { background: linear-gradient(180deg, var(--card-hi), #f4ecdb); }
.n-eng  { background: linear-gradient(180deg, var(--card-hi), #ede1c6); }

/* Detail panel */
.detail {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 18px;
  position: sticky;
  top: 90px;
  align-self: start;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.detail-eyebrow {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-title {
  font-family: var(--font-serif);
  font-size: 24px;
  letter-spacing: -0.4px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.detail-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 14px;
}
.detail-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}
.detail-h {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-list li {
  font-size: 12.5px;
  color: var(--ink-2);
  padding-left: 12px;
  position: relative;
}
.detail-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rule-2);
}
.kv {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 4px 12px;
  font-size: 12.5px;
}
.kv dt { color: var(--ink-mute); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.kv dd { margin: 0; color: var(--ink-2); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--rule-2);
  background: var(--paper-2);
  color: var(--ink-2);
  line-height: 1.4;
}
.chip.dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
}
.chip.ok { color: var(--ink); background: transparent; border-color: var(--rule-2); }
.chip.ok.dot::before { background: var(--ok); }
.chip.warn { color: var(--rust); background: transparent; border-color: rgba(246, 140, 57, 0.5); }
.chip.warn.dot::before { background: var(--warn); }
.chip.risk { color: var(--wine); background: transparent; border-color: rgba(217, 68, 65, 0.5); }
.chip.risk.dot::before { background: var(--risk); }
.chip.mute { color: var(--ink-3); }

/* ---------- Tracker table ---------- */

.tracker-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px dashed var(--rule-2);
  border-radius: 0;
  padding: 6px 10px;
}
.search input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 13px;
  color: var(--ink);
}
.select {
  background: transparent;
  border: 1px dashed var(--rule-2);
  border-radius: 0;
  padding: 6px 8px;
  font-size: 12.5px;
  color: var(--ink);
}

.table-wrap {
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 0;
  overflow: hidden;
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.tbl th, .tbl td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px dashed var(--rule);
  vertical-align: top;
}
.tbl th {
  background: transparent;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule-2);
}
.tbl th:hover { color: var(--ink); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(242, 240, 234, 0.04); }
.tbl td.name { font-weight: 500; font-family: var(--font-serif); font-size: 14px; letter-spacing: -0.1px; }
.tbl td.mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.tbl td.right { text-align: right; }
.tbl .row-fund {
  width: 3px;
  padding: 0;
  border-bottom: none;
}

/* ---------- Sparkline / bars ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.bar-track {
  flex: 1;
  height: 5px;
  background: rgba(242, 240, 234, 0.12);
  border-radius: 0;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--rust);
  border-radius: 0;
}
.bar-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  min-width: 30px;
  text-align: right;
}

/* ---------- Grid layouts ---------- */

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

/* ---------- Pillar cards ---------- */

.pillar {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-1);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.pillar:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.pillar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.pillar-tag {
  width: 6px;
  height: 22px;
  border-radius: 2px;
}
.pillar-name {
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: -0.2px;
  line-height: 1;
}
.pillar-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.pillar-stat {
  text-align: left;
}
.pillar-stat-lbl {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.pillar-stat-val {
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.3px;
  margin-top: 2px;
}
.pillar-foot {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.4;
}

/* ---------- Timeline ---------- */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tl-item {
  display: grid;
  grid-template-columns: 90px 8px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
}
.tl-item:last-child { border-bottom: none; }
.tl-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-mute);
  padding-top: 2px;
}
.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  margin-top: 6px;
}
.tl-body {
  font-size: 12.5px;
  color: var(--ink-2);
}
.tl-title {
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}
.tl-meta {
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ---------- Tabs (in-panel) ---------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 14px;
}
.tab {
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }

/* ---------- Legend ---------- */

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-3);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* ---------- Empty ---------- */

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 13px;
  font-style: italic;
  font-family: var(--font-serif);
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26,22,19,0.35);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--paper);
  border-radius: var(--radius-l);
  border: 1px solid var(--rule);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.form-row { margin-bottom: 12px; }
.form-row label {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px dashed var(--rule-2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.form-row textarea { min-height: 70px; resize: vertical; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.form-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3, #7a7974);
  font-weight: 600;
  margin-top: 18px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--rule);
}
.link-row {
  display: grid;
  grid-template-columns: 130px 1fr 2fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.link-row select, .link-row input {
  padding: 6px 8px;
  font-size: 12px;
}
.link-row button {
  padding: 4px 10px;
  font-size: 14px;
  line-height: 1;
}
.form-row label.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 0;
  cursor: pointer;
}
.form-row label.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .map-wrap { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .footer-mini { position: static; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .section { padding: 16px; }
}

/* utility */
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); }
.mute { color: var(--ink-mute); }
.small { font-size: 11.5px; }
.hr { height: 1px; background: var(--rule); margin: 14px 0; border: none; }
.tag-inline {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---- 5×5 Tracker Grid ---- */
.grid-tracker-wrap {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--rule);
  overflow: hidden;
}
.grid-tracker {
  display: grid;
  grid-template-columns: 160px repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
}
.grid-cell {
  background: var(--paper);
  padding: 10px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.grid-corner {
  background: var(--paper-2);
  min-height: 72px;
  justify-content: space-between;
}
.corner-eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.corner-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.grid-colhead {
  background: var(--paper-2);
  min-height: 44px;
  padding: 10px 14px;
  gap: 4px;
  cursor: help;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
}
.colhead-name {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.colhead-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.grid-lanehead {
  background: var(--paper-2);
  padding: 12px 14px 12px 14px;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: help;
}
.lanehead-bar {
  width: 3px;
  min-height: 32px;
  align-self: stretch;
  border-radius: 2px;
}
.lanehead-name {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
  margin-bottom: 2px;
  letter-spacing: 0.01em;
}
.lanehead-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.grid-swim {
  gap: 8px;
  padding: 10px;
}
.swim-empty {
  color: var(--ink-4, #c9bfa9);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  padding-top: 20px;
  opacity: 0.5;
}
.kcard {
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: none;
}
.kcard-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kcard-tag {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.kcard-fund {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
  margin-right: auto;
}
.kcard-name {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.3;
  font-weight: 500;
}
.kcard-fundinfo {
  font-size: 10.5px;
  color: var(--ink-2);
  margin-top: 4px;
  margin-bottom: 6px;
  padding: 6px 8px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: color-mix(in oklab, var(--rust, #964219) 6%, transparent);
  border-left: 2px solid color-mix(in oklab, var(--rust, #964219) 55%, transparent);
  border-radius: 3px;
}
.kcard-fundinfo-label {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rust, #964219);
  opacity: 0.75;
  margin-bottom: 2px;
}
.kcard-fundinfo-thesis {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px dashed color-mix(in oklab, var(--rust, #964219) 25%, transparent);
  font-style: italic;
  color: var(--ink-1);
  font-size: 10.5px;
  line-height: 1.35;
}
.kcard-fundinfo-empty {
  font-size: 10px;
  font-style: italic;
  color: var(--ink-4, var(--ink-3));
}
.kcard-fundinfo-row {
  display: block;
}
.kcard-fundinfo .mute {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4, var(--ink-3));
  margin-right: 3px;
}
.kcard-initinfo {
  font-size: 10.5px;
  color: var(--ink-1);
  margin-top: 4px;
  margin-bottom: 4px;
  line-height: 1.4;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 3px;
  border-top: 1px dashed var(--rule, rgba(0,0,0,0.06));
}
.kcard-initinfo-row {
  display: block;
}
.kcard-initinfo .mute {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4, var(--ink-3));
  margin-right: 3px;
  font-weight: 500;
}
.kcard-initinfo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.kcard-initlink {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface-2, rgba(0,0,0,0.04));
  color: var(--ink-1);
  text-decoration: none;
  border: 1px solid var(--rule, rgba(0,0,0,0.06));
  transition: background 0.15s ease, border-color 0.15s ease;
}
.kcard-initlink:hover {
  background: var(--surface-3, rgba(0,0,0,0.08));
  border-color: var(--rule-2, rgba(0,0,0,0.12));
}
.kcard-initlink-label {
  font-size: 9.5px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--ink-2);
}
.kcard-meta {
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.owner-chip {
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--ink-2);
  transition: background 120ms, color 120ms;
}
.owner-chip:hover {
  background: rgba(154,63,31,0.08);
  color: var(--rust);
}
.owner-select, .owner-input {
  font: inherit;
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
  max-width: 130px;
}
.owner-select:focus, .owner-input:focus {
  outline: none;
  border-color: var(--rust);
}
.kcard-next {
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.35;
  padding-top: 2px;
  border-top: 1px dashed var(--rule);
}
.kcard-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kcard-actions {
  display: flex;
  gap: 4px;
  padding-top: 2px;
}
.kcard-actions .btn-sm {
  padding: 2px 6px;
  font-size: 10px;
  min-width: 0;
}

@media (max-width: 900px) {
  .grid-tracker {
    grid-template-columns: 1fr;
  }
  .grid-corner, .grid-colhead {
    display: none;
  }
  .grid-lanehead {
    background: var(--paper-2);
    border-top: 2px solid var(--rule);
  }
  .grid-swim::before {
    content: attr(data-col);
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
}

/* ============================================================
   Password gate
   ============================================================ */
.pw-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
  background-image:
    linear-gradient(to right, rgba(242, 240, 234, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 240, 234, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  color: var(--ink);
  font-family: "General Sans", system-ui, sans-serif;
}
.pw-card {
  width: 100%;
  max-width: 380px;
  background: transparent;
  border: 1px dashed var(--rule-2);
  border-radius: 0;
  padding: 28px 28px 22px;
  box-shadow: none;
}
.pw-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.pw-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(26, 22, 19, 0.12);
}
.pw-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.pw-brand-name {
  font-family: "Instrument Serif", serif;
  font-size: 20px;
  line-height: 1;
}
.pw-brand-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 4px;
}
.pw-title {
  font-family: "Instrument Serif", serif;
  font-size: 28px;
  line-height: 1.1;
  margin-bottom: 6px;
}
.pw-sub {
  color: var(--ink-3);
  font-size: 14px;
  margin-bottom: 18px;
}
.pw-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.pw-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px dashed var(--rule-2);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pw-form input:focus {
  border-color: var(--rust);
  border-style: solid;
  box-shadow: 0 0 0 2px rgba(246,140,57,0.2);
}
.pw-form button {
  padding: 10px 14px;
  border: 1px solid var(--rust);
  border-radius: 0;
  background: var(--rust);
  color: #1e2a4a;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.15s ease;
}
.pw-form button:hover { opacity: 0.9; }
.pw-form button:active { transform: translateY(1px); }
.pw-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--ink-3);
  font-family: "JetBrains Mono", monospace;
  user-select: none;
  cursor: pointer;
}
.pw-remember input[type="checkbox"] {
  accent-color: var(--rust);
  cursor: pointer;
}
.pw-error {
  min-height: 18px;
  color: var(--rust);
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
  margin-bottom: 12px;
}
.pw-foot {
  border-top: 1px dashed var(--rule);
  padding-top: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ============================================================
   Card close button (top-right of every .kcard)
   ============================================================ */
.kcard { position: relative; }
.kcard-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(26,22,19,0.35);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
  z-index: 2;
}
.kcard:hover .kcard-close { color: rgba(26,22,19,0.7); }
.kcard-close:hover {
  background: var(--rust);
  color: var(--paper);
  border-color: var(--rust);
}

/* Keep card title from colliding with the × */
.kcard-name { padding-right: 22px; }

/* ============================================================
   Archive view
   ============================================================ */
.archive-view .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}
.archive-list {
  border: 1px solid rgba(26,22,19,0.1);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.4);
}
.archive-row {
  display: grid;
  grid-template-columns: 4px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid rgba(26,22,19,0.07);
}
.archive-row:last-child { border-bottom: none; }
.archive-tag {
  align-self: stretch;
  width: 4px;
  background: var(--ink);
}
.archive-main { min-width: 0; }
.archive-name {
  font-family: "Instrument Serif", serif;
  font-size: 18px;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 4px;
}
.archive-meta { display: block; }
.archive-next {
  color: rgba(26,22,19,0.7);
  margin-top: 4px;
}
.archive-when { white-space: nowrap; }
.archive-actions { display: flex; gap: 6px; padding-right: 12px; }

.empty-panel {
  padding: 40px;
  text-align: center;
  border: 1px dashed rgba(26,22,19,0.2);
  border-radius: 10px;
  color: rgba(26,22,19,0.6);
  background: rgba(255,255,255,0.3);
}

/* ---------- Editable card: click affordance + goals preview ---------- */
.kcard {
  cursor: pointer;
  transition: box-shadow 120ms, border-color 120ms, transform 120ms;
}
.kcard:hover {
  border-color: rgba(26,22,19,0.28);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.kcard:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 1px;
}

.kcard-name { padding-right: 22px; } /* leave room for × archive button */

/* Health pill — replaces the wordy status chip on the card head. Just a
   colored circle inside the same pill shape as other chips. */
.chip.health-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  gap: 0;
}
.chip.health-chip::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  margin: 0;
}
.chip.health-chip-green {
  color: var(--ink);
  background: transparent;
  border-color: var(--rule-2);
}
.chip.health-chip-yellow {
  color: var(--rust);
  background: transparent;
  border-color: rgba(246, 140, 57, 0.5);
}
.chip.health-chip-red {
  color: var(--wine);
  background: transparent;
  border-color: rgba(217, 68, 65, 0.5);
}

.kcard-goals {
  list-style: none;
  margin: 2px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px dashed var(--rule);
  padding-top: 4px;
}
.kcard-goals li {
  position: relative;
  padding-left: 10px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--ink-2);
}
.kcard-goals li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-3);
}

/* ---------- Edit modal: wider + health picker ---------- */
.modal.modal-wide {
  max-width: 560px;
  width: 92vw;
}
.health-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.health-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--paper);
  transition: border-color 120ms, background 120ms, color 120ms;
}
.health-option input { display: none; }
.health-option:hover { border-color: rgba(26,22,19,0.32); }
.health-option.is-active {
  color: var(--ink);
  border-color: rgba(26,22,19,0.5);
  background: rgba(154,63,31,0.04);
}
.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08);
}
.health-dot-green  { background: #6ea75b; }
.health-dot-yellow { background: #d9a441; }
.health-dot-red    { background: #b13b32; }

/* ---------- Notes (Focus page) ---------- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.note-card {
  border: 1px solid var(--rule, #d9d1bd);
  background: var(--paper-2, #fdfaf1);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.note-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.note-title-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  padding: 4px 2px;
  outline: none;
}
.note-title-input:focus { border-bottom: 1px solid var(--rust, #9a3f1f); }
.note-body-input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  padding: 6px 4px;
  outline: none;
}
.note-body-input:focus { border-color: var(--rule, #d9d1bd); background: rgba(255,255,255,0.4); border-radius: 6px; }

/* ---------- Auto-populate section (Add Initiative modal) ---------- */
.ai-populate {
  margin: 8px 0 18px;
  border: 1px solid var(--rule, #d9d1bd);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(120, 78, 40, 0.045), rgba(120, 78, 40, 0.02));
  overflow: hidden;
}
.ai-populate-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
}
.ai-populate-toggle:hover { background: rgba(120, 78, 40, 0.05); }
.ai-populate-icon { font-size: 15px; }
.ai-populate-chev {
  margin-left: auto;
  font-family: monospace;
  font-size: 16px;
  color: var(--muted, #7c6f57);
  width: 16px;
  text-align: center;
}
.ai-populate-body {
  padding: 8px 14px 14px;
  border-top: 1px solid var(--rule, #d9d1bd);
  background: rgba(255, 253, 247, 0.6);
}
.ai-populate-inputs {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 1.4fr;
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 720px) {
  .ai-populate-inputs { grid-template-columns: 1fr; }
}
/* ---- Ingestion drop zone with glow ---- */
.ai-populate-drop {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 130px;
  border: 1.5px dashed rgba(168, 75, 47, 0.35);
  border-radius: 12px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 197, 83, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255, 253, 247, 0.55));
  cursor: pointer;
  overflow: hidden;
  transition: border-color 160ms ease, box-shadow 200ms ease, transform 120ms ease, background 200ms ease;
}
.ai-populate-drop:hover {
  border-color: rgba(168, 75, 47, 0.55);
  box-shadow: 0 4px 24px -6px rgba(168, 75, 47, 0.25), inset 0 0 0 1px rgba(255, 197, 83, 0.15);
}
.ai-populate-drop.is-dragover {
  border-color: var(--accent, #a84b2f);
  border-style: solid;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 197, 83, 0.30), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255, 249, 236, 0.7));
  box-shadow:
    0 0 0 3px rgba(255, 197, 83, 0.25),
    0 8px 32px -6px rgba(168, 75, 47, 0.35),
    inset 0 0 30px rgba(255, 197, 83, 0.15);
  transform: translateY(-1px);
}
.ai-populate-drop.has-image {
  border-style: solid;
  border-color: rgba(168, 75, 47, 0.25);
  background: rgba(255, 253, 247, 0.9);
  cursor: default;
}
.ai-populate-drop.is-busy {
  cursor: wait;
  animation: ai-drop-shimmer 1.6s ease-in-out infinite;
}
@keyframes ai-drop-shimmer {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 197, 83, 0.35), inset 0 0 20px rgba(255, 197, 83, 0.10); }
  50%      { box-shadow: 0 0 0 4px rgba(255, 197, 83, 0.15), inset 0 0 30px rgba(255, 197, 83, 0.22); }
}
.ai-populate-drop-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 16px;
  text-align: center;
  pointer-events: none;
  width: 100%;
}
.ai-populate-drop-glow {
  position: absolute;
  inset: -30%;
  z-index: 0;
  background: radial-gradient(closest-side, rgba(255, 197, 83, 0.35), transparent 70%);
  filter: blur(24px);
  opacity: 0.55;
  pointer-events: none;
  animation: ai-glow-pulse 4.5s ease-in-out infinite;
}
@keyframes ai-glow-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.95); }
  50%      { opacity: 0.70; transform: scale(1.05); }
}
.ai-populate-drop-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 2px 6px rgba(168, 75, 47, 0.25));
}
.ai-populate-drop-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink, #2b1e10);
  letter-spacing: -0.005em;
}
.ai-populate-drop-sub {
  font-size: 11.5px;
  color: var(--muted, #7c6f57);
  line-height: 1.35;
  max-width: 260px;
}
.ai-populate-preview {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  align-items: center;
  width: 100%;
}
.ai-populate-preview img {
  max-width: 110px;
  max-height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--rule, #d9d1bd);
  box-shadow: 0 2px 8px -2px rgba(0,0,0,0.15);
}
.ai-populate-preview-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.ai-populate-preview-meta .small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.ai-populate-text {
  width: 100%;
  border: 1px solid var(--rule, #d9d1bd);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.ai-populate-text:focus {
  border-color: var(--accent, #a84b2f);
  background: rgba(255, 255, 255, 0.85);
}
.ai-populate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.ai-populate-status {
  font-size: 11.5px;
  line-height: 1.35;
  padding: 4px 8px;
  border-radius: 6px;
  flex: 1;
  min-width: 0;
}
.ai-populate-status-ok {
  background: transparent;
  color: var(--ink);
  border: 1px dashed var(--rule-2);
}
.ai-populate-status-err {
  background: rgba(217, 68, 65, 0.08);
  color: var(--wine);
  border: 1px dashed rgba(217, 68, 65, 0.5);
}
.ai-populate-status-info {
  background: rgba(246, 140, 57, 0.08);
  color: var(--rust);
  border: 1px dashed rgba(246, 140, 57, 0.5);
}
