/* Claves shell, using the existing Dibujo editor and portal visual vocabulary.
   Load after app.css. No controls, document geometry or module mechanics change. */
:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  --display: Inter, "Segoe UI", Arial, sans-serif;
  --ink: #263746;
  --muted: #667680;
  --border: #e0e5e9;
  --surface: #fff;
  --ground: #fcfdfd;
  --subtle: #f5f7f8;
  --accent: #e56840;
  --accent-text: #a94625;
  --accent-fill: #bf4d29;
  --accent-hover: #a94020;
  --accent-soft: #faede6;
  --accent-line: #edc8b5;
  --on-accent: #fff;
  --plum: var(--accent-text);
  --deep: var(--ink);
  --lavender: var(--subtle);
  --copper: var(--accent-text);
  --select-surface: var(--surface);
  --select-menu: var(--surface);
  --select-hover: #f3f5f6;
  --select-active: var(--accent-soft);
  --select-border: #cbd3d9;
  --select-text: var(--ink);
  --select-secondary: #667680;
  --select-shadow: 0 10px 28px #2637461f;
  color: var(--ink);
  background: var(--ground);
}

:root[data-theme="dark"] {
  --ink: #e4ebef;
  --muted: #aab8c2;
  --border: #35434d;
  --surface: #202a32;
  --ground: #172129;
  --subtle: #28353e;
  --accent: #ee9675;
  --accent-text: #ffb69a;
  --accent-fill: #ee9675;
  --accent-hover: #ffb295;
  --accent-soft: #43352f;
  --accent-line: #825541;
  --on-accent: #202a32;
  --plum: var(--accent-text);
  --deep: var(--ink);
  --lavender: var(--subtle);
  --copper: var(--accent-text);
  --select-surface: var(--surface);
  --select-menu: var(--surface);
  --select-hover: #2d3c46;
  --select-active: var(--accent-soft);
  --select-border: #53636e;
  --select-text: var(--ink);
  --select-secondary: #b4c3cc;
  --select-shadow: 0 10px 28px #10181e66;
  color: var(--ink);
  background: var(--ground);
}

:root body { background: var(--ground); color: var(--ink); }
#shell { font-size: 13px; }
#shell :is(h1, h2, h3), dialog :is(h1, h2, h3) { font-family: var(--display); color: var(--ink); }
#shell h1 { font-size: 26px; letter-spacing: -.6px; line-height: 1.25; }
#shell h2 { font-size: 20px; letter-spacing: -.35px; }
#shell :is(aside, .catalog-panel), :root dialog { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: none; }
#shell :is(.catalog-panel, #contractsModule) { border-radius: 8px; }
#shell #contractsModule { background: var(--surface); }

/* Familiar compact controls; the darker orange keeps small action labels legible. */
:root button {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--select-border);
  border-radius: 6px;
  font-family: var(--display);
  min-height: 36px;
  box-shadow: none;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
:root button:hover { background: var(--select-hover); color: var(--ink); border-color: var(--select-secondary); box-shadow: none; }
:root button:active { transform: none; }
:root button:disabled { opacity: .45; cursor: not-allowed; }
:root button.primary, #shell button.primary {
  color: var(--on-accent);
  background: var(--accent-fill);
  border-color: var(--accent-fill);
  box-shadow: none;
}
:root button.primary:hover, #shell button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
:root :is(button, input, select, textarea, summary, a):focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}
:root :is(input, select, textarea), #shell .toolbar :is(input, select), #login input {
  font-family: var(--display);
  background: var(--surface);
  color: var(--ink);
  border-color: var(--select-border);
  border-radius: 6px;
}
:root :is(input, select, textarea):focus { background: var(--surface); border-color: var(--accent-text); box-shadow: none; }
:root :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
:root label { color: var(--ink); }
#shell :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--accent-fill); }
:root .styled-select .styled-select-trigger { border-radius: 6px; min-height: 40px; box-shadow: none; }
:root .styled-select.is-open > .styled-select-trigger { box-shadow: none; }
:root .styled-select-menu { font-family: var(--display); border-radius: 7px; }
:root .styled-select-option { border-radius: 4px; }
:root .styled-select-option[aria-selected="true"] { color: var(--accent-text); border-color: var(--accent-line); }

/* Keep the existing navigation and its collapse behavior. */
#shell aside .brand-mark, #loading .brand-mark { background: var(--accent); border-radius: 8px; }
#shell aside .brand-mark > span, #loading .brand-mark > span { color: var(--on-accent); }
#shell aside .brand strong { font-size: 24px; letter-spacing: -.6px; }
#shell aside :is(.brand small, .workspace-label, .sidebar-note, .sidebar-note strong, .sidebar-note p, .account small, .account-actions button) { color: var(--muted); }
#shell aside nav { gap: 5px; }
#shell aside nav button {
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  min-height: 42px;
  padding: 10px 12px;
  font-size: 13px;
  gap: 10px;
  white-space: normal;
}
#shell aside nav button > span:not(.nav-count) { min-width: 0; }
#shell aside nav button:hover { background: var(--select-hover); }
#shell aside nav button.active { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
#shell :is(.nav-count, .count-chip, .avatar) { color: var(--muted); background: var(--subtle); }
#shell .active .nav-count { color: var(--accent-text); background: var(--surface); }
#shell #sidebarToggle { background: var(--surface); color: var(--muted); border-color: var(--border); border-radius: 6px; }
#shell .account-actions button { min-height: 34px; }
#shell .topbar, #shell .topbar strong, #shell .topbar div > span { color: var(--muted); }
#shell .panel-dot { background: var(--accent); }
#shell :is(.panel-heading > span, .page-footnote, footer, .pagination span, .danger-zone, .muted) { color: var(--muted); }
#shell :is(.catalog-tabs button, .module-navigation button, .duplicate-modes button) { color: var(--muted); background: transparent; box-shadow: none; }
#shell .catalog-tabs button[aria-selected="true"], #shell .module-navigation button[aria-pressed="true"], #shell .duplicate-modes button[aria-pressed="true"] {
  color: var(--accent-text);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
#shell .module-navigation .electrical-dropdown > [data-current-nav] { border-radius: 6px; box-shadow: none; }
#shell .module-navigation .electrical-menu button[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
#shell :is(.electrical-menu, .catalog-options-menu) { border-radius: 7px; background: var(--surface); }

/* Preserve table layout and numeric precision. */
#shell th { background: var(--subtle); color: var(--muted); border-color: var(--border); font-weight: 600; }
#shell :is(td, tbody tr) { border-color: var(--border); }
#shell tbody tr:hover { background: var(--select-hover); }
#shell :is(.description, .sheet-description, .sheet-code, .code) { color: var(--ink); }
#shell .code-token { background: var(--subtle); color: var(--ink); border-color: var(--border); border-radius: 4px; }
#shell :is(.origin, .origin small, .source-row, .move span, .duplicate-record small, .duplicate-record dt, .no-counterpart, .duplicate-controls p) { color: var(--muted); }
#shell :is(.icon-button, .move .icon-button) { background: transparent; border-color: transparent; color: var(--muted); }
#shell .icon-button:hover { background: var(--select-hover); color: var(--ink); }
#shell :is(.duplicate-group-title, .snapshot, .batch), #shell .spreadsheet-table .sheet-section td { background: var(--subtle); color: var(--ink); border-color: var(--border); }
#shell .history-entry { border-color: var(--border); }
#shell .history-entry::before { background: var(--accent); border-color: var(--surface); }
#shell .history-entry :is(h3, summary) { color: var(--ink); }
#shell .empty { color: var(--muted); }
#shell .empty::before { color: var(--select-border); }

/* Contract selectors and import controls retain their source ordering. */
#shell .apu-breadcrumb button { color: var(--accent-text); background: transparent; }
#shell .apu-breadcrumb strong, #shell .apu-choices [data-choice] strong { color: var(--ink); }
#shell #contractsModule .contracts-bar button:not(.primary), #shell #contractsSettings button {
  background: var(--surface);
  border-color: var(--select-border);
  color: var(--ink);
}
#shell #contractsModule .contracts-bar button:not(.primary):hover, #shell #contractsSettings button:hover { background: var(--select-hover); border-color: var(--select-secondary); }
#shell #contractsModule .contracts-bar .styled-select-trigger { background: var(--select-surface); color: var(--ink); border-color: var(--select-border); }
#shell #contractsImportPanel .contracts-import-toolbar { background: var(--subtle); border-radius: 7px; }
#shell #contractsImportPanel .contracts-source label { background: var(--surface); color: var(--ink); border-radius: 5px; border-color: var(--select-border); }
#shell #contractsImportPanel .contracts-source label:has(input:checked) { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
#shell #contractsImportPanel .contracts-source label:hover { border-color: var(--select-secondary); }
#shell :is(.contracts-editor fieldset, .contract-manage-work, .contracts-legacy, .contracts-conflicts) { border-radius: 7px; }
#shell #contractsImportPanel .contracts-paste-label textarea { font-family: var(--mono); }
#shell :is(#contractsCsvFile, #contractsExcelFile) { background: var(--surface); border-radius: 6px; }
#shell :is(#contractsCsvFile, #contractsExcelFile)::file-selector-button { border-radius: 5px; }

/* Status colors keep their existing meaning. */
#shell #notice:not(:empty) { background: var(--accent-soft); color: var(--accent-text); border-radius: 6px; }
#shell #notice.error, :root .error { color: #a43f34; background: transparent; }
#shell .danger, #shell .icon-button.danger { color: #a43f34; }
:root[data-theme="dark"] #shell #notice.error, :root[data-theme="dark"] .error,
:root[data-theme="dark"] #shell .danger, :root[data-theme="dark"] #shell .icon-button.danger { color: #ffb6ad; }
:root dialog { border-radius: 10px; box-shadow: 0 20px 60px #17212926; }
:root dialog::backdrop { background: #26374655; backdrop-filter: none; }

@media (pointer: coarse) {
  #shell :is(button, .styled-select-trigger, .contracts-source label),
  :root .styled-select-option, :root dialog button { min-height: 44px; touch-action: manipulation; }
  #shell .row-actions { gap: 6px; }
  #shell .row-actions .icon-button { min-width: 40px; }
  #shell.sidebar-collapsed .account-actions button { min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  :root :is(button, input, select, textarea, tbody tr, .select-chevron) { transition: none; }
}
