:root {
    color-scheme: light;
    --ink: #182e48;
    --muted: #68697b;
    --canvas: #f5f5f9;
    --line: #e6e5ef;
    --blue: #145fae;
    --dark: #102642;
    --gold: #ebcb7d;
    --white: #fff;
    font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; font-size: .93rem; line-height: 1.55; }
a { color: var(--blue); text-decoration: none; font-weight: 650; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #87b9e8;
    outline-offset: 3px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 2.5vw, 2.35rem); line-height: 1.2; letter-spacing: -.025em; }
h2 { font-size: 1.12rem; line-height: 1.35; }
p { margin: .45rem 0; }
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.sidebar { color: #eef6ff; background: var(--dark); display: flex; flex-direction: column; padding: 28px 16px; position: sticky; top: 0; height: 100vh; }
.brand { color: inherit; display: inline-flex; align-items: center; gap: 11px; padding: 3px 9px; letter-spacing: .095em; font-weight: 800; line-height: 1.25; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: .63rem; letter-spacing: .24em; margin-top: 3px; }
.mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: #23486b; background: var(--gold); font-size: 20px; }
.sidebar nav { display: grid; gap: 5px; margin-top: 32px; }
.sidebar nav a, .sidebar-bottom a { color: #d7e6f6; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; font-size: .9rem; font-weight: 550; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: #204a76; color: #fff; text-decoration: none; }
.sidebar nav span { width: 18px; text-align: center; color: var(--gold); font-size: 1.02rem; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid #344b64; padding-top: 12px; }
.workspace { min-width: 0; }
.topbar { min-height: 62px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px clamp(16px, 3vw, 40px); }
.session { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.alert-link { color: #204e79; background: #eaf4ff; border-radius: 20px; padding: 5px 12px; white-space: nowrap; }
main { padding: 28px clamp(16px, 3vw, 40px) 44px; max-width: 1630px; margin: auto; }
.page-title, .section-head, .line-footer, .paper-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.page-title { margin-bottom: 22px; }
.page-title p, .muted { color: var(--muted); }
.block { display: block; }
.panel, .table-wrap { background: var(--white); border: 1px solid var(--line); border-radius: 15px; }
.panel { padding: 19px; margin-bottom: 17px; min-width: 0; }
.panel > h2 { margin-bottom: 12px; }
.panel .table-wrap { border-radius: 10px; }
.section-head { margin-bottom: 15px; }
.section-head a { white-space: nowrap; font-size: .83rem; }
.button, .text-button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; white-space: nowrap; }
.button { background: var(--blue); color: #fff; border-radius: 9px; padding: 8px 14px; min-height: 39px; }
.button:hover { background: #16558f; text-decoration: none; }
.button.secondary { background: #fff; color: var(--blue); border-color: #c9dced; }
.button.secondary:hover { background: #ecf5ff; }
.button.danger { color: #9a3246; border-color: #eed3db; background: #fff; }
.text-button { background: none; color: var(--blue); padding: 0; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 17px; }
.metric { padding: 15px; min-width: 0; min-height: 110px; border-radius: 13px; background: #fff; border: 1px solid var(--line); }
.metric.green { background: #e6f3ee; border-color: #d9ebe3; }
.metric.blue { background: #e7f2ff; border-color: #d4e6fa; }
.metric.gold { background: #faf0d9; border-color: #f0e6ce; }
.metric-label { font-size: .83rem; font-weight: 650; }
.metric strong { display: block; font-size: clamp(1.08rem, 2.15vw, 1.85rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric small { color: #57576b; font-size: .72rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 15px; }
.chart-legend { display: flex; flex-wrap: wrap; font-size: .77rem; gap: 12px; margin-bottom: 12px; }
.chart-legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: #1a6abd; }
.chart-legend span:nth-child(2)::before { background: #af9561; }
.chart-grid { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 8px; margin: 8px 0 0; }
.chart-scale { display: flex; flex-direction: column; justify-content: space-between; align-items: end; color: var(--muted); font-size: .68rem; line-height: 1; height: 160px; }
.chart { height: 160px; display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 5px; background: repeating-linear-gradient(to top,#e8f0f8 0px,#e8f0f8 1px,transparent 1px,transparent 25%); margin-bottom: 26px; }
.chart-group { text-align: center; height: 160px; color: var(--muted); }
.bars { display: flex; justify-content: center; align-items: end; gap: 4px; height: 100%; }
.bars span { width: min(26%,30px); border-radius: 4px 4px 0 0; background: #1a6abd; }
.bars span:nth-child(2) { background: #af9561; }
.due-row { display: flex; gap: 10px; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.due-row > :last-child { text-align: right; }
.summary-links { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 7px; }
.empty-message, .empty { color: var(--muted); padding: 18px; text-align: center; }
.empty-message { background: #f4f8fc; border-radius: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f0f5fa; color: #40556c; font-size: .81rem; white-space: nowrap; }
td { overflow-wrap: anywhere; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7faff; }
.badge { display: inline-block; background: #eaf2fa; color: #3f5670; padding: 2px 8px; border-radius: 20px; white-space: nowrap; font-size: .76rem; }
.badge.green { background: #e5f1e9; color: #245e48; }
.badge.amber { background: #fbefd7; color: #6f4b12; }
.badge.red { background: #fae6eb; color: #96344c; }
.filters, .toolbar, .tabs { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.tabs a { padding: 8px 11px; border-bottom: 2px solid transparent; }
.tabs a.selected { border-color: var(--blue); }
.fields { display: grid; gap: 13px; }
.fields + h2, .table-wrap + h2, .table-wrap + .fields { margin-top: 18px; }
.form-grid, .split { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; align-items: start; }
label { display: grid; gap: 4px; color: #374c62; font-weight: 650; font-size: .84rem; min-width: 0; }
input, select, textarea { width: 100%; max-width: 100%; min-height: 39px; border: 1px solid #cbd8e6; background: #fff; color: var(--ink); border-radius: 8px; padding: 7px 9px; font: inherit; }
textarea { resize: vertical; }
input[type="hidden"] { display: none; }
.inline { display: inline; }
.document-line { display: grid; grid-template-columns: minmax(180px,3fr) minmax(75px,.6fr) minmax(115px,1fr) auto; align-items: end; gap: 9px; margin-bottom: 10px; }
.paper-head { padding-bottom: 12px; }
.paper-head > div:last-child { text-align: right; }
.total { text-align: right; font-size: 1.12rem; margin-top: 16px; }
.timeline article { border-left: 2px solid #d2e5f7; padding-left: 12px; margin-bottom: 13px; overflow-wrap: anywhere; }
.notice { background: #e5f4ec; color: #25583f; border: 1px solid #d2eadc; padding: 9px 12px; margin: 0 0 12px; border-radius: 8px; }
.notice.error { background: #fae8ea; color: #8a2940; border-color: #f0d3db; }
.report-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); margin-top: 15px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at top left,#d8eafb,#f2f6fa 65%); }
.login-card { width: min(100%,440px); margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: clamp(20px,5vw,40px); box-shadow: 0 18px 44px #162d4b13; }
.login-card .brand { margin-bottom: 24px; padding-left: 0; color: var(--dark); }
.login-card .button { width: 100%; }
@media (max-width: 1120px) {
    .layout { grid-template-columns: 185px minmax(0,1fr); }
    .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 830px) {
    .dashboard-grid, .split { grid-template-columns: minmax(0,1fr); gap: 0; }
    .layout { grid-template-columns: minmax(0,1fr); }
    .sidebar { height: auto; position: static; padding: 12px; }
    .sidebar nav { display: flex; overflow: auto; margin-top: 9px; }
    .sidebar nav a { white-space: nowrap; padding: 7px 9px; }
    .sidebar-bottom { margin-top: 5px; padding-top: 3px; }
    .sidebar-bottom a { display: inline-flex; padding: 5px 9px; }
}
@media (max-width: 510px) {
    .topbar { flex-wrap: wrap; }
    .page-title, .line-footer { flex-wrap: wrap; }
    .form-grid, .document-line { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .document-line > label:first-child { grid-column: 1 / -1; }
    .document-line { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
}
@media print {
    @page { size: A4; margin: 14mm; }
    :root { background: white; }
    .sidebar, .topbar, .page-title, .notice, .toolbar, .filters, .no-print { display: none !important; }
    .layout { display: block; }
    main { padding: 0; }
    .paper, .report-paper { border: 0; padding: 0; }
    .table-wrap { overflow: visible; }
    tr { break-inside: avoid; }
    a { color: inherit; }
}

[hidden] { display: none !important; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.office-image { display: block; max-width: min(100%,240px); max-height: 200px; object-fit: contain; margin: 8px 0; }
.attachment-preview { display: inline-block; width: min(46%,260px); max-height: 220px; margin: 8px; vertical-align: top; }
.signature-preview { max-width: 170px; max-height: 100px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 17px; min-height: 17px; accent-color: var(--blue); }
.repeat-history { padding: 12px 16px; background: #eaf4ff; border-radius: 9px; }
.password-form meter { width: min(100%,300px); height: 16px; }
[data-password-status] { color: #52667a; }
[data-password-status][data-level="invalid"] { color: #9a3246; }
[data-password-status][data-level="weak"] { color: #795007; }
[data-password-status][data-level="strong"] { color: #245e48; }
.work-group { border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 12px; }
.work-step { display: grid; gap: 7px; padding: 10px; background: #f4f8fd; border-radius: 8px; }
.tracking-page { max-width: 1120px; margin: auto; padding: clamp(18px,4vw,44px); }
.tracking-stages { display: grid; grid-template-columns: repeat(auto-fit,minmax(245px,1fr)); gap: 16px; align-items: start; }
.tracking-stages ul { list-style: none; padding: 0; }
.tracking-stages li { display: grid; gap: 5px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.tracking-stages li:last-child { border-bottom: none; }
.stage-icon { width: 44px; height: 44px; border-radius: 50%; background: #e0efff; color: #145fae; display: grid; place-items: center; font-size: 22px; }
.stage-icon.complete { background: #e5f1e9; color: #245e48; }
@media print { .office-image { break-inside: avoid; } }

:root { --tab-active: #204a76; --surface-soft: #f0f5fa; --accent-button: #145fae; }
:root[data-accent=teal], [data-swatch=teal] { --dark: #0c3840; --tab-active: #10646b; --accent-button: #0a7076; }
:root[data-accent=green], [data-swatch=green] { --dark: #143b32; --tab-active: #236049; --accent-button: #246745; }
:root[data-accent=violet], [data-swatch=violet] { --dark: #32234e; --tab-active: #624093; --accent-button: #6542a0; }
:root[data-accent=rose], [data-swatch=rose] { --dark: #4a2539; --tab-active: #873a61; --accent-button: #8c3d62; }
:root[data-accent=slate], [data-swatch=slate] { --dark: #263341; --tab-active: #4a5b6e; --accent-button: #4c5e73; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: var(--tab-active); }
.button:not(.secondary):not(.danger) { background: var(--accent-button); color: white; }
button:disabled { cursor: not-allowed; opacity: .52; }
.display-tools { display: inline-flex; gap: 3px; align-items: center; }
.display-tools button, .password-box button { background: var(--surface-soft); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; white-space: nowrap; }
.password-box { display: flex; align-items: stretch; gap: 6px; }
.password-box button { min-width: 43px; }
.password-box svg { width: 21px; height: 21px; display: block; }
.password-box svg [hidden] { display: none; }
.accent-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-choice { background: var(--dark); color: #fff; border-radius: 8px; display: inline-flex; gap: 7px; align-items: center; padding: 6px 10px; }
.accent-choice input { min-height: 0; width: auto; margin: 0; }
.favicon-demo { padding: 10px 10px 0; background: var(--surface-soft); border-radius: 8px; width: min(100%,380px); }
.favicon-tab { display: inline-flex; gap: 7px; background: var(--white); padding: 6px 12px; border-radius: 8px 8px 0 0; align-items: center; }
.favicon-tab img { width: 16px; height: 16px; object-fit: contain; }
[data-logo-editor] { display: grid; gap: 8px; width: min(100%,460px); }
[data-logo-editor] canvas { display: block; max-width: 100%; max-height: 340px; object-fit: contain; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
[data-logo-editor] input[type=range] { min-height: 0; padding: 0; }
.sign-pad { max-width: 600px; }
.sign-pad canvas { display: block; width: 100%; background: #fff; border: 1px solid #a9b8c9; border-radius: 8px; touch-action: none; }
[data-sign-code] canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.signature-preview { background: #fff; }
.review-dialog { width: min(94vw,700px); max-height: 88vh; border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--white); color: var(--ink); }
.review-dialog::backdrop { background: #07172a99; }
.review-body { margin: 12px 0; max-height: 52vh; overflow: auto; overflow-wrap: anywhere; }
.review-body th,.review-body td { white-space: normal; vertical-align: top; }
.review-image { display: block; max-width: min(100%,240px); max-height: 140px; object-fit: contain; background: #fff; margin: 6px 0; }
.audit-changes { padding-inline-start: 1.25em; margin: 0; }
:root[data-theme=dark] { color-scheme: dark; --canvas: #0e1724; --white: #192638; --ink: #ecf3fa; --muted: #b5c2d0; --line: #35455b; --blue: #91c9ff; --surface-soft: #22334a; }
[data-theme=dark] .login { background: var(--canvas); }
[data-theme=dark] :is(.login-card,.button.secondary,.metric,input,select,textarea,.empty-message,.work-step,.repeat-history,th,tbody tr:hover) {
    background: var(--surface-soft); color: var(--ink); border-color: var(--line);
}
[data-theme=dark] .button.secondary:hover { background: var(--white); }
[data-theme=dark] .button.danger { background: #432433; color: #ffbacb; }
[data-theme=dark] .alert-link { background: var(--surface-soft); color: var(--blue); }
[data-theme=dark] .paper { background: white; color: #182e48; }
[data-theme=dark] .paper :is(.table-wrap,th,td,.muted) { background: white; color: #182e48; border-color: #e6e5ef; }

:root[data-accent^="custom"] { --dark: var(--office-custom,#285478); --tab-active: #ffffff38; --accent-button: var(--office-custom,#285478); }
.side-subnav { padding: 4px 0 9px 12px; display: grid; gap: 4px; }
.sidebar .side-subnav a { min-height: 32px; font-size: .8rem; border-left: 2px solid var(--kind-color,#87b9e8); }
.sidebar .side-subnav .sub-selected { background: #ffffff25; }
.kind-quote { --kind-color:#247aab; } .kind-invoice { --kind-color:#9b6a24; } .kind-receipt { --kind-color:#287d56; }
.kind-po { --kind-color:#6e5ead; } .kind-purchase { --kind-color:#2f8589; } .kind-expense { --kind-color:#ac5548; } .kind-wht { --kind-color:#8b5b83; }
.tabs .doc-tab,.tabs [data-tab-tone] { border:1px solid var(--line); border-top:3px solid var(--kind-color,#5681ad); border-radius:9px; background:var(--white); }
.tabs .doc-tab.selected { box-shadow: inset 0 0 0 1px var(--kind-color); }
[data-tab-tone="1"] { --kind-color:#287d56; } [data-tab-tone="2"] { --kind-color:#795cad; }
[data-tab-tone="3"] { --kind-color:#ac5548; } [data-tab-tone="4"] { --kind-color:#9b6a24; }
.office-tab-icon { display:inline-block; margin-inline-end:6px; }
.doc-filters { align-items:end; } .date-fields { display:flex; flex-wrap:wrap; gap:8px; }
.doc-queue .table-wrap { overflow:visible; } .doc-queue table { min-width:0; }
.doc-queue .row-menu { position:relative; display:inline-block; text-align:start; }
.row-menu summary { cursor:pointer; list-style:none; padding:3px 8px; background:var(--surface-soft); border:1px solid var(--line); border-radius:6px; }
.row-menu summary::-webkit-details-marker { display:none; }
.row-menu > div { position:absolute; z-index:8; inset-inline-end:0; top:100%; width:max-content; max-width:80vw; padding:7px; background:var(--white); color:var(--ink); box-shadow:0 8px 24px #172c4b35; border:1px solid var(--line); border-radius:8px; }
.row-menu > div a,.row-menu > div button { display:block; text-align:start; padding:5px 9px; }
.workflow-menu summary { border-inline-start:3px solid #32869e; }
.doc-queue input[type=checkbox] { width:16px; min-height:16px; }
.doc-bulk { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:10px; }
.transfer-progress { position:fixed; z-index:12; inset:auto 16px 16px auto; padding:12px 17px; border-radius:10px; border:1px solid var(--line); background:var(--white); box-shadow:0 10px 25px #172c4b35; max-height:40vh; overflow:auto; }
.danger-text { color:#a33151; } .duplicate-warning { color:#ab4e28; } .duplicate-warning:empty { display:none; }
.document-parties { border-bottom:1px solid var(--line); padding-bottom:20px; } .document-edit-section { border-top:1px solid var(--line); padding-top:14px; }
.head-templates { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:8px; }
.head-template { border:1px solid var(--line); border-radius:8px; padding:9px; } .head-template input { width:auto; min-height:0; }
.head-template span { display:flex; gap:8px; justify-content:space-between; font-size:.73rem; padding-top:5px; }
.paper-logo { display:block; width:auto; max-width:145px; height:48px; object-fit:contain; margin-bottom:7px; }
.styled-paper-head { border-bottom:2px solid #254e64; padding-bottom:10px; margin-bottom:17px; }
.head-band .styled-paper-head,.head-template.head-band span { background:#e8f0f4; border-top:5px solid #254e64; padding:9px; }
.head-center .styled-paper-head,.head-template.head-center span { display:grid; justify-content:center; text-align:center; }
.head-center .paper-logo { margin-inline:auto; }
.receipt-signatures { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:30px; text-align:center; }
.receipt-signatures > div { padding-top:12px; border-top:1px dashed #526579; min-height:70px; }
.receipt-signatures img { margin-inline:auto; }
.office-export main { padding:16px; max-width: 850px; margin:auto; }
.export-toolbar { display:flex; gap:8px; align-items:center; margin-bottom:12px; }
.pdf-render-area { position:absolute; left:-12000px; top:0; width:688px; color:#182e48; background:white; }
.pdf-render-area .paper { box-sizing:border-box; width:688px; margin:0; padding:0; border:0; border-radius:0; background:white; color:#182e48; font-size:12px; }
.pdf-render-area .paper :is(.table-wrap,td,th) { background:white; color:#182e48; }
@page { size:A4 portrait; margin:14mm; }
@media print {
    .office-export main, main .paper { width:auto; max-width:none; margin:0; padding:0; }
    .paper { border:0; }
    .paper tr,.receipt-signatures,.styled-paper-head { break-inside:avoid; }
    .paper thead { display:table-header-group; }
    .head-band .styled-paper-head { print-color-adjust:exact; }
}
@media (max-width:780px) {
    .doc-queue .table-wrap { overflow:auto; }
    .doc-queue table { min-width:560px; }
    .doc-queue .row-menu > div { position:relative; }
}

.top-icon { display:inline-grid; place-items:center; min-width:36px; min-height:34px; padding:4px; border:1px solid var(--line); border-radius:8px; background:var(--surface-soft); color:var(--ink); }
.top-icon svg { width:20px; height:20px; stroke-linecap:round; stroke-linejoin:round; }
.top-icon svg[hidden] { display:none; }
@media (min-width: 761px) {
    .sidebar { height:100vh; height:100dvh; overflow:hidden; }
    .sidebar > .brand,.sidebar-bottom { flex-shrink:0; }
    .sidebar > nav { min-height:0; overflow-y:auto; overflow-x:hidden; align-content:start; margin-bottom:9px; scrollbar-width:thin; }
}
.branding-settings { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.branding-panel { min-width:0; display:grid; align-content:start; gap:8px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--white); }
.branding-panel h2 { margin-bottom:4px; }
[data-logo-editor] canvas { width:auto; height:auto; max-width:100%; max-height:350px; margin-block:4px; touch-action:none; }
.accent-entry { display:flex; align-items:center; gap:6px; }
.paint-grid,.login-settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start; gap:14px; }
.paint-grid canvas { width:100%; touch-action:none; border-radius:8px; }
.paint-grid input[type=range] { min-height:0; padding:0; accent-color:#267cac; }
.paint-swatches { display:grid; grid-template-columns:repeat(6,1fr); gap:4px; margin:8px 0; }
.paint-swatches button { aspect-ratio:1; min-width:14px; padding:0; border:1px solid #67798d; border-radius:2px; }
.paint-sample { border:1px solid var(--line); border-radius:6px; min-height:32px; margin-top:7px; }
.login-scene { position:relative; isolation:isolate; overflow:hidden; background:var(--login-color,#e5eff9); }
.login-scene::before { content:''; position:absolute; z-index:-1; inset:0; background:radial-gradient(ellipse at top left,#d8eafb,#f2f6fa 65%); }
.login-scene[data-background=color]::before,.login-scene[data-background=image]::before { background:var(--login-color,#e5eff9); }
.login-scene[data-background=image]::before { background:var(--login-image,none) center/cover no-repeat,var(--login-color,#e5eff9); filter:blur(var(--login-blur,0px)); transform:scale(1.08); }
.login-scene[data-layout=left] { justify-items:start; padding-inline:min(10vw,120px); }
.login-scene[data-layout=split] { grid-template-columns:minmax(300px,1fr) minmax(0,1fr); padding-inline:22px; }
.login-scene[data-layout=split]::after { z-index:-1; position:absolute; content:''; inset:0 50% 0 0; background:var(--white); opacity:.96; }
.login-scene[data-layout=split] .login-card { box-shadow:none; border:0; }
.login-scene-preview { min-height:250px; display:grid; place-items:center; padding:10px; border-radius:10px; border:1px solid var(--line); }
.login-scene-preview .login-card { width:min(155px,90%); border-radius:8px; padding:11px; display:grid; gap:4px; font-size:.58rem; }
.login-scene-preview .login-card h2 { font-size:.83rem; }
.login-scene-preview .login-card i { border:1px solid var(--line); height:13px; border-radius:3px; }
.login-scene-preview .login-card b { display:block; background:var(--accent-button); color:white; border-radius:3px; text-align:center; padding:3px; }
.login-scene-preview[data-layout=left] { padding-inline:13px; }
.login-scene-preview[data-layout=split] { grid-template-columns:1fr 1fr; padding-inline:6px; }
[data-theme=dark] .login-scene:not(.login-scene-preview) .login-card { background:#fff; color:#182e48; color-scheme:light; --surface-soft:#eff5fa; --ink:#182e48; --muted:#53667b; --line:#cbd8e6; }
[data-theme=dark] .login-scene:not(.login-scene-preview) .login-card input { background:#fff; color:#182e48; }
@media (max-width:760px) {
    .branding-settings,.login-settings-grid { grid-template-columns:1fr; }
    .login-scene:not(.login-scene-preview)[data-layout=split] { grid-template-columns:1fr; }
    .login-scene:not(.login-scene-preview)[data-layout=split]::after { display:none; }
    .login-scene:not(.login-scene-preview)[data-layout=split] .login-card { border:1px solid var(--line); }
}

.office-layout { grid-template-columns:68px 204px minmax(0,1fr); }
.office-rail { padding:14px 8px; gap:14px; align-items:stretch; }
.office-rail > nav { display:flex; flex-direction:column; gap:7px; margin:0; }
.rail-brand,.office-rail nav .rail-link { display:grid; place-items:center; min-height:44px; flex-shrink:0; padding:0; border-radius:10px; }
.rail-brand { color:var(--gold); font-size:1.3rem; background:#ffffff13; }
.rail-logo { width:34px; height:34px; object-fit:contain; }
.office-rail .rail-link svg { width:25px; height:25px; stroke-linecap:round; stroke-linejoin:round; }
.office-rail .rail-link.rail-active { color:#fff; background:var(--tab-active); }
.office-rail .rail-link:last-child { margin-top:auto; }
.office-submenu { display:flex; flex-direction:column; position:sticky; top:0; height:100vh; height:100dvh; min-width:0; padding:22px 12px;
    background:var(--white); border-right:1px solid var(--line); }
.office-submenu > h2 { padding:3px 11px 17px; overflow-wrap:anywhere; font-size:1.12rem; }
.office-submenu nav { min-height:0; overflow:auto; display:grid; align-content:start; gap:4px; }
.office-submenu nav a { display:flex; gap:9px; align-items:center; min-height:41px; padding:8px 10px; border-radius:8px;
    color:var(--ink); font-size:.88rem; line-height:1.4; overflow-wrap:anywhere; }
.office-submenu nav a > span { width:7px; height:7px; border-radius:50%; background:var(--line); flex:none; }
.office-submenu nav a:hover,.office-submenu nav a[aria-current=page] { text-decoration:none; color:var(--blue); background:var(--surface-soft); }
.office-submenu nav a[aria-current=page] > span { background:var(--blue); }
.login-choice-group { border:0; padding:0; margin:0 0 12px; }
.login-choice-group legend { margin:0 0 8px; font-weight:650; }
.login-choices { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.login-choice { position:relative; display:grid; cursor:pointer; padding:8px; gap:6px; border:1px solid var(--line); border-radius:10px; min-width:0; }
.login-choice input { position:absolute; z-index:2; inset:8px 8px auto auto; width:17px; min-height:17px; accent-color:var(--blue); }
.login-choice:has(input:checked) { border-color:var(--blue); box-shadow:0 0 0 1px var(--blue); }
.login-layout-thumb { position:relative; height:82px; display:grid; place-items:center; border-radius:6px; background:#e5eff9; overflow:hidden; }
.login-layout-thumb[data-layout=left] { justify-items:start; padding-left:12%; }
.login-layout-thumb[data-layout=split] { grid-template-columns:1fr 1fr; }
.login-layout-thumb[data-layout=split]::before { content:""; position:absolute; inset:0 50% 0 0; background:#f8fbff; }
.login-thumb-card { z-index:1; width:min(50px,70%); background:white; padding:6px; display:grid; gap:3px; border:1px solid #d7e3ef; border-radius:4px; }
.login-thumb-card i { height:4px; background:#e6edf4; }
.login-thumb-card b { height:5px; border-radius:2px; background:#2f6799; }
.login-settings-fields { display:grid; align-content:start; gap:10px; }
@media (max-width: 950px) and (min-width: 761px) {
    .office-layout { grid-template-columns:58px 168px minmax(0,1fr); }
}
@media (max-width: 760px) {
    .office-layout { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:auto auto minmax(0,1fr); }
    .office-rail { position:static; flex-direction:row; align-items:center; padding:7px; gap:7px; }
    .rail-brand { width:41px; flex:none; }
    .office-rail > nav { display:flex; flex-direction:row; margin:0; min-width:0; overflow-x:auto; }
    .office-rail nav .rail-link { width:43px; min-height:40px; }
    .office-rail .rail-link:last-child { margin-top:0; }
    .office-submenu { position:static; height:auto; padding:7px 10px; border-right:0; border-bottom:1px solid var(--line); }
    .office-submenu > h2 { display:none; }
    .office-submenu nav { display:flex; overflow-x:auto; }
    .office-submenu nav a { white-space:nowrap; min-height:36px; }
}
@media print {
    .office-layout { display:block; }
    .office-rail,.office-submenu { display:none !important; }
}

.office-tooltip { position:fixed; z-index:200; padding:8px 13px; border-radius:10px; border:1px solid var(--line); box-shadow:0 6px 22px #14294130; pointer-events:none; color:var(--ink); background:var(--white); max-width:min(260px,calc(100vw - 16px)); font-size:.88rem; line-height:1.4; }
.office-tooltip strong,.office-tooltip span { display:block; overflow-wrap:anywhere; }
.office-tooltip span { color:var(--muted); margin-top:4px; font-size:.78rem; }
.office-tooltip.tip-rail::before { content:''; position:absolute; width:8px; height:8px; background:var(--white); border-left:1px solid var(--line); border-bottom:1px solid var(--line); top:50%; left:-5px; transform:translateY(-50%) rotate(45deg); }
.office-layout .workspace { position:relative; min-width:0; }
.submenu-toggle { position:absolute; z-index:12; left:-13px; top:21px; min-width:26px; min-height:26px; border-radius:50%; padding:3px; background:var(--white); box-shadow:0 3px 7px #14294125; }
.submenu-toggle svg { width:15px; height:15px; }
.submenu-collapsed .submenu-toggle svg { transform:rotate(180deg); }
.office-layout.submenu-collapsed { grid-template-columns:68px minmax(0,1fr); }
.notice-bell { position:relative; }
.unread-dot { position:absolute; top:3px; right:4px; width:8px; height:8px; border-radius:50%; background:#e95046; box-shadow:0 0 0 2px var(--surface-soft); }
.online-team,.user-row-actions,.user-name-cell { display:flex; align-items:center; }
.user-row-actions,.user-name-cell { gap:7px; }
.team-avatar { border-radius:50%; display:inline-grid; place-items:center; width:31px; height:31px; object-fit:cover; overflow:hidden; box-sizing:border-box; }
.team-avatar-fallback { background:#e1e6eb; color:#6d7985; }
.avatar-silhouette-1 { background:#d9e0e7; color:#637485; }
.avatar-silhouette-2 { background:#e6e7eb; color:#747987; }
.avatar-silhouette-3 { background:#e1e5e7; color:#667981; }
.team-avatar svg { width:21px; height:21px; }
.team-person { cursor:pointer; border-radius:50%; border:2px solid var(--white); padding:0; background:var(--surface-soft); color:var(--ink); min-width:35px; height:35px; position:relative; }
.team-person+.team-person { margin-left:-4px; }
.team-person:is(:hover,:focus-visible) { z-index:1; }
.team-more { padding:0 4px; font-size:.72rem; }
.user-dialog-heading { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; gap:10px; }
.user-editor-dialog [data-password-match]:empty { display:none; }
.profile-editor { display:grid; gap:8px; }
.current-avatar { width:60px; height:60px; }
[data-avatar-editor] canvas { display:block; width:auto; height:auto; max-width:100%; max-height:280px; touch-action:none; margin-block:6px; border-radius:8px; }
.background-choice > span { display:grid; place-items:center; min-height:48px; border-radius:6px; background:var(--surface-soft); color:var(--blue); }
.background-choice svg { width:28px; height:28px; }
.blur-choices { display:flex; flex-wrap:wrap; gap:5px; }
.blur-choice { position:relative; cursor:pointer; display:inline-flex; }
.blur-choice input { position:absolute; opacity:0; width:1px; height:1px; min-height:0; margin:0; }
.blur-choice span { padding:5px 8px; border-radius:7px; background:var(--surface-soft); border:1px solid var(--line); font-size:.8rem; }
.blur-choice input:checked + span,.blur-choice input:focus-visible + span { border-color:var(--blue); color:var(--blue); }
@media (min-width:761px) and (max-width:950px) { .office-layout.submenu-collapsed { grid-template-columns:58px minmax(0,1fr); } }
@media (max-width:760px) {
    .office-layout.submenu-collapsed { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
    .submenu-toggle { top:-14px; left:5px; transform:rotate(-90deg); }
    .topbar .session { flex-wrap:wrap; justify-content:flex-end; }
}
@media print { .submenu-toggle { display:none; } }

/* The saved signature often has a transparent background. Keep the ink readable in dark mode. */
[data-theme=dark] :is(.current-signature,.signature-preview,[data-sign-preview]) {
    display:block; background:#fff; border:1px solid #d8e0e9; padding:8px; border-radius:6px;
}
[data-theme=dark] [data-sign-preview][hidden] { display:none; }
.login-scene[data-background=color]::before {
    background:radial-gradient(ellipse at 20% 15%,color-mix(in srgb,var(--login-color,#e5eff9) 72%,white),var(--login-color,#e5eff9) 72%);
    filter:blur(var(--login-blur,0px)); transform:scale(1.08);
}
.draft-number { color:var(--ink); background:var(--surface-soft); padding:7px 10px; border-radius:7px; }
.draft-number output { font-weight:700; }
#best-sellers { scroll-margin-top:16px; }
.login-saved-background { width:min(100%,240px); max-height:140px; object-fit:cover; border-radius:7px; }
