:root {
  --paper: #f6f6f3;
  --paper-deep: #ecebe6;
  --surface: #fff;
  --ink: #20201d;
  --muted: #74736d;
  --line: #cecdc7;
  --line-soft: #e6e5df;
  --wood: #7a6048;
  --wood-dark: #5e4938;
  --sage: #687368;
  --warning: #8a6a3f;
  --danger: #8a4d45;
  --shadow: none;
  --font-sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-serif: "Songti TC", "Noto Serif TC", "PMingLiU", serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; }
.is-hidden { display: none !important; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr); background: var(--surface); }
.brand-panel { min-height: 100vh; padding: clamp(32px, 5vw, 76px); display: flex; flex-direction: column; justify-content: space-between; background: var(--paper); position: relative; overflow: hidden; }
.brand-panel::after { content: ""; position: absolute; width: 1px; height: 38%; right: 11%; bottom: 0; background: var(--line); transform: rotate(18deg); transform-origin: bottom; }
.brand-top { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 14px; position: relative; z-index: 1; text-align: center; }
.brand-mark { width: 132px; height: 132px; object-fit: contain; mix-blend-mode: multiply; }
.brand-name { margin: 0 0 7px; font-family: var(--font-serif); font-size: 30px; letter-spacing: .16em; }
.brand-en { margin: 0; font-size: 11px; letter-spacing: .25em; color: var(--muted); }
.brand-statement { max-width: 650px; position: relative; z-index: 1; }
.eyebrow, .section-label { margin: 0 0 20px; font-size: 10px; letter-spacing: .28em; color: var(--wood); font-weight: 600; }
.brand-statement h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(44px, 5vw, 74px); font-weight: 500; line-height: 1.28; letter-spacing: .04em; }
.brand-statement > p:last-child { margin: 30px 0 0; max-width: 34em; color: var(--muted); font-size: 15px; line-height: 2; letter-spacing: .05em; }
.brand-foot { margin: 0; color: #918c83; font-size: 11px; letter-spacing: .12em; }
.login-panel { display: grid; place-items: center; padding: 48px; background: var(--surface); }
.login-card { width: min(390px, 100%); }
.mobile-brand { display: none; }
.login-card h2 { margin: 0; font-family: var(--font-serif); font-weight: 500; font-size: 34px; letter-spacing: .08em; }
.intro { margin: 12px 0 38px; color: var(--muted); font-size: 14px; }
.login-card > label, .login-card .label-row label { display: block; margin: 0 0 9px; font-size: 13px; font-weight: 600; letter-spacing: .06em; }
.label-row { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.label-row label { margin: 0 !important; }
input, select { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: var(--ink); outline: none; transition: border-color .18s, box-shadow .18s; }
textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font: inherit; line-height: 1.6; outline: none; resize: vertical; }
input:focus, select:focus { border-color: var(--wood); box-shadow: 0 0 0 3px rgba(122, 96, 72, .10); }
textarea:focus { border-color: var(--wood); }
.text-button { padding: 0; border: 0; background: none; color: var(--wood); font-size: 12px; cursor: pointer; }
.login-options { margin: 18px 0 28px; display: flex; justify-content: space-between; align-items: center; }
.check-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-label input { width: 15px; height: 15px; accent-color: var(--wood); }
.primary-button, .secondary-button { min-height: 42px; padding: 0 18px; border-radius: 3px; font-weight: 600; font-size: 13px; letter-spacing: .04em; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.primary-button { border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.primary-button:hover { background: #151513; transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--ink); }
.secondary-button:hover { border-color: #aaa399; background: rgba(255,255,255,.5); }
.login-button { width: 100%; height: 50px; }
.prototype-note { margin: 14px 0 0; color: #9b968d; text-align: center; font-size: 11px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); background: var(--surface); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 32px 22px 22px; display: flex; flex-direction: column; background: #f0efe9; color: var(--ink); border-right: 1px solid var(--line); }
@media (min-width: 681px) { .sidebar { overflow-y: auto; } }
.sidebar-brand { display: flex; align-items: center; gap: 14px; padding: 0 4px 30px; border-bottom: 1px solid var(--line); }
.sidebar-brand img { width: 64px; height: 64px; object-fit: contain; filter: none; opacity: 1; }
.sidebar-brand div { display: grid; gap: 1px; }
.sidebar-brand strong { font-family: var(--font-serif); font-size: 22px; font-weight: 500; letter-spacing: .18em; }
.sidebar-brand span { color: var(--muted); font-size: 10px; letter-spacing: .26em; }
.side-nav { margin-top: 38px; display: grid; gap: 0; }
.nav-item { width: 100%; min-height: 60px; padding: 10px 4px; display: flex; justify-content: space-between; align-items: center; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; color: #686761; cursor: pointer; text-align: left; }
.nav-item span { display: grid; gap: 4px; }
.nav-item b { font-size: 10px; font-weight: 600; letter-spacing: .14em; }
.nav-item em { font-size: 12px; font-style: normal; letter-spacing: .08em; }
.nav-item small { font-size: 9px; opacity: .55; }
.nav-item:hover { color: var(--ink); background: transparent; }
.nav-item.is-active { color: var(--ink); background: transparent; border-bottom-color: var(--ink); }
.sidebar-bottom { margin-top: auto; }
.admin-nav { margin-bottom: 8px; border-top: 1px solid var(--line); }
.admin-nav > p { margin: 0; padding: 13px 4px 7px; display: grid; gap: 3px; color: var(--muted); font-size: 8px; letter-spacing: .14em; }
.admin-nav > p span { font-size: 10px; letter-spacing: .06em; }
.admin-nav .nav-item { min-height: 54px; }
.schedule-projects { display: grid; border-top: 1px solid var(--line); }
#archiveDetail { margin: 0 0 16px; }
#caseManagementRows > #archiveDetail { border: 1px solid var(--line); border-top: 0; background: var(--paper); }
.case-management-row[aria-expanded="true"] { background: var(--paper); border-bottom-color: transparent; }
#archiveDetail h4 { margin: 22px 0 10px; font-size: 14px; font-weight: 600; }
#archiveDetail .archive-version { display: block; overflow-x: auto; padding: 14px 0; border-top: 1px solid var(--line); }
#archiveDetail .archive-version > span { margin-left: 16px; color: var(--muted); font-size: 11px; }
#archiveDetail table { width: 100%; min-width: 550px; border-collapse: collapse; text-align: left; }
#archiveDetail th, #archiveDetail td { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
#archiveDetail #archiveSchedule { overflow-x: auto; }
.schedule-project { width: 100%; padding: 18px 4px; display: flex; align-items: center; gap: 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.schedule-project:hover, .schedule-project.is-active { background: var(--paper); }
.schedule-project strong { min-width: 160px; font-size: 14px; font-weight: 500; }
.schedule-project span, .schedule-project small { color: var(--muted); font-size: 11px; }
.schedule-project small { margin-left: auto; white-space: nowrap; }
#projectRows .select-project-quote { cursor: pointer; }
#projectRows .select-project-quote:hover, #projectRows .select-project-quote:focus-visible { background: var(--paper); }
#projectRows .select-project-quote:focus-visible { outline: 2px solid var(--wood); outline-offset: -2px; }
#projectRows .project-row-arrow { color: var(--muted); white-space: nowrap; text-align: right; }
.schedule-empty, .schedule-note, .schedule-source, .schedule-status { color: var(--muted); font-size: 12px; line-height: 1.8; }
#scheduleDetail { margin-top: 20px; }
.schedule-projects > #scheduleDetail { min-width: 0; margin: 0 0 20px; border-top: 0; }
.schedule-controls { margin: 18px 0 12px; display: flex; align-items: end; gap: 16px; }
.schedule-controls label { display: grid; gap: 8px; font-size: 12px; }
.schedule-controls input, .schedule-days, .schedule-order { height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); }
.schedule-days, .schedule-order { width: 65px; text-align: center; }
.schedule-start-control { display: grid; gap: 3px; }
.schedule-manual-start { width: 137px; height: 38px; padding: 0 5px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font-size: 11px; }
.schedule-start-control small, .schedule-reset-start { color: var(--muted); font-size: 10px; }
.schedule-reset-start { width: fit-content; padding: 0; border: 0; border-bottom: 1px solid currentColor; background: none; cursor: pointer; }
.schedule-table td { font-variant-numeric: tabular-nums; }
.schedule-trade-source { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.schedule-head-actions { display: flex; gap: 8px; align-items: center; }

.duration-rule-shell { width: 100%; box-sizing: border-box; padding: 24px; }
#durationRulesModal { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; overflow-x: hidden; box-sizing: border-box; }
#durationRulesModal .table-wrap { max-width: 100%; overflow-x: auto; }
@media (max-width: 680px) { .duration-rule-shell { padding: 18px; } }
.duration-rule-table { min-width: 440px; width: 100%; border-collapse: collapse; margin-top: 4px; }
.duration-rule-table th, .duration-rule-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; }
.duration-rule-table input { width: 100%; min-width: 90px; height: 38px; padding: 0 8px; }
.duration-rule-swipe { margin: 12px 0 4px; color: var(--muted); font-size: 11px; }
@media (max-width: 680px) {
  #durationRulesModal .duration-rule-swipe { display: none; }
  #durationRulesModal .duration-rule-table { display: block; min-width: 0; }
  #durationRulesModal .duration-rule-table thead { display: none; }
  #durationRulesModal .duration-rule-table tbody { display: grid; gap: 14px; }
  #durationRulesModal .duration-rule-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px; border: 1px solid var(--line); }
  #durationRulesModal .duration-rule-table td { display: grid; gap: 6px; min-width: 0; padding: 0; border: 0; }
  #durationRulesModal .duration-rule-table td::before { content: attr(data-label); font-size: 10px; color: var(--muted); }
  #durationRulesModal .duration-rule-table td:nth-child(3) { grid-column: 1; }
  #durationRulesModal .duration-rule-table td:nth-child(4) { grid-column: 2; align-self: end; justify-items: end; }
  #durationRulesModal .duration-rule-table input { min-width: 0; box-sizing: border-box; }
  #durationRulesModal .modal-actions { flex-wrap: wrap; }
}
.schedule-status { min-height: 22px; color: var(--ink); }
.schedule-mobile-swipe { display: none; }
.schedule-source a { color: inherit; text-underline-offset: 3px; }
.schedule-craftsman { width: 135px; max-width: 100%; padding: 7px 5px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; }

.schedule-conflicts { margin-top: 12px; padding: 13px 16px; border-left: 3px solid #af7945; background: #f8f0e6; color: #554334; font-size: 12px; }
.schedule-conflicts ul { margin: 7px 0 0; padding-left: 19px; }
.craftsman-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 12px 0 20px; }
.craftsman-form label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.craftsman-form input, .craftsman-form select { min-width: 180px; height: 38px; padding: 0 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.craftsman-form details { flex: 1 0 100%; min-width: 0; margin: 0; padding: 11px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.craftsman-form summary { width: fit-content; cursor: pointer; }
.craftsman-trade-choices { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.craftsman-form details .craftsman-trade-choices { padding-top: 12px; }
.craftsman-trade-choices label { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; cursor: pointer; }
.craftsman-form .craftsman-trade-choices input { min-width: 0; width: 15px; height: 15px; margin: 0; }
.craftsman-form-actions { display: flex; gap: 8px; }
.craftsman-directory-row { display: flex; align-items: center; gap: 18px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 12px; }
.craftsman-directory-row span { flex: 1; color: var(--muted); }
@media (max-width: 680px) { .craftsman-directory-row { flex-wrap: wrap; gap: 8px; } .craftsman-directory-row span { flex-basis: 100%; } }
.craftsman-booking-group { border-top: 1px solid var(--line); padding: 17px 0 23px; }
.craftsman-clash { margin: 4px 0 10px; padding: 8px 10px; background: #f8f0e6; color: #6e4b28; font-size: 11px; }
.crew-demo-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 16px; border-left: 3px solid #857b62; background: #eeece5; font-size: 11px; }
.craftsman-booking-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.craftsman-booking-group h4 { margin: 0; font-size: 16px; font-weight: 600; }
.craftsman-booking-group h4 small { margin-left: 12px; font-size: 11px; color: var(--muted); font-weight: 400; }
.craftsman-export-actions { display: flex; gap: 7px; }
.craftsman-export-actions .secondary-button { padding: 8px 11px; font-size: 11px; }
.craftsman-booking { display: grid; grid-template-columns: minmax(115px, .9fr) minmax(130px, 1.2fr) minmax(90px, .8fr) minmax(135px, .9fr); align-items: center; gap: 12px; padding: 12px 5px; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.craftsman-booking:last-child { border-bottom: 0; }
.craftsman-booking time { font-variant-numeric: tabular-nums; }
.craftsman-booking small, .craftsman-export-list small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 400; }
.craftsman-booking .craftsman-end-date, .craftsman-export-list .craftsman-end-date { margin: 5px 0 0; white-space: nowrap; }
.craftsman-booking .craftsman-end-date { color: var(--ink); font-size: 11px; }
.craftsman-addresses { margin-top: 10px; padding: 12px 14px; background: #f6f5f1; }
.craftsman-addresses p { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.craftsman-address-row { display: flex; gap: 12px; padding: 4px 0; font-size: 11px; line-height: 1.5; }
.craftsman-address-row strong { flex: 0 0 auto; }
.craftsman-address-row span { overflow-wrap: anywhere; }
.craftsman-booking span { color: var(--muted); }
.craftsman-export-sheet { position: fixed; z-index: -1; top: 0; left: 0; box-sizing: border-box; width: 760px; padding: 35px 42px; background: white; color: #292825; font-family: var(--font-sans); }
.craftsman-export-sheet header { padding-bottom: 20px; border-bottom: 2px solid #343331; }
.craftsman-export-sheet header p { margin: 0 0 15px; color: #847866; font-size: 12px; letter-spacing: .09em; }
.craftsman-export-sheet header h2 { margin: 0 0 9px; font-size: 27px; }
.craftsman-export-sheet header span { color: #736f69; font-size: 12px; }
.craftsman-export-list section { display: grid; grid-template-columns: 140px minmax(0, 1fr) 120px 125px; gap: 13px; padding: 18px 0; border-bottom: 1px solid #dedbd5; font-size: 13px; }
.craftsman-export-list strong { display: block; overflow-wrap: anywhere; }
.craftsman-export-addresses { margin-top: 18px; padding: 15px 18px; background: #f6f5f1; }
.craftsman-export-addresses h3 { margin: 0 0 8px; font-size: 13px; }
.craftsman-export-addresses .craftsman-address-row { font-size: 12px; }
.craftsman-export-sheet footer { padding-top: 23px; color: #736f69; font-size: 11px; }
@media (max-width: 680px) { .craftsman-booking { grid-template-columns: 1fr 1fr; gap: 9px 12px; } .craftsman-booking strong { grid-column: 1 / -1; } .craftsman-address-row { flex-wrap: wrap; gap: 0 8px; } }
.schedule-calendar-panel { margin-top: 28px; border-top: 1px solid var(--line); }
.schedule-calendar-head { padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.schedule-calendar-head p { margin: 0 0 5px; color: var(--wood); font-size: 9px; letter-spacing: .18em; }
.schedule-calendar-head h4 { margin: 0; font-size: 18px; font-weight: 500; }
.schedule-month-controls { display: flex; align-items: center; gap: 16px; }
.schedule-month-controls strong { min-width: 92px; text-align: center; font-size: 12px; font-weight: 500; white-space: nowrap; }
.schedule-month-controls button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 0; background: var(--surface); cursor: pointer; }
.schedule-calendar-scroll { overflow-x: auto; border: 1px solid var(--line); }
.schedule-calendar-weekdays { min-width: 700px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.schedule-calendar-weekdays span { padding: 9px 0; border-right: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; text-align: center; }
.schedule-calendar-grid { min-width: 700px; border-top: 1px solid var(--line); }
.schedule-calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.schedule-calendar-day { min-height: 38px; padding: 7px 6px 2px; border-right: 1px solid var(--line-soft); background: #fff; }
.schedule-calendar-day.is-outside { background: var(--paper); color: #aaa9a3; }
.schedule-calendar-day.is-holiday { background: #f7f6f3; }
.schedule-calendar-date { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.schedule-calendar-date span { color: #ad2525; font-size: 10px; }
.schedule-holiday-name { margin-top: 4px; color: #ad2525; font-size: 10px; line-height: 1.25; overflow-wrap: anywhere; }
.schedule-week-bars { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 27px; row-gap: 4px; min-height: 48px; padding: 2px 0 9px; background: #fff; }
.schedule-week-bar { min-width: 0; padding: 5px 8px; border-left: 3px solid var(--wood); background: #eee9e3; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-week-bar small { margin-left: 8px; font-size: 9px; opacity: .7; }
.schedule-week-bar.spans-rest { background-image: repeating-linear-gradient(135deg, transparent, transparent 14px, rgba(255,255,255,.32) 14px, rgba(255,255,255,.32) 17px); }
.schedule-week-bar.tone-1 { border-color: var(--sage); background-color: #e9ede9; }
.schedule-week-bar.tone-2 { border-color: #817868; background-color: #eeece7; }
.schedule-week-bar.tone-3 { border-color: #8c716e; background-color: #eee9e8; }
.schedule-week-bar.tone-4 { border-color: #67757b; background-color: #e9edef; }
.schedule-address-field { display: grid; gap: 6px; max-width: 600px; margin: 10px 0 16px; font-size: 11px; color: var(--muted); }
.schedule-address-field input { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); }
.schedule-pdf-report { width: 1000px; height: 674px; box-sizing: border-box; padding: 17px 20px 10px; background: #fff; color: var(--ink); font-family: var(--font-sans); display: flex; flex-direction: column; }
.schedule-pdf-report header { padding-bottom: 11px; border-bottom: 2px solid var(--ink); }
.schedule-pdf-report header p:first-child { margin: 0 0 8px; color: var(--wood); font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.schedule-pdf-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.schedule-pdf-heading h1 { margin: 0; font-size: 26px; font-weight: 600; }
.schedule-pdf-heading strong { font-size: 22px; white-space: nowrap; }
.schedule-pdf-address { margin: 10px 0 0; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.schedule-pdf-month { margin-top: 14px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.schedule-pdf-month .schedule-calendar-weekdays { min-width: 0; border: 1px solid #bdb8ae; border-bottom: 0; }
.schedule-pdf-month .schedule-calendar-weekdays span { color: var(--ink); font-size: 12px; font-weight: 600; border-right: 1px solid #bdb8ae; }
.schedule-pdf-month .schedule-calendar-grid { min-width: 0; flex: 1; display: flex; flex-direction: column; border: 1px solid #bdb8ae; }
.schedule-pdf-month .schedule-calendar-week { flex: 1; min-height: 0; border-bottom: 1px solid #bdb8ae; grid-template-rows: minmax(26px, 1fr) auto; }
.schedule-pdf-month .schedule-calendar-week:last-child { border-bottom: 0; }
.schedule-pdf-month .schedule-calendar-day { min-height: 26px; padding: 6px; border-right: 1px solid #bdb8ae; }
.schedule-pdf-month .schedule-calendar-date { font-size: 13px; font-weight: 600; }
.schedule-pdf-month .schedule-calendar-date span, .schedule-pdf-month .schedule-holiday-name { color: #ad2525; font-weight: 700; }
.schedule-pdf-month .schedule-holiday-name { font-size: 11px; line-height: 1.2; }
.schedule-pdf-month .schedule-week-bars { min-height: 37px; grid-auto-rows: 15px; row-gap: 0; padding: 2px 0 20px; background: #fff; }
.schedule-pdf-month .schedule-bar-cell { border-right: 1px solid #bdb8ae; }
.schedule-pdf-month .schedule-week-bar { position: relative; z-index: 1; box-sizing: border-box; height: 30px; font-size: 14px; font-weight: 700; padding: 5px 8px; color: #20201e; border-left-width: 4px; }
.schedule-pdf-month .schedule-week-bars.has-concurrent { grid-auto-rows: 23px; padding-bottom: 5px; }
.schedule-pdf-month .schedule-week-bars.has-concurrent .schedule-week-bar { height: 23px; padding: 3px 6px; font-size: 12px; }
.schedule-pdf-report footer { display: flex; justify-content: space-between; margin-top: 8px; font-size: 10px; color: var(--muted); }
.settings-button { width: 100%; padding: 14px 4px; display: grid; gap: 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.settings-button b { font-size: 9px; letter-spacing: .14em; }
.settings-button span { font-size: 11px; }
.user-block { padding: 18px 6px 2px; display: grid; grid-template-columns: 34px 1fr 24px; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #ded5c6; color: #433a31; font-family: var(--font-serif); font-size: 13px; }
.avatar { text-align: center; overflow: hidden; overflow-wrap: anywhere; line-height: 1.05; padding: 2px; font-size: 8px; }
.user-block div:nth-child(2) { display: grid; gap: 2px; }
.user-block strong { font-size: 12px; }
.user-block span { color: var(--muted); font-size: 10px; }
.user-block button { border: 0; background: none; color: var(--muted); cursor: pointer; }
.role-hidden { display: none !important; }

.price-category-list { border-top: 1px solid var(--ink); }
.price-category-row { width: 100%; min-height: 76px; padding: 0 6px; display: grid; grid-template-columns: 54px minmax(180px, 1fr) 120px 130px; align-items: center; gap: 20px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.price-category-row:hover { background: #f6f5f0; }
.price-category-index { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.price-category-row strong { font-family: var(--font-serif); font-size: 18px; font-weight: 500; letter-spacing: .06em; }
.price-category-row small { color: var(--muted); font-size: 11px; }
.price-category-row i { color: var(--muted); font-size: 11px; font-style: normal; text-align: right; }
.price-detail-head { min-height: 112px; display: grid; grid-template-columns: 180px 1fr auto; align-items: center; gap: 30px; border-bottom: 1px solid var(--ink); }
.price-detail-head p { margin: 0 0 7px; color: var(--muted); font-size: 9px; letter-spacing: .2em; }
.price-detail-head h3 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 24px; font-weight: 500; }
.price-detail-head span { color: var(--muted); font-size: 11px; }
.price-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.back-button { padding: 0; border: 0; border-bottom: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 11px; justify-self: start; cursor: pointer; }
.price-override-input { width: 116px; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.price-override-input:focus { outline: 1px solid var(--ink); outline-offset: -1px; }
.price-input-with-reset { display: grid; gap: 5px; justify-items: end; }
.price-reset-row { width: 116px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reset-auto-price { padding: 0 0 2px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; white-space: nowrap; }
.reset-auto-price:hover { color: var(--ink); border-bottom-color: var(--ink); }
.auto-price-reference { color: var(--wood); font-size: 9px; white-space: nowrap; }
.price-item-number { width: 52px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.price-order-input { width: 52px; height: 36px; padding: 0 5px; border: 1px solid var(--ink); border-radius: 0; background: #fff; color: var(--ink); text-align: center; font-size: 13px; font-weight: 600; }
.price-order-input:focus { outline: 1px solid var(--ink); outline-offset: -1px; }
.delete-price-item { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: #8f4f45; font-size: 10px; cursor: pointer; }
.delete-price-item:hover { border-bottom-color: #8f4f45; }
.price-text-field { min-width: 230px; display: grid; gap: 5px; }
.price-text-field span { color: var(--muted); font-size: 9px; }
.price-text-input { width: 100%; min-width: 180px; height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font-size: 11px; }
.price-text-input:focus { outline: 1px solid var(--ink); outline-offset: -1px; }
.note-input { min-width: 190px; }
#priceItemRows td { vertical-align: top; }
#priceItemRows .price-item-number { padding-top: 17px; vertical-align: top; }
.price-cell-center { width: 100%; height: 38px; display: flex; align-items: center; justify-content: center; text-align: center; white-space: nowrap; }
#priceDetailView th:nth-child(4), #priceDetailView th:nth-child(8), #priceDetailView th:nth-child(9) { text-align: center; }

.workspace { min-width: 0; padding: 0 clamp(30px, 5vw, 76px) 72px; }
.topbar { min-height: 132px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--ink); }
.breadcrumb { margin: 0 0 7px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.topbar h2 { margin: 0; font-family: var(--font-serif); font-size: 28px; font-weight: 500; letter-spacing: .08em; }
.top-actions { display: flex; gap: 9px; }
.view { display: none; padding-top: 30px; }
.view.is-active { display: block; animation: reveal .24s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.context-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.context-row p { margin: 0; color: var(--muted); font-size: 14px; }
.context-row > span { padding: 0; border: 0; border-radius: 0; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); background: transparent; }
.summary-strip > button { min-height: 108px; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.summary-strip > button:hover, .summary-strip > button:focus-visible { background: var(--surface); outline-offset: -3px; }
.summary-strip span { color: var(--muted); font-size: 12px; }
.summary-strip span small { display: block; margin-top: 5px; font-size: 10px; }
.summary-strip strong { font-family: var(--font-serif); font-size: 28px; font-weight: 500; }
.case-filters { display: flex; flex-wrap: wrap; gap: 14px; margin: 20px 0; }
.case-filters label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.case-filters select { min-width: 140px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 0; background: #fff; color: var(--ink); font-size: 13px; }
.case-management-rows { border-top: 1px solid var(--line); }
.case-management-row { width: 100%; padding: 17px 8px; display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(70px, .45fr) minmax(135px, 1fr) minmax(110px, .7fr) auto; align-items: center; gap: 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.case-management-row:hover, .case-management-row:focus-visible { background: var(--paper); }
.case-management-row strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.case-management-row span, .case-management-row small { color: var(--muted); font-size: 11px; }
.case-management-row small { white-space: nowrap; }
.case-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.case-contract-summary { padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 8px; font-size: 12px; }
.case-contract-summary p { margin: 0; display: flex; justify-content: space-between; gap: 14px; }
.case-contract-summary strong { font-weight: 600; }
.content-section { margin-top: 42px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.section-head h3, .settings-form h3 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 20px; font-weight: 500; letter-spacing: .06em; }
.section-head p { margin: 0; color: var(--muted); font-size: 11px; }
.filter-group { display: flex; gap: 18px; padding: 0; background: transparent; }
.filter { min-height: 32px; padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.filter.is-active { background: transparent; color: var(--ink); border-bottom-color: var(--ink); box-shadow: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { padding: 12px 13px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .08em; text-align: left; }
td { padding: 17px 13px; border-bottom: 1px solid var(--line-soft); font-size: 12px; vertical-align: middle; }
.select-project-quote td:first-child small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f7f4ee; }
td strong, td span { display: block; }
td > span:not(.type-tag):not(.status) { margin-top: 4px; color: var(--muted); font-size: 10px; }
.type-tag, .status { display: inline-block; width: fit-content; padding: 0 0 3px; border-radius: 0; border-bottom: 1px solid currentColor; font-size: 10px; background: transparent !important; }
.type-tag.own { color: #65523f; }
.type-tag.partner { color: #556257; }
.status.confirmed { color: #526052; }
.status.draft { color: #7a6241; }
.status.pending { color: #6c5f53; }

.split-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; }
.quote-list { display: grid; align-content: start; gap: 8px; }
.quote-item { padding: 18px; display: grid; gap: 7px; border: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.quote-item.is-selected { border-color: var(--wood); background: var(--surface); }
.quote-item span, .quote-item small { color: var(--muted); font-size: 10px; }
.quote-item strong { font-size: 13px; }
.document-preview { padding: 34px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.doc-head { display: flex; justify-content: space-between; padding-bottom: 18px; border-bottom: 2px solid var(--ink); }
.doc-head p { margin: 0 0 7px; font-size: 11px; }
.doc-head h3 { margin: 0; font-family: var(--font-serif); font-size: 24px; font-weight: 500; }
.doc-head > span { font-size: 10px; color: var(--muted); }
.doc-meta { padding: 15px 0; display: flex; flex-wrap: wrap; gap: 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.doc-lines { margin: 22px 0; }
.doc-lines > div { padding: 13px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.doc-lines .total { padding-top: 20px; font-size: 15px; border-bottom-color: var(--ink); }
.doc-actions { display: flex; justify-content: flex-end; gap: 8px; }
.member-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.member { min-height: 122px; padding: 20px; display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; border: 1px solid var(--line-soft); }
.avatar.large { width: 46px; height: 46px; }
.member h4 { margin: 0 0 4px; font-size: 13px; }
.member p { margin: 0; color: var(--muted); font-size: 10px; }
.member > span { grid-column: 2; color: var(--wood); font-size: 10px; }
.member-entry { width: 100%; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.member-entry:hover, .member-entry:focus-visible { background: var(--paper); border-color: var(--wood); }
.settings-form { max-width: 900px; }
.form-grid { margin: 24px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid label, dialog label { display: grid; gap: 8px; font-size: 11px; font-weight: 600; }
.form-grid .wide { grid-column: 1 / -1; }

Dialog { border: 0; }
dialog { width: min(500px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 30px 90px rgba(40,35,30,.2); }
#projectModal { max-height: calc(100vh - 32px); overflow-y: auto; }
dialog::backdrop { background: rgba(33,31,27,.38); }
dialog form { padding: 28px; display: grid; gap: 18px; }
.quote-settings-shell { padding: 28px; display: grid; gap: 18px; }
#quoteSettingsModal { max-height: calc(100vh - 32px); overflow-y: auto; }
.case-settings { display: grid; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.case-settings h4, .quote-fee-heading { margin: 0; font-size: 14px; font-weight: 600; }
.case-setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.case-settings .assignee-fieldset { margin: 0; }
.case-settings .dialog-note { margin: 0; line-height: 1.6; }
.design-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quote-settings-shell input, .quote-settings-shell select { width: 100%; }
.autosave-note { margin: 12px 0 0; font-size: 11px; color: #5e5a53; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.modal-head p { margin: 0 0 5px; color: var(--wood); font-size: 9px; letter-spacing: .2em; }
.modal-head h3 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 500; }
.modal-head button { border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 18px; background: var(--ink); color: #fff; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }

.version-panel { margin-bottom: 42px; border-bottom: 1px solid var(--line); }
.version-heading { min-height: 94px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.version-actions { display: flex; gap: 8px; }
.version-heading p, .picker-head p { margin: 0 0 7px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .2em; }
.version-heading h3 { margin: 0; font-family: var(--font-serif); font-size: 21px; font-weight: 500; }
.version-tabs { display: flex; overflow-x: auto; border-top: 1px solid var(--line-soft); }
.version-tab { min-width: 210px; min-height: 88px; padding: 16px 22px 16px 0; display: grid; gap: 5px; border: 0; border-right: 1px solid var(--line-soft); background: transparent; color: var(--muted); text-align: left; cursor: pointer; }
.version-tab + .version-tab { padding-left: 22px; }
.version-tab span { font-size: 9px; letter-spacing: .16em; }
.version-tab strong { color: var(--ink); font-size: 13px; font-weight: 500; }
.version-tab time { color: var(--ink); font-size: 10px; font-variant-numeric: tabular-nums; }
.version-tab small { font-size: 10px; white-space: nowrap; }
.version-tab.is-active { box-shadow: inset 0 -2px 0 var(--ink); }
.version-tab.is-active span { color: var(--wood); }
.final-quote-panel { padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); }
.final-quote-panel strong { font-size: 13px; font-weight: 600; }
.final-quote-panel p { margin: 6px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.quote-editor.is-version-locked .version-panel { border-bottom-color: var(--ink); }
.quote-editor.is-version-locked input:disabled, .quote-editor.is-version-locked select:disabled { color: #88867f; background: #f1f0eb !important; cursor: not-allowed; }
.quote-editor button:disabled { color: #aaa8a1; border-color: var(--line-soft); cursor: not-allowed; }

.row-action { min-height: 32px; padding: 0; border: 0; border-bottom: 1px solid var(--ink); background: transparent; color: var(--ink); font-size: 11px; cursor: pointer; }
.row-action:hover { color: var(--wood); border-bottom-color: var(--wood); }

.quote-editor { border-top: 1px solid var(--ink); }
.editor-head { min-height: 132px; padding: 28px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.editor-head p { margin: 0 0 12px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .2em; }
.editor-head h3 { margin: 0 0 8px; font-family: var(--font-serif); font-size: 27px; font-weight: 500; letter-spacing: .06em; }
.editor-head span { color: var(--muted); font-size: 11px; }
.editor-actions { display: flex; gap: 8px; }
.editor-fields { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; border-bottom: 1px solid var(--line); }
.editor-fields.project-fields { grid-template-columns: 2fr 1fr; margin-bottom: 0; }
.editor-fields.fee-fields { grid-template-columns: 1fr 1fr; max-width: 520px; margin-left: auto; border-top: 1px solid var(--line); }
.editor-fields label { padding: 18px 18px 20px 0; display: grid; gap: 8px; border-right: 1px solid var(--line-soft); color: var(--muted); font-size: 10px; }
.editor-fields label + label { padding-left: 18px; }
.editor-fields label:last-child { border-right: 0; }
.editor-fields input, .editor-fields select { height: 38px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none; }
.percent-input { display: grid; grid-template-columns: 1fr 24px; align-items: center; border-bottom: 1px solid var(--line); }
.percent-input input { border-bottom: 0; }
.percent-input span { color: var(--muted); text-align: right; font-size: 12px; }
.item-picker { margin-top: 42px; border-top: 1px solid var(--ink); }
.picker-head { min-height: 94px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); }
.picker-head h4 { margin: 0; font-family: var(--font-serif); font-size: 20px; font-weight: 500; letter-spacing: .05em; }
.picker-head > span { color: var(--muted); font-size: 11px; }
.trade-group { border-bottom: 1px solid var(--line); }
.trade-group summary { min-height: 64px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.trade-group summary::-webkit-details-marker { display: none; }
.trade-group summary > span { display: flex; align-items: baseline; gap: 18px; }
.trade-group summary b { font-family: var(--font-serif); font-size: 16px; font-weight: 500; }
.trade-group summary small, .trade-group summary i { color: var(--muted); font-size: 10px; font-style: normal; }
.catalog-items { padding: 0 0 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line-soft); }
.catalog-items label { min-height: 52px; padding: 0 16px 0 0; display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.catalog-items label:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line-soft); }
.catalog-items input { width: 15px; height: 15px; accent-color: var(--ink); }
.catalog-items span { font-size: 12px; }
.catalog-items small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.add-custom-item { min-height: 48px; padding: 0; border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 11px; }
.add-custom-item:hover { color: var(--ink); }
.quote-table-wrap { margin-top: 42px; overflow-x: auto; border-top: 1px solid var(--ink); }
.quote-table { min-width: 940px; }
.quote-table th { padding-block: 14px; }
.quote-table td { padding: 11px 8px; }
.quote-table td:first-child, .quote-table th:first-child { padding-left: 0; }
.quote-table td:last-child, .quote-table th:last-child { padding-right: 0; }
.quote-table input, .quote-table select { height: 38px; padding: 0 8px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; box-shadow: none; font-size: 13px; }
.quote-table .item-category { min-width: 110px; }
.quote-table .item-name { min-width: 200px; }
.quote-table .item-qty { min-width: 72px; }
.quote-table .item-unit { min-width: 58px; }
.quote-table .item-price { min-width: 110px; }
.item-total { min-width: 100px; text-align: right; font-variant-numeric: tabular-nums; }
.remove-item { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.remove-item:hover { color: var(--danger); }
.add-line-button { min-height: 48px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; cursor: pointer; font-size: 12px; }
.add-line-button:hover { color: var(--ink); }
.quote-lines-section { margin-top: 42px; border-top: 1px solid var(--ink); }
.quote-lines-section .quote-table-wrap { margin-top: 0; border-top: 0; }
.quote-table th:nth-child(1) { width: 30%; }
.quote-table th:nth-child(2) { width: 10%; }
.quote-table th:nth-child(3) { width: 8%; }
.quote-table th:nth-child(4), .quote-table th:nth-child(5) { width: 11%; text-align: right; }
.quote-table th:nth-child(6) { width: 30%; }
.category-row:hover { background: transparent; }
.category-row td { padding: 0; border-bottom: 1px solid var(--ink); }
.category-row td > div { min-height: 56px; display: flex; align-items: center; justify-content: space-between; }
.category-row strong { font-family: var(--font-serif); font-size: 16px; font-weight: 500; letter-spacing: .06em; }
.category-actions { display: flex; align-items: center; gap: 18px; }
.category-lock-button { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; }
.category-lock-button:hover, .category-lock-button.is-locked { color: var(--ink); border-bottom-color: var(--ink); }
.category-lock-button.is-locked::before { content: '● '; color: var(--wood); }
.category-lock-button:disabled { cursor: not-allowed; opacity: .5; }
.category-subtotal-row td { padding: 0; border-bottom: 1px solid var(--ink); }
.category-subtotal-row td > div { min-height: 48px; padding: 0 8px; display: flex; align-items: center; justify-content: flex-end; gap: 36px; background: #f4f2ec; }
.category-subtotal-row span { color: var(--muted); font-size: 11px; }
.category-subtotal-row strong { min-width: 100px; text-align: right; font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.add-category-item { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.add-category-item:hover { color: var(--ink); border-bottom-color: var(--ink); }
.locked-value { min-height: 38px; padding: 0 8px; display: flex !important; align-items: center; font-size: 13px; }
.item-price-text, .item-total { text-align: right; font-variant-numeric: tabular-nums; }
.item-price-text { justify-content: flex-end; }
.quote-row.is-unused .locked-value { color: #34312d; }
.quote-row.is-unused .item-total { color: #66615b; }
.quote-row.is-unused { background: #faf9f6; }
.quote-row .item-name-text { font-size: 14px; font-weight: 600; }
.quote-table .item-qty { border: 1px solid #827a70; color: #282522; font-weight: 600; background: #fff !important; }
.quote-table .item-qty::placeholder, .quote-table .item-note::placeholder { color: #625d56; opacity: 1; }
.editable-cell { background: #fff !important; }
.custom-row { background: #f7f5ef; }
.custom-row .editable-cell { border-bottom-color: #aaa69d; }
.custom-note-cell { display: grid; grid-template-columns: minmax(150px, 1fr) 34px; align-items: center; gap: 6px; }
.quote-summary { width: min(430px, 100%); margin: 42px 0 0 auto; border-top: 1px solid var(--ink); }
.quote-summary > div, .quote-summary > label { min-height: 49px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.quote-summary strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.quote-summary .before-discount-row { font-weight: 600; }
.quote-summary label input { width: 130px; height: 36px; padding-right: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; text-align: right; box-shadow: none; }
.discount-control { display: flex; align-items: center; gap: 8px; }
.discount-control button { padding: 0; border: 0; border-bottom: 1px solid transparent; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.discount-control button:hover { color: var(--ink); border-bottom-color: var(--ink); }
.discount-control button:disabled { cursor: not-allowed; opacity: .5; }
.quote-summary .grand-total { min-height: 68px; border-bottom-color: var(--ink); font-size: 16px; }
.quote-summary .grand-total strong { font-size: 24px; }

.assignee-fieldset { margin: 0; padding: 0; border: 0; }
.assignee-fieldset legend { margin-bottom: 10px; font-size: 11px; font-weight: 600; }
.assignee-options { display: flex; flex-wrap: wrap; gap: 8px; }
.assignee-options label { min-height: 42px; padding: 0 14px; display: inline-flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.assignee-options label:has(input:checked) { border-color: var(--ink); color: var(--ink); }
.assignee-options input { width: 15px; height: 15px; accent-color: var(--ink); }
.add-assignee { width: 42px; height: 42px; border: 1px solid var(--line); background: transparent; font-size: 20px; cursor: pointer; }
.new-assignee-row { margin-top: 10px; display: grid; grid-template-columns: 1fr 70px; }
.new-assignee-row input { border-radius: 0; }
.new-assignee-row button { border: 1px solid var(--ink); background: var(--ink); color: white; cursor: pointer; }
.form-grid.compact { margin: 0; gap: 12px; }
.dialog-note { margin: -4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.preview-dialog { width: min(910px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: #e8e6df; }
.print-sheet { padding: 24px; background: #e8e6df; overflow-x: auto; }
.print-toolbar { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; color: #57564f; font-size: 11px; }
.print-toolbar > div { display: flex; gap: 8px; }
.quote-document { width: 794px; max-width: none; margin-inline: auto; padding: 0; background: transparent; color: #292b29; font-size: 12px; line-height: 1.65; }
.quote-page { width: 794px; height: 1123px; padding: 48px 50px 40px; background: #f9f7f1; overflow: hidden; box-shadow: 0 3px 14px #34383122; }
.quote-detail-pages > .quote-page { margin-top: 28px; }
.detail-page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 6px solid #555b52; }
.detail-page-head p { margin: 0 0 4px; color: #836e54; font-size: 9px; letter-spacing: .17em; }
.detail-page-head h3 { margin: 0; font-family: var(--font-serif); font-size: 22px; font-weight: 500; }
.detail-page-head small { color: #736d61; font-size: 10px; }
.detail-body { padding-top: 23px; }
.trade-section + .trade-section { margin-top: 29px; }
.trade-section h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: #505a50; }
.trade-section h4 small { margin-left: 8px; font-size: 10px; font-weight: 400; color: #736d61; }
.trade-subtotal { display: flex; justify-content: flex-end; gap: 50px; margin-top: 0; padding: 10px 21% 10px 6px; border-top: 1px solid #666b60; font-size: 12px; font-weight: 600; }
.trade-section:has(> .trade-subtotal) .detail-table tbody tr:last-child td { border-bottom: 0; }
.trade-subtotal strong { min-width: 85px; text-align: right; font-variant-numeric: tabular-nums; }
.detail-table th:nth-child(1), .detail-table td:nth-child(1) { width: 7%; }
.detail-table th:nth-child(2), .detail-table td:nth-child(2) { width: 29%; }
.detail-table th:nth-child(3), .detail-table td:nth-child(3) { width: 9%; }
.detail-table th:nth-child(4), .detail-table td:nth-child(4) { width: 8%; }
.detail-table th:nth-child(5), .detail-table td:nth-child(5), .detail-table th:nth-child(6), .detail-table td:nth-child(6) { width: 13%; }
.detail-table th:nth-child(7), .detail-table td:nth-child(7) { width: 21%; }
.document-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; }
.document-brand { display: flex; align-items: center; gap: 14px; }
.document-brand img { display: block; width: 63px; height: 63px; object-fit: contain; }
.document-brand p { margin: 0; font-family: var(--font-serif); font-size: 19px; letter-spacing: .1em; white-space: nowrap; }
.document-brand small { display: block; color: #736d61; font-size: 8px; letter-spacing: .13em; }
.document-company-details { margin-top: 7px; color: #66675f; font-size: 9px; line-height: 1.55; letter-spacing: .025em; }
.document-title { text-align: right; }
.document-title > span, .document-note > span { color: #836e54; font-size: 9px; letter-spacing: .19em; }
.document-title h2 { margin: 2px 0 0; font-family: var(--font-serif); font-size: 29px; font-weight: 500; letter-spacing: .09em; }
.document-title p { margin: 0; color: #77736c; font-size: 10px; }
.document-rule { height: 7px; margin: 22px 0 29px; background: #555b52; }
.document-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0 25px; margin-bottom: 30px; border-top: 1px solid #b9b4a9; }
.document-meta > div { display: grid; grid-template-columns: 118px minmax(0,1fr); gap: 8px; padding: 11px 0; border-bottom: 1px solid #c9c5b9; min-height: 44px; }
.document-meta span { color: #736d61; font-size: 9px; letter-spacing: .035em; }
.document-meta strong { font-size: 11px; font-weight: 500; overflow-wrap: anywhere; }
.document-table-wrap { width: 100%; }
.document-table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; }
.document-table thead { display: table-header-group; }
.document-table th { padding: 10px 6px; background: #e6e2d6; color: #3c403a; border-top: 1px solid #666b60; border-bottom: 1px solid #a7a99f; font-size: 10px; font-weight: 600; text-align: left; }
.document-table td { padding: 6px 6px; border-bottom: 1px solid #d8d5ca; font-size: 11px; overflow-wrap: anywhere; vertical-align: top; }
.document-table td:nth-child(3), .document-table td:nth-child(5), .document-table td:nth-child(6), .document-table th:nth-child(3), .document-table th:nth-child(5), .document-table th:nth-child(6) { text-align: right; font-variant-numeric: tabular-nums; }
.document-table td:nth-child(1) { color: #7b786f; }
.document-table td:nth-child(7) { color: #69665e; font-size: 10px; }
.document-table .category-band td { padding: 10px 6px 6px; border-bottom: 1px solid #9b9f94; color: #505a50; font-weight: 600; background: #efeee7; letter-spacing: .04em; }
.overview-table th:first-child, .overview-table td:first-child { width: 10%; }
.overview-table th:last-child, .overview-table td:last-child { width: 27%; text-align: right; font-variant-numeric: tabular-nums; }
.overview-table td { padding: 11px 8px; font-size: 12px; }
.overview-table .overview-subtotal td { border-top: 1px solid #666b60; background: #efeee7; font-weight: 600; }
.quote-summary-page.is-dense .overview-table td { padding: 3px 8px; font-size: 10px; }
.quote-summary-page.is-dense .document-close { margin-top: 14px; }
.quote-summary-page.is-dense .document-footer { margin-top: 20px; }
.quote-summary-page.is-dense .signature-space { height: 75px; }
.quote-summary-page.is-ultra-dense .overview-table td { padding: 1px 6px; font-size: 10px; line-height: 1.25; }
.quote-summary-page.is-ultra-dense .document-meta { margin-bottom: 15px; }
.quote-summary-page.is-ultra-dense .document-rule { margin: 12px 0 17px; }
.quote-summary-page.is-ultra-dense .document-footer { margin-top: 12px; }
.document-close { display: grid; grid-template-columns: minmax(0,1fr) minmax(240px, .8fr); gap: 30px; margin-top: 27px; break-inside: avoid; }
.document-note p { margin: 9px 0; color: #6c6a61; font-size: 10px; }
.preview-breakdown { width: 100%; }
.preview-breakdown > div { padding: 7px 0; display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid #d8d5ca; font-size: 11px; }
.preview-breakdown > div:has(+ .before-discount-row) { border-bottom: 0; }
.preview-breakdown > .before-discount-row { border-top: 1px solid #666b60; font-weight: 600; }
.preview-breakdown strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.preview-total { margin-top: 12px; padding: 15px 13px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #555b52; color: #fff; }
.preview-total span { font-size: 12px; }
.preview-total small { font-size: 9px; opacity: .7; }
.preview-total strong { font-size: 21px; font-weight: 500; font-variant-numeric: tabular-nums; }
.document-footer { display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; margin-top: 45px; padding-top: 12px; border-top: 1px solid #999e92; font-size: 11px; }
.document-footer .client-signature { display: grid; align-content: start; gap: 12px; }
.signature-space { height: 90px; border-bottom: 1px solid #9b9b91; }
.document-footer .prepared-by { display: flex; align-items: start; gap: 18px; }
.prepared-by strong { font-weight: 500; overflow-wrap: anywhere; }
.document-footer p { grid-column: 1/-1; display: flex; justify-content: space-between; gap: 12px; margin: 24px 0 0; color: #827e74; font-size: 9px; letter-spacing: .05em; }
.document-footer .brand-philosophy { display: block; text-align: center; font-family: var(--font-serif); font-size: 11px; letter-spacing: .055em; color: #696b63; }
.document-footer p small { letter-spacing: .16em; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { display: none; }
  .login-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 48px; text-align: center; }
  .mobile-brand img { width: 108px; height: 108px; object-fit: contain; mix-blend-mode: multiply; }
  .mobile-brand span { font-family: var(--font-serif); font-size: 24px; letter-spacing: .16em; }
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding: 24px 18px; }
  .sidebar-brand { padding: 0 0 24px; }
  .sidebar-brand img { width: 52px; height: 52px; }
  .user-block { padding-inline: 2px; }
  .summary-strip { grid-template-columns: 1fr 1fr; }

  .split-layout { grid-template-columns: 1fr; }
  .quote-list { grid-template-columns: 1fr 1fr; }
  .member-grid { grid-template-columns: 1fr; }
  .editor-fields { grid-template-columns: 1fr 1fr; }
  .editor-fields label:nth-child(2) { border-right: 0; }
  .editor-fields label:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .catalog-items { grid-template-columns: 1fr; }
  .catalog-items label:nth-child(even) { padding-left: 0; border-left: 0; }
}
@media (max-width: 680px) {
  #craftsmen .context-row, #crewDirectory .context-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .schedule-head-actions { flex-wrap: wrap; }
  .schedule-mobile-swipe { display: block; margin: 8px 0; color: var(--wood); font-size: 11px; }
  .schedule-project { flex-wrap: wrap; gap: 5px 12px; }
  .schedule-project strong { min-width: 100%; }
  .schedule-project small { margin-left: 0; }
  .schedule-controls { align-items: stretch; flex-direction: column; }
  .schedule-table { min-width: 780px; }
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px 16px 0; display: block; }
  .sidebar-brand { border: 0; padding: 0; }
  .sidebar-brand img { width: 44px; height: 44px; }
  .sidebar-brand div { display: grid; }
  .sidebar-brand strong { font-size: 17px; }
  .side-nav { margin: 14px -16px 0; padding: 0 16px; display: flex; overflow-x: auto; border-top: 1px solid var(--line); }
  .nav-item { width: auto; min-width: 132px; min-height: 58px; padding-right: 16px; }
  .nav-item span { display: grid; }
  .nav-item small { display: none; }
  .nav-item::before { content: none; }
  .sidebar-bottom { margin: 0 -16px; display: block; }
  .admin-nav { margin: 0; padding: 0 16px; display: flex; overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .admin-nav > p { display: none; }
  .admin-nav .nav-item, .admin-nav .settings-button { width: auto; min-width: 150px; min-height: 58px; padding: 10px 18px 10px 0; border-bottom: 0; flex: 0 0 auto; }
  .admin-nav .settings-button { align-content: center; }
  .sidebar-bottom .user-block { display: none; }
  .workspace { padding: 0 16px 36px; }
  .topbar { min-height: 94px; }
  .topbar h2 { font-size: 22px; }
  .top-actions .secondary-button { display: none; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip > button { padding: 14px; min-height: 100px; }
  .case-filters label { flex: 1 1 120px; }
  .case-setting-grid { grid-template-columns: 1fr; }
  .case-filters select { width: 100%; min-width: 0; }
  .case-management-row { grid-template-columns: minmax(0,1fr) auto; gap: 6px 12px; }
  .case-management-row strong { grid-column: 1; }
  .case-management-row .case-row-status { grid-column: 2; grid-row: 1; }
  .case-management-row .case-row-amount { grid-column: 1 / -1; grid-row: 3; }
  .case-management-row small { grid-column: 2; grid-row: 2; }
  .final-quote-panel { align-items: flex-start; flex-direction: column; }
  .content-section { padding: 18px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .filter-group { width: 100%; overflow-x: auto; }
  .quote-list { grid-template-columns: 1fr; }
  .document-preview { padding: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .editor-head { flex-direction: column; }
  .editor-actions { width: 100%; }
  .editor-actions button { flex: 1; }
  .editor-fields { grid-template-columns: 1fr; }
  .editor-fields label, .editor-fields label + label { padding: 14px 0; border-right: 0; border-top: 1px solid var(--line-soft); }
  .editor-fields.project-fields, .editor-fields.fee-fields { width: 100%; max-width: none; grid-template-columns: 1fr; margin-left: 0; }
  .version-heading, .picker-head { align-items: flex-start; flex-direction: column; justify-content: center; padding: 18px 0; }
  .price-category-row { grid-template-columns: 34px minmax(130px, 1fr) 80px; gap: 10px; }
  .price-category-row i { display: none; }
  .price-detail-head { grid-template-columns: 1fr; gap: 14px; padding: 20px 0; }
  .version-tab { min-width: 180px; }
  .print-sheet { padding: 10px; }
  .print-toolbar { flex-wrap: wrap; }
  .quote-document { min-width: 794px; }
  .preview-dialog .print-sheet { overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
