﻿:root {
  color-scheme: light;
  --bg: #eff1fa;
  --panel: #fff;
  --input: #f8f9fc;
  --text: #0d1745;
  --muted: #6b7390;
  --border: #e4e7f0;
  --gold: #eab84f;
  --gold-hover: #f0cb76;
  --gold-text: #131a36;
  --rail: #0c1643;
  --rail-active: #303c67;
  --hero: #101b49;
  --head: #e9edf7;
  --selected: #ecebf8;
  font: 13.33px "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1020;
  --panel: #141830;
  --input: #0f1329;
  --text: #eceefb;
  --muted: #9aa1c4;
  --border: #2a305a;
  --gold: #c9a85f;
  --gold-hover: #dbbd78;
  --gold-text: #141830;
  --rail: #101428;
  --rail-active: #262b55;
  --hero: #1a2049;
  --head: #1a1f3d;
  --selected: #2a3066;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
#workspace { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
aside { background: var(--rail); color: #e1e7fa; }
.brand { padding: 22px 16px; color: var(--gold); font-size: 26px; font-weight: 700; }
.brand small { font-size: 12px; }
.nav-label { color: #b1bedc; padding: 14px 14px 5px; font-weight: 700; font-size: 11px; }
nav a { display: block; padding: 9px 14px; color: inherit; text-decoration: none; }
nav a:hover, nav a[aria-current] { background: var(--rail-active); }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); padding: 14px 20px; border-bottom: 1px solid var(--border); }
h1, h2, h3 { margin: 0 0 6px; }
h1 { font-size: 24px; }
p { color: var(--muted); margin: 6px 0 12px; }
.content { padding: 6px 20px; }
.hero { padding: 24px; border-radius: 10px; background: var(--hero); color: white; }
.hero a { color: var(--gold); }
#contractors { padding: 16px; background: var(--panel); border: 1px solid var(--border); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.end { justify-content: flex-end; }
input, button, .button { font: inherit; color: inherit; border: 1px solid var(--border); border-radius: 5px; padding: 6px 10px; }
input { background: var(--input); min-width: 0; }
button, .button { background: var(--panel); cursor: pointer; text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }
button:not(:disabled):hover, .button:hover { background: var(--selected); }
button.primary { background: var(--gold); color: var(--gold-text); font-weight: 600; }
button.primary:not(:disabled):hover { background: var(--gold-hover); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#query { flex: 1; }
.panes { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 4fr); gap: 20px; margin-top: 10px; }
article { min-width: 0; }
#metadata { white-space: pre-line; margin-bottom: 12px; }
.tabs { display: flex; flex-wrap: wrap; margin-top: 12px; border-bottom: 1px solid var(--border); }
.tabs button[aria-pressed="true"] { background: var(--selected); }
.related-tools { margin-top: 8px; justify-content: space-between; }
.table-wrap { overflow: auto; max-height: 54vh; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th { background: var(--head); position: sticky; top: 0; }
td button { padding: 0; border: 0; border-radius: 0; background: transparent; text-align: left; }
tr[aria-selected="true"] { background: var(--selected); }
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; max-width: calc(100% - 24px); }
dialog::backdrop { background: rgb(13 23 69 / 48%); }
#fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-block: 14px; }
#fields label { display: grid; gap: 4px; }
dd { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  #workspace { grid-template-columns: 145px minmax(0, 1fr); }
  .panes { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #workspace { display: block; }
  #fields { grid-template-columns: 1fr; }
}

#module { padding: 12px 8px; }
.module-bar { margin-block: 8px; }
.module-bar:empty { display: none; }
.module-bar input[type="search"] { flex: 1; }
.module-table { border: 1px solid var(--border); background: var(--panel); margin-block: 8px; }
.module-table th { white-space: nowrap; }
.module-table td { min-width: 105px; }
.module-table tbody tr.packed { background: #ccebd2; color: #173c23; }
.module-table th button { border: 0; background: transparent; padding: 0; }
.module-details, .module-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.module-details fieldset { border: 1px solid var(--border); }
.module-fields { margin-block: 12px; }
.module-fields label { display: grid; align-content: start; gap: 5px; }
.module-fields input:not([type="checkbox"]), .module-fields select, .module-fields textarea { width: 100%; }
#module-editor { width: min(720px, 100% - 24px); }
select, textarea { font: inherit; color: inherit; background: var(--input); border: 1px solid var(--border); border-radius: 5px; padding: 6px 10px; }
textarea { min-height: 48px; resize: vertical; }
@media (max-width: 580px) { .module-details, .module-fields { grid-template-columns: 1fr; } }
.sales-kanban { display: flex; gap: 10px; overflow: auto; max-height: 55vh; padding: 5px; }
.sales-kanban section { flex: 0 0 280px; padding: 0 5px 8px; background: var(--head); }
.sales-kanban h3 { display: grid; place-items: center; min-height: 55px; margin: 0 0 10px; color: white; text-align: center; }
.sales-kanban strong { display: block; text-align: center; }
.sales-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-top: 8px; }
.sales-card p { margin: 6px 0; }
.quote-positions { grid-column: 1 / -1; }
.quote-positions fieldset { border: 1px solid var(--border); }
#module-editor p { white-space: pre-line; }
.module-bar [aria-pressed="true"] { background: var(--selected); }
.sales-calendar { display: grid; grid-template-columns: repeat(7, minmax(84px, 1fr)); gap: 3px; overflow-x: auto; }
.sales-calendar article, .sales-calendar > strong { border: 1px solid var(--border); padding: 5px; }
.sales-calendar article { min-height: 67px; background: var(--panel); }
.sales-calendar button { width: 100%; margin-block: 2px; overflow-wrap: anywhere; text-align: left; }

.mail-preview { width: min(760px, calc(100vw - 2rem)); }
.mail-body { max-height: 58vh; overflow: auto; overflow-wrap: anywhere; margin-bottom: 1rem; }
.mail-body pre { white-space: pre-wrap; font: inherit; }
.mail-steps, .mail-recipients { grid-column: 1 / -1; }
.mail-steps fieldset { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem; margin: .5rem 0; }
.mail-recipients { max-height: 19rem; overflow: auto; }
.mail-recipients details { padding: .4rem .6rem; }
.mail-recipients label { display: block; margin: .35rem 0; }
.mail-recipients textarea { width: 100%; }
#module a[aria-current="page"] { background: var(--selected); font-weight: 600; }
.mail-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; margin: .7rem 0; text-align: center; }
.mail-calendar button { min-width: 0; padding-inline: .1rem; }
.mail-calendar button[aria-pressed="true"] { background: var(--gold); color: var(--gold-text); }
