/* =========================================================================
   The ARC console — on top of /core/css/core.css.

   Layout only: every colour, radius and shadow is a token from the palette
   file, as in core.css. Split (CONSOLE-UI-PLAN §3.2):
     console.css   the shell (switcher, sidebar rail, icons), page anatomy
                   (header, toolbar), the shared components (data table,
                   picker, chips, empty, kv), utilities
     map.css       the map page: panel, legend, filters, controls, preview
     drawer.css    the record drawer: sections, tabs, dyn forms, files, tiles,
                   the palette picker, the lightbox
     pages.css     builders, palettes, config, users, home
   ========================================================================= */

/* ---- Toolbar: brand · area tabs · (spacer) · community · user ------------ */
/* The tabs take the slack and scroll sideways; the end never wraps or hides. */
.area-bar { flex: 1 1 auto; min-width: 0; }
.toolbar-end { flex: none; gap: 8px; }
.site-switcher { display: flex; align-items: center; gap: 8px; }
.site-switcher-label {
  font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fg-mute);
}
.site-switcher arc-picker { min-width: 200px; }
.site-switcher .picker-field { background: var(--bg-2); border-color: var(--line); }
.site-switcher .picker-field:hover { border-color: var(--line-hover); }
@media (max-width: 1100px) {
  .site-switcher-label { display: none; }
  .site-switcher arc-picker { min-width: 150px; max-width: 180px; }
  #toolbar { padding: 0 12px; }
}
@media (max-width: 900px) {
  #user-name { display: none; }
  .user-menu-trigger { gap: 4px; padding: 4px; }
  .user-initials {
    display: inline-block; width: 30px; height: 30px;
    border: 1px solid currentColor; border-radius: 50%;
    font: 600 11px/28px var(--f-mono); letter-spacing: 0.04em; text-align: center;
    color: inherit; -webkit-text-fill-color: currentColor;
  }
}

/* ---- Sidebar: an icon per item, the community's name, a collapsible rail --- */
.nav-icon { flex: none; width: 16px; height: 16px; display: inline-flex; color: var(--fg-dim); }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { color: var(--amber); }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-caption {
  margin: -4px 10px 4px; font-size: 12.5px; font-weight: 600; color: var(--fg); letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail-toggle {
  grid-column: 1 / -1; margin-top: 6px; padding: 5px 6px; display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); color: var(--fg-dim);
  font: 500 11px/1 var(--f-sans); cursor: pointer;
}
.rail-toggle:hover { color: var(--fg); background: var(--bg-1); border-color: var(--line); }
@media (min-width: 761px) {
  #app.rail { --sidebar-w: 72px; }
  #app.rail .brand-name { display: none; }
  #app.rail .toolbar-brand { justify-content: center; padding: 0; }
  #app.rail .sidebar-nav { padding: 14px 8px; }
  #app.rail .nav-section { font-size: 0; padding: 14px 0 6px; }
  #app.rail .nav-section::before { content: ''; display: block; width: 24px; height: 1px; margin: 0 auto; background: var(--amber-line); }
  #app.rail .nav-subsection, #app.rail .nav-caption, #app.rail .nav-label, #app.rail .sf-key, #app.rail .sf-val, #app.rail .rail-toggle span { display: none; }
  #app.rail .nav-item { justify-content: center; padding: 10px 0; }
  #app.rail .nav-item.active::before { left: -8px; }
  #app.rail .nav-icon { width: 18px; height: 18px; }
  #app.rail .nav-icon .icon { width: 18px; height: 18px; }
  #app.rail .sidebar-foot { grid-template-columns: 1fr; justify-items: center; padding: 10px 6px; }
  #app.rail .rail-toggle { margin: 0; }
}

/* ---- Page anatomy ------------------------------------------------------- */
.page-header-main { min-width: 0; }
.page-context {
  margin-top: 4px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-dim);
}
.page-sub { margin-top: 6px; color: var(--fg-mute); font-size: 13px; max-width: 72ch; }
.crumbs .crumb-here { color: var(--fg); }
.page-header-actions .btn-icon { flex: none; }

/* The toolbar under the header (ui/toolbar.js). */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-main { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.toolbar-search { position: relative; display: flex; align-items: center; flex: 0 1 300px; min-width: 180px; }
.toolbar-search .icon { position: absolute; left: 10px; color: var(--fg-dim); pointer-events: none; }
.toolbar-search input[type="search"] { width: 100%; min-width: 0; padding-left: 30px; }
.toolbar-count { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--fg-dim); white-space: nowrap; }
.toolbar > .toolbar-end { display: flex; align-items: center; gap: 8px; margin-left: auto; height: auto; }
@media (max-width: 760px) {
  .toolbar-search { flex: 1 1 100%; }
  .toolbar > .toolbar-end { margin-left: 0; width: 100%; }
}

/* ---- Segmented control (ui/segmented.js, over the core's .tab-group) ------ */
arc-segmented { display: inline-flex; }
arc-segmented .tab { display: inline-flex; align-items: center; gap: 6px; }
arc-segmented[data-size="sm"] .tab { padding: 4px 9px; font-size: 11.5px; }
arc-segmented .tab:focus-visible { outline: 2px solid var(--amber-line); outline-offset: -2px; }

/* ---- Data table (ui/data-table.js) ---------------------------------------- */
arc-data-table { display: block; }
.dt-scroll { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-1); }
.dt-table thead th { position: sticky; top: 0; z-index: 1; }
.dt-table thead th.th-sort { user-select: none; }
.dt-check { width: 36px; padding-left: 12px; padding-right: 4px; }
.dt-check input { width: 14px; height: 14px; margin: 0; vertical-align: -2px; }
.dt-table tbody tr.is-selected td { background: var(--amber-soft); }
.dt-table tbody tr.is-highlight td { background: var(--bg-3); box-shadow: inset 2px 0 0 var(--amber); }
.dt-table tbody tr:focus-visible { outline: 2px solid var(--amber-line); outline-offset: -2px; }
.dt-table td.text-right, .dt-table th.text-right { font-variant-numeric: tabular-nums; }
.dt-dense th { padding: 7px 10px; }
.dt-dense td { padding: 6px 10px; font-size: 12.5px; }
.dt-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px 0;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--fg-dim);
}
.dt-foot strong { color: var(--amber); font-weight: 600; }
.dt-pager { display: inline-flex; gap: 2px; }
/* A table inside a card loses its own border. */
.card > arc-data-table .dt-scroll, .card-body > arc-data-table .dt-scroll { border: 0; border-radius: 0; }
.card > arc-data-table .dt-foot { padding: 8px 14px; border-top: 1px solid var(--line); }

/* ---- Picker (ui/picker.js) ------------------------------------------------- */
arc-picker { display: block; min-width: 0; }
.form-field arc-picker { width: 100%; }
.picker-field {
  width: 100%; min-height: 36px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 8px 6px 10px; text-align: left; cursor: pointer;
  background: var(--bg-0); color: var(--fg);
  border: 1px solid var(--line-bold); border-radius: var(--r-sm);
  font: inherit; font-size: 13px;
}
.picker-field:hover { border-color: var(--line-hover); }
.picker-field:focus-visible { outline: none; border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-soft); }
.picker-field[aria-expanded="true"] { border-color: var(--amber); }
.picker-field:disabled { opacity: 0.55; cursor: not-allowed; }
.picker-shown { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.picker-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-placeholder { color: var(--fg-dim); }
.picker-hint { color: var(--fg-dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-tools { display: inline-flex; align-items: center; gap: 2px; flex: none; color: var(--fg-mute); }
.picker-clear { display: inline-flex; padding: 3px; border-radius: var(--r-xs); color: var(--fg-dim); }
.picker-clear:hover { color: var(--err); background: var(--err-soft); }
.picker-caret { display: inline-flex; color: var(--fg-dim); }
.picker-swatch { flex: none; width: 18px; height: 18px; border: 1px solid var(--line-bold); border-radius: var(--r-xs); background: var(--bg-2) center / cover no-repeat; }
.picker-icon { display: inline-flex; color: var(--fg-mute); }
.picker-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-xs); font-size: 12px; }
.picker-more { font-family: var(--f-mono); font-size: 11px; color: var(--fg-mute); }
.picker-compact .picker-field { min-height: 30px; padding: 3px 6px 3px 8px; font-size: 12.5px; }
.picker-pop {
  position: fixed; z-index: 3500; display: flex; flex-direction: column; max-height: 360px;
  background: var(--bg-2); border: 1px solid var(--line-bold); border-radius: var(--r-md); box-shadow: var(--shadow-md);
}
.picker-search { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--line); color: var(--fg-dim); }
.picker-search input[type="search"] { flex: 1 1 auto; min-width: 0; padding: 5px 8px; font-size: 13px; background: var(--bg-0); }
.picker-list { overflow-y: auto; overscroll-behavior: contain; padding: 4px; }
.picker-group { padding: 8px 10px 4px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-dim); }
.picker-option {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-xs); cursor: pointer;
  font-size: 13px; color: var(--fg);
}
.picker-option.is-active { background: var(--bg-hover); }
.picker-option.is-on { color: var(--amber-bright); }
.picker-option[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.picker-option-text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.picker-option-text > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-on { margin-left: auto; display: inline-flex; color: var(--amber); }
.picker-check { flex: none; width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-bold); border-radius: var(--r-xs); color: var(--amber); }
.is-on .picker-check { border-color: var(--amber); }
.picker-empty { padding: 14px 10px; color: var(--fg-mute); font-size: 13px; text-align: center; }
.picker-foot { padding: 6px 8px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

/* ---- Chips (ui/chips.js) ---------------------------------------------------- */
arc-chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip .icon { color: var(--fg-mute); }
.chip-x { display: inline-flex; padding: 1px; border-radius: var(--r-xs); }
.chip-x:hover { background: var(--err-soft); }
.chip-amber { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.chips-clear { font-size: 12px; }

/* ---- Empty, error, key/value ------------------------------------------------ */
.empty-icon { color: var(--fg-dim); margin-bottom: 10px; }
.empty-icon .icon { width: 28px; height: 28px; }
.empty-compact { padding: 28px 16px; }
.empty-error h3 { color: var(--err); }
.empty-state .btn { margin-top: 4px; }
.kv-2 { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 760px) { .kv-2 { grid-template-columns: max-content 1fr; } }
.kv dd.mono { font-size: 12.5px; }

/* ---- Keyboard shortcuts sheet ---------------------------------------------- */
.kbd {
  display: inline-block; min-width: 22px; padding: 1px 6px; text-align: center;
  font-family: var(--f-mono); font-size: 11px; color: var(--fg);
  background: var(--bg-3); border: 1px solid var(--line-bold); border-bottom-width: 2px; border-radius: var(--r-xs);
}
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: center; margin: 0; }
.shortcuts dt { margin: 0; }
.shortcuts dd { margin: 0; color: var(--fg-mute); font-size: 13px; }
.shortcuts-group { grid-column: 1 / -1; margin-top: 8px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }

/* ---- Utilities ----------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.text-dim { color: var(--fg-dim); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--amber); }
.text-err { color: var(--err); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.section-label {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-dim); margin: 0 0 8px;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* A switch with its words beside it (no On / Off of its own). */
.toggle-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--fg-mute); }

/* A record's key after its name in a table cell (Layers, Forms): a gap, not one word space between two fonts. */
td strong + .mono { margin-left: 10px; }

/* ---- Seam tab: the handle on a pane's edge that moves it — the map panel (hide) and the lot drawer
   (back to the map). At the top of the pane's left edge, level with its header (Eric, 2026-11-04);
   on a narrow screen the pane is below, so the tab sits centred on its top edge and the chevron
   turns with it. ------------------------------------------------------------------------------ */
.seam-tab {
  position: absolute; left: -15px; top: 14px; z-index: 5;
  display: flex; align-items: center; justify-content: center; width: 15px; height: 64px; padding: 0; margin: 0;
  background: var(--bg-2); color: var(--fg-mute); border: 1px solid var(--line-bold); border-right: 0;
  border-radius: 7px 0 0 7px; cursor: pointer; box-shadow: -2px 0 6px rgba(0, 0, 0, 0.28);
}
.seam-tab:hover { background: var(--amber); color: var(--bg-1); border-color: var(--amber); }
.seam-tab:focus-visible { outline: 2px solid var(--amber-line); outline-offset: 1px; }
.seam-tab svg { width: 13px; height: 13px; }
@media (max-width: 900px) {
  .seam-tab {
    left: 50%; top: -15px; transform: translateX(-50%); width: 64px; height: 15px;   /* the pane is below the map */
    border-right: 1px solid var(--line-bold); border-bottom: 0; border-radius: 7px 7px 0 0; box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.28);
  }
  .seam-tab svg { transform: rotate(90deg); }
}
