:root {
    --bg: #f3f6fa;
    --surface: #ffffff;
    --ink: #1a2635;
    --ink-soft: #5f6d7e;
    --line: #d8e0ea;
    --brand: #0e4a72;
    --brand-strong: #0a3756;
    --brand-sub: #15a4a7;
    --warn: #b54708;
    --ok: #067647;
    --danger: #b42318;
    --shadow-1: 0 8px 24px rgba(15, 33, 55, 0.08);
    --shadow-2: 0 18px 40px rgba(15, 33, 55, 0.14);
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--ink);
    font-family: "Avenir Next", "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", sans-serif;
    background:
        radial-gradient(1400px 500px at 8% -20%, rgba(21, 164, 167, 0.18), transparent 60%),
        radial-gradient(900px 420px at 95% -10%, rgba(14, 74, 114, 0.16), transparent 52%),
        linear-gradient(180deg, #eef4fb 0%, #f7f9fc 52%, #f2f6fa 100%);
    min-height: 100vh;
}

.app-shell { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    background: linear-gradient(116deg, var(--brand-strong), var(--brand));
    box-shadow: 0 8px 22px rgba(6, 25, 43, 0.24);
}

.brand {
    color: #f7fbff;
    font-weight: 800;
    letter-spacing: 0.02em;
    font-size: 1.15rem;
}

.brand-wrap {
    display: grid;
    gap: 2px;
}

.brand-subline {
    color: rgba(229, 239, 255, 0.84);
    font-size: 0.74rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    color: #dbecff;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav a:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.25);
}

.container {
    max-width: 1160px;
    margin: 26px auto;
    padding: 0 18px 48px;
    animation: rise 0.35s ease;
}

.container-login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin-top: 0;
    padding-top: 24px;
}

h1 {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    letter-spacing: 0.02em;
}

h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

h3 {
    margin: 16px 0 10px;
    color: #334154;
    font-size: 0.96rem;
}

p {
    margin: 0 0 8px;
}

.muted {
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.mt12 { margin-top: 12px; }

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 16px;
    box-shadow: var(--shadow-1);
}

.mt16 { margin-top: 16px; }

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.metric-card {
    border-radius: var(--radius);
    border: 1px solid #d5dfec;
    background: linear-gradient(180deg, #ffffff, #f7fbff);
    padding: 16px;
    box-shadow: var(--shadow-1);
}

.metric-card h2 {
    color: #526174;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.metric-value {
    margin: 0;
    color: #173851;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.flash {
    margin-bottom: 12px;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid;
    font-size: 0.92rem;
}

.flash-success {
    color: var(--ok);
    border-color: #abefc6;
    background: #ecfdf3;
}

.flash-error {
    color: var(--danger);
    border-color: #fecdc9;
    background: #fff2f1;
}

.form-stack {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
    color: #3e4d60;
}

input, select, textarea, button {
    font: inherit;
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cdd8e5;
    border-radius: 10px;
    background: #fff;
    padding: 10px 11px;
    color: #182230;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #7fb4dd;
    box-shadow: 0 0 0 3px rgba(90, 157, 208, 0.2);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.span-2 {
    grid-column: 1 / -1;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.align-end {
    align-items: flex-end;
    justify-content: flex-end;
}

.search-form {
    display: flex;
    gap: 8px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

th, td {
    padding: 11px 10px;
    border-bottom: 1px solid #e4eaf1;
    text-align: left;
    font-size: 0.91rem;
}

thead th {
    color: #415064;
    font-weight: 700;
    background: #f8fbff;
}

tfoot th {
    color: #213347;
    background: #f8fbff;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.summary-box {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #cfd9e5;
    display: grid;
    gap: 6px;
    justify-content: end;
}

.summary-box div {
    min-width: 230px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
}

.btn-primary, .btn-outline, button {
    border-radius: 11px;
    border: 1px solid transparent;
    padding: 10px 13px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary, button[type='submit'] {
    color: #ffffff;
    border-color: #0a5b8c;
    background: linear-gradient(130deg, #1570a6, #0f4f79);
    box-shadow: 0 7px 20px rgba(12, 66, 101, 0.26);
}

.btn-primary:hover, button[type='submit']:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-2);
}

.btn-outline {
    color: #2a4156;
    border-color: #b9c8d9;
    background: #fff;
}

.btn-outline:hover {
    border-color: #89a7c3;
    background: #f7fbff;
}

.btn-link {
    border: none;
    background: none;
    padding: 0;
    color: var(--danger);
}

.btn-install-app {
    color: #f7fbff;
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
}

.btn-install-app:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.user-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.24);
    color: #eff7ff;
    font-size: 0.82rem;
}

.lg {
    font-weight: 700;
    padding: 12px 18px;
}

.flat-list {
    margin: 0;
    padding-left: 18px;
}

.steps {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: #35495e;
}

.doc-actions-card {
    margin-bottom: 16px;
    border: 1px solid #c8d8ea;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.action-chip {
    border: 1px solid #cfe0f0;
    background: #fff;
    border-radius: 12px;
    text-decoration: none;
    color: #1e3348;
    display: grid;
    gap: 4px;
    padding: 12px;
    transition: all 0.2s ease;
}

.action-chip strong {
    font-size: 0.95rem;
}

.action-chip span {
    color: #627286;
    font-size: 0.82rem;
}

.action-chip:hover {
    transform: translateY(-2px);
    border-color: #86afd1;
    box-shadow: var(--shadow-1);
}

.action-chip.envelope {
    background: linear-gradient(180deg, #ffffff 0%, #fffdf6 100%);
}

.action-chip.active {
    border-color: #1a7cb3;
    box-shadow: inset 0 0 0 1px #1a7cb3;
}

.pdf-preview-header {
    align-items: flex-end;
}

.pdf-preview-card {
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(132, 153, 174, 0.42);
    border-radius: var(--radius-xl);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.98)),
        radial-gradient(circle at 18% 0%, rgba(33, 111, 136, 0.09), transparent 34%);
    box-shadow: var(--shadow-2);
}

.pdf-preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(146, 164, 184, 0.36);
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(14px);
}

.pdf-preview-toolbar div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.pdf-preview-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pdf-preview-toolbar strong,
.pdf-preview-toolbar span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pdf-preview-toolbar span {
    color: var(--muted);
    font-size: 0.9rem;
}

.pdf-preview-frame {
    display: block;
    width: 100%;
    height: min(76vh, 920px);
    min-height: 620px;
    border: 0;
    background: #eef3f7;
}

.pdf-preview-help {
    padding: 12px 16px 16px;
    color: var(--muted);
    font-size: 0.92rem;
}

.pdf-preview-help p {
    margin: 0;
}

.pdf-print-guide {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid rgba(159, 178, 196, 0.36);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.74);
}

.pdf-print-guide h2 {
    margin: 0 0 10px;
    color: #1d3042;
    font-size: 1rem;
}

.print-tip-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.print-tip-grid div {
    display: grid;
    gap: 5px;
    padding: 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #f7fbff);
    border: 1px solid rgba(174, 190, 207, 0.44);
}

.print-tip-grid strong {
    color: #1e3348;
    font-size: 0.92rem;
}

.print-tip-grid span {
    line-height: 1.55;
}

.mobile-pdf-actions {
    display: none;
}

.status-pill {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid;
}

.status-draft { background: #eef4ff; color: #355074; border-color: #c7d8f1; }
.status-sent { background: #e8f5ff; color: #0f5985; border-color: #b8def3; }
.status-paid { background: #ecfdf3; color: #0e6a43; border-color: #abe8c6; }
.status-overdue { background: #fff3ee; color: #ac3513; border-color: #f0c7b9; }

.timeline {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 12px 1fr;
    gap: 10px;
    align-items: flex-start;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    background: #0f6a9e;
    box-shadow: 0 0 0 3px rgba(15, 106, 158, 0.2);
}

.timeline-body {
    padding: 8px 10px;
    border-radius: 10px;
    background: #f6faff;
    border: 1px solid #d9e6f2;
    font-size: 0.9rem;
    color: #33475c;
}

.timeline-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
    color: #23384f;
}

.timeline-head span {
    color: #688097;
    font-size: 0.8rem;
}

.timeline-status {
    margin-bottom: 4px;
    color: #425a73;
    font-size: 0.84rem;
}

.login-card {
    width: min(520px, 92vw);
    padding: 24px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-form input,
.inline-form select {
    min-width: 120px;
}

.ocr-preview {
    margin-top: 10px;
    border: 1px dashed #b8cadb;
    border-radius: 10px;
    padding: 10px;
    background: #fbfdff;
}

.ocr-preview pre {
    margin: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.82rem;
    color: #3c4f65;
}

.company-lookup-card {
    position: relative;
    overflow: hidden;
    border-color: #c9dde9;
    background:
        radial-gradient(circle at 92% 8%, rgba(55, 132, 172, 0.16), transparent 28%),
        linear-gradient(135deg, #ffffff 0%, #f3f9fc 100%);
}

.company-lookup-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(120deg, rgba(15, 76, 117, 0.05) 0 1px, transparent 1px 18px);
}

.company-lookup-card > * {
    position: relative;
}

.lookup-grid textarea {
    min-height: 124px;
}

.lookup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lookup-result {
    min-height: 1.4em;
    color: #24644a;
    font-size: 0.86rem;
    font-weight: 700;
}

.lookup-result.is-error {
    color: var(--danger);
}

.field-hint {
    color: var(--ink-soft);
    font-size: 0.78rem;
}

.billing-item-list {
    display: grid;
    gap: 12px;
}

.billing-item-card {
    border: 1px solid #d7e4ef;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    padding: 14px;
}

.billing-item-card.is-inactive {
    background: #f7f8fa;
    opacity: 0.72;
}

.billing-item-edit-form {
    margin: 0;
}

.seal-preview {
    margin: 12px 0 14px;
    border: 1px solid #d7e0ea;
    border-radius: 12px;
    background: #fafcff;
    padding: 12px;
}

.seal-preview img {
    display: block;
    width: 110px;
    height: 110px;
    object-fit: contain;
    border: 1px solid #cdd9e6;
    border-radius: 10px;
    background: #fff;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #36485c;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.install-panel[hidden] {
    display: none;
}

.install-panel {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
}

.install-panel__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 25, 41, 0.48);
}

.install-panel__dialog {
    position: relative;
    width: min(420px, 100%);
    border: 1px solid #d3dfeb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 54px rgba(12, 30, 48, 0.26);
    padding: 20px;
}

.install-panel__dialog h2 {
    margin-right: 34px;
}

.install-panel__dialog ol {
    margin: 12px 0 16px;
    padding-left: 22px;
    color: #34465a;
    line-height: 1.8;
}

.install-panel__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #d6e0ea;
    background: #fff;
    color: #33475c;
    box-shadow: none;
}

.install-panel-open {
    overflow: hidden;
}

.print-stage {
    margin-top: 16px;
}

.envelope-scroll {
    overflow: auto;
    padding: 10px 2px;
}

.envelope-sheet {
    width: var(--env-w, 235mm);
    height: var(--env-h, 120mm);
    position: relative;
    margin: 0 auto;
    background: #fdf8ee;
    border: 1px solid #d6ccb7;
    box-shadow: 0 10px 30px rgba(39, 34, 22, 0.16);
}

.sender-block {
    position: absolute;
    top: 14mm;
    left: 14mm;
    width: 78mm;
    font-size: 10.5px;
    line-height: 1.4;
    color: #4e4536;
}

.recipient-block {
    position: absolute;
    top: 42mm;
    right: 16mm;
    width: 92mm;
    text-align: left;
    font-size: 15px;
    line-height: 1.55;
    color: #1f1d18;
}

.recipient-block .recipient-name {
    margin-top: 6mm;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.toast-stack {
    position: fixed;
    top: 88px;
    right: 18px;
    z-index: 120;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 28px));
    pointer-events: none;
}

.toast {
    position: relative;
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(169, 189, 209, 0.74);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 255, 0.98));
    box-shadow: 0 18px 44px rgba(13, 32, 52, 0.18);
    padding: 12px 12px 12px 14px;
    color: #20364c;
    font-size: 0.9rem;
    line-height: 1.45;
    pointer-events: auto;
    animation: toast-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast-success {
    border-color: rgba(76, 158, 117, 0.48);
}

.toast-error {
    border-color: rgba(208, 86, 74, 0.5);
}

.toast-mark {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--ok);
    box-shadow: 0 0 0 5px rgba(6, 118, 71, 0.12);
}

.toast-error .toast-mark {
    background: var(--danger);
    box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.12);
}

.toast-close {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #d5dfeb;
    border-radius: 9px;
    background: #fff;
    color: #5b6d80;
    box-shadow: none;
    line-height: 1;
}

.toast-close:hover {
    color: #24384e;
    border-color: #aebed0;
    background: #f7fbff;
}

.toast.is-leaving {
    animation: toast-out 0.22s ease both;
}

.ui-reveal {
    animation: reveal-card 0.52s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: var(--reveal-delay, 0ms);
}

.ui-pulse {
    animation: ui-pulse 0.54s ease;
}

.metric-value.ui-pulse,
.summary-box .ui-pulse {
    display: inline-block;
}

.ui-field-updated {
    animation: field-updated 1.05s ease;
}

tr.row-enter {
    animation: row-enter 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

tr.row-leave {
    animation: row-leave 0.18s ease both;
}

tr.row-selected td {
    animation: row-selected 0.72s ease;
}

.btn-primary.is-loading,
.btn-outline.is-loading,
button.is-loading,
.action-chip.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.82;
}

.btn-primary.is-loading::after,
.btn-outline.is-loading::after,
button.is-loading::after,
.action-chip.is-loading::after {
    content: "";
    display: inline-block;
    width: 0.92em;
    height: 0.92em;
    margin-left: 0.62em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.13em;
    animation: spin 0.72s linear infinite;
}

.action-chip.is-loading {
    box-shadow: var(--shadow-1);
    transform: translateY(-1px);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px) translateY(-4px) scale(0.98); }
    to { opacity: 1; transform: translateX(0) translateY(0) scale(1); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(18px) scale(0.98); }
}

@keyframes reveal-card {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ui-pulse {
    0% { transform: scale(1); filter: none; }
    35% { transform: scale(1.035); filter: drop-shadow(0 6px 12px rgba(21, 112, 166, 0.18)); }
    100% { transform: scale(1); filter: none; }
}

@keyframes field-updated {
    0% { box-shadow: 0 0 0 0 rgba(21, 164, 167, 0); border-color: #cdd8e5; }
    24% { box-shadow: 0 0 0 4px rgba(21, 164, 167, 0.18); border-color: #24a8ad; }
    100% { box-shadow: 0 0 0 0 rgba(21, 164, 167, 0); border-color: #cdd8e5; }
}

@keyframes row-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes row-leave {
    to { opacity: 0; transform: translateX(14px); }
}

@keyframes row-selected {
    0% { background: rgba(21, 164, 167, 0); }
    24% { background: rgba(21, 164, 167, 0.09); }
    100% { background: rgba(21, 164, 167, 0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .topbar {
        position: static;
        padding: 14px 16px;
    }

    .container {
        margin-top: 16px;
        padding: 0 12px 26px;
    }

    .metrics-grid, .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .search-form {
        width: 100%;
    }

    .search-form input {
        flex: 1;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .toast-stack {
        top: 14px;
        right: 14px;
    }

    .pdf-preview-header {
        align-items: stretch;
    }

    .pdf-preview-header .actions-row,
    .pdf-preview-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .pdf-preview-header .btn-primary,
    .pdf-preview-header .btn-outline,
    .pdf-preview-toolbar .btn-primary,
    .pdf-preview-toolbar .btn-outline {
        justify-content: center;
        width: 100%;
        text-align: center;
    }

    .pdf-preview-toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .pdf-preview-frame {
        height: 68vh;
        min-height: 440px;
    }

    .pdf-preview-card {
        margin-bottom: 98px;
    }

    .print-tip-grid {
        grid-template-columns: 1fr;
    }

    .mobile-pdf-actions {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 20;
        display: grid;
        grid-template-columns: 1.25fr 1fr 0.8fr;
        gap: 8px;
        padding: 10px;
        border: 1px solid rgba(128, 149, 170, 0.38);
        border-radius: 18px;
        background: rgba(255, 255, 255, 0.94);
        box-shadow: 0 18px 44px rgba(22, 38, 55, 0.18);
        backdrop-filter: blur(18px);
    }

    .mobile-pdf-actions .btn-primary,
    .mobile-pdf-actions .btn-outline {
        justify-content: center;
        min-height: 44px;
        padding-right: 8px;
        padding-left: 8px;
        text-align: center;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .flash,
    .toast-stack,
    .page-header,
    .no-print,
    .btn-primary,
    .btn-outline,
    nav {
        display: none !important;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .card {
        border: 0;
        box-shadow: none;
        padding: 0;
        background: transparent;
    }

    .print-stage {
        margin: 0;
    }

    .envelope-scroll {
        overflow: visible;
        padding: 0;
    }
}


.sponsor-banner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid #b8d8d5;
    border-left: 4px solid #16827d;
    border-radius: 8px;
    background: #f4fbfa;
}
.sponsor-banner:has(.sponsor-banner-image) {
    grid-template-columns: 120px minmax(0, 1fr) auto;
}
.sponsor-banner-image {
    width: 120px;
    height: 68px;
    border-radius: 4px;
    object-fit: cover;
}
.sponsor-banner-copy {
    min-width: 0;
}
.sponsor-banner-label {
    display: block;
    margin-bottom: 3px;
    color: #35706d;
    font-size: 0.75rem;
    font-weight: 700;
}
.sponsor-banner-copy strong {
    display: block;
    color: #183b3a;
    font-size: 1rem;
}
.sponsor-banner-copy p {
    margin: 4px 0 0;
    color: #4c6261;
    font-size: 0.875rem;
}
.sponsor-banner-link {
    white-space: nowrap;
}
.sponsor-banner-fallback {
    border-color: #d7dee6;
    border-left-color: #66798c;
    background: #f7f9fb;
}
@media (max-width: 700px) {
    .sponsor-banner,
    .sponsor-banner:has(.sponsor-banner-image) {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .sponsor-banner-image {
        width: 100%;
        height: auto;
        aspect-ratio: 16 / 5;
    }
    .sponsor-banner-link {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}
@media print {
    .sponsor-banner {
        display: none !important;
    }
}

.demo-notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 10px 18px;
    color: #442d00;
    background: #fff2cc;
    border-bottom: 2px solid #d69e2e;
}
.demo-notice strong { padding: 4px 8px; color: #fff; background: #9c6500; border-radius: 4px; }
.demo-notice a { color: #5d3d00; font-weight: 800; }
@media (max-width: 720px) {
    .demo-notice { grid-template-columns: auto 1fr; }
    .demo-notice a { grid-column: 1 / -1; }
}
