/* =========================================================
   Cover Maker
   Application UI
   ========================================================= */

/* -------------------------
   Design tokens
   ------------------------- */

:root {
    color-scheme: light;

    --font-sans:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;

    --color-brand-50: #eef2ff;
    --color-brand-100: #e0e7ff;
    --color-brand-200: #c7d2fe;
    --color-brand-500: #4f46e5;
    --color-brand-600: #4338ca;
    --color-brand-700: #3730a3;
    --color-brand-800: #312e81;

    --color-success-50: #ecfdf5;
    --color-success-500: #10b981;
    --color-success-700: #047857;

    --color-warning-50: #fffbeb;
    --color-warning-600: #d97706;

    --color-danger-50: #fef2f2;
    --color-danger-500: #ef4444;
    --color-danger-600: #dc2626;
    --color-danger-700: #b91c1c;

    --surface-page: #f4f6fa;
    --surface-card: #ffffff;
    --surface-elevated: #ffffff;
    --surface-muted: #f8fafc;
    --surface-input: #ffffff;
    --surface-hover: #f8fafc;

    --text-primary: #101828;
    --text-secondary: #475467;
    --text-tertiary: #667085;
    --text-placeholder: #98a2b3;

    --border-default: #e4e7ec;
    --border-strong: #d0d5dd;

    --shadow-xs:
        0 1px 2px rgba(16, 24, 40, 0.04);

    --shadow-sm:
        0 1px 3px rgba(16, 24, 40, 0.08),
        0 1px 2px rgba(16, 24, 40, 0.04);

    --shadow-md:
        0 8px 24px rgba(16, 24, 40, 0.08);

    --shadow-lg:
        0 20px 48px rgba(16, 24, 40, 0.14);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --header-height: 72px;

    --transition-fast: 140ms ease;
    --transition-normal: 220ms ease;
}

/* -------------------------
   Dark theme
   ------------------------- */

html[data-theme="dark"] {
    color-scheme: dark;

    --surface-page: #0d1117;
    --surface-card: #151a22;
    --surface-elevated: #1a2029;
    --surface-muted: #10151c;
    --surface-input: #11171f;
    --surface-hover: #1d2530;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --text-placeholder: #64748b;

    --border-default: #29313d;
    --border-strong: #3a4554;

    --color-brand-50: rgba(99, 102, 241, 0.12);
    --color-brand-100: rgba(99, 102, 241, 0.18);
    --color-brand-200: rgba(129, 140, 248, 0.28);
    --color-brand-500: #818cf8;
    --color-brand-600: #6366f1;
    --color-brand-700: #818cf8;

    --shadow-xs:
        0 1px 2px rgba(0, 0, 0, 0.2);

    --shadow-sm:
        0 2px 8px rgba(0, 0, 0, 0.2);

    --shadow-md:
        0 12px 28px rgba(0, 0, 0, 0.28);

    --shadow-lg:
        0 24px 54px rgba(0, 0, 0, 0.4);
}

/* -------------------------
   Base
   ------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    background: var(--surface-page);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;

    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;

    color: var(--text-primary);
    background:
        linear-gradient(
            180deg,
            rgba(79, 70, 229, 0.025) 0,
            transparent 320px
        ),
        var(--surface-page);

    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

svg {
    display: block;
}

[hidden] {
    display: none !important;
}

::selection {
    color: #ffffff;
    background: var(--color-brand-600);
}

/* -------------------------
   Accessibility
   ------------------------- */

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 10000;

    padding: 10px 14px;

    color: #ffffff;
    background: var(--color-brand-600);
    border-radius: var(--radius-sm);

    font-weight: 700;
    text-decoration: none;

    transform: translateY(-150%);
    transition: transform var(--transition-fast);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.28);
    outline-offset: 2px;
}

/* -------------------------
   Layout
   ------------------------- */

.app-container {
    width: min(100% - 40px, 1440px);
    margin-inline: auto;
}

.app-main {
    padding-top: 40px;
    padding-bottom: 88px;
}

/* -------------------------
   Header
   ------------------------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;

    height: var(--header-height);

    background: color-mix(
        in srgb,
        var(--surface-card) 94%,
        transparent
    );

    border-bottom: 1px solid var(--border-default);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    height: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    min-width: 0;

    color: var(--text-primary);
    text-decoration: none;
}

.brand__mark {
    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: 44px;
    height: 44px;

    overflow: hidden;
    border-radius: 10px;
}

.brand__mark img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.brand__text {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.brand__text strong {
    overflow: hidden;

    font-size: 17px;
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -0.02em;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand__text small {
    margin-top: 2px;

    color: var(--text-tertiary);

    font-size: 12px;
    line-height: 1.2;
    font-weight: 500;
}

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

.header-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;

    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;

    font-size: 14px;
    font-weight: 650;
    text-decoration: none;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        border-color var(--transition-fast);
}

.header-button:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    border-color: var(--border-default);
}

.header-button--text {
    padding-inline: 13px;
}

.header-button--icon {
    width: 40px;
    padding: 0;
}

.header-button--icon svg {
    width: 19px;
    height: 19px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.network-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    height: 34px;
    margin-right: 4px;
    padding-inline: 11px;

    color: var(--text-tertiary);
    background: var(--surface-muted);
    border: 1px solid var(--border-default);
    border-radius: 999px;

    font-size: 12px;
    font-weight: 650;
}

.network-status__dot {
    width: 7px;
    height: 7px;

    background: var(--color-success-500);
    border-radius: 999px;

    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.network-status.is-offline .network-status__dot {
    background: var(--color-warning-600);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

/* -------------------------
   Connectivity banner
   ------------------------- */

.connection-banner {
    position: relative;
    z-index: 120;

    color: #92400e;
    background: var(--color-warning-50);
    border-bottom: 1px solid rgba(217, 119, 6, 0.18);
}

.connection-banner__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 38px;
    padding: 8px 20px;

    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.connection-banner__dot {
    flex: 0 0 auto;

    width: 7px;
    height: 7px;

    background: var(--color-warning-600);
    border-radius: 50%;
}

/* -------------------------
   Draft recovery
   ------------------------- */

.draft-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    margin-top: 24px;
    padding: 18px 20px;

    background: var(--color-brand-50);
    border: 1px solid var(--color-brand-200);
    border-radius: var(--radius-md);
}

.draft-notice strong {
    display: block;

    font-size: 14px;
    font-weight: 750;
}

.draft-notice p {
    margin: 3px 0 0;

    color: var(--text-secondary);

    font-size: 13px;
}

.draft-notice__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

/* -------------------------
   Intro
   ------------------------- */

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;

    margin-bottom: 28px;
}

.eyebrow {
    margin: 0 0 7px;

    color: var(--color-brand-600);

    font-size: 12px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.page-intro h1 {
    margin: 0;

    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.12;
    font-weight: 780;
    letter-spacing: -0.035em;
}

.page-intro__description {
    max-width: 680px;
    margin: 9px 0 0;

    color: var(--text-secondary);

    font-size: 15px;
}

.page-intro__actions {
    flex: 0 0 auto;
}

/* -------------------------
   Workspace
   ------------------------- */

.workspace {
    display: grid;
    grid-template-columns:
        minmax(0, 1.04fr)
        minmax(420px, 0.96fr);

    align-items: start;
    gap: 28px;
}

.workspace__form {
    min-width: 0;
}

.workspace__preview {
    position: sticky;
    top: calc(var(--header-height) + 24px);

    min-width: 0;
}

/* -------------------------
   Generic buttons
   ------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 44px;
    padding: 10px 16px;

    border: 1px solid transparent;
    border-radius: 10px;

    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;

    cursor: pointer;
    user-select: none;

    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast),
        color var(--transition-fast);
}

.button:active {
    transform: translateY(1px);
}

.button svg {
    width: 18px;
    height: 18px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button--primary {
    color: #ffffff;
    background: var(--color-brand-600);
    border-color: var(--color-brand-600);

    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.04),
        0 2px 5px rgba(67, 56, 202, 0.18);
}

.button--primary:hover {
    background: var(--color-brand-700);
    border-color: var(--color-brand-700);
}

.button--secondary {
    color: var(--text-primary);
    background: var(--surface-card);
    border-color: var(--border-strong);

    box-shadow: var(--shadow-xs);
}

.button--secondary:hover {
    background: var(--surface-hover);
}

.button--danger {
    color: #ffffff;
    background: var(--color-danger-600);
    border-color: var(--color-danger-600);
}

.button--danger:hover {
    background: var(--color-danger-700);
    border-color: var(--color-danger-700);
}

.button--small {
    min-height: 38px;
    padding: 8px 13px;

    font-size: 13px;
}

.button--large {
    min-height: 48px;
    padding-inline: 20px;
}

.text-button,
.footer-link-button {
    padding: 0;

    color: var(--color-brand-600);
    background: transparent;
    border: 0;

    font-size: 13px;
    font-weight: 700;

    cursor: pointer;
}

.text-button:hover,
.footer-link-button:hover {
    text-decoration: underline;
}

/* -------------------------
   Form cards
   ------------------------- */

.form-card {
    margin-bottom: 18px;
    padding: 24px;

    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-xs);
}

.form-card--compact {
    padding: 20px 24px;
}

.form-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;

    margin-bottom: 22px;
}

.form-card__header > div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-card__header h2 {
    margin: 0;

    font-size: 17px;
    line-height: 1.3;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.form-card__header p {
    max-width: 330px;
    margin: 2px 0 0;

    color: var(--text-tertiary);

    font-size: 12px;
    line-height: 1.45;
    text-align: right;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 28px;
    height: 24px;
    padding-inline: 7px;

    color: var(--color-brand-700);
    background: var(--color-brand-50);
    border: 1px solid var(--color-brand-100);
    border-radius: 6px;

    font-size: 11px;
    line-height: 1;
    font-weight: 800;
}

/* -------------------------
   Segmented control
   ------------------------- */

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    padding: 4px;

    background: var(--surface-muted);
    border: 1px solid var(--border-default);
    border-radius: 11px;
}

.segmented-control__button {
    min-height: 42px;
    padding: 8px 14px;

    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: 8px;

    font-size: 14px;
    font-weight: 700;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.segmented-control__button:hover {
    color: var(--text-primary);
}

.segmented-control__button.is-active {
    color: var(--text-primary);
    background: var(--surface-elevated);

    box-shadow: var(--shadow-sm);
}

.segmented-control--small {
    width: min(100%, 360px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segmented-control--small .segmented-control__button {
    min-height: 38px;
    padding-inline: 10px;

    font-size: 13px;
}

/* -------------------------
   Form controls
   ------------------------- */

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

.field {
    position: relative;
    min-width: 0;
}

.field--wide {
    grid-column: 1 / -1;
}

.field label {
    display: block;

    margin-bottom: 7px;

    color: var(--text-secondary);

    font-size: 13px;
    line-height: 1.3;
    font-weight: 700;
}

.field label > span {
    color: var(--color-danger-500);
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;

    color: var(--text-primary);
    background: var(--surface-input);
    border: 1px solid var(--border-strong);
    border-radius: 9px;

    font-size: 14px;
    line-height: 1.4;

    outline: none;

    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast);
}

.field input::placeholder {
    color: var(--text-placeholder);
}

.field input:hover,
.field select:hover {
    border-color: color-mix(
        in srgb,
        var(--border-strong) 72%,
        var(--text-secondary)
    );
}

.field input:focus,
.field select:focus {
    border-color: var(--color-brand-500);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--color-brand-500) 14%,
            transparent
        );
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] {
    border-color: var(--color-danger-500);
}

.field input[aria-invalid="true"]:focus,
.field select[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.field-error {
    display: block;

    min-height: 0;
    margin-top: 5px;

    color: var(--color-danger-600);

    font-size: 11px;
    line-height: 1.4;
    font-weight: 600;
}

.field-error:empty {
    display: none;
}

.field-hint {
    display: block;

    margin-top: 5px;

    color: var(--text-tertiary);

    font-size: 11px;
    line-height: 1.4;
}

.select-control {
    position: relative;
}

.select-control::after {
    content: "";

    position: absolute;
    top: 50%;
    right: 13px;

    width: 7px;
    height: 7px;

    border-right: 1.5px solid var(--text-tertiary);
    border-bottom: 1.5px solid var(--text-tertiary);

    pointer-events: none;

    transform:
        translateY(-65%)
        rotate(45deg);
}

.select-control select {
    padding-right: 34px;
    appearance: none;
}

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

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 13px;
    z-index: 2;

    width: 17px;
    height: 17px;

    fill: none;
    stroke: var(--text-tertiary);
    stroke-width: 1.8;
    stroke-linecap: round;

    pointer-events: none;

    transform: translateY(-50%);
}

.input-icon-wrapper input {
    padding-left: 39px;
}

/* -------------------------
   Faculty autocomplete
   ------------------------- */

.faculty-search {
    z-index: 10;
}

.autocomplete {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    z-index: 50;

    max-height: 300px;
    margin: 6px 0 0;
    padding: 5px;

    overflow-y: auto;
    overscroll-behavior: contain;

    list-style: none;

    background: var(--surface-elevated);
    border: 1px solid var(--border-default);
    border-radius: 11px;

    box-shadow: var(--shadow-lg);
}

.autocomplete__item {
    display: block;

    width: 100%;
    padding: 10px 11px;

    color: var(--text-primary);
    background: transparent;
    border: 0;
    border-radius: 7px;

    text-align: left;

    cursor: pointer;

    transition: background var(--transition-fast);
}

.autocomplete__item:hover,
.autocomplete__item.is-active {
    background: var(--surface-hover);
}

.autocomplete__item strong {
    display: block;

    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
}

.autocomplete__item span {
    display: block;

    margin-top: 3px;

    color: var(--text-tertiary);

    font-size: 11px;
    line-height: 1.4;
}

/* -------------------------
   Remember profile
   ------------------------- */

.profile-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-top: 22px;
    padding-top: 20px;

    border-top: 1px solid var(--border-default);
}

.checkbox-control {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    cursor: pointer;
}

.checkbox-control input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
    pointer-events: none;
}

.checkbox-control__box {
    position: relative;

    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: 18px;
    height: 18px;
    margin-top: 1px;

    background: var(--surface-input);
    border: 1px solid var(--border-strong);
    border-radius: 5px;

    transition:
        background var(--transition-fast),
        border-color var(--transition-fast);
}

.checkbox-control input:checked + .checkbox-control__box {
    background: var(--color-brand-600);
    border-color: var(--color-brand-600);
}

.checkbox-control input:checked + .checkbox-control__box::after {
    content: "";

    width: 7px;
    height: 4px;

    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;

    transform:
        translateY(-1px)
        rotate(-45deg);
}

.checkbox-control input:focus-visible + .checkbox-control__box {
    outline: 3px solid rgba(79, 70, 229, 0.2);
    outline-offset: 2px;
}

.checkbox-control strong {
    display: block;

    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;
}

.checkbox-control small {
    display: block;

    max-width: 420px;
    margin-top: 3px;

    color: var(--text-tertiary);

    font-size: 11px;
    line-height: 1.4;
}

/* -------------------------
   Form footer/actions
   ------------------------- */

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    padding-top: 4px;
}

.form-actions__note {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    max-width: 430px;

    color: var(--text-tertiary);

    font-size: 11px;
    line-height: 1.45;
}

.form-actions__note svg {
    flex: 0 0 auto;

    width: 16px;
    height: 16px;
    margin-top: 1px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-actions__buttons {
    display: flex;
    flex: 0 0 auto;
    gap: 9px;
}

/* -------------------------
   Preview
   ------------------------- */

.preview-panel {
    overflow: hidden;

    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-sm);
}

.preview-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    min-height: 74px;
    padding: 16px 18px;

    border-bottom: 1px solid var(--border-default);
}

.preview-panel__label {
    display: block;

    margin-bottom: 2px;

    color: var(--color-brand-600);

    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-panel__header h2 {
    margin: 0;

    font-size: 15px;
    line-height: 1.3;
    font-weight: 750;
}

.icon-button {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;

    width: 38px;
    height: 38px;
    padding: 0;

    color: var(--text-secondary);
    background: var(--surface-muted);
    border: 1px solid var(--border-default);
    border-radius: 9px;

    cursor: pointer;

    transition:
        color var(--transition-fast),
        background var(--transition-fast),
        border-color var(--transition-fast);
}

.icon-button:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.icon-button svg {
    width: 17px;
    height: 17px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.preview-stage {
    display: grid;
    place-items: center;

    min-height: min(690px, calc(100vh - 230px));
    padding: 26px;

    overflow: auto;

    background:
        linear-gradient(
            45deg,
            rgba(148, 163, 184, 0.055) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(148, 163, 184, 0.055) 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            rgba(148, 163, 184, 0.055) 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            rgba(148, 163, 184, 0.055) 75%
        ),
        var(--surface-muted);

    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;

    background-size: 20px 20px;
}

.cover-preview {
    position: relative;

    width: min(100%, 510px);
    aspect-ratio: 210 / 297;

    overflow: hidden;

    color: #111827;
    background: #ffffff;

    box-shadow:
        0 4px 16px rgba(15, 23, 42, 0.08),
        0 18px 48px rgba(15, 23, 42, 0.12);
}

.preview-placeholder {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 48px;

    color: #667085;
    text-align: center;
}

.preview-placeholder img {
    width: 64px;
    height: 64px;
    margin-bottom: 18px;

    object-fit: contain;

    opacity: 0.38;
    filter: grayscale(1);
}

.preview-placeholder strong {
    color: #344054;

    font-size: 15px;
    font-weight: 700;
}

.preview-placeholder p {
    max-width: 270px;
    margin: 7px 0 0;

    font-size: 12px;
    line-height: 1.55;
}

.preview-panel__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 46px;
    padding: 10px 18px;

    color: var(--text-tertiary);
    border-top: 1px solid var(--border-default);

    font-size: 10px;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

/* -------------------------
   Dialog base
   ------------------------- */

dialog {
    padding: 0;

    color: var(--text-primary);
    background: transparent;
    border: 0;

    outline: none;
}

dialog::backdrop {
    background: rgba(15, 23, 42, 0.64);

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* -------------------------
   Preview dialog
   ------------------------- */

.preview-dialog {
    width: min(100% - 32px, 1050px);
    max-height: calc(100dvh - 32px);

    overflow: hidden;

    border-radius: var(--radius-lg);
}

.preview-dialog__surface {
    display: flex;
    flex-direction: column;

    max-height: calc(100dvh - 32px);

    overflow: hidden;

    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.preview-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 16px 18px;

    border-bottom: 1px solid var(--border-default);
}

.preview-dialog__header span {
    display: block;

    color: var(--color-brand-600);

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-dialog__header h2 {
    margin: 2px 0 0;

    font-size: 16px;
}

.preview-dialog__body {
    display: grid;
    place-items: center;

    min-height: 0;
    padding: 24px;

    overflow: auto;

    background: var(--surface-muted);
}

.preview-dialog__body .cover-preview {
    width: min(100%, 560px);
}

.preview-dialog__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;

    padding: 14px 18px;

    border-top: 1px solid var(--border-default);
}

/* -------------------------
   PDF result dialog
   ------------------------- */

.result-dialog {
    width: min(100% - 32px, 480px);

    border-radius: var(--radius-lg);
}

.result-dialog__surface {
    position: relative;

    padding: 30px;

    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.result-dialog__icon {
    display: grid;
    place-items: center;

    width: 48px;
    height: 48px;
    margin-bottom: 18px;

    color: var(--color-success-700);
    background: var(--color-success-50);
    border-radius: 50%;
}

.result-dialog__icon svg {
    width: 23px;
    height: 23px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.result-dialog__content h2 {
    margin: 0;

    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.result-dialog__content p {
    margin: 8px 0 0;

    color: var(--text-secondary);

    font-size: 13px;
    line-height: 1.55;
}

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

    margin-top: 24px;
}

.result-dialog__actions .button:last-child {
    grid-column: 1 / -1;
}

.result-dialog__close {
    position: absolute;
    top: 14px;
    right: 14px;

    display: grid;
    place-items: center;

    width: 34px;
    height: 34px;

    color: var(--text-tertiary);
    background: transparent;
    border: 0;
    border-radius: 8px;

    cursor: pointer;
}

.result-dialog__close:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.result-dialog__close svg {
    width: 16px;
    height: 16px;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

/* -------------------------
   Settings dialog
   ------------------------- */

.settings-dialog {
    width: min(100% - 32px, 620px);

    border-radius: var(--radius-lg);
}

.settings-dialog__surface {
    overflow: hidden;

    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-lg);
}

.settings-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 22px 24px;

    border-bottom: 1px solid var(--border-default);
}

.settings-dialog__header h2 {
    margin: 0;

    font-size: 20px;
    letter-spacing: -0.02em;
}

.settings-dialog__body {
    padding: 0 24px;
}

.settings-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;

    padding: 24px 0;

    border-bottom: 1px solid var(--border-default);
}

.settings-group:last-child {
    border-bottom: 0;
}

.settings-group h3 {
    margin: 0;

    font-size: 14px;
    font-weight: 750;
}

.settings-group p {
    max-width: 260px;
    margin: 5px 0 0;

    color: var(--text-tertiary);

    font-size: 12px;
    line-height: 1.5;
}

.settings-group--danger {
    align-items: flex-start;
}

.settings-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;

    min-width: 170px;
}

/* -------------------------
   App toast
   ------------------------- */

.app-toast {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 500;

    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 13px;

    width: min(calc(100vw - 40px), 420px);
    padding: 16px;

    background: var(--surface-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-lg);
}

.app-toast__icon {
    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;

    overflow: hidden;

    background: var(--surface-muted);
    border: 1px solid var(--border-default);
    border-radius: 10px;
}

.app-toast__icon img {
    width: 36px;
    height: 36px;

    object-fit: contain;
}

.app-toast__content {
    min-width: 0;
}

.app-toast__content strong {
    display: block;

    font-size: 13px;
    font-weight: 750;
}

.app-toast__content p {
    margin: 3px 0 0;

    color: var(--text-tertiary);

    font-size: 11px;
    line-height: 1.45;
}

.app-toast__actions {
    grid-column: 1 / -1;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 13px;

    padding-top: 3px;
}

/* -------------------------
   Footer
   ------------------------- */

.app-footer {
    border-top: 1px solid var(--border-default);
}

.app-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    min-height: 88px;
    padding-top: 18px;
    padding-bottom: 18px;
}

.app-footer__inner > div {
    display: flex;
    flex-direction: column;
}

.app-footer strong {
    font-size: 13px;
    font-weight: 750;
}

.app-footer span {
    margin-top: 2px;

    color: var(--text-tertiary);

    font-size: 11px;
}

.app-footer nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.app-footer a,
.app-footer button {
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
}

.app-footer a:hover,
.app-footer button:hover {
    color: var(--text-primary);
}

/* -------------------------
   Mobile action bar
   ------------------------- */

.mobile-action-bar {
    display: none;
}

/* -------------------------
   Responsive - medium desktop
   ------------------------- */

@media (max-width: 1180px) {
    .workspace {
        grid-template-columns:
            minmax(0, 1.08fr)
            minmax(330px, 0.92fr);

        gap: 20px;
    }

    .preview-stage {
        padding: 16px;
    }

    .form-card__header {
        display: block;
    }

    .form-card__header p {
        max-width: none;
        margin-top: 8px;

        text-align: left;
    }
}

/* -------------------------
   Responsive - tablet
   ------------------------- */

@media (max-width: 820px) {
    .app-container {
        width: min(100% - 32px, 820px);
    }

    .app-main {
        padding-top: 30px;
    }

    .workspace {
        display: block;
    }

    .workspace__preview {
        display: none;
    }

    .page-intro {
        align-items: center;
    }

    .form-actions {
        margin-bottom: 18px;
    }
}

/* -------------------------
   Responsive - mobile
   ------------------------- */

@media (max-width: 640px) {
    :root {
        --header-height: 64px;
    }

    body {
        padding-bottom:
            calc(
                76px +
                env(safe-area-inset-bottom)
            );
    }

    .app-container {
        width: min(100% - 24px, 620px);
    }

    .app-header__inner {
        gap: 10px;
    }

    .brand {
        gap: 9px;
    }

    .brand__mark,
    .brand__mark img {
        width: 38px;
        height: 38px;
    }

    .brand__text strong {
        font-size: 15px;
    }

    .brand__text small {
        font-size: 10px;
    }

    .network-status,
    .header-button--text {
        display: none;
    }

    .header-button--icon {
        width: 40px;
        height: 40px;
    }

    .connection-banner__inner {
        justify-content: flex-start;
        text-align: left;
    }

    .draft-notice {
        display: block;

        margin-top: 16px;
        padding: 15px;
    }

    .draft-notice__actions {
        justify-content: flex-end;

        margin-top: 13px;
    }

    .app-main {
        padding-top: 24px;
        padding-bottom: 32px;
    }

    .page-intro {
        display: block;

        margin-bottom: 20px;
    }

    .page-intro h1 {
        font-size: 28px;
    }

    .page-intro__description {
        font-size: 13px;
        line-height: 1.55;
    }

    .page-intro__actions {
        display: none;
    }

    .form-card {
        margin-bottom: 12px;
        padding: 18px 16px;

        border-radius: 13px;
    }

    .form-card--compact {
        padding: 16px;
    }

    .form-card__header {
        margin-bottom: 18px;
    }

    .form-card__header > div {
        gap: 8px;
    }

    .form-card__header h2 {
        font-size: 16px;
    }

    .form-card__header p {
        margin-top: 7px;

        font-size: 11px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .field--wide {
        grid-column: auto;
    }

    .field input,
    .field select {
        min-height: 48px;

        font-size: 16px;
    }

    .field label {
        font-size: 12px;
    }

    .segmented-control__button {
        min-height: 44px;
    }

    .split-inputs {
        gap: 7px;
    }

    .profile-option {
        display: block;

        margin-top: 19px;
        padding-top: 17px;
    }

    .profile-option > .text-button {
        margin-top: 13px;
        margin-left: 28px;
    }

    .form-actions {
        display: none;
    }

    .mobile-action-bar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 300;

        display: block;

        padding:
            10px
            max(12px, env(safe-area-inset-right))
            calc(
                10px +
                env(safe-area-inset-bottom)
            )
            max(12px, env(safe-area-inset-left));

        background:
            color-mix(
                in srgb,
                var(--surface-card) 94%,
                transparent
            );

        border-top: 1px solid var(--border-default);

        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .mobile-action-bar__inner {
        display: grid;
        grid-template-columns: 0.72fr 1.28fr;
        gap: 8px;

        width: min(100%, 620px);
        margin-inline: auto;
    }

    .mobile-action-bar .button {
        min-height: 48px;
    }

    .app-footer {
        margin-bottom: 0;
    }

    .app-footer__inner {
        display: block;

        min-height: auto;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .app-footer nav {
        margin-top: 15px;
    }

    .preview-dialog {
        width: 100%;
        max-width: none;
        max-height: 100dvh;

        margin: 0;

        border-radius: 0;
    }

    .preview-dialog__surface {
        height: 100dvh;
        max-height: 100dvh;

        border: 0;
        border-radius: 0;
    }

    .preview-dialog__body {
        padding: 16px 12px;
    }

    .preview-dialog__footer {
        padding:
            11px
            12px
            calc(
                11px +
                env(safe-area-inset-bottom)
            );
    }

    .preview-dialog__footer .button {
        flex: 1;
    }

    .result-dialog {
        width: calc(100% - 24px);
    }

    .result-dialog__surface {
        padding: 24px 18px 18px;
    }

    .result-dialog__actions {
        grid-template-columns: 1fr;
    }

    .result-dialog__actions .button:last-child {
        grid-column: auto;
    }

    .settings-dialog {
        width: calc(100% - 24px);
    }

    .settings-dialog__header {
        padding: 18px;
    }

    .settings-dialog__body {
        padding: 0 18px;
    }

    .settings-group {
        display: block;

        padding: 20px 0;
    }

    .settings-group p {
        max-width: none;
    }

    .settings-group .segmented-control,
    .settings-buttons {
        width: 100%;
        margin-top: 16px;
    }

    .app-toast {
        right: 12px;
        bottom:
            calc(
                84px +
                env(safe-area-inset-bottom)
            );
        left: 12px;

        width: auto;
    }
}

/* -------------------------
   Very small devices
   ------------------------- */

@media (max-width: 380px) {
    .app-container {
        width: min(100% - 18px, 620px);
    }

    .brand__text small {
        display: none;
    }

    .page-intro h1 {
        font-size: 25px;
    }

    .form-card {
        padding-inline: 13px;
    }

    .split-inputs {
        grid-template-columns: 1fr;
    }
}

/* -------------------------
   Reduced motion
   ------------------------- */

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

/* -------------------------
   Print safety
   ------------------------- */

@media print {
    .app-header,
    .connection-banner,
    .draft-notice,
    .page-intro,
    .workspace__form,
    .preview-panel__header,
    .preview-panel__footer,
    .mobile-action-bar,
    .app-footer,
    .app-toast {
        display: none !important;
    }

    body {
        padding: 0;

        background: #ffffff;
    }
}


/* =========================================================
   Workspace layout - final responsive override
   Keep desktop preview beside the form
   ========================================================= */

/* Desktop and laptop */
@media screen and (min-width: 821px) {
    .app-container {
        width: min(100% - 32px, 1440px);
    }

    .workspace {
        display: grid !important;

        grid-template-columns:
            minmax(0, 1.12fr)
            minmax(340px, 0.88fr) !important;

        align-items: start;
        gap: 24px;
    }

    .workspace__form {
        display: block;
        min-width: 0;
        width: auto;
    }

    .workspace__preview {
        display: block !important;

        position: sticky;
        top: calc(var(--header-height) + 20px);

        min-width: 0;
        width: auto;

        align-self: start;
    }

    .preview-panel {
        width: 100%;
    }

    .preview-stage {
        width: 100%;

        min-height: 620px;
        padding: 18px;
    }

    .cover-preview {
        width: min(100%, 500px);
        margin-inline: auto;
    }
}


/* Tablet and mobile */
@media screen and (max-width: 820px) {
    .workspace {
        display: block !important;
    }

    .workspace__form {
        width: 100%;
    }

    .workspace__preview {
        display: none !important;
    }
}

/* =========================================================
   PDF Attachment
   ========================================================= */

.field-optional {
    margin-left: 5px;

    color: var(--text-tertiary) !important;

    font-size: 10px;
    font-weight: 600;
}

.pdf-upload {
    position: relative;

    display: grid;
    grid-template-columns:
        auto
        minmax(0, 1fr)
        auto;

    align-items: center;
    gap: 14px;

    min-height: 82px;
    padding: 14px;

    background: var(--surface-muted);

    border:
        1px dashed
        var(--border-strong);

    border-radius: 11px;

    transition:
        border-color var(--transition-fast),
        background var(--transition-fast);
}

.pdf-upload:hover {
    border-color:
        var(--color-brand-500);

    background:
        color-mix(
            in srgb,
            var(--color-brand-50) 42%,
            var(--surface-muted)
        );
}

/*
 * Hide the native file input.
 * The styled label acts as the file picker.
 */
.pdf-upload > input[type="file"] {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;

    pointer-events: none;
}

.pdf-upload__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 42px;
    padding: 9px 14px;

    color: var(--text-primary);

    background:
        var(--surface-card);

    border:
        1px solid
        var(--border-strong);

    border-radius: 9px;

    box-shadow:
        var(--shadow-xs);

    font-size: 13px;
    line-height: 1;
    font-weight: 700;

    cursor: pointer;

    user-select: none;

    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        transform var(--transition-fast);
}

.pdf-upload__button:hover {
    background:
        var(--surface-hover);

    border-color:
        var(--color-brand-500);
}

.pdf-upload__button:active {
    transform:
        translateY(1px);
}

.pdf-upload__button svg {
    display: block;

    width: 17px;
    height: 17px;

    flex: 0 0 auto;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 2;

    stroke-linecap: round;
    stroke-linejoin: round;
}

.pdf-upload__info {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.pdf-upload__info strong {
    overflow: hidden;

    color:
        var(--text-primary);

    font-size: 13px;
    line-height: 1.35;
    font-weight: 700;

    text-overflow:
        ellipsis;

    white-space:
        nowrap;
}

.pdf-upload__info span {
    margin-top: 4px;

    color:
        var(--text-tertiary);

    font-size: 11px;
    line-height: 1.4;
}

.pdf-upload > .text-button {
    flex: 0 0 auto;

    color:
        var(--color-danger-600);
}


/* Selected file state */

.pdf-upload:has(
    input[type="file"]:valid
) {
    border-style:
        solid;
}


/* Mobile */

@media (max-width: 640px) {
    .pdf-upload {
        grid-template-columns:
            1fr;

        gap: 11px;

        padding: 13px;
    }

    .pdf-upload__button {
        width: 100%;
    }

    .pdf-upload__info {
        text-align: center;
    }

    .pdf-upload__info strong {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .pdf-upload > .text-button {
        justify-self: center;
    }
}

/* =========================================================
   COVER MAKER V2
   Final Application UI
   ========================================================= */


/* =========================================================
   1. Application palette
   ========================================================= */

:root {
    --ui-bg: #f5f4ef;
    --ui-bg-soft: #f8f8f5;

    --ui-surface: #ffffff;
    --ui-surface-soft: #f1f3f5;
    --ui-surface-blue: #f4f6ff;

    --ui-text: #20242c;
    --ui-text-strong: #182033;
    --ui-text-muted: #687181;
    --ui-text-soft: #8c94a1;

    --ui-blue: #293aa8;
    --ui-blue-dark: #202d7d;
    --ui-blue-soft: #e9ecff;

    --ui-navy: #26364d;

    --ui-teal: #38736f;
    --ui-teal-soft: #e7f2f0;

    --ui-amber: #a97832;
    --ui-amber-soft: #f5ecdc;

    --ui-danger: #b84a4a;
    --ui-danger-soft: #fbecec;

    --ui-border: #dcdfe4;
    --ui-border-strong: #c7ccd4;

    --ui-shadow-xs:
        0 1px 2px
        rgba(31, 37, 48, 0.05);

    --ui-shadow-sm:
        0 4px 14px
        rgba(31, 37, 48, 0.07);

    --ui-shadow-md:
        0 14px 38px
        rgba(31, 37, 48, 0.12);

    --ui-shadow-drawer:
        -20px 0 55px
        rgba(16, 24, 40, 0.17);

    --ui-radius-sm: 9px;
    --ui-radius-md: 14px;
    --ui-radius-lg: 18px;

    --ui-header-height: 72px;
}


/* =========================================================
   2. Dark mode
   ========================================================= */

html[data-theme="dark"] {
    --ui-bg: #15181d;
    --ui-bg-soft: #191d23;

    --ui-surface: #20242b;
    --ui-surface-soft: #262b33;
    --ui-surface-blue: #23283d;

    --ui-text: #edf0f4;
    --ui-text-strong: #ffffff;
    --ui-text-muted: #adb5c2;
    --ui-text-soft: #838c99;

    --ui-blue: #8290ff;
    --ui-blue-dark: #a5afff;
    --ui-blue-soft: #2b3152;

    --ui-navy: #cdd5e1;

    --ui-teal: #70b3ad;
    --ui-teal-soft: #213a39;

    --ui-amber: #d7ae72;
    --ui-amber-soft: #3a3022;

    --ui-danger: #e17a7a;
    --ui-danger-soft: #402526;

    --ui-border: #343b46;
    --ui-border-strong: #444d59;

    --ui-shadow-xs:
        0 1px 2px
        rgba(0, 0, 0, 0.2);

    --ui-shadow-sm:
        0 5px 18px
        rgba(0, 0, 0, 0.22);

    --ui-shadow-md:
        0 18px 45px
        rgba(0, 0, 0, 0.32);

    --ui-shadow-drawer:
        -20px 0 55px
        rgba(0, 0, 0, 0.46);
}


/* =========================================================
   3. Base application
   ========================================================= */

html {
    background:
        var(--ui-bg);
}

body {
    color:
        var(--ui-text);

    background:
        var(--ui-bg);

    font-family:
        Inter,
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

html.drawer-is-open,
body.drawer-is-open {
    overflow: hidden;
}

.app-container {
    width:
        min(
            calc(100% - 40px),
            1440px
        );

    margin-inline: auto;
}


/* =========================================================
   4. Header
   ========================================================= */

.app-header {
    position: relative;
    z-index: 50;

    height:
        var(--ui-header-height);

    background:
        color-mix(
            in srgb,
            var(--ui-surface) 94%,
            transparent
        );

    border-bottom:
        1px solid
        var(--ui-border);

    box-shadow:
        0 1px 0
        rgba(255, 255, 255, 0.5);

    backdrop-filter:
        blur(14px);

    -webkit-backdrop-filter:
        blur(14px);
}

.app-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    height: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;

    color:
        var(--ui-text-strong);

    text-decoration: none;
}

.brand__mark {
    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        11px;

    box-shadow:
        var(--ui-shadow-xs);
}

.brand__mark img {
    display: block;

    width: 34px;
    height: 34px;

    object-fit: contain;
}

.brand__text {
    display: flex;
    flex-direction: column;

    line-height: 1.15;
}

.brand__text strong {
    color:
        var(--ui-text-strong);

    font-size: 15px;
    font-weight: 750;
}

.brand__text small {
    margin-top: 4px;

    color:
        var(--ui-text-muted);

    font-size: 10px;
    font-weight: 600;

    letter-spacing: 0.03em;
}


/* =========================================================
   5. Header status
   ========================================================= */

.header-status {
    display: flex;
    align-items: center;
    gap: 13px;
}

.header-status__connection {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    min-height: 32px;

    padding:
        6px
        10px;

    color:
        var(--ui-teal);

    background:
        var(--ui-teal-soft);

    border-radius:
        999px;

    font-size: 11px;
    font-weight: 700;
}

.network-status__dot {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    background:
        var(--ui-teal);

    border-radius:
        50%;

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--ui-teal) 12%,
            transparent
        );
}

.network-status.is-offline {
    color:
        var(--ui-amber);

    background:
        var(--ui-amber-soft);
}

.network-status.is-offline
.network-status__dot {
    background:
        var(--ui-amber);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--ui-amber) 12%,
            transparent
        );
}

.header-status__separator {
    width: 1px;
    height: 20px;

    background:
        var(--ui-border);
}

.header-status__date {
    color:
        var(--ui-text-muted);

    font-size: 12px;
    font-weight: 650;

    white-space: nowrap;
}


/* =========================================================
   6. Hamburger button
   ========================================================= */

.menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    gap: 4px;

    width: 42px;
    height: 42px;

    margin-left: 3px;
    padding: 0;

    color:
        var(--ui-text-strong);

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        11px;

    box-shadow:
        var(--ui-shadow-xs);

    cursor: pointer;

    transition:
        border-color 150ms ease,
        background 150ms ease,
        transform 150ms ease;
}

.menu-button:hover {
    background:
        var(--ui-surface-soft);

    border-color:
        var(--ui-border-strong);
}

.menu-button:active {
    transform:
        scale(0.96);
}

.menu-button span {
    display: block;

    width: 17px;
    height: 1.6px;

    background:
        currentColor;

    border-radius:
        999px;
}


/* =========================================================
   7. Connection banner
   ========================================================= */

.connection-banner {
    position: relative;
    z-index: 45;

    color:
        #2d2415;

    background:
        #f4dfbb;

    border-bottom:
        1px solid
        #e4c98f;
}

html[data-theme="dark"]
.connection-banner {
    color:
        #f4e7cf;

    background:
        #433823;

    border-color:
        #5a492c;
}


/* =========================================================
   8. Main content
   ========================================================= */

.app-main {
    padding-top: 38px;
    padding-bottom: 72px;
}


/* =========================================================
   9. Page intro
   ========================================================= */

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;

    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 8px;

    color:
        var(--ui-blue);

    font-size: 10px;
    line-height: 1.2;

    font-weight: 800;

    letter-spacing: 0.12em;

    text-transform: uppercase;
}

.page-intro h1 {
    margin: 0;

    color:
        var(--ui-text-strong);

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size:
        clamp(
            29px,
            3vw,
            41px
        );

    line-height: 1.08;

    letter-spacing:
        -0.025em;
}

.page-intro__description {
    max-width: 660px;

    margin:
        12px
        0
        0;

    color:
        var(--ui-text-muted);

    font-size: 14px;
    line-height: 1.65;
}


/* =========================================================
   10. Main workspace
   ========================================================= */

.workspace {
    display: grid !important;

    grid-template-columns:
        minmax(0, 1.08fr)
        minmax(360px, 0.92fr) !important;

    align-items: start;

    gap: 28px;
}

.workspace__form,
.workspace__preview {
    min-width: 0;
}


/* =========================================================
   11. CRITICAL:
   Desktop preview no longer follows scrolling
   ========================================================= */

@media screen and (min-width: 821px) {
    .workspace__preview {
        position: static !important;

        top: auto !important;

        align-self: start;
    }
}


/* =========================================================
   12. Form cards
   ========================================================= */

.form-card {
    position: relative;

    margin-bottom: 18px;

    padding:
        24px
        25px;

    overflow: visible;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        var(--ui-radius-lg);

    box-shadow:
        var(--ui-shadow-xs);
}

.form-card--compact {
    padding:
        21px
        25px;

    background:
        linear-gradient(
            135deg,
            var(--ui-surface) 0%,
            var(--ui-surface-blue) 135%
        );
}

.form-card::before {
    content: "";

    position: absolute;

    top: 26px;
    left: 0;

    width: 3px;
    height: 34px;

    background:
        var(--ui-blue);

    border-radius:
        0
        3px
        3px
        0;
}


/* Cover details: amber */
.form-card:nth-of-type(2)::before {
    background:
        var(--ui-amber);
}


/* Submitted To: teal */
.form-card:nth-of-type(3)::before {
    background:
        var(--ui-teal);
}


/* Submitted By: university blue */
.form-card:nth-of-type(4)::before {
    background:
        var(--ui-blue);
}


/* =========================================================
   13. Card headers
   ========================================================= */

.form-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 23px;
}

.form-card__header > div {
    min-width: 0;
}

.form-card__header h2 {
    margin: 0;

    color:
        var(--ui-text-strong);

    font-size: 16px;
    line-height: 1.25;

    font-weight: 750;
}

.form-card__header p {
    max-width: 260px;

    margin: 0;

    color:
        var(--ui-text-muted);

    font-size: 11px;
    line-height: 1.5;

    text-align: right;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 31px;
    height: 22px;

    margin-bottom: 9px;

    padding-inline: 7px;

    color:
        var(--ui-amber);

    background:
        var(--ui-amber-soft);

    border-radius:
        999px;

    font-size: 9px;
    line-height: 1;

    font-weight: 800;

    letter-spacing: 0.06em;
}

.form-card:nth-of-type(3)
.section-number {
    color:
        var(--ui-teal);

    background:
        var(--ui-teal-soft);
}

.form-card:nth-of-type(4)
.section-number {
    color:
        var(--ui-blue);

    background:
        var(--ui-blue-soft);
}


/* =========================================================
   14. Fields
   ========================================================= */

.field label {
    color:
        var(--ui-text);

    font-size: 11px;

    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    color:
        var(--ui-text);

    background:
        var(--ui-bg-soft);

    border-color:
        var(--ui-border);

    border-radius:
        10px;

    transition:
        background 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color:
        var(--ui-border-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    background:
        var(--ui-surface);

    border-color:
        var(--ui-blue);

    box-shadow:
        0 0 0 3px
        color-mix(
            in srgb,
            var(--ui-blue) 11%,
            transparent
        );

    outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
    color:
        var(--ui-text-soft);
}

.field-hint {
    color:
        var(--ui-text-soft);

    font-size: 10px;
}


/* =========================================================
   15. Segmented Cover Type
   ========================================================= */

.segmented-control {
    padding: 3px;

    background:
        var(--ui-surface-soft);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        11px;
}

.segmented-control__button {
    color:
        var(--ui-text-muted);

    border-radius:
        8px;

    font-weight: 700;

    transition:
        background 150ms ease,
        color 150ms ease,
        box-shadow 150ms ease;
}

.segmented-control__button.is-active {
    color:
        #ffffff;

    background:
        var(--ui-blue);

    box-shadow:
        0 2px 6px
        rgba(41, 58, 168, 0.18);
}


/* =========================================================
   16. PDF attachment
   ========================================================= */

.pdf-upload {
    min-height: 76px;

    padding:
        13px
        14px;

    background:
        linear-gradient(
            135deg,
            var(--ui-bg-soft),
            var(--ui-surface)
        );

    border:
        1px dashed
        var(--ui-border-strong);

    border-radius:
        12px;
}

.pdf-upload:hover {
    background:
        var(--ui-surface-blue);

    border-color:
        var(--ui-blue);
}

.pdf-upload__button {
    min-height: 40px;

    color:
        var(--ui-blue-dark);

    background:
        var(--ui-blue-soft);

    border-color:
        color-mix(
            in srgb,
            var(--ui-blue) 25%,
            var(--ui-border)
        );

    box-shadow:
        none;
}

.pdf-upload__button:hover {
    color:
        #ffffff;

    background:
        var(--ui-blue);

    border-color:
        var(--ui-blue);
}

.pdf-upload__info strong {
    color:
        var(--ui-text-strong);
}

.pdf-upload__info span {
    color:
        var(--ui-text-muted);
}


/* =========================================================
   17. Buttons
   ========================================================= */

.button {
    border-radius:
        10px;

    font-weight: 700;
}

.button--primary {
    color:
        #ffffff;

    background:
        var(--ui-blue);

    border-color:
        var(--ui-blue);

    box-shadow:
        0 5px 14px
        rgba(41, 58, 168, 0.16);
}

.button--primary:hover {
    background:
        var(--ui-blue-dark);

    border-color:
        var(--ui-blue-dark);
}

.button--secondary {
    color:
        var(--ui-text);

    background:
        var(--ui-surface);

    border-color:
        var(--ui-border-strong);
}

.button--secondary:hover {
    background:
        var(--ui-surface-soft);
}

.button--danger {
    color:
        var(--ui-danger);

    background:
        var(--ui-danger-soft);

    border-color:
        color-mix(
            in srgb,
            var(--ui-danger) 25%,
            var(--ui-border)
        );
}


/* =========================================================
   18. Form actions
   ========================================================= */

.form-actions {
    padding:
        17px
        18px;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        var(--ui-radius-md);

    box-shadow:
        var(--ui-shadow-xs);
}

.form-actions__note {
    color:
        var(--ui-text-muted);
}


/* =========================================================
   19. Teacher autocomplete
   ========================================================= */

.autocomplete {
    margin-top: 7px;

    padding: 6px;

    overflow: hidden;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        12px;

    box-shadow:
        var(--ui-shadow-md);
}

.autocomplete__item {
    width: 100%;

    padding:
        10px
        11px;

    border-radius:
        8px;
}

.autocomplete__item:hover,
.autocomplete__item.is-active {
    background:
        var(--ui-surface-blue);
}

.autocomplete__item strong {
    color:
        var(--ui-text-strong);
}

.autocomplete__item span {
    color:
        var(--ui-text-muted);
}


/* =========================================================
   20. Desktop preview panel
   ========================================================= */

.preview-panel {
    overflow: hidden;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        var(--ui-radius-lg);

    box-shadow:
        var(--ui-shadow-sm);
}

.preview-panel__header {
    min-height: 68px;

    padding:
        15px
        17px;

    background:
        var(--ui-surface);

    border-bottom:
        1px solid
        var(--ui-border);
}

.preview-panel__label {
    color:
        var(--ui-blue);

    font-size: 8px;

    font-weight: 800;

    letter-spacing: 0.11em;

    text-transform: uppercase;
}

.preview-panel__header h2 {
    margin-top: 3px;

    color:
        var(--ui-text-strong);

    font-size: 13px;

    font-weight: 750;
}

.preview-stage {
    display: flex;
    align-items: flex-start;
    justify-content: center;

    min-height: 620px;

    padding:
        22px;

    background-color:
        #e5e8ed;

    background-image:
        linear-gradient(
            45deg,
            rgba(255,255,255,0.38) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(255,255,255,0.38) 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            rgba(255,255,255,0.38) 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            rgba(255,255,255,0.38) 75%
        );

    background-size:
        18px 18px;

    background-position:
        0 0,
        0 9px,
        9px -9px,
        -9px 0;
}

html[data-theme="dark"]
.preview-stage {
    background-color:
        #171b21;

    background-image:
        linear-gradient(
            45deg,
            rgba(255,255,255,0.025) 25%,
            transparent 25%
        ),
        linear-gradient(
            -45deg,
            rgba(255,255,255,0.025) 25%,
            transparent 25%
        ),
        linear-gradient(
            45deg,
            transparent 75%,
            rgba(255,255,255,0.025) 75%
        ),
        linear-gradient(
            -45deg,
            transparent 75%,
            rgba(255,255,255,0.025) 75%
        );
}

.preview-stage .cover-preview {
    width:
        min(
            100%,
            500px
        );

    margin-inline: auto;

    /*
     * Do not transform this element.
     * It is the PDF capture source.
     */
    transform: none !important;
}

.preview-panel__footer {
    min-height: 42px;

    padding:
        10px
        16px;

    color:
        var(--ui-text-soft);

    background:
        var(--ui-surface);

    border-top:
        1px solid
        var(--ui-border);

    font-size: 9px;

    font-weight: 700;

    letter-spacing: 0.03em;

    text-transform: uppercase;
}


/* =========================================================
   21. Drawer backdrop
   ========================================================= */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;

    background:
        rgba(17, 24, 39, 0.42);

    opacity: 0;

    backdrop-filter:
        blur(2px);

    -webkit-backdrop-filter:
        blur(2px);

    transition:
        opacity 220ms ease;
}

.drawer-backdrop.is-visible {
    opacity: 1;
}


/* =========================================================
   22. Drawer
   ========================================================= */

.app-drawer {
    position: fixed;

    top: 0;
    right: 0;
    bottom: 0;

    z-index: 910;

    width:
        min(
            360px,
            90vw
        );

    overflow: hidden;

    background:
        var(--ui-surface);

    border-left:
        1px solid
        var(--ui-border);

    box-shadow:
        var(--ui-shadow-drawer);

    transform:
        translateX(103%);

    transition:
        transform 230ms
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
}

.app-drawer.is-open {
    transform:
        translateX(0);
}

.app-drawer__inner {
    display: flex;
    flex-direction: column;

    height: 100%;
}

.app-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 18px;

    min-height: 88px;

    padding:
        18px
        20px;

    border-bottom:
        1px solid
        var(--ui-border);
}


/* =========================================================
   23. Drawer brand
   ========================================================= */

.drawer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drawer-brand__mark {
    display: grid;
    place-items: center;

    width: 46px;
    height: 46px;

    background:
        var(--ui-surface-soft);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        12px;
}

.drawer-brand__mark img {
    width: 37px;
    height: 37px;

    object-fit: contain;
}

.drawer-brand > div {
    display: flex;
    flex-direction: column;
}

.drawer-brand strong {
    color:
        var(--ui-text-strong);

    font-size: 15px;
    font-weight: 800;
}

.drawer-brand span {
    margin-top: 4px;

    color:
        var(--ui-text-muted);

    font-size: 10px;

    font-weight: 600;
}


/* =========================================================
   24. Drawer close
   ========================================================= */

.drawer-close {
    display: grid;
    place-items: center;

    width: 38px;
    height: 38px;

    padding: 0;

    color:
        var(--ui-text-muted);

    background:
        var(--ui-surface-soft);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        10px;

    cursor: pointer;
}

.drawer-close:hover {
    color:
        var(--ui-text-strong);

    background:
        var(--ui-surface);
}

.drawer-close svg {
    width: 17px;
    height: 17px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;
}


/* =========================================================
   25. Drawer body
   ========================================================= */

.app-drawer__body {
    flex: 1;

    min-height: 0;

    padding:
        10px
        20px
        20px;

    overflow-y: auto;
}

.drawer-section {
    padding:
        20px
        0;

    border-bottom:
        1px solid
        var(--ui-border);
}

.drawer-section:last-child {
    border-bottom: 0;
}

.drawer-section__heading {
    margin-bottom: 15px;
}

.drawer-section__eyebrow {
    display: block;

    margin-bottom: 4px;

    color:
        var(--ui-text-soft);

    font-size: 8px;

    font-weight: 800;

    letter-spacing: 0.11em;

    text-transform: uppercase;
}

.drawer-section__heading h2 {
    margin: 0;

    color:
        var(--ui-text-strong);

    font-size: 15px;

    font-weight: 750;
}


/* =========================================================
   26. Theme control
   ========================================================= */

.drawer-theme {
    padding:
        14px;

    background:
        var(--ui-bg-soft);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        13px;
}

.drawer-theme__row {
    display: grid;

    grid-template-columns:
        1fr
        auto
        1fr;

    align-items: center;

    gap: 10px;
}

.drawer-theme__side {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color:
        var(--ui-text-muted);

    font-size: 11px;

    font-weight: 700;
}

.drawer-theme__side:last-child {
    justify-content: flex-end;
}

.drawer-theme__side svg {
    width: 15px;
    height: 15px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.7;

    stroke-linecap: round;

    stroke-linejoin: round;
}


/* actual slider */

.theme-switch {
    display: inline-flex;

    cursor: pointer;
}

.theme-switch input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}

.theme-switch__track {
    position: relative;

    display: block;

    width: 48px;
    height: 26px;

    background:
        #d6dae1;

    border:
        1px solid
        #c3c8d1;

    border-radius:
        999px;

    transition:
        background 170ms ease,
        border-color 170ms ease;
}

.theme-switch__thumb {
    position: absolute;

    top: 3px;
    left: 3px;

    width: 18px;
    height: 18px;

    background:
        #ffffff;

    border-radius:
        50%;

    box-shadow:
        0 2px 5px
        rgba(18, 24, 35, 0.22);

    transition:
        transform 180ms
        cubic-bezier(
            0.22,
            1,
            0.36,
            1
        );
}

.theme-switch input:checked
+
.theme-switch__track {
    background:
        var(--ui-blue);

    border-color:
        var(--ui-blue);
}

.theme-switch input:checked
+
.theme-switch__track
.theme-switch__thumb {
    transform:
        translateX(22px);
}

.theme-switch input:disabled
+
.theme-switch__track {
    opacity: 0.48;

    cursor: not-allowed;
}


/* =========================================================
   27. Follow-system option
   ========================================================= */

.system-theme-option {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    margin-top: 15px;

    padding-top: 14px;

    border-top:
        1px solid
        var(--ui-border);

    cursor: pointer;
}

.system-theme-option input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}

.system-theme-option__box {
    position: relative;

    width: 17px;
    height: 17px;

    flex: 0 0 auto;

    margin-top: 1px;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border-strong);

    border-radius:
        5px;
}

.system-theme-option
input:checked
+
.system-theme-option__box {
    background:
        var(--ui-blue);

    border-color:
        var(--ui-blue);
}

.system-theme-option
input:checked
+
.system-theme-option__box::after {
    content: "";

    position: absolute;

    top: 3px;
    left: 5px;

    width: 4px;
    height: 7px;

    border:
        solid
        #ffffff;

    border-width:
        0 2px 2px 0;

    transform:
        rotate(45deg);
}

.system-theme-option > span:last-child {
    display: flex;
    flex-direction: column;
}

.system-theme-option strong {
    color:
        var(--ui-text);

    font-size: 11px;

    font-weight: 700;
}

.system-theme-option small {
    margin-top: 3px;

    color:
        var(--ui-text-soft);

    font-size: 9px;

    line-height: 1.4;
}


/* =========================================================
   28. Drawer navigation
   ========================================================= */

.drawer-navigation {
    display: grid;

    gap: 7px;
}

.drawer-navigation__item {
    display: grid;

    grid-template-columns:
        39px
        minmax(0, 1fr)
        18px;

    align-items: center;

    gap: 11px;

    width: 100%;

    padding:
        10px
        10px;

    color:
        var(--ui-text);

    background:
        transparent;

    border: 0;

    border-radius:
        11px;

    text-align: left;

    cursor: pointer;

    transition:
        background 150ms ease;
}

.drawer-navigation__item:hover {
    background:
        var(--ui-surface-soft);
}

.drawer-navigation__icon {
    display: grid;
    place-items: center;

    width: 39px;
    height: 39px;

    color:
        var(--ui-blue);

    background:
        var(--ui-blue-soft);

    border-radius:
        10px;
}

.drawer-navigation__icon svg {
    width: 18px;
    height: 18px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.7;

    stroke-linecap: round;

    stroke-linejoin: round;
}

.drawer-navigation__item > span:nth-child(2) {
    display: flex;
    flex-direction: column;

    min-width: 0;
}

.drawer-navigation__item strong {
    color:
        var(--ui-text-strong);

    font-size: 12px;

    font-weight: 750;
}

.drawer-navigation__item small {
    margin-top: 3px;

    color:
        var(--ui-text-muted);

    font-size: 9px;
}

.drawer-navigation__arrow {
    width: 15px;
    height: 15px;

    fill: none;

    stroke:
        var(--ui-text-soft);

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


/* =========================================================
   29. Drawer footer
   ========================================================= */

.app-drawer__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    min-height: 78px;

    padding:
        15px
        20px;

    background:
        var(--ui-bg-soft);

    border-top:
        1px solid
        var(--ui-border);
}

.drawer-status {
    display: flex;
    align-items: center;

    gap: 9px;
}

.drawer-status__dot {
    width: 8px;
    height: 8px;

    flex: 0 0 auto;

    background:
        var(--ui-teal);

    border-radius:
        50%;
}

.drawer-status__dot.is-offline {
    background:
        var(--ui-amber);
}

.drawer-status > div {
    display: flex;
    flex-direction: column;
}

.drawer-status strong {
    color:
        var(--ui-text);

    font-size: 10px;

    font-weight: 750;
}

.drawer-status time {
    margin-top: 2px;

    color:
        var(--ui-text-muted);

    font-size: 9px;
}

.drawer-version {
    color:
        var(--ui-text-soft);

    font-size: 9px;

    font-weight: 700;
}


/* =========================================================
   30. About dialog
   ========================================================= */

.about-dialog {
    width:
        min(
            92vw,
            540px
        );

    max-height:
        min(
            86vh,
            680px
        );

    padding: 0;

    overflow: hidden;

    color:
        var(--ui-text);

    background:
        transparent;

    border: 0;

    border-radius:
        var(--ui-radius-lg);

    box-shadow:
        var(--ui-shadow-md);
}

.about-dialog::backdrop {
    background:
        rgba(17, 24, 39, 0.46);

    backdrop-filter:
        blur(3px);
}

.about-dialog__surface {
    overflow: hidden;

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        var(--ui-radius-lg);
}

.about-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding:
        19px
        21px;

    border-bottom:
        1px solid
        var(--ui-border);
}

.about-dialog__brand {
    display: flex;
    align-items: center;

    gap: 12px;
}

.about-dialog__brand img {
    width: 48px;
    height: 48px;

    object-fit: contain;
}

.about-dialog__brand div {
    display: flex;
    flex-direction: column;
}

.about-dialog__brand span {
    color:
        var(--ui-text-muted);

    font-size: 9px;

    font-weight: 700;
}

.about-dialog__brand h2 {
    margin:
        3px
        0
        0;

    color:
        var(--ui-text-strong);

    font-size: 19px;

    font-weight: 800;
}

.about-dialog__body {
    padding:
        24px
        22px;
}

.about-dialog__lead {
    margin:
        0
        0
        22px;

    color:
        var(--ui-text);

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 17px;

    line-height: 1.55;
}

.about-features {
    display: grid;

    gap: 11px;
}

.about-feature {
    display: grid;

    grid-template-columns:
        43px
        minmax(0, 1fr);

    gap: 12px;

    padding:
        12px;

    background:
        var(--ui-bg-soft);

    border:
        1px solid
        var(--ui-border);

    border-radius:
        12px;
}

.about-feature > span {
    display: grid;
    place-items: center;

    width: 43px;
    height: 43px;

    color:
        var(--ui-blue);

    background:
        var(--ui-blue-soft);

    border-radius:
        10px;

    font-size: 8px;

    font-weight: 900;

    letter-spacing: 0.04em;
}

.about-feature strong {
    color:
        var(--ui-text-strong);

    font-size: 11px;

    font-weight: 750;
}

.about-feature p {
    margin:
        4px
        0
        0;

    color:
        var(--ui-text-muted);

    font-size: 10px;

    line-height: 1.55;
}

.about-dialog__meta {
    display: flex;
    justify-content: space-between;

    gap: 16px;

    margin-top: 20px;

    padding-top: 15px;

    color:
        var(--ui-text-soft);

    border-top:
        1px solid
        var(--ui-border);

    font-size: 9px;

    font-weight: 700;
}

.about-dialog__footer {
    display: flex;
    justify-content: flex-end;

    padding:
        14px
        21px;

    background:
        var(--ui-bg-soft);

    border-top:
        1px solid
        var(--ui-border);
}


/* =========================================================
   31. Settings dialog polish
   ========================================================= */

.settings-dialog__surface {
    color:
        var(--ui-text);

    background:
        var(--ui-surface);

    border:
        1px solid
        var(--ui-border);

    box-shadow:
        var(--ui-shadow-md);
}

.settings-dialog__header {
    border-color:
        var(--ui-border);
}

.settings-dialog__header h2,
.settings-group h3 {
    color:
        var(--ui-text-strong);
}

.settings-group p {
    color:
        var(--ui-text-muted);
}


/* =========================================================
   32. Main footer
   ========================================================= */

.app-footer {
    margin-top: 0;

    background:
        var(--ui-surface);

    border-top:
        1px solid
        var(--ui-border);
}

.app-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;

    min-height: 84px;
}

.app-footer__brand {
    display: flex;
    align-items: center;

    gap: 10px;
}

.app-footer__brand img {
    width: 28px;
    height: 28px;

    object-fit: contain;
}

.app-footer__brand > div {
    display: flex;
    flex-direction: column;
}

.app-footer__brand strong {
    color:
        var(--ui-text-strong);

    font-size: 11px;

    font-weight: 800;
}

.app-footer__brand span {
    margin-top: 3px;

    color:
        var(--ui-text-muted);

    font-size: 9px;
}

.app-footer__meta {
    display: flex;
    align-items: center;

    gap: 7px;

    color:
        var(--ui-text-soft);

    font-size: 9px;

    font-weight: 600;
}


/* =========================================================
   33. Mobile
   ========================================================= */

@media screen and (max-width: 820px) {
    :root {
        --ui-header-height:
            64px;
    }

    .app-container {
        width:
            min(
                calc(100% - 26px),
                760px
            );
    }

    .app-header__inner {
        gap: 12px;
    }

    .brand__mark {
        width: 39px;
        height: 39px;
    }

    .brand__mark img {
        width: 31px;
        height: 31px;
    }

    .brand__text strong {
        font-size: 13px;
    }

    .brand__text small {
        font-size: 9px;
    }

    .header-status {
        gap: 8px;
    }

    .header-status__connection {
        display: none;
    }

    .header-status__separator {
        display: none;
    }

    .header-status__date {
        font-size: 10px;
    }

    .menu-button {
        width: 39px;
        height: 39px;

        border-radius: 10px;
    }

    .app-main {
        padding-top: 26px;
        padding-bottom: 96px;
    }

    .page-intro {
        display: block;

        margin-bottom: 22px;
    }

    .page-intro__actions {
        margin-top: 18px;
    }

    .page-intro h1 {
        font-size: 29px;
    }

    .page-intro__description {
        font-size: 12px;
    }

    .workspace {
        display: block !important;
    }

    .workspace__preview {
        display: none !important;
    }

    .form-card {
        margin-bottom: 14px;

        padding:
            20px
            18px;

        border-radius:
            15px;
    }

    .form-card__header {
        display: block;

        margin-bottom: 19px;
    }

    .form-card__header p {
        max-width: none;

        margin-top: 8px;

        text-align: left;
    }

    .pdf-upload {
        grid-template-columns:
            1fr;

        text-align: center;
    }

    .app-footer {
        margin-bottom:
            76px;
    }

    .app-footer__inner {
        display: block;

        padding-block:
            20px;

        text-align: center;
    }

    .app-footer__brand {
        justify-content: center;
    }

    .app-footer__meta {
        justify-content: center;

        margin-top: 12px;
    }
}


/* =========================================================
   34. Very small mobile
   ========================================================= */

@media screen and (max-width: 480px) {
    .header-status__date {
        display: none;
    }

    .app-drawer {
        width:
            min(
                88vw,
                340px
            );
    }

    .app-drawer__header {
        padding:
            16px
            17px;
    }

    .app-drawer__body {
        padding-inline:
            17px;
    }

    .drawer-theme__row {
        gap: 6px;
    }

    .drawer-theme__side {
        font-size: 10px;
    }

    .about-dialog {
        width:
            calc(100vw - 24px);
    }

    .about-dialog__lead {
        font-size: 15px;
    }
}


/* =========================================================
   35. Reduced motion
   ========================================================= */

@media (
    prefers-reduced-motion:
    reduce
) {
    .app-drawer,
    .drawer-backdrop,
    .theme-switch__track,
    .theme-switch__thumb,
    .menu-button,
    .button {
        transition:
            none !important;
    }
}
/* =========================================================
   COVER MAKER 2.0 — SIGNATURE STUDIO SKIN
   A deliberately distinctive, lightweight visual system.
   ========================================================= */
:root {
    --ui-bg: #e7e4dc;
    --ui-bg-soft: #eeece6;
    --ui-surface: #e9e7e1;
    --ui-surface-soft: #dedbd2;
    --ui-surface-blue: #e1ebe8;
    --ui-text: #263238;
    --ui-text-strong: #182329;
    --ui-text-muted: #667278;
    --ui-text-soft: #8b9699;
    --ui-blue: #2f7f7a;
    --ui-blue-dark: #256762;
    --ui-blue-soft: #d8e9e6;
    --ui-navy: #344b52;
    --ui-teal: #2f7f7a;
    --ui-teal-soft: #d8e9e6;
    --ui-amber: #b07a42;
    --ui-amber-soft: #f0dfcc;
    --ui-danger: #ad5751;
    --ui-danger-soft: #f1dcd9;
    --ui-border: #d1cec5;
    --ui-border-strong: #bcb8ae;
    --ui-shadow-xs: 4px 4px 10px rgba(72, 76, 73, .10), -4px -4px 10px rgba(255,255,255,.60);
    --ui-shadow-sm: 8px 10px 22px rgba(72,76,73,.12), -7px -7px 18px rgba(255,255,255,.58);
    --ui-shadow-md: 14px 18px 34px rgba(72,76,73,.15), -10px -10px 26px rgba(255,255,255,.52);
    --ui-header-height: 66px;
}

html[data-theme="dark"] {
    --ui-bg: #252a2b;
    --ui-bg-soft: #2a3031;
    --ui-surface: #2b3132;
    --ui-surface-soft: #343b3c;
    --ui-surface-blue: #2b3b3a;
    --ui-text: #e2e7e5;
    --ui-text-strong: #f2f5f3;
    --ui-text-muted: #aab5b3;
    --ui-text-soft: #7f8c8a;
    --ui-blue: #73b9b2;
    --ui-blue-dark: #8bc8c1;
    --ui-blue-soft: #29413f;
    --ui-navy: #d1d9d7;
    --ui-teal: #73b9b2;
    --ui-teal-soft: #29413f;
    --ui-amber: #d0a06d;
    --ui-amber-soft: #453724;
    --ui-danger: #d48279;
    --ui-danger-soft: #482b29;
    --ui-border: #3e4748;
    --ui-border-strong: #505b5b;
    --ui-shadow-xs: 4px 4px 10px rgba(0,0,0,.24), -4px -4px 10px rgba(255,255,255,.025);
    --ui-shadow-sm: 8px 10px 22px rgba(0,0,0,.28), -7px -7px 18px rgba(255,255,255,.025);
    --ui-shadow-md: 14px 18px 34px rgba(0,0,0,.34), -10px -10px 26px rgba(255,255,255,.02);
}

body {
    background:
        radial-gradient(circle at 12% 10%, rgba(47,127,122,.11), transparent 24rem),
        radial-gradient(circle at 88% 70%, rgba(176,122,66,.09), transparent 22rem),
        linear-gradient(135deg, var(--ui-bg) 0%, var(--ui-bg-soft) 52%, var(--ui-bg) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: .28;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(38,50,56,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(38,50,56,.045) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
}

html[data-theme="dark"] body::before {
    opacity: .12;
    background-image:
        linear-gradient(rgba(226,231,229,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(226,231,229,.05) 1px, transparent 1px);
}

.app-header {
    position: sticky;
    top: 14px;
    width: min(calc(100% - 32px), 1360px);
    height: var(--ui-header-height);
    margin: 14px auto 0;
    border: 1px solid var(--ui-border);
    border-radius: 22px;
    background: color-mix(in srgb, var(--ui-surface) 88%, transparent);
    box-shadow: var(--ui-shadow-sm);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.app-header__inner { width: 100%; padding-inline: 18px; }
.brand__mark {
    width: 42px; height: 42px; border-radius: 14px;
    box-shadow: inset 2px 2px 5px rgba(255,255,255,.45), inset -2px -2px 5px rgba(80,80,70,.10);
}

.brand__text strong { letter-spacing: -.025em; }
.brand__text small { color: var(--ui-text-muted); }

.header-status { gap: 10px; }
.header-status__connection, .menu-button {
    box-shadow: var(--ui-shadow-xs);
}

.menu-button {
    width: 42px; height: 42px; border-radius: 14px;
    border-color: var(--ui-border);
    background: var(--ui-surface);
}

.app-main {
    padding-top: 28px;
    padding-bottom: 54px;
}

.workspace {
    position: relative;
    grid-template-columns: minmax(0, 1fr) minmax(430px, .82fr) !important;
    gap: 34px;
    align-items: stretch;
}

.workspace__form {
    min-height: 0;
}

@media (min-width: 821px) {
    .workspace__form {
        height: calc(100vh - 124px);
        max-height: calc(100vh - 124px);
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 6px 12px 28px 4px;
        scrollbar-width: thin;
        scrollbar-color: var(--ui-border-strong) transparent;
    }
    .workspace__preview {
        position: sticky !important;
        top: 94px !important;
        height: calc(100vh - 124px);
        align-self: start;
        display: flex;
        align-items: center;
    }
}

.workspace__form::-webkit-scrollbar { width: 7px; }
.workspace__form::-webkit-scrollbar-thumb { background: var(--ui-border-strong); border-radius: 99px; }

.form-card {
    padding: 25px 27px;
    border: 1px solid var(--ui-border);
    border-radius: 22px;
    background: color-mix(in srgb, var(--ui-surface) 96%, transparent);
    box-shadow: var(--ui-shadow-sm);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.form-card:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--ui-blue) 28%, var(--ui-border));
    box-shadow: var(--ui-shadow-md);
}

.form-card::before {
    top: 25px; left: 0; width: 4px; height: 42px;
    border-radius: 0 5px 5px 0;
}

.form-card--compact {
    background:
        radial-gradient(circle at 100% 0%, rgba(47,127,122,.10), transparent 12rem),
        var(--ui-surface);
}

.form-card__header { margin-bottom: 21px; }
.form-card__header h2 { font-size: 17px; letter-spacing: -.02em; }
.form-card__header p { color: var(--ui-text-muted); }

.section-number {
    min-width: 32px; height: 25px; margin-bottom: 10px;
    border: 1px solid color-mix(in srgb, var(--ui-amber) 22%, var(--ui-border));
    box-shadow: inset 1px 1px 2px rgba(255,255,255,.42);
}

.field input, .field select, .field textarea {
    min-height: 44px;
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    background: var(--ui-bg-soft);
    box-shadow: inset 2px 2px 5px rgba(90,88,80,.075), inset -2px -2px 5px rgba(255,255,255,.38);
}

.field textarea { min-height: 96px; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--ui-blue);
    box-shadow: inset 2px 2px 5px rgba(60,80,78,.08), 0 0 0 4px color-mix(in srgb, var(--ui-blue) 12%, transparent);
}

.segmented-control {
    padding: 5px;
    border-radius: 15px;
    background: var(--ui-bg-soft);
    box-shadow: inset 2px 2px 6px rgba(70,70,65,.09), inset -2px -2px 6px rgba(255,255,255,.4);
}
.segmented-control__button { border-radius: 11px; min-height: 40px; }
.segmented-control__button.is-active { background: var(--ui-blue); box-shadow: 4px 4px 9px rgba(47,127,122,.18); }

.button {
    min-height: 42px;
    border-radius: 14px;
    border: 1px solid var(--ui-border);
    box-shadow: var(--ui-shadow-xs);
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-1px); box-shadow: var(--ui-shadow-sm); }
.button:active { transform: translateY(1px); box-shadow: inset 2px 2px 5px rgba(0,0,0,.08); }
.button--primary { background: var(--ui-blue); border-color: var(--ui-blue); box-shadow: 6px 7px 15px rgba(47,127,122,.20), -3px -3px 8px rgba(255,255,255,.20); }
.button--secondary { background: var(--ui-surface); }

.pdf-upload {
    min-height: 108px;
    grid-template-columns: auto minmax(0,1fr) auto;
    padding: 17px;
    border: 1px dashed color-mix(in srgb, var(--ui-blue) 42%, var(--ui-border));
    border-radius: 18px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ui-blue-soft) 65%, var(--ui-surface)), var(--ui-surface));
    box-shadow: inset 2px 2px 5px rgba(60,70,68,.06), inset -2px -2px 5px rgba(255,255,255,.35);
}
.pdf-upload:hover { border-color: var(--ui-blue); transform: translateY(-1px); }
.pdf-upload__button { min-height: 46px; padding-inline: 17px; border-radius: 14px; background: var(--ui-surface); box-shadow: var(--ui-shadow-xs); }

.preview-panel {
    width: 100%;
    max-height: calc(100vh - 142px);
    border: 1px solid var(--ui-border);
    border-radius: 28px;
    background: color-mix(in srgb, var(--ui-surface) 93%, transparent);
    box-shadow: var(--ui-shadow-md);
    overflow: hidden;
    position: relative;
}
.preview-panel::before {
    content: "";
    position: absolute;
    width: 170px; height: 170px;
    right: -75px; top: -80px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ui-blue) 10%, transparent);
    pointer-events: none;
}
.preview-panel__header { padding: 21px 22px 17px; border-bottom: 1px solid var(--ui-border); }
.preview-panel__label { color: var(--ui-blue); font-size: 10px; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.preview-panel__header h2 { margin-top: 4px; font-size: 18px; letter-spacing: -.025em; }
.preview-stage { min-height: 0; padding: 25px; background: linear-gradient(145deg, var(--ui-bg-soft), var(--ui-surface)); }
.cover-preview {
    border-radius: 5px;
    box-shadow: 0 18px 34px rgba(50,55,54,.18), 0 3px 8px rgba(50,55,54,.12);
}
.preview-panel__footer { padding: 12px 20px; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); }

.app-footer { border-top: 0; padding: 0 0 30px; }
.app-footer__inner { min-height: 36px; justify-content: center; color: var(--ui-text-muted); font-size: 11px; letter-spacing: .03em; }

@media (max-width: 820px) {
    .app-header { position: sticky; top: 10px; width: calc(100% - 20px); margin-top: 10px; border-radius: 18px; }
    .app-main { padding-top: 22px; }
    .workspace { grid-template-columns: 1fr !important; gap: 20px; }
    .workspace__form { order: 1; }
    .workspace__preview { order: 2; position: relative !important; top: auto !important; height: auto; }
    .preview-panel { max-height: none; border-radius: 22px; }
    .preview-stage { padding: 18px; }
}

@media (max-width: 560px) {
    .app-container { width: min(calc(100% - 24px), 1440px); }
    .app-header__inner { padding-inline: 11px; }
    .brand__text small, .header-status__separator, .header-status__date { display: none; }
    .header-status__connection { padding-inline: 8px; }
    .form-card { padding: 20px 18px; border-radius: 18px; }
    .pdf-upload { grid-template-columns: 1fr; text-align: center; }
    .pdf-upload__button { width: 100%; }
    .pdf-upload__info { align-items: center; }
}

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