/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #64748b;
    --color-success: #16a34a;
    --color-error: #dc2626;
    --color-warning: #d97706;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.logo-img {
    height: 120px;
    width: auto;
    display: block;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    flex-direction: column;
    gap: 5px;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle--open .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle--open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle--open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Nav menu — horizontal on desktop */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--color-primary);
}

/* ===== Main Content ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
    flex: 1;
    width: 100%;
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Hero ===== */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.hero-description {
    max-width: 600px;
    margin: 0 auto 2rem;
    color: var(--color-text-muted);
}

/* ===== Features ===== */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.feature-card h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e1;
}

.btn-large {
    padding: 0.8rem 2rem;
    font-size: 1.05rem;
}

.btn-small {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
}

/* ===== Page Section ===== */
.page-section {
    max-width: 900px;
    margin: 0 auto;
}

.page-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

/* ===== Drop Zone ===== */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    margin: 1.5rem 0;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--color-primary);
    background: #eff6ff;
}

.drop-zone .file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.drop-zone-hint {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* ===== Preview Grid ===== */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.preview-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.preview-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin: 1.5rem 0;
}

.form-group {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: var(--color-surface);
}

.form-group legend {
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0 0.5rem;
}

.form-group label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.9rem;
}

/* font-size ≥ 16px prevents auto-zoom on iOS */
.form-group select,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: white;
    font-family: inherit;
    resize: vertical;
}

.label-hint {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: normal;
}

.field-hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    font-weight: 400;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Filter Form (Admin) ===== */
.filter-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.filter-form label {
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-form input,
.filter-form select {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}

/* ===== Data Table ===== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background: #f1f5f9;
    font-weight: 600;
    white-space: nowrap;
}

.data-table code {
    font-size: 0.75rem;
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-queued { background: #e2e8f0; color: var(--color-secondary); }
.status-running { background: #dbeafe; color: var(--color-primary); }
.status-succeeded { background: #dcfce7; color: var(--color-success); }
.status-failed, .status-error { background: #fee2e2; color: var(--color-error); }

/* ===== Status Card ===== */
.status-card {
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.status-card .status-text {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.status-card .status-hint {
    color: var(--color-text-muted);
}

.status-card .status-warning {
    color: var(--color-warning);
    font-weight: 600;
}

.status-card .btn {
    margin-top: 1rem;
}

/* ===== Spinner ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ===== Review ===== */
.review-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    margin: 1.5rem 0;
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.review-section h4 {
    margin-bottom: 0.75rem;
    color: var(--color-primary);
}

.review-images {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.review-images img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.review-details dt {
    font-weight: 600;
    text-transform: capitalize;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.review-details dd {
    font-size: 0.95rem;
    margin-left: 0;
}

.cost-indicator {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-radius: var(--radius);
    border: 1px solid #bfdbfe;
}

/* ===== Image Grid (Results) ===== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.image-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.image-card img {
    width: 100%;
    display: block;
}

.image-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Generation Cost ===== */
.generation-cost {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: right;
}

/* ===== Generation Info ===== */
.generation-info {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.generation-info code {
    font-size: 0.75rem;
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

/* ===== Error ===== */
.error {
    color: var(--color-error);
}

/* ===== Danger Button ===== */
.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

/* ===== History Page ===== */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.history-header h2 {
    margin-bottom: 0;
}

.history-loading,
.history-empty,
.history-error {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.history-error {
    color: var(--color-error);
}

.history-empty .btn {
    margin-top: 1rem;
}

/* History status badge variants (raw status as class name) */
.status-badge.queued    { background: #e2e8f0; color: var(--color-secondary); }
.status-badge.running   { background: #dbeafe; color: var(--color-primary); }
.status-badge.succeeded { background: #dcfce7; color: var(--color-success); }
.status-badge.failed    { background: #fee2e2; color: var(--color-error); }

/* ===== History Grid ===== */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.history-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: column;
}

.history-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.history-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #f1f5f9;
    overflow: hidden;
}

.history-card-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.history-card-garment {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.history-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--color-border);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.history-card-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--color-text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.history-card-delete:hover {
    color: var(--color-error);
    background: #fee2e2;
}

/* ===== History Pagination ===== */
.history-pagination {
    text-align: center;
    margin-top: 2rem;
}

/* ===== Detail Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: sticky;
    top: 0.75rem;
    float: right;
    margin: 0.75rem 0.75rem 0 0;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 1;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--color-border);
}

.modal-body {
    padding: 1.5rem;
    clear: both;
}

.modal-section {
    margin-bottom: 1.75rem;
}

.modal-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

/* Generated images row */
.modal-images {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.modal-image-item {
    flex: 1 1 200px;
    max-width: 260px;
    text-align: center;
}

.modal-image-item img {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    display: block;
}

.modal-image-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
    font-weight: 500;
}

/* Garment thumbnails */
.modal-garments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.modal-garments img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

/* Settings dl */
.modal-settings {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    font-size: 0.9rem;
}

.modal-settings dt {
    font-weight: 600;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.modal-settings dd {
    margin: 0;
}

/* Modal footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: #f8fafc;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.modal-actions {
    flex-shrink: 0;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--color-bg);
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
}

.login-logo {
    text-align: center;
    margin-bottom: 0.25rem;
}

.login-logo-img {
    height: 100px;
    width: auto;
    display: inline-block;
}

.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-error {
    background: #fee2e2;
    color: var(--color-error);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    text-align: center;
}

.login-form label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    margin-top: 1rem;
}

.login-form label:first-of-type {
    margin-top: 0;
}

.login-form input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
}

.login-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-btn {
    width: 100%;
    margin-top: 1.5rem;
}

/* ===== User Nav ===== */
.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.nav-username {
    font-weight: 600;
    color: var(--color-text);
}

.nav-user a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-user a:hover {
    color: var(--color-error);
}

/* ===========================================================================
   Responsive — Tablet (≤ 768px)
   =========================================================================== */
@media (max-width: 768px) {

    /* ── Mobile Logo ── */
    .logo-img {
        height: 80px;
    }

    .login-logo-img {
        height: 80px;
    }

    /* ── Mobile Navigation ── */
    .site-header {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .nav-container {
        flex-wrap: nowrap;
        position: relative;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        flex-direction: column;
        gap: 0;
        padding: 0.5rem 1rem 0.75rem;
        z-index: 200;
    }

    .nav-menu--open {
        display: flex;
    }

    .nav-links {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--color-border);
        font-size: 1rem;
    }

    .nav-user {
        padding-top: 0.75rem;
        width: 100%;
        justify-content: space-between;
    }

    /* ── Main Content ── */
    .main-content {
        padding: 1rem 0.75rem;
    }

    /* ── Hero ── */
    .hero {
        padding: 2.5rem 0.5rem;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .hero-subtitle {
        font-size: 1.05rem;
    }

    /* ── Page Sections ── */
    .page-section h2 {
        font-size: 1.35rem;
    }

    /* ── Forms ── */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .form-group {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* ── Drop Zone ── */
    .drop-zone {
        padding: 2rem 1rem;
    }

    /* ── Preview Grid ── */
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.5rem;
    }

    /* ── Review ── */
    .review-summary {
        padding: 1.25rem;
    }
    .review-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .review-images img {
        width: 60px;
        height: 60px;
    }

    /* ── Results ── */
    .image-grid {
        grid-template-columns: 1fr;
    }
    .image-card-footer {
        flex-wrap: wrap;
        gap: 0.4rem;
        font-size: 0.8rem;
    }
    .generation-cost {
        text-align: center;
    }

    /* ── History ── */
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }

    /* ── Modal ── */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    .modal-body {
        padding: 1rem;
    }
    .modal-images {
        flex-direction: column;
        align-items: stretch;
    }
    .modal-image-item {
        max-width: 100%;
    }
    .modal-garments img {
        width: 72px;
        height: 72px;
    }
    .modal-settings {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
    .modal-settings dt {
        margin-top: 0.4rem;
    }
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 1rem;
    }

    /* ── Admin ── */
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-form input,
    .filter-form select {
        width: 100%;
    }
    .filter-form .btn {
        width: 100%;
        text-align: center;
    }

    /* ── Status Card ── */
    .status-card {
        padding: 2rem 1rem;
    }

    /* ── Login ── */
    .login-card {
        padding: 1.75rem 1.25rem;
    }
}

/* ===========================================================================
   Responsive — Small phone (≤ 480px)
   =========================================================================== */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.65rem;
    }
    .hero-subtitle {
        font-size: 0.95rem;
    }
    .btn-large {
        padding: 0.7rem 1.5rem;
        font-size: 0.95rem;
    }
    .features {
        grid-template-columns: 1fr;
    }
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .history-card-garment {
        width: 40px;
        height: 40px;
    }
    .page-section h2 {
        font-size: 1.2rem;
    }
}
