/* WetEdge styles. Rule order matters (later rules win), so sections follow the original order. */

/* ===== Colors and sizes (light theme; the dark theme follows) ===== */
:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel2: #f8fafb;
  --ink: #13232e;
  --muted: #5d6d79;
  --line: #dbe3e9;
  --brand: #0a6a84;
  --brand-2: #0e8aa8;
  --brand-soft: #e2f1f5;
  --on-brand: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #a15c07;
  --warn-soft: #fef4e6;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.05),0 1px 3px rgba(16,24,40,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f171d;
    --panel: #16222a;
    --panel2: #1b2933;
    --ink: #e4edf2;
    --muted: #9db0bd;
    --line: #2a3b46;
    --brand: #3fb3cf;
    --brand-2: #5cc4dc;
    --brand-soft: #173540;
    --on-brand: #06202a;
    --danger: #f97066;
    --danger-soft: #3a1a18;
    --warn: #fdb022;
    --warn-soft: #3a2a10;
    --ok: #47cd89;
    --ok-soft: #123224;
  }
}

/* ===== Base elements ===== */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
}

body {
  font: 14px/1.45 "Segoe UI",system-ui,-apple-system,Roboto,Arial,sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

/* ===== Page layout: header, left menu, main area ===== */
.app {
  display: grid;
  grid-template-columns: 210px minmax(0,1fr);
  grid-template-rows: 58px 1fr;
  min-height: 100vh;
}

header {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .2px;
}

.brand small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0;
}

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.co {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.co img {
  height: 26px;
  width: auto;
  border-radius: 4px;
}

.viewas {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.viewas select {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}

nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}

nav button:hover {
  background: var(--panel2);
  color: var(--ink);
}

nav button.on {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

nav svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.navnote {
  margin-top: auto;
  padding: 10px 12px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

main {
  padding: 22px;
  min-width: 0;
}

h1 {
  font-size: 22px;
  margin: 0;
}

h2 {
  font-size: 15px;
  margin: 0 0 12px;
}

h3 {
  font-size: 13px;
  margin: 16px 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.pagehead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.pagehead .sub {
  color: var(--muted);
  font-size: 13px;
}

.pagehead .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Cards, buttons and tables ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel2);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.btn.primary:hover {
  background: var(--brand-2);
}

.btn.danger {
  color: var(--danger);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn.icon {
  padding: 5px 8px;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.search {
  flex: 1 1 240px;
  min-width: 180px;
  position: relative;
}

.search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

select.f {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  background: var(--panel2);
  position: sticky;
  top: 0;
}

th.sort {
  cursor: pointer;
  user-select: none;
}

th.sort:hover {
  color: var(--ink);
}

tbody tr.click {
  cursor: pointer;
}

tbody tr.click:hover td {
  background: var(--brand-soft);
}

tr:last-child td {
  border-bottom: 0;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.wrap {
  white-space: normal;
  min-width: 240px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

/* ===== Status chips (Lead, Active, Sold…) ===== */
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.chip.Lead {
  background: #eef4ff;
  color: #3538cd;
  border-color: #c7d7fe;
}

.chip.Active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.chip.Hold {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.chip.Sold {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: transparent;
}

.chip.Complete {
  background: #f0f9ff;
  color: #026aa2;
  border-color: #b9e6fe;
}

.chip.Lost, .chip.Cnx {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

.chip.arch {
  background: var(--panel2);
  color: var(--muted);
}

@media (prefers-color-scheme: dark) {
  .chip.Lead {
    background: #1d2450;
    color: #a4bcfd;
    border-color: transparent;
  }
  .chip.Complete {
    background: #0b2a3a;
    color: #7cd4fd;
    border-color: transparent;
  }
}

.detail {
  display: grid;
  grid-template-columns: minmax(0,1.6fr) minmax(280px,1fr);
  gap: 16px;
  align-items: start;
}

/* ===== Forms and fields ===== */
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form.three {
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.form .full {
  grid-column: 1/-1;
}

.fld label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.fld input, .fld select, .fld textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.fld textarea {
  min-height: 76px;
  resize: vertical;
}

.fld input:focus, .fld select:focus, .fld textarea:focus, td input:focus, td select:focus {
  outline: 2px solid var(--brand-2);
  outline-offset: -1px;
  border-color: transparent;
}

.fld input[readonly] {
  background: var(--panel2);
  color: var(--muted);
}

.fld select:disabled {
  background: var(--panel2);
  color: var(--muted);
  cursor: not-allowed;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.dn {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -4px 0 14px;
  overflow-x: auto;
}

.tabs button {
  padding: 9px 12px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tabs button.on {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

td input, td select {
  width: 100%;
  min-width: 60px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

td input.n {
  text-align: right;
  width: 90px;
}

td select {
  min-width: 120px;
}

td input.w {
  min-width: 280px;
}

.phase {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.phase .row b {
  color: var(--ink);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 10px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  z-index: 20;
  font-size: 13px;
}

.toast button {
  background: none;
  border: 0;
  color: var(--brand-2);
  font-weight: 700;
  cursor: pointer;
}

/* ===== Sign-in and setup screens ===== */
.authcard {
  max-width: 420px;
  margin: 40px auto;
}

.authform {
  display: grid;
  gap: 12px;
}

.authform label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

.authform input {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink,inherit);
  font-size: 15px;
}

.btncap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  vertical-align: top;
}

.btncap>span {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
  max-width: 150px;
  text-align: center;
}

.actions:has(.btncap) {
  align-items: flex-start;
}

.listcards {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(280px,1fr));
  gap: 14px;
}

.listcards .card.wide {
  grid-column: 1/-1;
  order: -1;
}

.lrow textarea {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font: inherit;
  resize: vertical;
  line-height: 1.4;
}

.lrow {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.lrow input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.lock {
  font-size: 11px;
  color: var(--warn);
  font-weight: 600;
}

.total {
  font-weight: 700;
}

.total.bad {
  color: var(--danger);
}

.total.good {
  color: var(--ok);
}

/* ===== Printed documents: proposal, ATC, statements ===== */
.doc {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  color: #1a1a1a;
  font-family: Georgia,"Times New Roman",serif;
}

.doc .dhead {
  display: flex;
  gap: 12px;
  align-items: center;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.doc .dhead img {
  height: 44px;
}

.doc .dname {
  font-size: 20px;
  font-weight: 700;
  color: #0a4f87;
}

.doc .daddr {
  font-size: 11px;
  color: #444;
  font-family: Arial,sans-serif;
}

.doc h4 {
  margin: 6px 0;
  font-family: Arial,sans-serif;
  font-size: 13px;
  letter-spacing: .5px;
}

.doc p {
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
}

.doc .sig {
  display: flex;
  gap: 24px;
  margin-top: 26px;
  font-family: Arial,sans-serif;
  font-size: 11px;
  color: #444;
}

.doc .sig div {
  flex: 1;
  border-top: 1px solid #888;
  padding-top: 4px;
  text-align: center;
}

.logobox {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.logobox .slot {
  flex: 1 1 200px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.logobox img {
  max-height: 70px;
  max-width: 100%;
  display: block;
  margin: 0 auto 8px;
}

/* ===== Notices and hints ===== */
.notice {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 14px;
}

.notice.warn {
  background: var(--warn-soft);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.right {
  text-align: right;
}

/* ===== Estimate worksheet and totals ===== */
.ws {
  display: grid;
  grid-template-columns: minmax(0,1fr) 290px;
  gap: 16px;
  align-items: start;
}

.ws-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.ws-side {
  position: sticky;
  top: 74px;
}

table.mini {
  width: 100%;
}

table.mini td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  white-space: normal;
  font-size: 13px;
  background: none;
}

table.mini td.num {
  padding-left: 10px;
  white-space: nowrap;
}

table.mini tr.tot td {
  font-weight: 700;
  font-size: 16px;
  border-bottom: 0;
  padding-top: 10px;
}

.lines {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.readout {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.readout b {
  color: var(--ink);
}

tr.onrow td {
  background: var(--brand-soft);
}

select.st {
  min-width: 110px;
}

.prow {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}

.prow:hover {
  background: var(--brand-soft);
}

.prow span {
  color: var(--muted);
  font-size: 13px;
}

.prow span.num {
  margin-left: auto;
  color: var(--ink);
  font-weight: 600;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  border: 0;
  background: var(--panel);
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.seg button.on {
  background: var(--brand);
  color: var(--on-brand);
}

.doc.proposal {
  max-width: 860px;
  margin: 0 auto;
}

.kvbox {
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.kvbox b {
  color: var(--ink);
}

.doc.comm input, .doc.comm select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: #1a1a1a;
  font: inherit;
}

.doc.comm input.n {
  width: 100px;
  text-align: right;
}

.printonly {
  display: none;
}

.attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  font-weight: 600;
  font-size: 13px;
}

.doc {
  color-scheme: light;
}

.doc .btn {
  background: #fff;
  color: #1a1a1a;
  border-color: #c9c9c9;
}

.doc .btn:hover {
  background: #f2f2f2;
}

.card.ck>h2.ckh {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card.ck>h2.ckh .ckc {
  display: inline-block;
  width: 14px;
  color: var(--muted,#888);
  font-size: 12px;
}

.card.ck.collapsed>*:not(h2) {
  display: none!important;
}

.card.ck.collapsed>h2 {
  margin-bottom: 0;
}

.ckbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

.doc .btn.lopt {
  padding: 1px 7px;
  font-size: 11px;
  margin-left: 6px;
  vertical-align: 1px;
}

.doc .fld label {
  color: #555;
}

.doc .fld input, .doc .fld select, .doc .fld textarea {
  background: #fff;
  color: #1a1a1a;
  border-color: #c9c9c9;
}

.doc .fld textarea::placeholder, .doc input::placeholder {
  color: #888;
}

.doc .muted {
  color: #666;
}

.doc .btn, .doc .fld textarea, .doc .fld input, .doc .fld select, .doc.comm input, .doc.comm select {
  font-family: "Segoe UI",system-ui,Arial,sans-serif;
}

.pbody td input:not(.n):not(.w) {
  min-width: 150px;
}

/* compact price tables: no sideways scrolling */
.pbody .tablewrap {
  overflow-x: visible;
}

/* ===== Price list ===== */
.pbody table {
  width: 100%;
  table-layout: fixed;
}

.pbody th, .pbody td {
  padding: 6px 5px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.pbody th {
  white-space: normal;
  line-height: 1.2;
}

.pbody td input, .pbody td select, .pbody td input.w, .pbody td input.n, .pbody td input:not(.n):not(.w) {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 5px 6px;
  font-size: 13px;
}

.pbody th.num {
  width: 74px;
}

.pbody th.catc {
  width: 110px;
}

.pbody th.actc {
  width: 66px;
}

.pbody th.wc {
  width: 24%;
}

.pbody td .btn.icon {
  padding: 3px 6px;
}

@media (max-width:1180px) {
  .pbody .detail {
    grid-template-columns: minmax(0,1fr);
  }
}

.plist {
  display: grid;
  grid-template-columns: 200px minmax(0,1fr);
  gap: 20px;
  align-items: start;
}

.pnav {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  box-shadow: var(--shadow);
}

.pnav .pg {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 700;
  padding: 10px 10px 4px;
}

.pnav .pg:first-child {
  padding-top: 4px;
}

.pnav button.pg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  font-weight: 700;
  padding: 9px 10px;
  border-radius: 6px;
}

.pnav button.pg.open {
  color: var(--ink);
}

.pnav .pg .chev {
  width: 10px;
  font-size: 10px;
}

.pnav button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
}

.pnav button:hover {
  background: var(--panel2);
}

.pnav button.on {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.pnav-sel {
  display: none;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

@media (max-width:1280px) {
  .plist {
    grid-template-columns: minmax(0,1fr);
  }
  .pnav {
    position: static;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .pnav-list {
    display: none;
  }
  .pnav-sel {
    display: block;
  }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width:820px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.qtable td {
  white-space: normal;
}

textarea[data-f="notes"][data-bind^="pl:"] {
  min-height: 150px;
}

.qtable input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.tkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(170px,1fr));
  gap: 10px;
  margin-bottom: 10px;
}

/* ===== Takeoff ===== */
.tk {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel2);
}

.tkl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.tkv {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

textarea[data-bind="mail"] {
  min-height: 260px;
}

.doc h4 {
  margin: 16px 0 4px;
}

.doc .dmeta {
  text-align: right;
  font-family: Arial,sans-serif;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.doc .dcols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-family: Arial,sans-serif;
  font-size: 12.5px;
  margin: 10px 0 12px;
  line-height: 1.5;
}

.doc .dcols.three {
  grid-template-columns: repeat(3,1fr);
}

.doc .dcols>div:last-child:not(.kvd) {
  text-align: right;
}

.doc .dlabel {
  font-size: 10px;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: #666;
  margin-bottom: 3px;
}

.doc .dsmall {
  font-size: 11px;
  color: #555;
}

.doc .dfine {
  font-size: 11px;
  font-style: italic;
  color: #333;
  margin: 8px 0;
}

.doc .dnotes {
  font-size: 12px;
  font-style: normal;
}

.doc table.dtable {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial,sans-serif;
  font-size: 12px;
  margin-bottom: 4px;
}

.doc table.dtable td, .doc table.dtable th {
  padding: 4px 6px;
  border-bottom: 1px solid #e3e3e3;
  color: #1a1a1a;
  white-space: normal;
  background: #fff;
  position: static;
}

.doc table.dtable th {
  font-size: 11px;
  color: #555;
  background: #f3f3f3;
}

.doc table.dtable td.num {
  white-space: nowrap;
  width: 110px;
}

.doc table.dtable tr.sub td {
  font-weight: 700;
  border-bottom: 1px solid #999;
}

.doc table.dtable.grand {
  margin-top: 14px;
}

.doc table.dtable.grand td {
  font-size: 15px;
  font-weight: 700;
  border-top: 2px solid #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
}

.doc .kvd {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
}

.doc .kvd span:nth-child(odd) {
  color: #666;
}

.doc .draftmark {
  background: #fff4d6;
  color: #8a5a00;
  font-family: Arial,sans-serif;
  font-weight: 700;
  text-align: center;
  padding: 5px;
  margin: -6px 0 12px;
  border-radius: 4px;
  font-size: 12px;
}

/* ===== Smaller screens and printing ===== */
@media (max-width:1000px) {
  .detail {
    grid-template-columns: 1fr;
  }
  .ws {
    grid-template-columns: 1fr;
  }
  .ws-side {
    position: static;
    order: -1;
  }
}

@media (max-width:620px) {
  .doc .dcols, .doc .dcols.three {
    grid-template-columns: 1fr;
  }
}

@media print {
  .printonly {
    display: block;
  }
  .doc.comm input, .doc.comm select {
    border: 0;
    padding: 0;
    appearance: none;
  }
  header, nav, .noprint, #toast {
    display: none!important;
  }
  .app {
    display: block;
  }
  main {
    padding: 0;
  }
  body {
    background: #fff;
  }
  .doc {
    border: 0;
    padding: 0;
  }
  .doc.proposal {
    max-width: none;
  }
}

@media (max-width:820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
  header {
    flex-wrap: wrap;
    padding: 8px 16px;
    gap: 8px;
    position: static;
  }
  .hdr-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
  nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 6px 10px;
  }
  nav button {
    width: auto;
    white-space: nowrap;
  }
  .navnote {
    display: none;
  }
  main {
    padding: 16px;
  }
  .form, .form.three {
    grid-template-columns: 1fr;
  }
  .co span {
    display: none;
  }
}

/* ===== Utility classes ===== */
/* Utility classes (u-*) and small components (c-*) that replaced repeated inline styles.
   !important keeps them winning over component rules, the way the inline styles did. */
.u-mt-10 {
  margin-top: 10px !important;
}

.u-wrap {
  white-space: normal !important;
}

.u-mb-6 {
  margin-bottom: 6px !important;
}

.c-input-inline {
  flex: 1 !important;
  padding: 7px 8px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--panel) !important;
}

.u-maxw-90 {
  max-width: 90px !important;
}

.u-m-0-0-8 {
  margin: 0 0 8px !important;
}

.u-mt-12 {
  margin-top: 12px !important;
}

.u-mb-8 {
  margin-bottom: 8px !important;
}

.u-flex-1 {
  flex: 1 !important;
}

.u-mt-8 {
  margin-top: 8px !important;
}

.u-fs-12 {
  font-size: 12px !important;
}

.u-maxw-260 {
  max-width: 260px !important;
}

.u-mt-6 {
  margin-top: 6px !important;
}

.u-mt-0 {
  margin-top: 0 !important;
}

.u-mb-14 {
  margin-bottom: 14px !important;
}

.u-cols-2 {
  grid-template-columns: 1fr 1fr !important;
}

.u-hidden {
  display: none !important;
}

.u-row {
  display: flex !important;
  gap: 8px !important;
}

.u-row-wrap {
  flex-wrap: wrap !important;
}

.c-input-tiny {
  padding: 3px 6px !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px !important;
  background: var(--panel) !important;
}

.u-maxw-640 {
  max-width: 640px !important;
}

.u-m-0-0-10 {
  margin: 0 0 10px !important;
}

.u-m-n6-0-10 {
  margin: -6px 0 10px !important;
}

.u-mb-10 {
  margin-bottom: 10px !important;
}

.u-noshadow {
  box-shadow: none !important;
}
