:root {
  --brand: #e16811;
  --brand-dark: #b84c0a;
  --brand-deep: #71330e;
  --brand-soft: #fff3ea;
  --brand-dark: #b84c0a;
  --ink: #121820;
  --muted: #5e6975;
  --line: #d9e0e6;
  --soft: #f4f7f9;
  --soft-blue: #fff3ea;
  --white: #fff;
  --danger: #c03a4b;
  --danger-soft: #fff0f2;
  --warning: #9a6700;
  --warning-soft: #fff6d8;
  --success: #237a57;
  --success-soft: #eaf7f1;
  --sidebar: 248px;
  --shadow: 0 18px 48px rgba(18, 24, 32, .12);
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { padding: 5px; border-radius: 5px; cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { letter-spacing: -.025em; }
.page-loading { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; color: var(--ink); background: rgba(255, 255, 255, .86); backdrop-filter: blur(3px); opacity: 1; visibility: visible; transition: opacity .22s ease, visibility .22s ease; }
.page-loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.page-loading-card { min-width: 170px; padding: 18px 22px; display: flex; align-items: center; justify-content: center; gap: 11px; background: rgba(255, 255, 255, .96); border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(18, 24, 32, .12); font-size: 13px; font-weight: 750; }
.page-loading-spinner { width: 22px; height: 22px; display: inline-block; border: 3px solid #f2d4c0; border-top-color: var(--brand); border-radius: 50%; animation: page-loading-spin .72s linear infinite; }
@keyframes page-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .page-loading-spinner { animation-duration: 1.4s; } .page-loading { transition: none; } }

body.session-restore-pending #login-gateway,
body.session-restore-pending #portal-login-gateway,
body.session-restore-pending #runtime-login { display: none !important; }
body.session-restore-pending #backend-app.hidden,
body.session-restore-pending #portal-app.hidden,
body.session-restore-pending #runtime-app.runtime-hidden { display: block !important; }

.login-gateway, .access-state-page {
  min-height: 100vh;
  padding: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff7f0 0%, #ffffff 58%, #fff0e4 100%);
}
.auth-gateway-shell { width: min(1020px, 100%); min-height: 650px; display: grid; grid-template-columns: .9fr 1.1fr; background: white; border: 1px solid #f1d6c4; box-shadow: var(--shadow); }
.auth-brand-panel { padding: 52px 46px; display: flex; flex-direction: column; color: #71330e; background: #fff3ea; border-right: 1px solid #f1d6c4; }
.auth-brand-panel img { width: 168px; max-height: 44px; object-fit: contain; object-position: left center; }
.auth-brand-panel .section-kicker { margin-top: 86px; }
.auth-brand-panel h1 { margin: 8px 0 20px; color: #652a08; font-size: 42px; line-height: 1.15; }
.auth-brand-panel > p:not(.section-kicker) { color: #7b5b44; }
.gateway-scope { margin-top: auto; padding: 18px; display: grid; gap: 5px; background: white; border-left: 4px solid var(--brand); }
.gateway-scope strong { color: var(--brand-dark); font-size: 12px; letter-spacing: .12em; }
.gateway-scope span { color: #4d6877; font-size: 12px; }
.auth-entry-panel { padding: 54px 62px; align-self: center; }
.auth-entry-panel h2 { margin: 5px 0 8px; font-size: 34px; }
.gateway-intro { margin-bottom: 24px; color: var(--muted); font-size: 13px; }
.gateway-form { display: grid; gap: 15px; }
.gateway-form label { display: grid; gap: 6px; color: #43505b; font-size: 12px; font-weight: 750; }
.gateway-form label.checkbox-label { min-height: 42px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 0; color: #43505b; }
.gateway-form .checkbox-label input[type="checkbox"] { width: 18px; min-width: 18px; min-height: 18px; margin: 0; }
.password-input-shell { position: relative; display: block; width: 100%; }
.password-input-shell input { width: 100%; padding-right: 48px; }
.password-visibility-toggle { position: absolute; top: 50%; right: 8px; width: 34px; height: 34px; padding: 5px; display: grid; place-items: center; color: #52616c; background: transparent; border: 0; cursor: pointer; transform: translateY(-50%); }
.password-visibility-toggle:hover, .password-visibility-toggle:focus-visible { color: var(--brand-dark); background: var(--soft-blue); outline: 2px solid rgba(0, 146, 227, .22); }
.password-visibility-toggle svg { width: 20px; height: 20px; fill: currentColor; }
.preferred-area-fieldset { margin: 0; padding: 14px; display: grid; gap: 10px; border: 1px solid var(--line); }
.preferred-area-fieldset legend { padding: 0 6px; color: #43505b; font-size: 12px; font-weight: 800; }
.preferred-area-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 8px; }
.preferred-area-row > span { padding-bottom: 12px; color: var(--brand-dark); font-size: 12px; font-weight: 900; text-align: center; }
.field-help { margin: -4px 0 0; color: var(--muted); font-size: 11px; }
.form-section-title { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--brand-deep); font-size: 14px; font-weight: 800; letter-spacing: .08em; }
.bundle-item-section { display: grid; gap: 12px; }
.bundle-item-section[hidden] { display: none; }
.bundle-item-section .form-section-title { margin-top: 0; }
.bundle-item-picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 1fr) 96px auto; gap: 10px; align-items: end; }
.bundle-item-picker label { margin: 0; }
.bundle-item-picker .button { min-height: 38px; }
.bundle-item-table { margin: 0; }
.bundle-price-summary { margin-top: 0; }
.followup-form-section { padding: 16px; display: grid; gap: 14px; background: #f7f9fa; border: 1px solid var(--line); border-radius: 2px; }
.followup-form-heading { padding-bottom: 10px; border-bottom: 1px solid #dce3e8; }
.followup-form-heading h3 { margin: 0; color: var(--brand-deep); font-size: 14px; }
.followup-form-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.followup-form-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.followup-form-fields .wide { grid-column: 1 / -1; }
.captcha-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.captcha-image { min-height: 48px; padding: 8px 14px; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #9a460e; background: repeating-linear-gradient(-18deg, #fff7f1 0, #fff7f1 7px, #f8d8c2 8px, #f8d8c2 9px); border: 1px solid #e2b18e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; font-weight: 900; letter-spacing: .28em; text-shadow: 1px 1px 0 white; user-select: none; }
.captcha-refresh { min-height: 48px; padding: 0 13px; color: var(--brand-dark); background: white; border: 1px solid #e2b18e; font-size: 11px; font-weight: 800; }
.captcha-refresh:hover { background: var(--soft-blue); }
.compact-form { padding: 0; }
.gateway-links { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; }
.gateway-links button { padding: 5px; color: var(--brand-dark); background: transparent; border: 0; font-size: 12px; font-weight: 750; }
.demo-credentials { margin-top: 26px; padding: 14px 16px; display: grid; gap: 3px; color: #4e6674; background: var(--soft-blue); border-left: 3px solid var(--brand); font-size: 11px; }
.demo-credentials strong { color: var(--brand-dark); }
.support-card { padding: 18px; color: #3f5968; background: var(--soft-blue); border: 1px solid #f1d2be; }
.support-card ol { margin: 12px 0 0; padding-left: 20px; }
.access-state-card { width: min(560px, 100%); padding: 44px; text-align: center; background: white; border: 1px solid #f1d6c4; box-shadow: var(--shadow); }
.access-state-card > img { width: 150px; max-height: 42px; margin-bottom: 34px; object-fit: contain; }
.access-state-card > p:not(.section-kicker) { color: var(--muted); }
.state-icon { width: 58px; height: 58px; margin: 0 auto 22px; display: grid; place-items: center; color: white; background: var(--brand); border-radius: 50%; font-size: 28px; font-weight: 850; }
.pending-status { margin: 28px 0 20px; display: grid; grid-template-columns: 1fr 1.4fr; text-align: left; border: 1px solid var(--line); }
.pending-status span, .pending-status strong { padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 12px; }
.pending-status span { color: var(--muted); background: #f7f9fa; }
.pending-status strong:nth-last-child(-n+2), .pending-status span:nth-last-child(-n+2) { border-bottom: 0; }
.access-state-card .auth-security-note { margin-bottom: 22px; text-align: left; }
.password-change-card { text-align: left; }
.password-change-card > img { display: block; }
.password-change-card .text-button { margin-top: 18px; }
.admin-access-card { max-width: 620px; }
.security-shield { width: 64px; height: 64px; margin: 0 auto 22px; display: grid; place-items: center; color: white; background: var(--brand); border-radius: 18px 18px 28px 28px; font-weight: 900; letter-spacing: .08em; }
.security-check-list { margin: 24px 0; padding: 18px; display: grid; gap: 9px; color: #7b421e; background: var(--soft-blue); border-left: 4px solid var(--brand); text-align: left; font-size: 12px; }
.admin-access-card .field-help { margin-top: 14px; }

.prototype-bar {
  min-height: 32px;
  padding: 4px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #33404b;
  background: #f0f2f4;
  border-bottom: 0;
  font-size: 16px;
}
.prototype-bar strong { letter-spacing: .04em; }
.prototype-account { margin-left: auto; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 7px; }
.prototype-account-icon { width: 18px; height: 18px; fill: currentColor; }
.prototype-bar #header-account { letter-spacing: .04em; }
.prototype-bar #logout-button { margin-left: 0; }
.prototype-bar [data-portal-logout] { margin-left: 0; }
.prototype-bar label { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.prototype-bar select { min-height: 30px; border: 1px solid #aeb9c3; background: var(--white); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--sidebar);
  height: 100dvh;
  overflow-y: auto;
  padding: 26px 18px 22px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  color: var(--ink);
  border-right: 1px solid var(--line);
}
.brand-block { padding: 0 10px 25px; border-bottom: 1px solid var(--line); }
.brand-block img { width: 144px; max-height: 40px; object-fit: contain; object-position: left center; }
.product-name { margin-top: 18px; font-size: 19px; font-weight: 800; line-height: 1.25; }
.product-name .product-version { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.sidebar nav { margin-top: 24px; display: grid; gap: 6px; }
.nav-item {
  width: 100%; min-height: 46px; padding: 0 12px;
  display: flex; align-items: center; gap: 12px;
  color: #53616c; background: transparent; border: 0; text-align: left; font-weight: 700;
}
.nav-item span { color: #87949e; font-size: 11px; letter-spacing: .08em; }
.nav-item b { font: inherit; }
.nav-item:hover { color: var(--brand-dark); background: #fff4ea; }
.nav-item.active { color: #9b3f0b; background: var(--soft-blue); border-left: 3px solid var(--brand); }
.nav-group-toggle { width: 100%; min-height: 46px; padding: 0 12px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; color: #53616c; background: transparent; border: 0; text-align: left; font-weight: 800; }
.nav-group-toggle > span { color: #87949e; font-size: 11px; letter-spacing: .08em; }
.nav-group-toggle > b { font: inherit; }
.nav-group-toggle > i { color: var(--brand-dark); font-size: 17px; font-style: normal; }
.nav-group-toggle:hover, .nav-group-toggle.open { color: #9b3f0b; background: #fff4ea; }
.nav-submenu { margin: -2px 0 4px 28px; padding: 5px 0 5px 9px; display: grid; gap: 2px; border-left: 1px solid #e8c5aa; }
.nav-subitem { min-height: 36px; padding: 0 9px; font-size: 12px; }
.scope-note { margin-top: auto; padding: 18px; border: 1px solid #f1cbb2; background: var(--soft-blue); }
.scope-note strong { color: var(--brand-dark); font-size: 12px; letter-spacing: .08em; }
.scope-note p { margin: 8px 0 0; color: #7b5c45; font-size: 12px; }

.main-content { min-width: 0; }
.topbar {
  min-height: 92px;
  padding: 20px 32px;
  display: flex; align-items: center; gap: 18px;
  position: sticky; top: 0; z-index: 20;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 2px 0 0; font-size: 25px; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right .topbar-actions { margin-left: 0; }
.topbar-account { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.topbar-account-icon { width: 18px; height: 18px; fill: currentColor; }
.menu-button { display: none; }
.eyebrow, .section-kicker { margin-bottom: 4px; color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .13em; }
@media (min-width: 821px) {
  .sidebar { inset: 0 auto 0 0; }
  .main-content { grid-column: 2; padding-top: 92px; }
  .topbar { position: fixed; inset: 0 0 auto var(--sidebar); z-index: 30; }
}

.view { display: none; padding: 30px 32px 56px; }
.view.active { display: block; }
.context-row { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.context-row h2 { margin: 2px 0 0; font-size: 28px; }
.data-stamp, .subtle { margin: 0; color: var(--muted); font-size: 12px; }

.button {
  min-height: 40px; padding: 5px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ink); background: var(--white); color: var(--ink); font-weight: 750;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: var(--white); background: var(--brand); border-color: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { border-color: var(--line); }
.button-quiet { border-color: var(--line); color: var(--muted); background: var(--soft); }
.button:disabled, .row-action:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button.is-loading, .row-action.is-loading, .pending-action-note { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.button.is-loading:disabled, .row-action.is-loading:disabled { color: var(--brand-dark); background: #fff1e5; border-color: #f2b48a; opacity: 1; cursor: progress; }
.action-spinner { width: 12px; height: 12px; display: inline-block; flex: 0 0 auto; border: 2px solid rgba(79, 60, 44, .22); border-top-color: currentColor; border-radius: 50%; animation: action-spinner-spin .72s linear infinite; }
@keyframes action-spinner-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .action-spinner { animation-duration: 1.4s; } }
.text-button { padding: 5px; color: var(--brand-dark); border: 0; background: transparent; font-weight: 800; }
.icon-button { width: 38px; height: 38px; padding: 5px; border: 1px solid var(--line); background: white; font-size: 24px; line-height: 1; }
.full-width { width: 100%; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-height: 132px; padding: 20px; background: var(--white); border: 1px solid var(--line); }
.metric-card.urgent { border-top: 4px solid var(--danger); }
.metric-card.warning { border-top: 4px solid #e3a700; }
.metric-card.brand { border-top: 4px solid var(--brand); }
.metric-card.success { border-top: 4px solid var(--success); }
.metric-card p { margin: 0; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin: 10px 0 3px; font-size: 35px; line-height: 1; }
.metric-card span { color: var(--muted); font-size: 12px; }

.dashboard-grid { margin-top: 14px; display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.branch-application-dashboard-card { display: grid; gap: 14px; align-content: start; }
.branch-application-dashboard-card .panel-header { margin-bottom: 0; }
.branch-application-dashboard-card .button { justify-self: start; }
.portal-dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-dashboard-grid > .panel { min-width: 0; }
.panel { padding: 22px; background: var(--white); border: 1px solid var(--line); }
.panel-header { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-header h3 { margin: 0; font-size: 19px; }
.priority-item { padding: 14px 0; display: grid; grid-template-columns: 1fr auto; gap: 12px; border-top: 1px solid var(--line); }
.priority-item:first-child { border-top: 0; }
.priority-item p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.priority-item button { align-self: center; }
.bar-row { margin-top: 14px; display: grid; grid-template-columns: 92px 1fr 24px; align-items: center; gap: 10px; font-size: 12px; }
.bar-track { height: 8px; background: #e8edf1; }
.bar-fill { height: 100%; background: var(--brand); }
.source-grid { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); }
.source-item { padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.source-item:nth-child(even) { border-right: 0; }
.source-item strong { display: block; font-size: 22px; }
.source-item span { color: var(--muted); font-size: 12px; }
.region-row { padding: 12px 0; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.region-row:first-child { border-top: 0; }
.region-row span { color: var(--muted); font-size: 12px; }

.view-toggle { display: flex; border: 1px solid var(--line); }
.view-toggle button { min-height: 34px; padding: 5px; border: 0; background: white; color: var(--muted); }
.view-toggle button.active { color: white; background: var(--brand); }
.filter-panel { padding: 16px; display: grid; grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(130px, 1fr)) auto auto; gap: 10px; align-items: end; background: var(--white); border: 1px solid var(--line); }
.management-filter { margin-bottom: 14px; grid-template-columns: repeat(5, minmax(140px, 1fr)) auto; }
.partner-filter-panel { grid-template-columns: repeat(3, minmax(180px, 1fr)) auto; }
.lead-filter-panel { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: row dense; }
.lead-filter-search { grid-column: span 4; }
.lead-filter-status, .lead-filter-source, .lead-filter-tag, .lead-filter-assignment, .lead-filter-role, .lead-filter-city { grid-column: span 2; }
.lead-filter-worker { grid-column: span 3; }
.lead-filter-overdue { grid-column: span 2; justify-content: center; }
.lead-filter-submit { grid-column: span 1; width: 100%; padding: 0 8px; }
.lead-filter-clear { grid-column: span 2; width: 100%; }
.filter-panel label, .modal label, .mobile-content label { display: grid; gap: 6px; color: #43505b; font-size: 12px; font-weight: 750; }
input, select, textarea { width: 100%; min-height: 40px; padding: 5px; color: var(--ink); background: var(--white); border: 1px solid #bcc6ce; border-radius: 5px; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(225, 104, 17, .22); border-color: var(--brand); }
.checkbox-filter { min-height: 40px; display: flex !important; grid-template-columns: auto 1fr; align-items: center; white-space: nowrap; }
.checkbox-filter input, .consent input { width: 17px; min-height: 17px; }
.table-panel { margin-top: 14px; background: var(--white); border: 1px solid var(--line); }
.table-summary { padding: 14px 18px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 13px; }
.table-summary strong { color: var(--ink); }
.inventory-item-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inventory-item-summary .row-actions { margin-left: auto; }
.purchase-filter { margin-bottom: 14px; grid-template-columns: minmax(280px, 520px) auto auto 1fr; }
.purchase-filter .button { min-width: 110px; }
.purchase-table-summary { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.purchase-table-summary .row-actions { align-items: center; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th { padding: 12px 14px; color: var(--muted); background: #f7f9fa; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: .05em; }
td { padding: 14px; border-bottom: 1px solid #edf0f2; font-size: 13px; vertical-align: top; }
tbody tr:hover { background: #f8fbfd; }
.customer-cell strong { display: block; font-size: 14px; }
.customer-cell span, .cell-meta { color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; min-height: 26px; padding: 4px 8px; align-items: center; border: 1px solid var(--line); border-radius: 5px; color: #43505b; background: #f5f7f8; font-size: 11px; font-weight: 750; white-space: nowrap; }
.badge.pending { color: var(--warning); border-color: #edd48c; background: var(--warning-soft); }
.badge.overdue { color: var(--danger); border-color: #efbdc4; background: var(--danger-soft); }
.badge.done { color: var(--success); border-color: #b9dfcf; background: var(--success-soft); }
.badge.priority-tag { color: #8a4c00; border-color: #efc57d; background: #fff4df; }
.tag-color-badge { font-weight: 750; }
.color-picker-field { min-height: 42px; padding: 5px; display: flex; align-items: center; gap: 10px; background: white; border: 1px solid #bcc6ce; border-radius: 5px; }
.color-picker-field input[type="color"] { width: 52px; height: 30px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.color-picker-field output { color: #43505b; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.tag-multiselect { position: relative; }
.tag-multiselect > summary { min-height: 42px; padding: 5px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: white; border: 1px solid #bcc6ce; border-radius: 5px; cursor: pointer; list-style: none; }
.tag-multiselect > summary::-webkit-details-marker { display: none; }
.tag-multiselect[open] > summary { border-color: var(--brand); outline: 2px solid rgba(0,146,227,.16); }
.tag-multiselect-summary { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.tag-selected-count, .tag-placeholder { color: var(--muted); font-size: 11px; }
.tag-chevron { color: var(--brand-dark); font-size: 18px; transition: transform .16s ease; }
.tag-multiselect[open] .tag-chevron { transform: rotate(180deg); }
.tag-multiselect-menu { position: absolute; z-index: 3; top: calc(100% + 4px); left: 0; right: 0; max-height: 210px; padding: 10px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; overflow-y: auto; background: white; border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(18,24,32,.14); }
.feature-tag-field { display: grid; gap: 10px; }
.feature-tag-field > span { color: #43505b; font-size: 12px; font-weight: 750; }
.feature-tag-field > small { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.tag-option { min-height: 34px; width: auto; padding: 3px 7px; display: inline-flex; align-items: center; gap: 5px; color: var(--ink); background: white; border: 1px solid var(--line); cursor: pointer; }
.tag-option:hover { border-color: var(--brand); background: var(--soft-blue); }
.tag-option.is-selected { border-color: var(--brand); background: var(--soft-blue); box-shadow: inset 0 0 0 1px var(--brand); }
.tag-option small { color: var(--muted); font-size: 10px; }
.tag-option-state { color: var(--brand-dark); font-size: 10px; font-weight: 800; }
.tag-option:disabled { opacity: .55; cursor: not-allowed; }
.tag-center-filter { margin-bottom: 14px; grid-template-columns: minmax(220px, 360px) 1fr; }
.quotation-result-grid.four-results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tag-center-filter p { margin: 0; padding-bottom: 10px; color: var(--muted); font-size: 12px; }
.badge.source { color: var(--brand-dark); border-color: #f4cdb2; background: var(--soft-blue); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-action { min-height: 32px; padding: 5px; color: var(--ink); border: 1px solid var(--line); background: var(--white); font-size: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.row-action-icon { width: 32px; min-width: 32px; padding: 3px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; line-height: 1; }
.download-quote-icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.row-action:disabled { color: #a6b0b8; background: #f4f6f7; cursor: not-allowed; }
.empty-state { padding: 50px !important; color: var(--muted); text-align: center; }
.purchase-main-table { min-width: 1180px; table-layout: fixed; }
.purchase-select-column { width: 48px; }
.purchase-identity-column { width: 230px; }
.purchase-date-column { width: 145px; }
.purchase-items-column { width: 210px; }
.purchase-total-column { width: 140px; }
.purchase-status-column { width: 95px; }
.purchase-actor-column { width: 130px; }
.purchase-action-column { width: 120px; }
.purchase-receipt-identity strong, .purchase-receipt-identity span { display: block; white-space: nowrap; }
.purchase-receipt-identity span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.purchase-nowrap { white-space: nowrap; }
.purchase-main-table input[type="checkbox"] { width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; vertical-align: middle; }
.purchase-item-summary { display: grid; justify-content: start; gap: 6px; }
.purchase-item-summary .row-action { width: fit-content; }
.purchase-detail-row > td { padding: 0 14px 14px 62px; background: #fbfcfd; }
.purchase-detail-wrap { overflow-x: auto; }
.purchase-detail-table { min-width: 760px; table-layout: fixed; background: white; border: 1px solid var(--line); }
.purchase-detail-table th, .purchase-detail-table td { white-space: nowrap; }
.purchase-detail-table th:first-child { width: 58%; }
.purchase-detail-name { overflow: hidden; text-overflow: ellipsis; }
.purchase-detail-name strong, .purchase-detail-name span { display: block; overflow: hidden; text-overflow: ellipsis; }
.purchase-detail-name span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.notice { margin-bottom: 16px; padding: 14px 16px; color: #254b60; background: var(--soft-blue); border-left: 4px solid var(--brand); font-size: 13px; }
.portal-shipment-view > .notice { margin-bottom: 28px; }
.people-search-panel { margin-bottom: 14px; padding: 14px 16px; display: grid; grid-template-columns: minmax(280px, 560px) auto; align-items: end; gap: 16px; background: white; border: 1px solid var(--line); }
.people-search-panel label { display: grid; gap: 6px; color: #43505b; font-size: 12px; font-weight: 750; }
.people-search-panel span { padding-bottom: 10px; color: var(--muted); font-size: 12px; }
.people-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.person-card { padding: 20px; background: white; border: 1px solid var(--line); }
.person-card-header { display: flex; justify-content: space-between; gap: 10px; }
.person-card h3 { margin-bottom: 4px; font-size: 18px; }
.person-card p { color: var(--muted); font-size: 12px; }
.area-list { min-height: 58px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.area-list .badge { margin: 0 5px 5px 0; }
.person-footer { margin-top: 14px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; }
.table-area-list { min-height: 0; margin: 0; padding: 0; border: 0; }

.management-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.management-card { padding: 20px; background: white; border: 1px solid var(--line); }
.management-card-header { display: flex; justify-content: space-between; gap: 12px; }
.management-card h3 { margin-bottom: 4px; font-size: 18px; }
.management-card p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.management-card-stats { margin-top: 18px; display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--line); }
.management-card-stats div { padding: 12px; border-right: 1px solid var(--line); }
.management-card-stats div:last-child { border-right: 0; }
.management-card-stats strong, .management-card-stats span { display: block; }
.management-card-stats span { color: var(--muted); font-size: 10px; }
.management-card-footer { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; }

.pagination-bar { margin-top: 14px; min-height: 52px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); background: white; border: 1px solid var(--line); font-size: 12px; }
.pagination-bar > div { display: flex; gap: 6px; }
.pagination-bar button:disabled { color: #a6b0b8; background: #f4f6f7; cursor: not-allowed; }
.pagination-bar .page-summary { color: var(--muted); white-space: nowrap; }

.role-matrix-panel, .partner-table-panel { overflow-x: auto; background: white; border: 1px solid var(--line); }
.role-matrix, .partner-table { min-width: 920px; }
.permission-yes { color: var(--success); font-weight: 800; }
.permission-no { color: #8c98a2; }
.permission-scope { color: var(--brand-dark); font-weight: 750; }
.fixed-link { max-width: 360px; display: block; overflow: hidden; color: var(--brand-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.partner-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.partner-application-panel { margin-bottom: 18px; }
.partner-list-heading { margin-top: 8px; }

.management-tabs { margin-bottom: 14px; padding: 0; display: flex; gap: 24px; background: transparent; border: 0; }
.management-tabs button { min-height: 38px; padding: 5px; color: var(--muted); background: transparent; border: 0; font-weight: 750; }
.management-tabs button.active { color: var(--brand-dark); background: transparent; border: 0; }
.quotation-settings-tabs { gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.quotation-settings-tabs button { padding: 5px 12px; border-bottom: 3px solid transparent; }
.quotation-settings-tabs button.active { border-bottom: 3px solid var(--brand); }
.permission-check-grid { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); background: #fafcfd; }
.permission-category { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); background: var(--white); }
.permission-category legend { padding: 0 5px; color: var(--ink); font-size: 13px; font-weight: 800; }
.permission-category-header { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.permission-category-header .row-action { min-height: 30px; flex: 0 0 auto; }
.permission-category-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; }
.modal .permission-category-options .checkbox-field { min-width: 0; display: inline-flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; min-height: 28px; font-weight: 650; white-space: nowrap; }
.modal .permission-category-options .checkbox-field input { width: 16px; min-width: 16px; height: 16px; min-height: 16px; margin: 0; }
.modal .permission-category-options .checkbox-field span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .permission-category-options { grid-template-columns: 1fr; } }
.auth-mode-switch button { min-height: 38px; padding: 5px; color: var(--muted); background: white; border: 1px solid var(--line); font-weight: 750; }
.auth-mode-switch button.active { color: white; background: var(--brand); border-color: var(--brand); }
.permission-panel { display: block; }
.panel-action-row { margin-bottom: 12px; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: white; border: 1px solid var(--line); }
.panel-action-row h3 { margin-bottom: 3px; }
.panel-action-row p { margin: 0; color: var(--muted); font-size: 12px; }

.auth-flow-layout { display: grid; grid-template-columns: minmax(280px, .8fr) minmax(360px, 1.2fr); gap: 14px; align-items: start; }
.auth-flow-note, .auth-preview-shell { padding: 24px; background: white; border: 1px solid var(--line); }
.auth-flow-note h3 { font-size: 22px; }
.auth-flow-note ol { margin: 20px 0 0; padding-left: 22px; }
.auth-flow-note li { margin: 14px 0; color: #43505b; }
.auth-mode-switch { margin-bottom: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.auth-card { max-width: 460px; margin: 0 auto; }
.auth-card h3 { margin-bottom: 6px; font-size: 25px; }
.auth-card > p { color: var(--muted); font-size: 13px; }
.auth-card form { margin-top: 20px; display: grid; gap: 13px; }
.auth-divider { margin: 18px 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--line); }
.auth-security-note { margin-top: 18px; padding: 12px; color: #496270; background: var(--soft-blue); border-left: 3px solid var(--brand); font-size: 11px; }
.account-actions { min-width: 310px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.danger-action { color: var(--danger); border-color: #e5b5bd; }
.danger-button { color: white; background: var(--danger); border: 1px solid var(--danger); }
.audit-filter { margin-bottom: 14px; grid-template-columns: minmax(280px, 1fr) minmax(180px, 280px); }

.wireframe-hub { min-height: 100vh; padding: 54px 28px; background: linear-gradient(135deg, #fff7f0, white 60%, #fff3ea); }
.wireframe-hub-inner { width: min(1120px, 100%); margin: 0 auto; }
.wireframe-hub-brand { width: 170px; margin-bottom: 54px; }
.wireframe-hub h1 { max-width: 760px; margin-bottom: 14px; font-size: clamp(36px, 6vw, 62px); line-height: 1.05; }
.wireframe-hub-intro { max-width: 760px; color: var(--muted); }
.entry-card-grid { margin-top: 38px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.entry-card { min-height: 310px; padding: 28px; display: flex; flex-direction: column; color: var(--ink); background: white; border: 1px solid var(--line); text-decoration: none; transition: .18s ease; }
.entry-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-3px); }
.entry-card-code { color: var(--brand-dark); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.entry-card h2 { margin: 18px 0 8px; font-size: 26px; }
.entry-card p { color: var(--muted); font-size: 13px; }
.entry-card ul { padding-left: 18px; color: #425866; font-size: 12px; }
.entry-card-action { margin-top: auto; color: var(--brand-dark); font-weight: 850; }
.hub-boundary { margin-top: 20px; padding: 18px; color: #365a6d; background: white; border-left: 4px solid var(--brand); font-size: 12px; }

.portal-app-header { position: sticky; top: 0; z-index: 30; min-height: 76px; padding: 12px 24px; display: flex; align-items: center; gap: 18px; background: white; border-bottom: 1px solid var(--line); }
.portal-app-header .brand-block { padding: 0; display: flex; align-items: center; gap: 14px; border: 0; }
.portal-app-header .brand-block img { width: 108px; }
.portal-app-header .product-name { margin: 0; font-size: 19px; white-space: nowrap; }
.portal-app-header .product-version { display: block; margin-top: 3px; color: #71808e; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.portal-user-card { margin-left: auto; display: grid; justify-items: end; gap: 2px; line-height: 1.2; }
.portal-user-account { color: #71808e; font-size: 12px; font-weight: 700; }
.portal-header-logout { flex: 0 0 auto; }
@media (min-width: 821px) {
  .portal-app-header { position: fixed; inset: 0 0 auto; }
  .portal-shell { padding-top: 76px; }
}
.portal-menu-toggle { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); background: white; color: var(--ink); cursor: pointer; font-weight: 700; white-space: nowrap; }
.portal-menu-toggle:hover, .portal-menu-toggle[aria-expanded="true"] { color: var(--brand-dark); background: #fff4ea; }
.portal-menu-toggle:focus-visible { outline: 3px solid rgba(225, 104, 17, .25); outline-offset: 2px; }
.portal-shell { min-height: calc(100vh - 76px); display: block; }
.portal-sidebar { padding: 12px 24px; background: white; border-bottom: 1px solid var(--line); }
.portal-sidebar[hidden] { display: none; }
.portal-sidebar .nav-item[hidden] { display: none; }
.portal-sidebar nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.portal-user-card { margin-left: auto; display: grid; justify-items: end; gap: 2px; color: #365466; font-size: 12px; line-height: 1.2; white-space: nowrap; }
.portal-user-card span { color: var(--muted); }
.portal-user-card .portal-user-account { color: #71808e; font-weight: 700; }
.portal-main { min-width: 0; }
.portal-view { display: none; padding: 30px; }
.portal-view.active { display: block; }
.task-card-list { display: grid; gap: 10px; }
.task-card { padding: 16px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 16px; border: 1px solid var(--line); }
.planner-priority-card { text-align: left; }
.portal-dashboard-followup-card { text-align: left; }
.task-card p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.security-setting-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.security-setting-card { padding: 22px; background: white; border: 1px solid var(--line); }
.security-setting-card h3 { margin: 14px 0 7px; }
.security-setting-card p { color: var(--muted); font-size: 12px; }
.security-setting-card form { margin-top: 16px; }
.portal-view .task-card strong { display: block; }
.portal-view .empty-state { background: white; border: 1px solid var(--line); }
.case-work-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.case-work-photo-grid a { display: grid; gap: 7px; color: var(--ink); text-decoration: none; font-size: 12px; font-weight: 700; }
.case-work-photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); background: #f6f8fa; }
.case-work-photo-input { padding: 12px; border: 1px solid var(--line); background: #fff8f3; }
.case-work-photo-input label { display: grid; gap: 7px; color: var(--ink); font-weight: 750; }
.case-work-photo-input small { color: var(--muted); font-size: 12px; font-weight: 500; }
.portal-boundary-panel { margin-top: 0; }
.portal-boundary-panel .security-check-list { margin: 0; }
.metric-card-button { width: 100%; color: var(--ink); border-color: var(--line); text-align: left; cursor: pointer; }
.metric-card-button:hover { border-color: var(--brand); box-shadow: 0 8px 24px rgba(18, 24, 32, .08); transform: translateY(-2px); }
.metric-card-button:focus-visible { outline: 3px solid rgba(225, 104, 17, .25); outline-offset: 2px; }
.priority-toggle { min-width: 98px; display: inline-flex; align-items: center; gap: 7px; color: #53616c; font-size: 11px; font-weight: 800; cursor: pointer; white-space: nowrap; }
.priority-toggle input { width: 17px; min-height: 17px; accent-color: var(--brand); }
.priority-toggle:has(input:checked) { color: var(--danger); }

.join-invite-card { margin-bottom: 20px; padding: 15px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; color: #34576a; background: var(--soft-blue); border-left: 4px solid var(--brand); }
.join-invite-card span, .join-invite-card strong { display: block; font-size: 11px; }
.join-invite-card span { color: var(--muted); }
.join-status-switch { position: fixed; z-index: 5; top: 14px; right: 14px; display: flex; gap: 5px; }
.join-status-switch a { padding: 7px 10px; color: var(--brand-dark); background: white; border: 1px solid var(--line); text-decoration: none; font-size: 10px; font-weight: 800; }
.partner-apply-shell { width: min(1180px, 100%); }
.partner-apply-panel { padding: 42px 50px; }
.partner-readonly-notice { margin-top: 16px; }
.partner-link-panel { max-width: 780px; }
.partner-link-panel h3 { margin: 14px 0 6px; font-size: 24px; }
.partner-link-panel .utm-box { margin: 18px 0; }

.form-mode-switch { margin-bottom: 20px; padding: 10px; display: flex; align-items: end; gap: 8px; background: white; border: 1px solid var(--line); }
.form-mode-switch > button { min-height: 38px; padding: 5px; border: 1px solid var(--line); background: white; color: var(--muted); font-weight: 750; }
.form-mode-switch > button.active { color: white; background: var(--brand); border-color: var(--brand); }
.form-mode-switch label { min-width: 240px; margin-left: auto; display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
.partner-form-banner { margin: 12px 0 18px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #245269; background: var(--soft-blue); border-left: 4px solid var(--brand); }
.partner-form-banner span { color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.partner-form-banner strong { font-size: 14px; }
.partner-locked-field input { color: #3c5f71; background: #fff8f3; border-color: #efc8ac; cursor: not-allowed; }

.url-preview { max-width: 520px; padding: 9px 12px; overflow: hidden; color: var(--muted); background: #e8edf1; border: 1px dashed #a8b4be; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.form-preview-layout { display: grid; grid-template-columns: 390px minmax(300px, 560px); justify-content: center; align-items: start; gap: 34px; }
.mobile-frame { padding: 10px; background: #dfe7ec; border-radius: 28px; box-shadow: var(--shadow); }
.mobile-browser { padding: 10px 12px; overflow: hidden; color: #68737c; background: #eef1f3; border-radius: 19px 19px 0 0; font-size: 10px; white-space: nowrap; }
.mobile-content { min-height: 680px; padding: 28px 22px; background: white; border-radius: 0 0 19px 19px; }
.mobile-content h2 { margin: 5px 0 8px; font-size: 25px; }
.mobile-content > p { color: var(--muted); font-size: 13px; }
.mobile-brand { color: var(--brand) !important; font-weight: 850; letter-spacing: .08em; }
.mobile-content form { margin-top: 24px; display: grid; gap: 14px; }
.mobile-content label span { color: var(--danger); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent { display: grid !important; grid-template-columns: auto 1fr; align-items: start; font-weight: 500 !important; }
.annotation-panel { padding: 30px; background: white; border: 1px solid var(--line); }
.annotation-panel h3 { font-size: 24px; }
.annotation-panel ol { margin: 22px 0; padding-left: 22px; }
.annotation-panel li { margin: 12px 0; }
.boundary-card { margin-top: 28px; padding: 18px; color: #71330e; background: var(--soft-blue); border-left: 4px solid var(--brand); }
.boundary-card strong { color: var(--brand-dark); }
.boundary-card p { margin: 6px 0 0; color: #7b5c45; font-size: 13px; }
.success-state { padding-top: 80px; text-align: center; }
.success-mark { width: 58px; height: 58px; margin: 0 auto 20px; display: grid; place-items: center; color: white; background: var(--success); border-radius: 50%; font-size: 28px; }

.drawer-backdrop, .modal-backdrop { position: fixed; background: rgba(18,24,32,.38); opacity: 0; pointer-events: none; transition: .18s ease; z-index: 40; }
.drawer-backdrop { inset: 42px 0 0; }
.modal-backdrop { inset: 0; }
.drawer-backdrop.open, .modal-backdrop.open { opacity: 1; pointer-events: auto; }
.detail-drawer { position: fixed; z-index: 41; top: 50%; left: 50%; width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 90px); height: auto; padding: 26px; overflow-y: auto; background: white; box-shadow: var(--shadow); transform: translate(-50%, -48%) scale(.98); opacity: 0; pointer-events: none; transition: .18s ease; }
.detail-drawer.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.drawer-header, .modal-header { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.drawer-header { padding-bottom: 18px; }
.drawer-header h2, .modal-header h2 { margin: 0; font-size: 25px; }
.detail-summary { padding: 18px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-bottom: 1px solid var(--line); }
.detail-summary span, .info-item span { display: block; color: var(--muted); font-size: 11px; }
.detail-summary strong, .info-item strong { display: block; margin-top: 4px; font-size: 13px; }
.drawer-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.drawer-section h3 { margin-bottom: 12px; font-size: 16px; }
.drawer-section > .field-help { margin-top: 12px; line-height: 1.6; }
.drawer-section > .tag-multiselect + .field-help { margin-top: 14px; }
.lead-profile-section { padding-top: 20px; }
.lead-profile-section h3 { margin-bottom: 3px; }
.lead-profile-intro { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.lead-profile-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 24px; }
.lead-profile-grid label { grid-column: span 2; min-width: 0; display: grid; gap: 6px; color: #566473; font-size: 11px; font-weight: 650; }
.lead-profile-grid .profile-half { grid-column: span 3; }
.lead-profile-grid .wide { grid-column: 1 / -1; }
.lead-profile-grid small { color: #8a959e; font-size: 10px; font-weight: 500; }
.lead-profile-label { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; }
.lead-profile-label small { margin-left: 4px; }
.lead-profile-grid textarea { min-height: 76px; line-height: 1.55; }
.lead-profile-actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.lead-case-status { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; padding: 0; border-bottom: 0; }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline { position: relative; margin-left: 6px; padding-left: 22px; border-left: 1px solid #c9d3da; }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before { content: ""; position: absolute; left: -27px; top: 4px; width: 9px; height: 9px; background: var(--brand); border: 3px solid white; box-shadow: 0 0 0 1px var(--brand); border-radius: 50%; }
.timeline-item strong { font-size: 13px; }
.timeline-details { margin-top: 8px; display: grid; gap: 7px; }
.timeline-details > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.timeline-details span { color: var(--muted); font-size: 12px; font-weight: 750; }
.timeline-details p { margin: 0; color: #43505b; font-size: 13px; overflow-wrap: anywhere; }
.timeline-details time { color: #667581; font-size: 13px; font-weight: 750; }
.utm-box { padding: 14px; color: #4b5964; background: var(--soft); border: 1px dashed #adb9c2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.password-reset-value { margin-bottom: 0; }
.password-reset-expiry { display: block; margin-top: 10px; line-height: 1.5; }

.modal-backdrop { display: grid; place-items: center; z-index: 50; }
.modal { width: min(1400px, calc(100vw - 32px)); max-width: calc(100vw - 32px); box-sizing: border-box; height: auto; max-height: calc(100vh - 90px); overflow-y: auto; padding: 24px; background: white; box-shadow: var(--shadow); transform: translateY(12px); transition: .18s ease; }
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { padding-bottom: 16px; }
#modal-body, #portal-order-modal-body { padding-top: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > *, .form-grid .wide { min-width: 0; }
.shipment-contact-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.shipment-contact-row label { min-width: 0; }
.shipment-address-line { color: #43505b; font-size: 12px; font-weight: 750; }
.shipment-address-line strong { margin-left: 4px; color: var(--ink); font-size: 13px; }
.shipment-section-title { margin: 22px 0 10px; color: #43505b; font-size: 14px; }
#view-inventory-shipments .table-panel + .shipment-section-title { margin-top: 34px; }
#inventory-item-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#inventory-item-form .inventory-item-name-field { grid-column: span 2; }
#inventory-item-form .inventory-item-status-field { grid-column: 1 / -1; width: 30%; }
#order-quote-v12,
#portal-order-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); }
#order-quote-v12 > :nth-child(3),
#portal-order-form > :nth-child(3) { grid-column: 3; margin: 0; }
#order-quote-v12 > :nth-child(4),
#portal-order-form > :nth-child(4) { grid-column: 1; }
#order-quote-v12 > :nth-child(5),
#portal-order-form > :nth-child(5) { grid-column: 2 / 4; }
#order-quote-v12 > :nth-child(6),
#portal-order-form > :nth-child(6) { grid-column: 1; }
#order-quote-v12 > :nth-child(7),
#portal-order-form > :nth-child(7) { grid-column: 2; }
#order-quote-v12 > :nth-child(8),
#portal-order-form > :nth-child(8) { grid-column: 3; }
#order-quote-v12 > .quotation-summary-stack { grid-column: 1 / -1; }
#order-quote-v12 > .field-help { grid-column: 1 / -1; text-align: left; }
#order-quote-v12 > fieldset,
#portal-order-form > fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
#order-quote-v12 > fieldset legend,
#portal-order-form > fieldset legend { margin-bottom: 6px; padding: 0; color: #43505b; font-size: 12px; font-weight: 750; }
#order-quote-v12 fieldset .inline-options,
#portal-order-form fieldset .inline-options { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px 28px; min-height: 40px; padding: 0; }
#order-quote-v12 fieldset .checkbox-label,
#portal-order-form fieldset .checkbox-label { min-height: 32px; display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; white-space: nowrap; }
#order-quote-v12 fieldset input[type="radio"],
#portal-order-form fieldset input[type="radio"] { width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: var(--brand); }
#order-quote-v12 > .portal-order-item-picker,
#order-quote-v12 > .portal-order-lines,
#portal-order-form > .portal-order-item-picker,
#portal-order-form > .portal-order-lines,
#portal-order-form > .portal-order-quote-results,
#portal-order-form > .portal-order-cap-warning,
#portal-order-form > .portal-order-help,
#portal-order-form > .portal-order-actions { grid-column: 1 / -1; }
.portal-order-item-picker { display: grid; grid-template-columns: minmax(0, 7fr) minmax(220px, 3fr); gap: 14px; align-items: stretch; }
.portal-order-item-picker > div { display: grid; gap: 14px; }
.portal-order-item-picker label { display: grid; gap: 6px; color: #43505b; font-size: 12px; font-weight: 750; }
.portal-order-item-picker .button { min-height: 100%; }
#add-quote-line-v12,
#add-edit-order-line-v12,
#portal-add-quote-line,
#portal-add-edit-line { color: #a9470a; background: #fff1e6; border-color: #f2c39e; }
#add-quote-line-v12:hover,
#add-edit-order-line-v12:hover,
#portal-add-quote-line:hover,
#portal-add-edit-line:hover { background: #ffe4cf; border-color: #eaa66f; }
#portal-order-edit-form h3 { margin: 18px 0 -11px; font-size: 18px; }
#order-line-editor-v12 h3 { margin: 18px 0 -11px; font-size: 18px; }
.edit-order-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inline-meta { display: inline; margin-left: 2px; }
#company-news-form .form-grid { grid-template-columns: minmax(280px, 1fr) auto auto; align-items: end; }
#company-news-form .form-grid .checkbox-label { white-space: nowrap; }
.worker-role-field { display: grid; gap: 8px; color: #43505b; font-size: 12px; font-weight: 750; }
.worker-role-options { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px; border: 1px solid var(--line); background: #fafcfd; }
.worker-role-field small { color: var(--muted); font-weight: 500; }
.service-area-editor { padding: 12px; border: 1px solid var(--line); background: #fafcfd; }
.service-area-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #43505b; font-size: 12px; font-weight: 750; }
.service-area-editor .area-list { min-height: 40px; margin-top: 8px; padding-top: 10px; }
.service-area-editor .badge button { margin-left: 6px; padding: 5px; color: inherit; background: transparent; border: 0; cursor: pointer; }
.application-detail-grid { margin-top: 16px; }
.staff-profile-block { margin-top: 16px; padding: 18px; background: #f8fafb; border: 1px solid var(--line); }
.staff-profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 24px; }
.staff-service-area-block { margin-top: 18px; padding: 18px; border: 1px solid var(--line); background: white; }
.staff-service-area-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 22px; }
.staff-service-area-grid h3 { margin: 0 0 3px; font-size: 16px; }
.staff-area-editor { margin-top: 12px; display: grid; gap: 10px; }
.staff-area-editor-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: 8px; }
.staff-area-index { padding-bottom: 12px; color: var(--brand-dark); font-size: 12px; font-weight: 900; text-align: center; }
.staff-approved-area-field { display: grid; align-content: start; gap: 6px; color: #43505b; font-size: 12px; font-weight: 750; }
.staff-approved-area-field select { min-height: 118px; }
.modal-footer { margin-top: 24px; display: flex; justify-content: flex-end; gap: 8px; }
.candidate-list { display: grid; gap: 8px; }
.company-news-audience-picker { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.company-news-audience-search { margin-bottom: 8px; }
.company-news-audience-summary { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.company-news-audience-results { max-height: 250px; overflow: auto; padding-right: 2px; }
.company-news-audience-results .candidate-card { padding: 9px 10px; grid-template-columns: auto minmax(0, 1fr); gap: 8px; border-radius: 5px; }
.assignment-search-field { display: grid; gap: 6px; margin-bottom: 10px; color: #43505b; font-size: 12px; font-weight: 750; }
.assignment-result-summary { margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.assignment-candidate-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.assignment-candidate-grid .candidate-card { min-width: 0; padding: 12px 10px; grid-template-columns: auto minmax(0, 1fr); align-content: start; align-items: start; gap: 8px; cursor: pointer; }
.assignment-candidate-grid .candidate-card strong, .assignment-candidate-grid .candidate-card p { overflow-wrap: anywhere; }
.assignment-candidate-grid .candidate-rank { grid-column: 1 / -1; }
.assignment-empty-result { grid-column: 1 / -1; }
.candidate-card { padding: 14px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border: 1px solid var(--line); }
.candidate-card:has(input:checked) { border-color: var(--brand); background: var(--soft-blue); }
.candidate-card input { width: 17px; min-height: 17px; }
.candidate-card p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.service-area-picker { display: grid; gap: 8px; }
.service-area-picker-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; }
.service-area-picker-controls label { margin: 0; }
.service-area-picker-controls .button { min-height: 40px; white-space: nowrap; }
.service-area-selected { min-height: 42px; padding: 8px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafb; }
.service-area-selected .badge { gap: 5px; }
.service-area-selected .badge button { min-height: auto; padding: 0; color: inherit; background: transparent; border: 0; font-weight: 900; line-height: 1; }
.branch-contact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.branch-contact-grid label { min-width: 0; }
.candidate-rank { color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.modal-note { margin-bottom: 16px; padding: 12px; color: #66510a; background: var(--warning-soft); border-left: 3px solid #e0a900; font-size: 12px; }
.field-label { display: inline-block; white-space: nowrap; }
.required-marker { display: inline-block; color: #d62f2f; font-size: .7em; font-weight: 900; margin-left: 3px; white-space: nowrap; }
.money-input { min-height: 42px; display: grid; grid-template-columns: auto 1fr; align-items: center; overflow: hidden; border: 1px solid #bcc6ce; border-radius: 5px; background: white; }
.money-input span { padding: 0 11px; color: var(--muted); font-size: 12px; font-weight: 800; border-right: 1px solid var(--line); }
.money-input input { min-height: 40px; border: 0; border-radius: 0; }
.money-input input:focus { outline: 2px solid rgba(0,146,227,.16); outline-offset: -2px; }
.quotation-result-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: #f7fafc; }
.quotation-result-grid.two-results { grid-template-columns: repeat(2, 1fr); }
.quotation-result-grid.three-results { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quotation-result-grid > div { min-height: 86px; padding: 14px; display: grid; align-content: center; gap: 7px; border-right: 1px solid var(--line); }
.quotation-result-grid > div:last-child { border-right: 0; }
.quotation-result-grid span { color: var(--muted); font-size: 11px; }
.quotation-result-grid strong { font-size: 18px; white-space: nowrap; }
.quotation-summary-stack { display: grid; gap: 10px; }

.inventory-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.inventory-overview-grid { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.inventory-list-row { min-height: 66px; padding: 12px 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); }
.inventory-list-row:first-child { border-top: 0; }
.inventory-list-row p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.inventory-filter { margin-bottom: 14px; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr)); }
.quantity-in { color: var(--success); }
.quantity-out { color: var(--danger); }
.order-inventory-summary { margin-bottom: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); }
.order-inventory-summary > div { min-height: 76px; padding: 12px; display: grid; align-content: center; gap: 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.order-inventory-summary > div:nth-child(3n) { border-right: 0; }
.order-inventory-summary > div:nth-last-child(-n+3) { border-bottom: 0; }
.order-inventory-summary span { color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.order-status-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.order-status-summary > div { display: grid; align-content: center; gap: 5px; }
.order-quote-amount-summary { margin-bottom: 16px; }
.modal-table { margin: 14px 0; border: 1px solid var(--line); }
.modal-table table { min-width: 760px; }
#shipment-form, #shipment-order-lines, #shipment-order-lines .table-scroll { width: 100%; min-width: 0; max-width: 100%; }
.modal:has(#shipment-form) { overflow-x: hidden; }
#shipment-order-lines .table-scroll { overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.order-action-footer { flex-wrap: wrap; }
.order-action-reapply { margin-right: auto; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: 24px; min-width: 260px; padding: 12px 18px; color: white; background: var(--brand-dark); box-shadow: var(--shadow); text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hidden, .role-hidden { display: none !important; }

.compact-input {
  width: 76px;
  min-width: 64px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.compact-input:disabled { background: var(--soft-gray); color: var(--muted); }
.modal-table input[data-portal-quote-quantity],
.modal-table input[data-portal-edit-quantity],
.modal-table input[data-quote-v12-quantity],
.modal-table input[data-edit-order-qty] { width: 42px; min-width: 42px; text-align: center; }
.modal-table select[data-portal-quote-installation-location],
.modal-table select[data-portal-edit-installation-location],
.modal-table select[data-quote-v12-installation-location],
.modal-table select[data-edit-order-installation-location] { width: 220px; min-width: 220px; }

@media (max-width: 1180px) {
  .portal-dashboard-grid .task-card { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .inventory-metric-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-panel { grid-template-columns: repeat(3, 1fr); }
  .search-field { grid-column: span 2; }
  .people-grid { grid-template-columns: repeat(3, 1fr); }
  .management-grid { grid-template-columns: repeat(2, 1fr); }
  .lead-filter-panel { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .lead-filter-search { grid-column: span 3; }
  .lead-filter-status { grid-column: span 1; }
  .lead-filter-source { grid-column: span 2; }
  .lead-filter-tag, .lead-filter-assignment, .lead-filter-role, .lead-filter-city, .lead-filter-worker, .lead-filter-overdue { grid-column: span 2; }
  .lead-filter-submit, .lead-filter-clear { grid-column: span 3; }
}

@media (max-width: 820px) {
  .purchase-filter { grid-template-columns: 1fr 1fr; }
  .purchase-filter label { grid-column: 1 / -1; }
  #order-quote-v12,
  #portal-order-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #order-quote-v12 > :nth-child(3),
  #portal-order-form > :nth-child(3) { grid-column: 1 / -1; }
  #order-quote-v12 > :nth-child(5),
  #portal-order-form > :nth-child(5),
  #order-quote-v12 > :nth-child(7),
  #portal-order-form > :nth-child(7) { grid-column: 2; }
  #order-quote-v12 > :nth-child(8),
  #portal-order-form > :nth-child(8) { grid-column: 1 / -1; }
  .followup-form-fields { grid-template-columns: 1fr; }
  select {
    min-height: 48px;
    padding: 5px;
    font-size: 16px;
    line-height: 1.35;
  }
  select option { font-size: 16px; }
  .tag-multiselect > summary { min-height: 48px; padding: 10px 12px; font-size: 16px; }
  .tag-selected-count, .tag-placeholder { font-size: 16px; }
  .tag-multiselect-menu { max-height: 280px; gap: 10px; }
  .tag-option { min-height: 44px; padding: 8px 10px; font-size: 15px; }
  .tag-option small, .tag-option-state { font-size: 13px; }
  .quotation-result-grid.four-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-gateway, .access-state-page { padding: 18px; }
  .auth-gateway-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: auto; padding: 30px; border-right: 0; border-bottom: 1px solid #f1d6c4; }
  .auth-brand-panel .section-kicker { margin-top: 28px; }
  .auth-brand-panel h1 { font-size: 32px; }
  .gateway-scope { margin-top: 22px; }
  .auth-entry-panel { padding: 36px 30px; }
  .prototype-bar { min-height: 32px; padding: 4px 12px; flex-wrap: nowrap; gap: 10px; }
  .prototype-bar span { display: none; }
  .prototype-bar label { margin-left: auto; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 35; top: 0; bottom: 0; left: 0; width: 260px; overflow-y: auto; overscroll-behavior: contain; transform: translateX(-105%); transition: .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-flex; min-height: 38px; align-items: center; border: 1px solid var(--line); background: white; }
  .topbar { padding: 16px; }
  .topbar-actions .button-secondary { display: none; }
  .topbar h1 { font-size: 19px; }
  .view { padding: 22px 16px 42px; }
  .context-row { align-items: flex-start; flex-direction: column; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .inventory-overview-grid { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: repeat(2, 1fr); }
  .inventory-item-summary { align-items: flex-start; flex-direction: column; }
  .inventory-item-summary .row-actions { margin-left: 0; }
  .lead-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-filter-panel > * { grid-column: span 1; }
  .lead-filter-search, .lead-filter-worker, .lead-filter-clear { grid-column: span 2; }
  .people-grid { grid-template-columns: repeat(2, 1fr); }
  .management-grid { grid-template-columns: 1fr; }
  .people-search-panel { grid-template-columns: 1fr; }
  .form-mode-switch { align-items: stretch; flex-direction: column; }
  .form-mode-switch label { width: 100%; margin-left: 0; }
  .form-preview-layout { grid-template-columns: minmax(0, 390px); }
  .auth-flow-layout { grid-template-columns: 1fr; }
  .entry-card-grid { grid-template-columns: 1fr; }
  .staff-service-area-grid { grid-template-columns: 1fr; }
  .assignment-candidate-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .portal-shell { display: block; }
  .portal-app-header { padding: 12px 16px; flex-wrap: wrap; }
  .portal-sidebar { padding: 12px 16px; }
  .portal-sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .security-setting-grid { grid-template-columns: 1fr; }
  .annotation-panel { order: 2; }
}

@media (max-width: 520px) {
  .purchase-filter { grid-template-columns: 1fr; }
  .purchase-filter label { grid-column: 1; }
  .purchase-table-summary { align-items: stretch; flex-direction: column; }
  .purchase-table-summary .row-actions { justify-content: flex-start; }
  #inventory-item-form { grid-template-columns: minmax(0, 1fr); }
  #inventory-item-form .inventory-item-name-field,
  #inventory-item-form .inventory-item-status-field { grid-column: 1; width: 100%; }
  #order-quote-v12,
  #portal-order-form { grid-template-columns: minmax(0, 1fr); }
  #order-quote-v12 > :nth-child(n),
  #portal-order-form > :nth-child(n) { grid-column: 1; }
  .modal { width: min(1400px, calc(100vw - 16px)); max-width: calc(100vw - 16px); padding: 16px; }
  #order-quote-v12 fieldset .inline-options,
  #portal-order-form fieldset .inline-options { flex-wrap: wrap; gap: 8px 18px; }
  .portal-order-item-picker { grid-template-columns: 1fr; }
  .portal-order-item-picker .button { min-height: 44px; }
  #shipment-form .modal-footer { flex-wrap: wrap; }
  #shipment-form .modal-footer .button { flex: 1 1 140px; }
  .login-gateway, .access-state-page { padding: 0; place-items: stretch; background: white; }
  .auth-gateway-shell, .access-state-card { min-height: 100vh; border: 0; box-shadow: none; }
  .auth-brand-panel { display: none; }
  .auth-entry-panel, .access-state-card { padding: 34px 22px; }
  .pending-status { grid-template-columns: 1fr; }
  .pending-status span, .pending-status strong { border-bottom: 1px solid var(--line) !important; }
  .prototype-bar strong { font-size: 16px; }
  .prototype-bar label { font-size: 10px; }
  .prototype-bar select { width: 150px; }
  .topbar-actions .button { padding: 5px; font-size: 12px; }
  .eyebrow { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .inventory-metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 112px; padding: 14px; }
  .metric-card strong { font-size: 28px; }
  .filter-panel { grid-template-columns: 1fr; }
  .lead-filter-panel { grid-template-columns: 1fr; }
  .lead-filter-panel > *, .lead-filter-search, .lead-filter-worker, .lead-filter-clear { grid-column: span 1; }
  .people-grid { grid-template-columns: 1fr; }
  .assignment-candidate-grid { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .form-grid, .info-grid, .detail-summary, #company-news-form .form-grid, .shipment-contact-row { grid-template-columns: 1fr; }
  .lead-profile-grid { grid-template-columns: 1fr; }
  .lead-profile-grid label, .lead-profile-grid .profile-half, .lead-profile-grid .wide { grid-column: auto; }
  .lead-case-status { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .bundle-item-picker { grid-template-columns: 1fr; }
  .staff-profile-grid { grid-template-columns: 1fr; }
  .staff-area-editor-row { grid-template-columns: 22px 1fr; }
  .staff-area-editor-row label:last-child { grid-column: 2; }
  .order-inventory-summary { grid-template-columns: 1fr; }
  .order-inventory-summary > div { border-right: 0; border-bottom: 1px solid var(--line) !important; }
  .order-inventory-summary > div:last-child { border-bottom: 0 !important; }
  .quotation-result-grid, .quotation-result-grid.two-results { grid-template-columns: 1fr; }
  .quotation-result-grid > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .quotation-result-grid > div:last-child { border-bottom: 0; }
  .mobile-frame { padding: 0; border-radius: 0; box-shadow: none; }
  .mobile-browser { border-radius: 0; }
  .mobile-content { border-radius: 0; }
  .two-column { grid-template-columns: 1fr; }
  .preferred-area-row { grid-template-columns: 22px 1fr; }
  .preferred-area-row label:last-child { grid-column: 2; }
  .management-tabs { flex-direction: column; }
  .quotation-settings-tabs { flex-direction: row; }
  .wireframe-hub { padding: 34px 18px; }
  .wireframe-hub-brand { margin-bottom: 34px; }
  .portal-sidebar nav { grid-template-columns: 1fr; }
  .portal-app-header { gap: 10px; }
  .portal-app-header .brand-block img { width: 76px; }
  .portal-app-header .product-name { font-size: 15px; }
  .portal-menu-toggle { order: 3; width: 100%; }
  .portal-view { padding: 22px 16px; }
  .join-invite-card { grid-template-columns: 1fr; }
  .join-status-switch { position: static; padding: 10px; justify-content: center; background: var(--soft-blue); }
}


/* v1.2.0 DEV brand and entry-page composition */
.dev-entry { min-height: 100vh; color: #2b211c; background: #fffaf7; }
.dev-entry-header { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.dev-entry-brand { display: flex; align-items: center; gap: 14px; }
.dev-entry-brand img { width: 170px; height: auto; max-height: 48px; object-fit: contain; }
.dev-entry-brand span { padding-left: 14px; color: #8b5a3a; border-left: 1px solid #edcdb7; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.dev-entry-version { padding: 7px 11px; color: #9b3f0b; background: #fff0e4; border: 1px solid #f0c5a6; border-radius: 999px; font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.dev-entry-hero { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 42px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); align-items: center; gap: 56px; }
.dev-entry-kicker { margin: 0 0 14px; color: #b84c0a; font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.dev-entry h1 { max-width: 640px; margin: 0 0 20px; color: #51280f; font-size: clamp(38px, 5vw, 64px); line-height: 1.08; }
.dev-entry-lede { max-width: 580px; margin: 0 0 28px; color: #765a46; font-size: 17px; line-height: 1.8; }
.dev-entry-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.dev-entry-actions a { text-decoration: none; }
.dev-entry-preview { position: relative; padding: 28px; background: #fff; border: 1px solid #f0d7c5; box-shadow: 0 22px 55px rgba(138, 69, 20, .12); }
.dev-entry-preview::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 7px; background: #e16811; }
.dev-entry-preview-label { margin: 0 0 18px; color: #9b3f0b; font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.dev-entry-preview h2 { margin: 0 0 20px; color: #51280f; font-size: 28px; }
.dev-entry-preview-list { margin: 0; padding: 0; display: grid; gap: 11px; list-style: none; }
.dev-entry-preview-list li { padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; color: #654a38; background: #fff8f3; border: 1px solid #f3dfd1; font-size: 13px; }
.dev-entry-preview-list b { color: #b84c0a; }
.dev-entry-flow { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #f0d7c5; border: 1px solid #f0d7c5; }
.dev-entry-flow article { padding: 20px; background: #fff; }
.dev-entry-flow strong { display: block; margin-bottom: 5px; color: #b84c0a; font-size: 24px; }
.dev-entry-flow span { color: #765a46; font-size: 12px; }
.dev-entry-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 60px; color: #8b6b57; font-size: 12px; }
.dev-entry-footer a { color: #b84c0a; font-weight: 850; }
.dev-entry .button-primary { box-shadow: 0 9px 22px rgba(225, 104, 17, .2); }
.wireframe-hub { background: #fffaf7; }
.wireframe-hub-inner { max-width: 1180px; }
.wireframe-hub-brand { width: 190px; height: auto; max-height: 52px; }
.wireframe-hub h1 { color: #51280f; }
.entry-card { border-color: #f0d7c5; box-shadow: 0 8px 24px rgba(138, 69, 20, .06); }
.entry-card:hover { border-color: #e16811; box-shadow: 0 14px 30px rgba(138, 69, 20, .12); }
.entry-card-code, .entry-card-action { color: #b84c0a; }
.hub-boundary { background: #fff3ea; border-color: #f0d7c5; }
@media (max-width: 820px) {
  .dev-entry-header, .dev-entry-hero, .dev-entry-flow, .dev-entry-footer { width: min(100% - 32px, 640px); }
  .dev-entry-header { padding: 18px 0; }
  .dev-entry-brand span { display: none; }
  .dev-entry-hero { padding-top: 38px; grid-template-columns: 1fr; gap: 30px; }
  .dev-entry-lede { font-size: 15px; }
  .dev-entry-flow { grid-template-columns: 1fr; }
}
/* Internal company news */
.portal-news-panel { margin-top: 18px; }
.task-card[href] { text-decoration: none; color: inherit; }
.news-editor-field { display: grid; gap: 8px; }
.news-editor-shell { overflow: visible; border: 1px solid var(--border, #d5dce3); border-radius: 5px; background: #fff; }
.news-editor-toolbar { display: flex; flex-wrap: wrap; align-items: stretch; padding: 5px; border-bottom: 1px solid var(--border, #d5dce3); background: #fafbfc; }
.news-tool-group { display: flex; align-items: center; gap: 2px; margin: 2px 0; padding: 0 5px; border-right: 1px solid #e2e6ea; }
.news-tool-group-end { margin-left: auto; border-right: 0; }
.news-tool-button, .news-tool-select { min-height: 30px; border: 0; border-radius: 5px; background: transparent; color: #2f3740; padding: 4px 6px; cursor: pointer; font: inherit; line-height: 1.1; }
.news-tool-button:hover, .news-tool-button.is-active, .news-tool-select:hover { background: #e8edf1; }
.news-tool-button:disabled { cursor: not-allowed; opacity: .4; }
.news-tool-select { max-width: 88px; border: 1px solid transparent; }
.news-file-button { display: inline-grid; place-items: center; box-sizing: border-box; }
.news-editor-menu { position: relative; }
.news-editor-menu summary { list-style: none; }
.news-editor-menu summary::-webkit-details-marker { display: none; }
.news-editor-menu > div { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: max-content; max-width: 260px; padding: 7px; border: 1px solid var(--border, #d5dce3); border-radius: 5px; background: #fff; box-shadow: 0 10px 24px rgba(26, 37, 48, .18); }
.news-color-palette { display: grid; grid-template-columns: repeat(4, 26px); gap: 5px; }
.news-color-palette button { width: 26px; height: 26px; border: 1px solid rgba(0, 0, 0, .16); border-radius: 5px; background: var(--news-color); cursor: pointer; }
.news-table-menu { display: grid; gap: 3px; min-width: 136px; }
.news-table-menu button { border: 0; border-radius: 5px; padding: 6px 8px; background: transparent; text-align: left; cursor: pointer; font: inherit; }
.news-table-menu button:hover { background: #eef2f5; }
.news-rich-editor, .news-editor-source { box-sizing: border-box; width: 100%; min-height: 260px; border: 0; padding: 13px; background: #fff; color: #252d35; font: inherit; line-height: 1.7; }
.news-editor-source { resize: vertical; outline: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.news-rich-editor:focus { outline: 2px solid rgba(234, 105, 0, .25); outline-offset: -2px; }
.news-rich-editor table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.news-rich-editor th, .news-rich-editor td { min-width: 64px; border: 1px solid #c9d1d8; padding: 7px; vertical-align: top; }
.news-rich-editor blockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid #d46d1f; color: #5b6670; }
.news-rich-editor pre { overflow: auto; padding: 12px; border-radius: 5px; background: #1d2935; color: #f5f7fa; }
.news-editor-shell.is-fullscreen { position: fixed; z-index: 7600; inset: 16px; display: grid; grid-template-rows: auto 1fr; box-shadow: 0 16px 44px rgba(0, 0, 0, .28); }
.news-editor-shell.is-fullscreen .news-rich-editor, .news-editor-shell.is-fullscreen .news-editor-source { min-height: 0; height: 100%; }
.news-preview-overlay { position: fixed; z-index: 7700; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(24, 31, 38, .55); }
.news-preview-card { position: relative; width: min(860px, 100%); max-height: min(760px, 100%); overflow: auto; padding: 34px; border-radius: 5px; background: #fff; box-shadow: 0 20px 52px rgba(0, 0, 0, .3); }
.news-preview-close { position: absolute; top: 9px; right: 12px; border: 0; background: transparent; color: #4d5964; cursor: pointer; font-size: 30px; line-height: 1; }
.news-preview-label { margin: 0 0 14px; color: #9d4a0c; font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.news-rich-editor iframe, .news-article-content iframe { width: 100%; min-height: 360px; border: 0; border-radius: 5px; }
.news-rich-editor img, .news-article-content img { max-width: 100%; height: auto; border-radius: 5px; }
.news-target-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.news-target-grid fieldset { min-width: 0; border: 1px solid var(--border, #d5dce3); border-radius: 5px; padding: 10px; }
.news-target-grid legend { padding: 0 5px; font-weight: 700; }
.news-detail-page { background: #f4f7f9; }
.news-detail-shell { max-width: 900px; margin: 0 auto; padding: 40px 20px; display: grid; gap: 16px; }
.news-article { padding: 34px; }
.news-article h1 { margin: 4px 0 8px; font-size: clamp(26px, 4vw, 40px); }
.news-publish-at { color: #607080; font-size: 15px; }
.news-article-summary { border-left: 3px solid #e96a00; padding-left: 12px; color: #455463; }
.news-article-content { margin-top: 28px; line-height: 1.85; overflow-wrap: anywhere; }
.news-article-content a { color: #a94c00; }
@media (max-width: 820px) {
  html.mobile-modal-open { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body.mobile-modal-open { position: fixed; inset-inline: 0; width: 100%; max-width: 100vw; overflow: hidden; }
  .drawer-backdrop, .modal-backdrop { inset: 0; width: 100vw; height: 100dvh; box-sizing: border-box; }
  .detail-drawer { width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal { min-width: 0; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #modal-body, #portal-order-modal-body { min-width: 0; max-width: 100%; }
}
@media (max-width: 720px) { .news-target-grid { grid-template-columns: 1fr; } .news-tool-group-end { margin-left: 0; } .news-tool-group { padding: 0 3px; } .news-tool-select { max-width: 74px; } .news-rich-editor iframe, .news-article-content iframe { min-height: 210px; } .news-article { padding: 22px; } .news-editor-shell.is-fullscreen { inset: 6px; } .news-preview-card { padding: 26px 18px; } }
@media (max-width: 900px) { .branch-contact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .branch-contact-grid { grid-template-columns: 1fr; } }
