.project-history {
    margin-left: auto;
    color: var(--action);
    text-decoration: none;
    font-size: 14px;
    padding: 8px;
}
.project-identity {
    border-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
}
.project-identity input {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-subtle);
    border-radius: 4px;
    padding: 10px;
    color: var(--text);
}
.save-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    min-height: 27px;
}
#save-status {
    font-size: 11px;
    color: var(--muted);
}
#save-status[data-state="error"] {
    color: var(--warning-text);
}
.artwork-upload {
    font-size: 12px;
    margin-top: 18px;
}
.artwork-upload input {
    display: block;
    max-width: 100%;
    font-size: 12px;
    margin-top: 8px;
}
.artwork-upload input::file-selector-button {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface-subtle);
    color: var(--action);
    padding: 6px 9px;
    cursor: pointer;
}
.project-home-main {
    display: block;
    max-width: 1060px;
    margin: 0 auto;
    padding: 70px 32px;
}
.welcome {
    max-width: 700px;
}
.welcome h1 {
    font: 500 clamp(28px, 4vw, 42px) / 1.2 var(--font-body);
    letter-spacing: -0.5px;
    margin: 18px 0;
}
.welcome > p {
    color: var(--muted);
    font-size: 17px;
    line-height: 1.7;
    max-width: 580px;
}
#new-project {
    margin-top: 34px;
}
.create-row {
    display: flex;
    gap: 12px;
    margin-top: 9px;
}
.create-row input {
    flex: 1;
    padding: 13px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 5px;
    color: var(--text);
}
#project-feedback {
    min-height: 22px;
    font-size: 13px;
    color: var(--warning-text);
}
.project-history-section {
    margin-top: 60px;
    padding-top: 28px;
    border-top: 1px solid var(--gold-line);
}
.history-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.history-heading h2 {
    font: 500 21px var(--font-body);
}
.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
    gap: 18px;
    margin-top: 18px;
}
.project-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 24px;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s;
    overflow-wrap: anywhere;
}
.project-card:hover {
    border-color: var(--gold-line);
}
.project-card h3 {
    font: 500 20px var(--font-body);
    margin: 0 0 12px;
}
.project-card p {
    font-size: 12px;
    color: var(--muted);
}
.project-card > span {
    display: block;
    color: var(--action);
    font-size: 13px;
    margin-top: 24px;
}
.history-empty {
    color: var(--muted);
    grid-column: 1/-1;
}
@media (max-width: 660px) {
    .project-home-main {
        padding: 40px 24px;
    }
    .create-row {
        flex-direction: column;
    }
    .project-history {
        font-size: 12px;
        padding: 6px;
    }
    .topbar {
        gap: 10px;
    }
    .project-identity {
        margin-bottom: 0;
    }
    .history-heading .eyebrow {
        display: none;
    }
}

.language-picker {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}
.file-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    min-width: 0;
}
.file-control button {
    flex-shrink: 0;
    font-size: 12px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--action);
    background: var(--surface-subtle);
}
.file-control > span {
    overflow-wrap: anywhere;
    font-size: 11px;
}
.file-input {
    position: absolute;
    width: 1px !important;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}
@media (max-width: 1000px) {
    .topbar {
        gap: 14px;
    }
}
@media (max-width: 660px) {
    .topbar {
        gap: 8px;
        padding-left: 16px;
        padding-right: 16px;
    }
    .project-title {
        display: none;
    }
    .project-history {
        font-size: 11px;
        padding: 3px;
    }
    .topbar > .primary-button {
        padding: 10px 9px;
        font-size: 12px;
    }
}
.project-home .project-branding {
    display: block;
    line-height: 1.4;
}
.project-tagline {
    margin-left: 16px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
@media (max-width: 1000px) {
    .project-home .brand-name,
    .project-home .header-divider {
        display: none;
    }
    .project-home .project-branding {
        min-width: 0;
    }
}
@media (max-width: 660px) {
    .project-home .topbar {
        height: auto;
        min-height: var(--header-height);
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .project-home .project-branding {
        font-size: 12px;
        flex: 1;
    }
    .project-tagline {
        margin-left: 0;
        display: block;
        font-size: 10px;
    }
}
.language-switch {
    gap: 0;
    margin-left: auto;
}
.language-switch > button {
    min-width: 44px;
    min-height: 44px;
    padding: 7px 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
.language-switch > button[aria-pressed="true"] {
    color: var(--action);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
}
.language-switch > span {
    font-size: 12px;
    color: var(--line);
}
.language-switch + .project-history {
    margin-left: 0;
}
@media (max-width: 660px) {
    .language-switch > button {
        min-width: 44px;
        font-size: 11px;
    }
    .language-switch {
        flex-shrink: 0;
    }
    .topbar {
        gap: 6px;
    }
}

.rename-artwork {
    display: block;
    margin: 0;
    min-height: 44px;
    flex-shrink: 0;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--action);
    background: var(--surface);
    font-size: 12px;
}
.rename-dialog {
    width: min(400px, calc(100% - 32px));
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
    background: var(--surface);
    color: var(--text);
}
.rename-dialog::backdrop {
    background: var(--backdrop);
}
.rename-dialog h2 {
    font-size: 22px;
    font-weight: 500;
    margin: 0 0 24px;
}
.rename-dialog input {
    width: 100%;
    margin: 8px 0 4px;
}
.rename-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.artwork-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.artwork-picker-row select {
    flex: 1;
    min-width: 0;
}

/* One design-wide status overlay: no per-field label or layout shift. */
.design-save-state {
    position: fixed; top: 86px; right: 24px; z-index: 40;
    max-width: min(460px, calc(100vw - 32px)); padding: 8px 12px;
    background: var(--surface, #fbf8ef); border: 1px solid var(--line, #ddd7c8);
    border-radius: 8px; box-shadow: 0 3px 12px #0001;
}
.design-save-state[data-visible="false"] { visibility: hidden; pointer-events: none; }
@media (max-width: 600px) { .design-save-state { top: 72px; right: 16px; } }
.project-history[aria-busy="true"], .brand[aria-busy="true"] { cursor: progress; }

.export-controls { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.export-controls #open-export { margin: 0; }
.save-indicator-wrap { position: relative; display: inline-flex; }
.save-indicator {
    display: grid; place-items: center; width: 32px; height: 40px; padding: 0;
    border: 0; border-radius: 6px; background: transparent; cursor: help;
}
.save-indicator-light {
    display: grid; place-items: center; width: 15px; height: 15px; border-radius: 50%;
    background: var(--muted); color: #fff; font: 700 10px/1 Arial, sans-serif;
    box-shadow: inset 0 0 0 1px #0002; transition: background-color 180ms ease, box-shadow 180ms ease;
}
.save-indicator[data-state="saved"] .save-indicator-light { background: #467852; box-shadow: inset 0 0 0 1px #0002, 0 0 0 3px #46785212; }
.save-indicator[data-state="pending"] .save-indicator-light,
.save-indicator[data-state="saving"] .save-indicator-light { background: #a87522; box-shadow: inset 0 0 0 1px #0002, 0 0 0 3px #a8752215; }
.save-indicator[data-state="error"] .save-indicator-light { background: #aa4437; box-shadow: inset 0 0 0 1px #0002, 0 0 0 3px #aa443715; }
.save-indicator-label {
    position: absolute; z-index: 60; right: 0; top: calc(100% + 6px); width: max-content;
    max-width: min(290px, calc(100vw - 32px)); padding: 9px 12px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font-size: 12px; line-height: 1.5; box-shadow: 0 4px 12px #0001;
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms ease;
}
.save-indicator-wrap:hover .save-indicator-label,
.save-indicator-wrap:focus-within .save-indicator-label { opacity: 1; visibility: visible; }
.save-announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 660px) {
    .export-controls { gap: 4px; }
    .export-controls #open-export { padding: 10px 9px; font-size: 12px; }
    .save-indicator { width: 28px; }
    .save-indicator-label { position: fixed; top: calc(var(--header-height) + 6px); right: 12px; max-width: calc(100% - 24px); }
}
@media (max-width: 360px) {
    .topbar:has(.export-controls) { padding-inline: 12px; gap: 4px; }
    .export-controls { gap: 2px; }
    .export-controls #open-export { padding-inline: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    .save-indicator-light, .save-indicator-label { transition: none; }
}
@media (forced-colors: active) {
    .save-indicator-light { forced-color-adjust: auto; border: 1px solid ButtonText; }
}

.logout-form { margin: 0; }
.logout-form button { min-height: 44px; padding: 8px 16px; }
