:root {
    --ink: #17211d;
    --muted: #617068;
    --paper: #f4f3ed;
    --white: #fffefa;
    --line: #d5d8cf;
    --blue: #07558a;
    --green: #205b43;
    --green-dark: #123c2b;
    --sun: #e7b934;
    --error: #a33d2c;
    --warning: #8a5700;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: "IBM Plex Sans", "Aptos", "Trebuchet MS", sans-serif;
    letter-spacing: 0;
}
body.auth-pending { visibility: hidden; }

.masthead {
    min-height: 220px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 42px max(24px, calc((100% - 1040px) / 2));
    color: white;
    background:
        linear-gradient(90deg, rgba(15, 45, 32, .94), rgba(15, 45, 32, .35)),
        url("solar-panels.jpg") center 43% / cover;
}

.masthead a, .button-outline {
    padding: 10px 14px;
    color: white;
    border: 1px solid rgba(255, 255, 255, .6);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 700;
}
.masthead-actions { display: flex; align-items: center; gap: 12px; }
.masthead-actions span { color: rgba(255,255,255,.78); font-size: .82rem; font-weight: 800; }
.button-outline { min-height: 40px; background: transparent; cursor: pointer; }
.button-outline:hover { background: rgba(255,255,255,.12); }

h1, h2, h3 { margin: 0; font-family: "Palatino Linotype", "Book Antiqua", serif; font-weight: 600; }
h1 { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1; }
h2 { font-size: clamp(1.45rem, 3vw, 2.1rem); }
h3 { font-size: 1.05rem; }
.eyebrow { margin: 0 0 5px; color: var(--sun); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.subtitle { margin: 10px 0 0; color: rgba(255, 255, 255, .78); }

main { width: min(1040px, calc(100% - 40px)); margin: 0 auto 64px; }
main > section { padding: 38px 0; border-bottom: 1px solid var(--line); }
.admin-tabs { display: flex; gap: 0; width: min(1040px, calc(100% - 40px)); margin: 0 auto; border-right: 1px solid var(--line); border-left: 1px solid var(--line); }
.admin-tabs button { flex: 1; border: 0; border-right: 1px solid var(--line); border-radius: 0; color: var(--muted); background: var(--white); }
.admin-tabs button:last-child { border-right: 0; }
.admin-tabs button[aria-selected="true"] { color: white; background: var(--green); }
.admin-view[hidden] { display: none; }
.module-placeholder { min-height: 330px; display: grid; align-content: center; max-width: 680px; }
.module-placeholder .eyebrow { color: var(--green); }
.module-placeholder p:last-child { color: var(--muted); line-height: 1.55; }
.section-heading, .result-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.section-heading .eyebrow, .result-heading .eyebrow { color: var(--green); }

button {
    min-height: 44px;
    padding: 9px 18px;
    color: white;
    border: 1px solid var(--green);
    border-radius: 4px;
    background: var(--green);
    font: inherit;
    font-weight: 800;
    letter-spacing: 0;
    cursor: pointer;
}
button:hover { background: var(--green-dark); }
button:disabled { color: #e0e3df; border-color: #7f8b84; background: #7f8b84; cursor: not-allowed; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 28px 0 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stats div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); }
dt { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
dd { margin: 7px 0 0; overflow-wrap: anywhere; font-weight: 750; font-variant-numeric: tabular-nums; }

.result { border-left: 4px solid var(--line); padding-left: 24px; }
.result[data-state="loading"] { border-left-color: var(--sun); }
.result[data-state="updated"], .result[data-state="unchanged"] { border-left-color: var(--green); }
.result[data-state="error"] { border-left-color: var(--error); }
#result-state { padding: 6px 10px; color: var(--muted); border: 1px solid var(--line); font-size: .76rem; font-weight: 800; }
.result[data-state="updated"] #result-state, .result[data-state="unchanged"] #result-state { color: var(--green); border-color: #8eb7a3; background: #e7f1eb; }
.result[data-state="error"] #result-state { color: var(--error); border-color: #d2a097; background: #fff2ef; }
#result-message { max-width: 760px; margin: 16px 0 0; color: var(--muted); line-height: 1.55; }

.change-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 26px; border: 1px solid var(--line); background: var(--white); }
.change-summary div { display: grid; gap: 5px; padding: 18px; border-right: 1px solid var(--line); text-align: center; }
.change-summary div:last-child { border-right: 0; }
.change-summary strong { font-family: "Palatino Linotype", serif; font-size: 2rem; color: var(--green); }
.change-summary span { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.change-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
ul { margin: 12px 0 0; padding-left: 20px; color: var(--muted); font-size: .84rem; line-height: 1.55; }
.change-item { margin-bottom: 14px; }
.change-item strong, .change-item span { display: block; }
.change-item strong { color: var(--ink); }
.change-item span { margin-top: 3px; font-size: .78rem; }
details { margin-top: 28px; color: var(--muted); }
summary { color: var(--ink); font-weight: 800; cursor: pointer; }
#excluded-list { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 16px 0 0; }

input, select {
    width: 100%;
    min-height: 44px;
    padding: 9px 11px;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--white);
    font: inherit;
}
input:focus, select:focus { outline: 2px solid rgba(32, 91, 67, .25); border-color: var(--green); }
label { color: var(--muted); font-size: .76rem; font-weight: 800; }
label span { font-weight: 500; }

.users-heading { margin-bottom: 24px; }
.users-search { width: min(330px, 100%); }
.users-search span { display: block; margin-bottom: 6px; }
.users-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 34px; border: 1px solid var(--line); background: var(--white); }
.users-stats div { padding: 15px 18px; border-right: 1px solid var(--line); }
.users-stats div:last-child { border-right: 0; }
.users-stats dd { color: var(--green); font-family: "Palatino Linotype", serif; font-size: 1.7rem; }
.user-create { display: grid; grid-template-columns: minmax(190px, .65fr) minmax(0, 1.8fr); gap: 36px; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.user-create > div > p:last-child { color: var(--muted); line-height: 1.5; }
.user-create form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.user-create label { display: grid; align-content: start; gap: 6px; }
.user-create .user-password-field { grid-column: 1 / 2; }
.user-create button[type="submit"] { align-self: end; }
.users-feedback { margin: 22px 0 0; padding: 12px 14px; color: var(--green-dark); border-left: 3px solid var(--green); background: #e7f1eb; overflow-wrap: anywhere; }
.users-feedback[data-state="error"] { color: var(--error); border-color: var(--error); background: #fff2ef; }
.users-list-section { margin-top: 34px; }
.users-list-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.button-secondary, .button-quiet { color: var(--green); border-color: var(--line); background: var(--white); }
.button-secondary:hover, .button-quiet:hover { color: white; border-color: var(--green); background: var(--green); }
.users-list-heading .button-secondary { width: auto; }
.users-table-wrap { border: 1px solid var(--line); background: var(--white); overflow-x: auto; }
.users-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.users-table th, .users-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.users-table th { color: var(--muted); background: #eef0ea; font-size: .7rem; text-align: center; text-transform: uppercase; }
.users-table th:nth-child(1), .users-table td:nth-child(1) { width: 220px; }
.users-table th:nth-child(3), .users-table td:nth-child(3) { width: 105px; }
.users-table th:nth-child(4), .users-table td:nth-child(4) { width: 110px; }
.users-table th:nth-child(5), .users-table td:nth-child(5) { width: 210px; }
.users-table td:nth-child(3), .users-table td:nth-child(4), .users-table td:nth-child(5) { text-align: right; }
.users-table tr:last-child td { border-bottom: 0; }
.users-table td strong, .users-table td small, .users-table td a { display: block; }
.users-table td small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.users-table td a { max-width: 210px; margin-top: 4px; color: var(--green); font-size: .78rem; overflow-wrap: anywhere; }
.user-status { display: inline-block; padding: 5px 8px; border: 1px solid; font-size: .7rem; font-weight: 800; }
.user-status-active { color: var(--green); border-color: #8eb7a3; background: #e7f1eb; }
.user-status-blocked { color: var(--error); border-color: #d2a097; background: #fff2ef; }
.user-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.user-actions-grid button { min-width: 0; min-height: 34px; width: 100%; padding: 5px 6px; font-size: .68rem; }
.button-warning { color: var(--warning); border-color: #d4ad66; background: #fff8e8; }
.button-warning:hover { color: white; border-color: var(--warning); background: var(--warning); }
.button-positive { color: var(--green); border-color: #8eb7a3; background: #e7f1eb; }
.button-positive:hover { color: white; background: var(--green); }
.button-danger, .button-danger-quiet:hover { color: white; border-color: var(--error); background: var(--error); }
.button-danger-quiet { color: var(--error); border-color: #d2a097; background: var(--white); }
.users-empty { margin: 0; padding: 38px 18px; color: var(--muted); text-align: center; }
.counters-table-wrap { margin-top: 18px; }
.counters-table th:nth-child(n), .counters-table td:nth-child(n) { width: auto; text-align: center; }
.counters-table th:nth-child(3), .counters-table td:nth-child(3),
.counters-table th:nth-child(4), .counters-table td:nth-child(4) { width: 120px; }
.counters-table th:last-child, .counters-table td:last-child { width: 110px; }
.counters-table button { width: auto; min-height: 34px; padding: 5px 10px; font-size: .72rem; }

.user-dialog { width: min(520px, calc(100% - 28px)); padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; background: var(--white); }
.user-dialog::backdrop { background: rgba(12, 24, 18, .62); }
.user-dialog form { display: grid; gap: 15px; padding: 24px; }
.user-dialog label { display: grid; gap: 6px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.dialog-heading .eyebrow { color: var(--green); }
.dialog-close { width: 38px; min-height: 38px; padding: 0; color: var(--muted); border-color: transparent; background: transparent; font-size: 1.6rem; line-height: 1; }
.dialog-close:hover { color: var(--ink); background: #eef0ea; }
.user-dialog p { margin: 0; color: var(--muted); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: end; gap: 9px; margin-top: 5px; }
.dialog-actions button { width: auto; }

@media (max-width: 720px) {
    .masthead { min-height: 260px; align-items: start; flex-direction: column; justify-content: end; }
    .masthead-actions { width: 100%; justify-content: space-between; }
    .masthead-actions button { width: auto; }
    .admin-tabs { width: 100%; overflow-x: auto; }
    .admin-tabs button { min-width: 150px; }
    .section-heading, .result-heading { align-items: stretch; flex-direction: column; }
    button { width: 100%; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .change-details { grid-template-columns: 1fr; }
    .users-heading { align-items: stretch; }
    .users-search { width: 100%; }
    .users-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .users-stats div:nth-child(2) { border-right: 0; }
    .users-stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .user-create { grid-template-columns: 1fr; gap: 18px; }
    .user-create form { grid-template-columns: 1fr; }
    .user-create .user-password-field { grid-column: auto; }
    .users-table-wrap { border: 0; background: transparent; overflow: visible; }
    .users-table, .users-table tbody, .users-table tr, .users-table td { display: block; }
    .users-table thead { display: none; }
    .users-table tr { margin-bottom: 12px; border: 1px solid var(--line); background: var(--white); }
    .users-table td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 11px 13px; }
    .users-table tr:last-child td { border-bottom: 1px solid var(--line); }
    .users-table tr td:last-child { border-bottom: 0; }
    .users-table td::before { content: attr(data-label); color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
    .users-table th:nth-child(1), .users-table td:nth-child(1),
    .users-table th:nth-child(3), .users-table td:nth-child(3),
    .users-table th:nth-child(4), .users-table td:nth-child(4),
    .users-table th:nth-child(5), .users-table td:nth-child(5) { width: auto; text-align: left; }
    .users-table .user-actions { display: grid; min-width: 0; }
    .user-actions-grid { grid-column: 2; }
    .users-table.counters-table td { text-align: center; }
    .counters-table td:last-child { width: auto; align-items: center; }
    .counters-table td:last-child button { width: 100%; min-height: 40px; }
}

@media (max-width: 420px) {
    main { width: min(100% - 24px, 1040px); }
    .stats, .change-summary { grid-template-columns: 1fr; }
    .change-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
    .change-summary div:last-child { border-bottom: 0; }
    .users-list-heading { align-items: stretch; flex-direction: column; }
    .users-list-heading .button-secondary { width: 100%; }
    .users-table td { grid-template-columns: 78px minmax(0, 1fr); }
    .dialog-actions { flex-direction: column-reverse; }
    .dialog-actions button { width: 100%; }
}

.pdf-designer-actions, .pdf-panel-heading, .pdf-canvas-toolbar { display: flex; align-items: center; gap: 8px; }
.pdf-designer-actions button, .pdf-panel-heading button, .pdf-canvas-toolbar button { width: auto; }
#admin-pdf { width: min(1400px, calc(100vw - 40px)); margin-left: 50%; transform: translateX(-50%); }
.pdf-designer-workspace { display: grid; grid-template-columns: 220px minmax(540px, 1fr) 270px; min-height: 825px; margin-top: 20px; border: 1px solid var(--line); background: #eef0ea; }
.pdf-tools-panels { min-width: 0; border-left: 1px solid var(--line); background: var(--white); }
.pdf-tools-view-control { display: grid; gap: 5px; padding: 16px 16px 0; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pdf-tools-view-control select { min-height: 38px; color: var(--ink); font-size: .9rem; font-weight: 800; }
.pdf-tools-panels > aside[hidden] { display: none; }
.pdf-pages-panel, .pdf-inspector-panel, .pdf-branding-panel { min-width: 0; padding: 16px; background: var(--white); }
.pdf-pages-panel { border-right: 1px solid var(--line); }
.pdf-pages-panel h3, .pdf-inspector-panel h3, .pdf-branding-panel h3 { margin: 0 0 12px; font-size: .9rem; }
.pdf-panel-heading { justify-content: space-between; }
.pdf-panel-heading button { min-height: 32px; padding: 4px 9px; font-size: .68rem; }
.pdf-page-list { display: grid; gap: 6px; max-height: 260px; margin-bottom: 22px; overflow-y: auto; }
.pdf-page-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; align-items: center; min-height: 38px; padding: 4px; border: 1px solid var(--line); background: white; }
.pdf-page-item[data-active="true"] { border-color: var(--green); box-shadow: inset 3px 0 var(--green); }
.pdf-page-item > button:first-child { min-width: 0; padding: 6px 8px; color: var(--ink); border: 0; background: transparent; text-align: left; font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-page-item > button:not(:first-child) { width: 28px; min-height: 28px; padding: 0; color: var(--green); border-color: var(--line); background: white; }
.pdf-block-search, .pdf-branding-panel label, #pdf-block-form label { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pdf-block-search input { min-height: 38px; }
.pdf-block-palette { display: grid; gap: 5px; max-height: 330px; margin-top: 9px; overflow-y: auto; }
.pdf-block-group { display: grid; gap: 5px; }
.pdf-block-group + .pdf-block-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.pdf-block-group h4 { margin: 0; color: var(--muted); font-size: .62rem; letter-spacing: 0; text-transform: uppercase; }
.pdf-block-palette button { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding: 5px 8px; color: var(--green); border-color: var(--line); background: white; text-align: left; font-size: .68rem; }
.pdf-block-palette button[data-used="true"] { border-color: #7ba28e; background: #e7f1eb; }
.pdf-block-palette button[data-used="true"][data-unique="true"] { color: #53655c; background: #edf0ed; }
.pdf-block-palette button:disabled { cursor: not-allowed; opacity: .72; }
.pdf-block-usage { color: #07558a; font-size: .6rem; font-weight: 900; white-space: nowrap; }
.pdf-canvas-panel { min-width: 0; padding: 14px; }
.pdf-canvas-toolbar { justify-content: space-between; min-height: 42px; margin-bottom: 12px; }
.pdf-canvas-toolbar label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pdf-canvas-toolbar select { width: auto; min-height: 34px; padding: 4px 25px 4px 7px; }
.pdf-page-title-control { min-width: 0; flex: 1; }
.pdf-page-title-control input { min-width: 120px; width: 100%; min-height: 34px; }
.pdf-canvas-stage { display: grid; place-items: start center; max-height: 750px; overflow: auto; padding: 16px; background: #d9ddd7; overscroll-behavior: contain; }
.pdf-a4-canvas { position: relative; flex: none; width: 493.5px; height: 697.95px; overflow: hidden; background-color: white; background-image: linear-gradient(rgba(7,85,138,.11) 1px, transparent 1px), linear-gradient(90deg, rgba(7,85,138,.11) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.62), rgba(255,255,255,.62)), var(--pdf-page-image, linear-gradient(transparent, transparent)), var(--pdf-page-colors, linear-gradient(white, white)); background-position: 0 0, 0 0, center, center, center; background-size: var(--pdf-grid, 4.7px) var(--pdf-grid, 4.7px), var(--pdf-grid, 4.7px) var(--pdf-grid, 4.7px), 100% 100%, 100% 100%, 100% 100%; background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat; box-shadow: 0 3px 14px rgba(20,38,28,.22); cursor: grab; touch-action: none; }
.pdf-canvas-stage.is-panning .pdf-a4-canvas { cursor: grabbing; }
.pdf-design-block { position: absolute; display: grid; place-items: center; min-width: 20px; min-height: 20px; padding: 5px; overflow: hidden; color: #174d36; border: 1px solid #7ba28e; background: rgba(231,241,235,.48); font-size: .65rem; font-weight: 800; text-align: center; cursor: move; user-select: none; }
.pdf-design-block[data-profile-locked="true"], .pdf-design-block[data-profile-locked="true"] * { cursor: not-allowed; }
.pdf-design-block[data-selected="true"] { z-index: 110 !important; border: 2px solid #07558a; background: rgba(222,238,247,.68); }
.pdf-design-block[data-visible="false"] { opacity: .42; border-style: dashed; }
.pdf-design-block.pdf-design-border-box { padding: 0; }
.pdf-design-block.pdf-design-border-box[data-selected="true"] { outline: 2px solid #07558a; outline-offset: 2px; }
.pdf-design-block.pdf-design-custom-image { padding: 0; }
.pdf-design-custom-image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.pdf-design-block.pdf-design-text-preview { display: block; padding: 0; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 400; }
.pdf-design-block.pdf-design-content-preview { display: block; padding: 0; color: #173c2c; background: rgba(255,255,255,.68); font-weight: 400; text-align: left; }
.pdf-preview-content { width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.pdf-preview-variable-badge { position: absolute; top: 2px; left: 2px; padding: 1px 3px; color: white; background: rgba(7,85,138,.8); font-size: 5px; line-height: 1.2; text-transform: uppercase; }
.pdf-property-preview-controls { display: flex; align-items: center; gap: 5px; min-height: 30px; }
.pdf-profile-block-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; border: 1px solid var(--line); background: #f5f7f4; }
.pdf-profile-block-controls[hidden] { display: none; }
.pdf-profile-block-controls button { width: auto; min-height: 34px; padding: 5px 9px; font-size: .68rem; }
.pdf-property-preview-controls button { width: auto; min-width: 48px; min-height: 28px; padding: 4px 9px; font-size: .68rem; }
.pdf-property-preview-controls button[data-active="true"] { color: white; border-color: var(--blue); background: var(--blue); }
.pdf-property-preview-controls span { min-width: 28px; font-size: .72rem; font-weight: 800; text-align: center; }
.pdf-preview-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 7px 4px 4px; }
.pdf-preview-metrics > div { min-width: 0; padding: 4px 3px; background: rgba(231,241,235,.86); }
.pdf-preview-metrics span, .pdf-preview-metrics strong { display: block; overflow: hidden; font-size: 5px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.pdf-preview-metrics span { color: #07558a; text-transform: uppercase; }
.pdf-preview-metrics strong { margin-top: 2px; font-size: 7px; }
.pdf-preview-summary { display: grid; grid-template-columns: 2fr 1fr; gap: 3px; height: 100%; padding: 9px 5px 4px; }
.pdf-preview-summary strong { grid-row: span 2; align-self: center; font-size: 9px; }
.pdf-preview-summary span { align-self: center; font-size: 6px; overflow-wrap: anywhere; }
.pdf-preview-donuts { display: flex; justify-content: center; gap: 22px; padding-top: 7px; }
.pdf-preview-donut { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: conic-gradient(#4c8f70 var(--value), #dce7e1 0); }
.pdf-preview-donut::after { position: absolute; inset: 8px; border-radius: inherit; background: rgba(255,255,255,.94); content: ""; }
.pdf-preview-donut strong, .pdf-preview-donut span { z-index: 1; font-size: 8px; }
.pdf-preview-donut span { position: absolute; top: 58px; width: 80px; font-size: 5px; text-align: center; }
.pdf-preview-table-section { width: 100%; height: 100%; overflow: hidden; }
.pdf-preview-table-title { display: block; height: 27px; padding: 12px 4px 3px; color: #07558a; font-size: 7px; }
.pdf-preview-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 5px; }
.pdf-preview-table th, .pdf-preview-table td { height: 14px; padding: 2px; border-bottom: 1px solid rgba(23,77,54,.2); overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.pdf-preview-table th { color: #07558a; background: #dedfdf; font-size: 4.7px; font-weight: 800; text-transform: uppercase; }
.pdf-preview-table th:first-child, .pdf-preview-table td:first-child { text-align: left; }
.pdf-preview-budget td:nth-child(3) { width: 55%; }
.pdf-preview-budget-total { display: flex; justify-content: space-between; align-items: center; padding: 5px; color: white; background: #174d36; font-size: 7px; }
.pdf-preview-text-card { height: 100%; padding: 10px 6px 5px; border-left: 4px solid #e7b934; background: rgba(255,255,255,.82); font-size: 7px; line-height: 1.35; white-space: pre-wrap; }
.pdf-preview-note { margin: 0; padding: 12px 6px; font-size: 7px; }
.pdf-preview-image { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.pdf-preview-chart { display: block; width: 100%; height: 100%; padding: 6px 3px 2px; }
.pdf-design-title { border-color: #07558a; background: rgba(232,243,248,.52); }
.pdf-design-logo { width: 100%; height: 100%; object-fit: contain; opacity: .62; pointer-events: none; }
.pdf-resize-handle { position: absolute; right: 0; bottom: 0; width: 15px; height: 15px; border-top: 1px solid #07558a; border-left: 1px solid #07558a; background: white; cursor: nwse-resize; }
.pdf-empty-selection { padding: 18px 0; color: var(--muted); font-size: .75rem; line-height: 1.5; }
#pdf-block-form { display: grid; gap: 12px; }
#pdf-block-form[hidden] { display: none; }
.pdf-text-properties { display: grid; gap: 10px; }
.pdf-text-properties[hidden] { display: none; }
.pdf-border-properties { display: grid; gap: 10px; padding-top: 2px; border-top: 1px solid var(--line); }
.pdf-border-properties[hidden] { display: none; }
.pdf-border-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pdf-border-sides label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: .7rem; }
.pdf-border-sides input { width: 17px; min-height: 17px; }
.pdf-border-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pdf-border-grid label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: .66rem; font-weight: 800; }
.pdf-border-grid input, .pdf-border-grid select { width: 100%; min-width: 0; min-height: 32px; padding: 4px; }
.pdf-border-grid input[type="color"] { padding: 3px; }
.pdf-image-properties { display: grid; gap: 10px; padding-top: 2px; border-top: 1px solid var(--line); }
.pdf-image-properties[hidden] { display: none; }
.pdf-image-file, .pdf-image-alt, .pdf-image-grid label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: .66rem; font-weight: 800; }
.pdf-image-file input { width: 100%; min-width: 0; font-size: .68rem; }
.pdf-image-file-state { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .68rem; }
.pdf-image-file-state button { min-height: 30px; padding: 4px 8px; font-size: .66rem; }
.pdf-image-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pdf-image-grid input, .pdf-image-grid select, .pdf-image-alt input { width: 100%; min-width: 0; min-height: 32px; padding: 4px; }
.pdf-image-grid .pdf-image-check { display: flex; align-items: center; align-self: end; min-height: 32px; gap: 7px; color: var(--ink); }
.pdf-image-grid .pdf-image-check input { width: 17px; min-height: 17px; padding: 0; }
.pdf-image-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pdf-image-toggles label { display: flex; align-items: center; min-width: 0; gap: 7px; font-size: .7rem; }
.pdf-image-toggles input { flex: none; width: 17px; min-height: 17px; }
.pdf-rich-panel { display: grid; gap: 8px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.pdf-rich-panel[hidden] { display: none; }
.pdf-rich-toolbar { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; }
.pdf-rich-toolbar [data-rich="font"], .pdf-rich-toolbar [name="pageNumberFont"] { grid-column: span 8; }
.pdf-rich-toolbar [data-rich="size"], .pdf-rich-toolbar [name="pageNumberSize"] { grid-column: span 4; }
.pdf-rich-toolbar button, .pdf-rich-toolbar input[type="color"] { grid-column: span 3; }
.pdf-rich-toolbar [data-rich="variable"], .pdf-rich-toolbar [data-rich="insert-variable"] { grid-column: span 6; }
.pdf-rich-toolbar button { width: auto; min-height: 34px; padding: 4px 7px; }
.pdf-rich-toolbar button[aria-pressed="true"] { color: white; border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.pdf-rich-toolbar button[aria-pressed="mixed"] { color: var(--blue); border-color: var(--blue); background: #e8f3f8; box-shadow: inset 0 -3px var(--blue); }
.pdf-rich-toolbar input, .pdf-rich-toolbar select { min-width: 0; min-height: 34px; padding: 4px; }
.pdf-rich-toolbar input[type="color"] { width: 100%; }
.pdf-block-rich-toolbar, .pdf-title-rich-toolbar { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > [data-rich="font"] { grid-row: 1; grid-column: 1 / span 7; font-size: .68rem; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > [data-rich="size"] { grid-row: 1; grid-column: 8 / span 3; font-size: .68rem; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > input[data-rich="color"] { grid-row: 1; grid-column: 11 / span 2; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > button[data-rich="bold"] { grid-row: 2; grid-column: 1 / span 3; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > button[data-rich="italic"] { grid-row: 2; grid-column: 4 / span 3; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > button[data-rich="underline"] { grid-row: 2; grid-column: 7 / span 3; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > .pdf-align-symbols { grid-row: 2; grid-column: 10 / span 3; }
:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) .pdf-align-symbols { font-size: .9rem; font-weight: 800; text-align: center; text-align-last: center; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > [data-rich="variable"] { grid-row: 3; grid-column: 1 / span 6; }
.pdf-rich-toolbar:is(.pdf-block-rich-toolbar, .pdf-title-rich-toolbar) > [data-rich="insert-variable"] { grid-row: 3; grid-column: 7 / span 6; }
.pdf-rich-content { min-height: 92px; max-height: 220px; overflow: auto; padding: 9px; color: #173c2c; border: 1px solid var(--line); background: white; font-size: 12px; line-height: 1.4; white-space: pre-wrap; outline: none; }
.pdf-rich-content:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(7,85,138,.12); }
.pdf-rich-variable { display: inline-block; padding: 1px 4px; color: #07558a; border: 1px solid #9abccd; background: #e8f3f8; font: 700 11px/1.4 monospace; }
.pdf-coordinate-grid, .pdf-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pdf-coordinate-grid input { min-width: 0; }
.pdf-title-layout-properties { display: grid; gap: 8px; }
.pdf-block-size-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.pdf-block-size-grid label, .pdf-block-style-row > label, .pdf-block-background-controls > label:first-child { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: .66rem; font-weight: 800; }
.pdf-block-size-grid input, .pdf-block-style-row input[type="number"] { width: 100%; min-width: 0; min-height: 32px; padding: 4px; }
.pdf-block-style-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: end; }
.pdf-block-background-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; min-width: 0; }
.pdf-block-background-controls[data-visible="false"] { visibility: hidden; }
.pdf-block-background-controls input[type="color"] { width: 100%; min-height: 32px; padding: 3px; }
.pdf-block-background-controls .pdf-visible-control { min-height: 32px; white-space: nowrap; }
.pdf-block-background-controls input[type="color"]:disabled { opacity: .35; cursor: not-allowed; }
.pdf-block-page-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pdf-block-page-row > label:first-child { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: .66rem; font-weight: 800; }
.pdf-block-page-row select { width: 100%; min-width: 0; min-height: 32px; padding: 4px; }
.pdf-block-page-row .pdf-visible-control { min-height: 32px; white-space: nowrap; }
.pdf-title-visible-control { min-height: 32px; }
.pdf-visible-control { display: flex !important; align-items: center; grid-template-columns: auto 1fr; gap: 8px !important; color: var(--ink) !important; }
.pdf-visible-control[hidden] { display: none !important; }
.pdf-visible-control input { width: 18px; min-height: 18px; }
.pdf-background-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.pdf-background-control > label:last-child { display: grid; gap: 5px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pdf-background-control input[type="color"] { width: 100%; min-height: 32px; padding: 3px; }
.pdf-background-control input[type="color"]:disabled { opacity: .35; cursor: not-allowed; }
.pdf-branding-panel > label, #pdf-branding-form { display: grid; gap: 10px; }
#pdf-branding-form { margin-top: 12px; }
.pdf-branding-asset { display: grid; gap: 5px; }
.pdf-branding-asset-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pdf-branding-asset-heading > span { color: var(--ink); font-weight: 900; }
.pdf-branding-asset-heading .pdf-visible-control { flex: 0 0 auto; font-size: .65rem; white-space: nowrap; }
.pdf-branding-asset-heading .pdf-visible-control input { width: 15px; min-height: 15px; height: 15px; }
.pdf-branding-asset > input[type="file"] { min-height: 30px; padding: 2px; font-size: .6rem; }
.pdf-branding-asset > input[type="file"]::file-selector-button { min-height: 24px; margin-right: 5px; padding: 3px 7px; font: inherit; }
.pdf-branding-asset-state { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pdf-branding-asset-state button { width: auto; min-height: 26px; padding: 3px 8px; font-size: .62rem; }
.pdf-company-summary { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pdf-company-summary-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pdf-company-summary-heading strong { color: var(--ink); font-size: .75rem; }
.pdf-company-summary-heading button { width: auto; min-height: 30px; padding: 4px 10px; font-size: .68rem; }
#pdf-company-summary { display: grid; gap: 4px; margin: 0; }
#pdf-company-summary div { display: grid; grid-template-columns: minmax(72px, auto) minmax(0, 1fr); gap: 8px; font-size: .68rem; line-height: 1.35; }
#pdf-company-summary dt { color: var(--muted); font-weight: 800; }
#pdf-company-summary dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.pdf-company-dialog-content { display: grid; gap: 15px; padding: 24px; }
.pdf-company-dialog-content label { display: grid; gap: 6px; }
.pdf-color-grid input { width: 100%; min-height: 38px; padding: 3px; }
.pdf-branding-source { display: none; }
.pdf-branding-asset-status { color: var(--muted); font-size: .65rem; line-height: 1.3; }
.pdf-branding-asset-status[data-loaded="true"] { color: var(--green); }
.pdf-branding-asset-status[data-remove="true"] { color: var(--danger); }

@media (max-width: 1240px) {
    .pdf-designer-workspace { grid-template-columns: 190px minmax(420px, 1fr); }
    .pdf-tools-panels { grid-column: 1 / -1; border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
    .pdf-designer-heading { gap: 14px; }
    .pdf-designer-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .pdf-designer-actions button:last-child { grid-column: 1 / -1; }
    .pdf-designer-workspace { display: block; }
    .pdf-tools-panels { display: block; border-top: 0; }
    .pdf-pages-panel, .pdf-inspector-panel, .pdf-branding-panel { border: 0; border-bottom: 1px solid var(--line); }
    .pdf-page-list { max-height: 190px; }
    .pdf-block-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 200px; }
    .pdf-canvas-panel { padding: 8px; }
    .pdf-canvas-toolbar { align-items: stretch; flex-direction: column; }
    .pdf-canvas-toolbar button, .pdf-canvas-toolbar select, .pdf-page-title-control { width: 100%; }
    .pdf-canvas-stage { height: min(70vh, 560px); justify-content: start; padding: 10px; }
    .pdf-inspector-panel { display: block; }
}
