/* Kraken "Custom Text" look & feel — extracted from the Figma design tokens.
   Design system: Untitled-UI-style scale, Inter type, kraken-red brand.
   Font note: Inter is preferred; falls back to the system UI stack until it's vendored. */

:root {
  /* brand + semantics */
  --kraken-600: #e62e05;
  --success-500: #17b26a;  --success-200: #abefc6;  --success-50: #ecfdf3;  --success-700: #067647;
  --warning-500: #f79009;  --warning-100: #fef0c7;  --warning-700: #b54708;
  --error-500:   #f04438;  --error-100:   #fee4e2;  --error-700:   #b42318;
  --brand-500:   #2e90fa;  --brand-100:   #d1e9ff;  --brand-700:   #175cd3;
  --magenta-800: #9e165f;  --magenta-200: #fccee8;

  /* steel (blue-grey) + grey neutrals */
  --steel-700: #363f72;  --steel-300: #b3b8db;  --steel-200: #d5d9eb;  --steel-100: #eaecf5;  --steel-50: #f8f9fc;
  --grey-900: #121926;  --grey-700: #364152;  --grey-600: #4b5565;  --grey-500: #697586;
  --grey-400: #9aa4b2;  --grey-200: #e3e8ef;  --grey-100: #eef2f6;  --grey-50: #f8fafc;
  --white: #ffffff;

  /* derived surfaces */
  --header-bg: linear-gradient(90deg, #3f4859 0%, #333c4b 100%);
  --app-bg: var(--white);
  --border: var(--steel-200);
  --border-subtle: var(--steel-100);

  /* type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* spacing (4px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  /* radius */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px; --r-2xl: 16px; --r-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
  --topnav-h: 64px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font);
  color: var(--grey-900);
  background: var(--app-bg);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- app layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topnav-h) 1fr;
  grid-template-areas: "nav nav" "side main";
  min-height: 100vh;
}

/* ---------- top nav ---------- */
.topnav {
  grid-area: nav;
  background: var(--header-bg);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  color: var(--white);
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand .logo { height: 30px; width: auto; display: block; }
.brand .mark { color: var(--kraken-600); font-size: 22px; line-height: 1; }
.brand .divider { width: 1px; height: 28px; background: rgba(255, 255, 255, 0.25); }
.brand .sun { opacity: 0.85; font-size: 18px; }

.navtabs { display: flex; gap: var(--sp-6); margin: 0 auto; height: 100%; }
.navtab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: 100%; padding: 0 var(--sp-2);
  color: rgba(255, 255, 255, 0.75); font-size: 12px; text-decoration: none;
  border-bottom: 3px solid transparent;
}
.navtab .ico { font-size: 18px; }
.navtab.active { color: var(--white); border-bottom-color: var(--kraken-600); }

.avatar {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--steel-300); display: grid; place-items: center;
  color: var(--grey-700); font-weight: 600; font-size: 13px; overflow: hidden;
}

/* ---------- sidebar ---------- */
.sidebar {
  grid-area: side;
  background: var(--steel-50);
  border-right: 1px solid var(--border-subtle);
  padding: var(--sp-2) 0;
}
.sidebar .collapse {
  display: flex; justify-content: flex-end;
  padding: var(--sp-2) var(--sp-4); color: var(--grey-500); cursor: pointer;
}
.side-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4); margin: 2px var(--sp-2);
  color: var(--grey-700); text-decoration: none; border-radius: var(--r-md);
  border-left: 3px solid transparent; font-weight: 500;
}
.side-item .ico { color: var(--grey-500); font-size: 16px; }
.side-item:hover { background: var(--steel-100); }
.side-item.active {
  background: #eef0fb; color: var(--grey-900); font-weight: 600;
  border-left-color: var(--kraken-600); border-radius: 0 var(--r-md) var(--r-md) 0;
  margin-left: 0;
}

/* ---------- main / page ---------- */
.main { grid-area: main; padding: var(--sp-6) var(--sp-8); overflow: auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-5); }
.page-title { font-size: 24px; line-height: 30px; font-weight: 600; letter-spacing: -0.5px; margin: 0; }
.section-block { margin-bottom: var(--sp-8); }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--grey-500); margin-bottom: var(--sp-3); }
.muted { color: var(--grey-500); }
.globe { color: var(--grey-400); font-size: 13px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font); font-size: 14px; font-weight: 600; line-height: 20px;
  padding: 10px var(--sp-4); border-radius: var(--r-lg); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn--primary { background: var(--success-500); color: var(--white); }
.btn--primary:hover { background: var(--success-700); }
.btn--secondary { background: var(--white); color: var(--grey-700); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { background: var(--grey-50); }
.btn--ghost { background: transparent; color: var(--grey-600); }
.btn:disabled, .btn.is-disabled { background: var(--grey-100); color: var(--grey-400); border-color: var(--grey-100); cursor: not-allowed; box-shadow: none; }
.btn--sm { padding: 6px var(--sp-3); font-size: 13px; }

/* ---------- inputs ---------- */
.input, .search input {
  width: 100%; font-family: var(--font); font-size: 14px; color: var(--grey-900);
  padding: 10px var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--white); box-shadow: var(--shadow-sm);
}
.input:focus, .search input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.field-label { font-size: 13px; font-weight: 600; color: var(--grey-700); margin: var(--sp-3) 0 var(--sp-1); }
.search { display: flex; gap: var(--sp-3); align-items: center; }
.search .grow { flex: 1; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; line-height: 14px;
  padding: 4px 10px; border-radius: var(--r-full); white-space: nowrap;
}
.badge .caret { opacity: 0.7; font-size: 10px; }
/* soft (manager) */
.badge--approved  { background: var(--success-50); color: var(--success-700); }
.badge--review    { background: var(--warning-100); color: var(--warning-700); }
.badge--progress  { background: var(--magenta-200); color: var(--magenta-800); }
.badge--awaiting  { background: var(--warning-100); color: var(--warning-700); }
.badge--notstarted{ background: var(--grey-100); color: var(--grey-600); }
/* solid (listing) */
.badge--complete   { background: var(--success-500); color: var(--white); }
.badge--published  { background: var(--success-500); color: var(--white); }
.badge--publishable{ background: var(--brand-500); color: var(--white); }
.badge--notpub     { background: var(--error-500); color: var(--white); }
.badge--reviewsolid{ background: var(--warning-500); color: var(--white); }
.badge--updated    { background: var(--warning-500); color: var(--white); }

/* ---------- table ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--grey-500);
  padding: var(--sp-3) var(--sp-3); border-bottom: 2px solid var(--grey-200); white-space: nowrap;
}
.table th .sort { color: var(--grey-400); margin-left: 4px; }
.table th.sortable a { color: inherit; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.table th.sortable a:hover { color: var(--grey-800); }
.table th.sortable.sorted a { color: var(--grey-800); }
.table th.num.sortable a { justify-content: flex-end; width: 100%; }
.sort-ind { color: var(--kraken-600); font-size: 11px; }
.table td { padding: 14px var(--sp-3); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tbody tr:hover { background: var(--steel-50); }
.table .name { font-weight: 600; }
.row-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; color: var(--grey-500); }
.row-actions .act { cursor: pointer; }
.row-actions .act:hover { color: var(--grey-700); }
.table-meta { display: flex; align-items: center; justify-content: space-between; margin: var(--sp-4) 0 var(--sp-2); font-size: 13px; color: var(--grey-600); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-4); font-size: 13px; color: var(--grey-600); }
.pager .pages { display: flex; gap: 4px; }
.pager .pg { padding: 6px 10px; border-radius: var(--r-md); cursor: pointer; }
.pager a.pg { color: var(--grey-700); text-decoration: none; }
.pager a.pg:hover { background: var(--grey-100); color: var(--grey-900); }
.pager .pg.active { background: var(--grey-100); color: var(--grey-900); font-weight: 600; }
.pager .pg-gap { padding: 6px 2px; color: var(--grey-400); }

/* ---------- section tabs ---------- */
.tabs { display: flex; gap: var(--sp-6); border-bottom: 1px solid var(--border-subtle); margin: var(--sp-4) 0 var(--sp-5); }
.tab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 0 0 var(--sp-3); color: var(--grey-600); text-decoration: none; font-weight: 500;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--grey-900); font-weight: 600; border-bottom-color: var(--kraken-600); }
.tab:hover { color: var(--grey-900); }
.tab-count { padding: 1px 8px; border-radius: var(--r-full); background: var(--steel-50); color: var(--grey-600);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab.active .tab-count { background: var(--kraken-50, #fdece7); color: var(--kraken-600); }
/* tab panels: the server renders exactly one .active (from ?tab=), so the correct panel shows
   with no JS and no flash; the inline script only toggles .active client-side to avoid reloads. */
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.dot { width: 16px; height: 16px; border-radius: var(--r-full); display: grid; place-items: center; color: var(--white); font-size: 10px; font-weight: 700; }
.dot--ok { background: var(--success-500); }
.dot--no { background: var(--error-500); }
.dot--info { background: var(--brand-500); }

/* ---------- entity summary bar ---------- */
.summary { display: flex; align-items: center; gap: var(--sp-8); padding: var(--sp-4) 0; }
.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-label { font-size: 12px; color: var(--grey-500); }
.summary-value { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.summary-actions { margin-left: auto; display: flex; gap: var(--sp-3); }

/* ---------- locale grid + cards ---------- */
.locale-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--white); padding: var(--sp-4); }
.card--panel { background: var(--steel-50); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.locale-tag { font-size: 12px; font-weight: 600; color: var(--grey-600); background: var(--grey-100); border-radius: var(--r-sm); padding: 2px 8px; }
.card-head .lbl { font-size: 13px; color: var(--grey-600); }
.field-value { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--white); padding: 10px var(--sp-3); color: var(--grey-700); }
.field-value--body { min-height: 96px; line-height: 22px; }
.card-actions { margin-top: var(--sp-3); display: flex; justify-content: flex-start; }

/* rich-text toolbar (edit mode) */
.rte-toolbar { display: flex; gap: 2px; background: var(--steel-700); border-radius: var(--r-md) var(--r-md) 0 0; padding: 6px; }
.rte-toolbar .tbtn { width: 28px; height: 26px; display: grid; place-items: center; color: rgba(255,255,255,0.85); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.rte-toolbar .tbtn:hover { background: rgba(255, 255, 255, 0.12); }
.rte-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--r-md) var(--r-md); padding: 10px var(--sp-3); min-height: 96px; line-height: 22px; }
.rte-body b { font-weight: 700; }

/* ---------- item band (repeating sections) ---------- */
.item { border: 1px solid var(--border); border-radius: var(--r-lg); margin-bottom: var(--sp-5); overflow: hidden; }
.item-band { background: var(--steel-700); color: var(--white); display: flex; align-items: center; justify-content: space-between; padding: var(--sp-3) var(--sp-4); }
.item-band .title { font-weight: 600; }
.item-band .right { display: flex; align-items: center; gap: var(--sp-3); }
.item-band .edit { background: rgba(255,255,255,0.15); width: 28px; height: 28px; border-radius: var(--r-md); display: grid; place-items: center; cursor: pointer; }
.item-band .edit.active { background: var(--brand-500); }
.item-body { padding: var(--sp-4); }
.item-body .locale-grid { gap: var(--sp-4); }

/* ---------- entity lookup + overview ---------- */
.lookup-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto auto; gap: var(--sp-4); align-items: end; }
.lookup-form .field-label { margin: 0 0 var(--sp-1); }
.lookup-form .actions { display: flex; gap: var(--sp-3); }
/* reporting: a prominent name search bar + a collapsible advanced-filters panel (Kraken "All
   Selection Groups" pattern). The form is a plain wrapper; the box styling lives on the panel. */
.report-form { margin-bottom: var(--sp-5); }
.report-searchbar { margin-bottom: 0; }  /* search row; the panel (when open) follows below */
.filters-panel { display: none; margin-top: var(--sp-4); padding: var(--sp-5);
  background: var(--steel-50); border: 1px solid var(--border-subtle); border-radius: var(--r-lg); }
.filters-panel.open { display: flex; flex-wrap: wrap; gap: var(--sp-5); align-items: flex-start; }
.report-form .field-label { margin: 0 0 var(--sp-1); }
.sort-ind--idle { color: var(--grey-400); }  /* the "sortable" affordance on inactive headers */
.rf-field { margin-bottom: var(--sp-3); }
.rf-col { display: flex; flex-direction: column; min-width: 220px; }
.rf-types select { min-width: 240px; }
.rf-range { display: flex; align-items: center; gap: var(--sp-2); }
.rf-range .input { width: 96px; }
.rf-actions { display: flex; gap: var(--sp-3); align-items: center; margin-top: 26px; }
/* report table-meta actions (Columns + Download CSV buttons, right-aligned) */
.meta-actions { display: inline-flex; gap: var(--sp-2); align-items: center; }
/* column-picker modal (native <dialog>) */
.modal { border: none; border-radius: var(--r-md); padding: 0; width: min(420px, 92vw);
  box-shadow: 0 10px 40px rgba(16, 24, 40, 0.18); color: var(--grey-900); }
.modal::backdrop { background: rgba(16, 24, 40, 0.45); }
.modal-head { padding: var(--sp-4); font-weight: 600; font-size: 15px; border-bottom: 1px solid var(--border-subtle); }
.modal-body { padding: var(--sp-4); }
.col-list { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2) var(--sp-4); font-size: 13px; }
.col-chk { display: inline-flex; align-items: center; gap: 6px; color: var(--grey-700); cursor: pointer; }
.col-chk input { cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border-subtle); }
/* persistent entity search bar (top of overview) */
.entity-search { display: flex; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-5); }
.search-input { position: relative; flex: 1; }
.search-input input {
  width: 100%; font-family: var(--font); font-size: 14px; color: var(--grey-900);
  padding: 10px 40px 10px var(--sp-4); border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--white); box-shadow: var(--shadow-sm);
}
.search-input input:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.search-input .mag { position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--grey-400); }

.overview-head { display: flex; align-items: baseline; gap: var(--sp-4); flex-wrap: wrap; margin: 0 0 var(--sp-5); }
.overview-head .lead { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.overview-head .lead b { color: var(--grey-900); }
.breadcrumb { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.crumb {
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase;
  color: var(--grey-600); background: var(--white); border: 1px solid var(--steel-200);
  border-radius: var(--r-md); padding: 3px 10px; text-decoration: none; white-space: nowrap;
}
a.crumb:hover { background: var(--steel-50); border-color: var(--steel-300); }
.crumb--current { color: var(--grey-900); background: var(--steel-100); border-color: var(--steel-300); }

.chip {
  font-size: 12px; font-weight: 600; color: var(--grey-700);
  background: var(--steel-100); border: 1px solid var(--steel-200);
  border-radius: var(--r-md); padding: 3px 10px; text-decoration: none;
}

/* view/link icons in table rows */
.view-col { text-align: right; width: 60px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { text-align: right; }
.icon-link { color: var(--grey-400); display: inline-flex; }
.icon-link:hover { color: var(--kraken-600); }

/* Names / scalar Attributes — responsive multi-column grid of editable key/value rows.
   Fewer, wider cells (min(420px,100%) — the min() stops a narrow panel overflowing
   horizontally) so long namespaced keys get a real key column and the key|value split
   stays legible; auto-fill collapses to one column when narrow. */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  align-content: start;
}
.kv-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: var(--sp-4);
  padding: 9px var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
/* THE FIX: min-width:0 lets the item shrink to its track, and overflow-wrap:anywhere
   collapses its min-content so a 40–44 char dotted/underscored key can never force the
   track wider or spill over the value — it wraps inside the key track (2 lines at 190px). */
.kv-row .k {
  min-width: 0; overflow-wrap: anywhere; line-height: 1.35;
  color: var(--grey-600); font-weight: 500; font-size: 13px;
}
.kv-row .v { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; color: var(--grey-900); }
.kv-row .loc { color: var(--grey-400); font-size: 12px; margin-left: 6px; white-space: nowrap; }
.kv-row .edit-cell { display: inline-flex; gap: var(--sp-2); justify-content: flex-end; white-space: nowrap; }
.kv-row.editing { grid-column: 1 / -1; }              /* full width while editing */
.kv-row.editing .v { grid-column: 2 / -1; }
.kv-empty { grid-column: 1 / -1; padding: 10px var(--sp-4); color: var(--grey-500); }

/* inline editing */
.icon-btn { cursor: pointer; }
.inline-edit { display: flex; align-items: flex-start; gap: var(--sp-2); }
.inline-edit .input { flex: 1; max-width: 480px; }
.inline-edit .rte { flex: 1; max-width: 560px; }
.inline-edit .btn { margin-top: 2px; }
.badge--override { background: var(--brand-100); color: var(--brand-700); margin-left: var(--sp-2); }
.lookup-code { color: var(--grey-400); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* add-a-new-item form (below an editable table) */
.add-form { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px dashed var(--steel-200); background: var(--steel-50); }
.add-form .input { flex: 1; }
.add-form .add-sm { flex: 0 0 200px; max-width: 200px; }
.add-form .btn { white-space: nowrap; }

/* children section (a plain section, not a banded panel) */
.section-heading { font-size: 18px; font-weight: 600; margin: var(--sp-6) 0 var(--sp-3); }
.children-section { margin-top: var(--sp-6); }

.panel { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: var(--sp-5); }
.panel-band {
  background: var(--steel-700); color: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); font-weight: 600; font-size: 14px;
}
.panel-band .count { font-weight: 500; opacity: 0.8; font-size: 13px; }
.panel-body { padding: 0; }
.panel .table { width: 100%; }
.panel .table th { padding: 10px var(--sp-4); border-bottom: 1px solid var(--border-subtle); }
.panel .table td { padding: 10px var(--sp-4); }
.panel .empty { padding: var(--sp-4); color: var(--grey-500); }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 10px var(--sp-4); border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.kv td.k { width: 280px; color: var(--grey-600); font-weight: 500; }
.kv td.v { color: var(--grey-900); word-break: break-word; }
.kv .loc { color: var(--grey-400); font-size: 12px; margin-left: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* complex attribute blocks (array-of-objects tables, chip lists, sub-objects) */
.attr-block { border-top: 1px solid var(--border-subtle); padding: var(--sp-4); }
.attr-title { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; color: var(--grey-700); margin-bottom: var(--sp-3); }
.attr-title .count { font-weight: 500; color: var(--grey-500); font-size: 12px; }
.attr-more { color: var(--grey-500); font-size: 12px; padding-top: var(--sp-2); }
.subtable-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--r-md); }
.subtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.subtable th { text-align: left; background: var(--steel-50); color: var(--grey-600); font-weight: 600; padding: 8px 12px; white-space: nowrap; border-bottom: 1px solid var(--border-subtle); }
.subtable td { padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.subtable tbody tr:last-child td { border-bottom: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.linkish { color: var(--brand-700); text-decoration: none; font-weight: 600; }
.linkish:hover { text-decoration: underline; }

/* Destination Hub content panel (loaded dest_hub:* facts; full content in <details>).
   On its own tab every locale/market variant is shown — one collapsible card each, with the
   variant's sections nested inside. */
.dh-variant { border: 1px solid var(--border-subtle); border-radius: var(--r-md); margin: var(--sp-3) var(--sp-4); overflow: hidden; }
.dh-variant > summary { display: flex; align-items: baseline; gap: 8px; padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; background: var(--steel-50); }
.dh-variant > summary::-webkit-details-marker { display: none; }
.dh-variant > summary::before { content: "▸"; color: var(--grey-500); font-size: 11px; }
.dh-variant[open] > summary::before { content: "▾"; }
.dh-variant[open] > summary { border-bottom: 1px solid var(--border-subtle); }
.dh-variant-name { font-weight: 600; font-size: 14px; color: var(--grey-900); }
.dh-variant-meta { margin-left: auto; color: var(--grey-500); font-size: 13px; }
/* variants with no authored content (e.g. a country's non-home markets) recede */
.dh-variant--empty > summary { background: transparent; }
.dh-variant--empty .dh-variant-name { font-weight: 500; color: var(--grey-500); }
.dh-variant-body > .empty { padding: var(--sp-3) var(--sp-4); }
.panel-body > .chips { padding: var(--sp-3) var(--sp-4); }
.panel-body > .empty { padding: var(--sp-3) var(--sp-4); }
.dh-section { border-bottom: 1px solid var(--border-subtle); }
.dh-section:last-child { border-bottom: none; }
.dh-section > summary { padding: var(--sp-3) var(--sp-4); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--grey-800); list-style: none; display: flex; align-items: center; gap: 8px; }
.dh-section > summary::-webkit-details-marker { display: none; }
.dh-section > summary::before { content: "▸"; color: var(--grey-500); font-size: 11px; }
.dh-section[open] > summary::before { content: "▾"; }
.dh-key { font-weight: 400; font-size: 12px; color: var(--grey-500); font-family: monospace; }
.dh-content { padding: var(--sp-4); max-height: 460px; overflow: auto; border-top: 1px solid var(--border-subtle); background: #fafafa; font-size: 14px; }
.dh-content img { max-width: 100%; height: auto; }
.dh-content section { max-width: 100%; }

/* select (status dropdown in edit) */
.status-select { font-size: 12px; font-weight: 600; border: none; border-radius: var(--r-full); padding: 4px 10px; cursor: pointer; }
.status-select--approved { background: var(--success-500); color: var(--white); }
.status-select--review { background: var(--warning-500); color: var(--white); }

/* --- Kraken MMP: image counts badge + galleries + selection groups (see docs/decisions/0004) --- */
.img-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-left: var(--sp-3);
  padding: 3px 10px; border-radius: var(--r-full); font-size: 12px; font-weight: 500;
  background: var(--steel-50); color: var(--grey-700); border: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.img-badge b { color: var(--grey-900); font-weight: 700; }
.img-badge svg { color: var(--kraken-600); }
.img-note { font-size: 13px; color: var(--grey-500); margin-bottom: var(--sp-4); }

/* responsive thumbnail grid — 1→N columns, cards keep a stable aspect box */
.img-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
}
.img-card {
  display: block; text-decoration: none; color: inherit; border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; background: var(--white);
  box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, transform 0.12s;
}
.img-card:hover { box-shadow: 0 4px 12px rgba(16, 24, 40, 0.16); transform: translateY(-1px); }
.img-thumb {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--grey-100); border-bottom: 1px solid var(--border-subtle);
}
.img-thumb--missing {
  display: grid; place-items: center; color: var(--grey-400); font-size: 12px;
}
.img-cap {
  display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap;
  padding: 6px var(--sp-3); font-size: 12px; color: var(--grey-600);
}
.img-rating { color: var(--warning-700); font-weight: 600; }
.img-status { color: var(--success-700); font-weight: 600; }
.img-pos { color: var(--grey-500); font-variant-numeric: tabular-nums; }

/* --- navigation progress bar (top of viewport; animates while a request is in flight) --- */
#nav-progress {
  position: fixed; top: 0; left: 0; z-index: 2000;
  height: 3px; width: 0; background: var(--kraken-600);
  box-shadow: 0 0 8px rgba(230, 46, 5, 0.55), 0 0 3px rgba(230, 46, 5, 0.9);
  opacity: 0; pointer-events: none; will-change: width, opacity;
}
/* start: quick jump then a slow creep to ~92% (ease-out) — stays until the page swaps / completes */
#nav-progress.loading { opacity: 1; width: 92%; transition: width 12s cubic-bezier(0.05, 0.75, 0.1, 1); }
/* finish (HTMX in-page requests): snap to 100% then fade out */
#nav-progress.done { opacity: 0; width: 100%; transition: width 0.2s ease-out, opacity 0.35s ease 0.2s; }
@media (prefers-reduced-motion: reduce) {
  /* no creep — just a static indeterminate bar while loading */
  #nav-progress.loading { width: 100%; transition: opacity 0.15s; }
  #nav-progress.done { transition: opacity 0.2s; }
}

/* slow-request log: let long path?query strings wrap instead of stretching the table */
.path-cell { max-width: 680px; overflow-wrap: anywhere; }
.path-cell .mono, .path-cell a { font-size: 13px; }
