:root {
    color-scheme: light;
    --ink: #182822;
    --muted: #66736d;
    --accent: #176347;
    --line: #dce3de;
    --soft: #f3f6f3;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: #f7f8f5;
    font-synthesis: none;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
button,
input {
    font: inherit;
}
button {
    cursor: pointer;
}
button,
input[type='text'] {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
}
button {
    min-height: 40px;
    padding: 9px 13px;
    transition:
        background 0.15s,
        color 0.15s;
}
button:hover {
    background: var(--soft);
}
button:disabled {
    cursor: default;
    opacity: 0.4;
}
button:focus-visible,
input:focus-visible {
    outline: 3px solid #36886a;
    outline-offset: 3px;
}
input[type='checkbox'] {
    accent-color: var(--accent);
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}
h1,
h2,
p {
    margin: 0;
}
h2 {
    font-size: 15px;
}
.page-header {
    padding: 26px 32px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--line);
    background: white;
}
.eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 7px;
}
h1 {
    font-size: 32px;
    letter-spacing: -1.4px;
    font-weight: 600;
}
h1 span {
    color: var(--accent);
}
.intro {
    font-size: 13px;
    line-height: 1.7;
    color: var(--muted);
}
.workspace {
    display: grid;
    grid-template-columns: 294px minmax(0, 1fr);
    gap: 24px;
    padding: 24px 32px 0;
    height: calc(100dvh - 162px);
    min-height: 500px;
}
.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.ballot {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line);
}
.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}
.section-heading strong {
    font-size: 12px;
    color: var(--accent);
}
.section-heading > span {
    font-size: 12px;
    color: var(--muted);
}
.name-label {
    font-size: 12px;
    display: block;
    margin-bottom: 7px;
}
input[type='text'] {
    width: 100%;
    height: 40px;
    padding: 10px 12px;
}
.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.primary:hover {
    background: #104c36;
}
.export {
    width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
}
.hint {
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
    margin-top: 9px;
}
.draft-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
    font-size: 10px;
    color: var(--muted);
}
.text-button {
    padding: 4px 0;
    border: 0;
    background: transparent;
    font-size: 11px;
    min-height: 30px;
    text-decoration: underline;
    white-space: nowrap;
}
.catalog {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-top: 20px;
}
.filter {
    display: flex;
    gap: 7px;
    align-items: center;
    font-size: 12px;
    margin-bottom: 12px;
}
nav {
    overflow: auto;
    padding: 3px 6px 6px 3px;
    scrollbar-width: thin;
}
.template-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e7ece8;
    border-radius: 7px;
    gap: 4px;
}
.template-row.active {
    background: #e8f0e9;
}
.template-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-align: left;
    border: 0;
    background: transparent;
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    font-size: 13px;
}
.template-link[aria-current='true'] {
    font-weight: 700;
    color: var(--accent);
}
.template-number {
    font-size: 10px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.row-favorite {
    margin-right: 4px;
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px;
    cursor: pointer;
}
.row-favorite input {
    margin: 0;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.preview {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.preview-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 0 14px;
    flex-shrink: 0;
}
.preview-title h2 {
    font-size: 21px;
    letter-spacing: -0.5px;
}
.preview-actions {
    display: flex;
    gap: 6px;
}
.preview-actions button {
    font-size: 13px;
}
.favorite {
    min-width: 155px;
}
.favorite[aria-pressed='true'] {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.preview-canvas {
    position: relative;
    flex: 1;
    min-height: 0;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 22px #18282208;
}
iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: white;
}
#preview-empty {
    padding: 32px;
    color: var(--muted);
    font-size: 14px;
}
.preview-note {
    font-size: 10px;
    color: var(--muted);
    padding: 9px 0;
    text-align: center;
}
#empty {
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    padding: 10px 0;
}
.status-bar {
    padding: 10px 32px;
    background: #f7f8f5;
    min-height: 36px;
    font-size: 12px;
    color: var(--accent);
}
[hidden] {
    display: none !important;
}
@media (min-width: 1500px) {
    .workspace {
        grid-template-columns: 310px minmax(0, 1fr);
    }
}
@media (max-width: 800px) {
    .page-header {
        padding: 20px;
        align-items: flex-start;
    }
    .intro {
        max-width: 220px;
        font-size: 11px;
    }
    h1 {
        font-size: 27px;
    }
    .workspace {
        height: auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        padding: 18px 16px 55px;
        gap: 20px;
    }
    .sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 18px;
    }
    .ballot {
        border: 0;
        padding: 0;
    }
    .catalog {
        padding: 0;
        max-height: 290px;
    }
    nav {
        max-height: 202px;
    }
    .section-heading {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 6px;
    }
    .preview-canvas {
        flex: none;
        height: 70dvh;
        min-height: 400px;
    }
    .preview-toolbar {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #f7f8f5;
        padding: 10px 0;
        flex-wrap: wrap;
    }
    .preview-actions {
        margin-left: auto;
    }
    .status-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 2;
        border-top: 1px solid var(--line);
        padding: 10px 16px;
        font-size: 11px;
    }
    .preview-title h2 {
        font-size: 18px;
    }
    .draft-row {
        flex-wrap: wrap;
    }
}
@media (max-width: 440px) {
    .page-header {
        display: block;
    }
    .intro {
        max-width: none;
        margin-top: 10px;
    }
    .sidebar {
        grid-template-columns: 1fr;
    }
    .ballot {
        padding-bottom: 16px;
        border-bottom: 1px solid var(--line);
    }
    .catalog {
        max-height: 210px;
    }
    nav {
        max-height: 135px;
    }
    .preview-actions {
        margin-left: 0;
    }
    .preview-toolbar {
        gap: 10px;
    }
    .preview-actions button {
        min-height: 42px;
    }
    .preview-note {
        font-size: 10px;
    }
}
@media (prefers-reduced-motion: reduce) {
    button {
        transition: none;
    }
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
}
#persistent-count {
    white-space: nowrap;
    font-size: 11px;
}
@media (max-width: 440px) {
    .status-bar {
        gap: 10px;
    }
    #persistent-count {
        font-size: 10px;
    }
}
