* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.login-card h1 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: #666;
    margin-bottom: 2rem;
}

.error-message {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.google-button {
    display: inline-block;
    background: #fff;
    color: #333;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    text-decoration: none;
    transition: background 0.2s, box-shadow 0.2s;
}

.google-button:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
    z-index: 100;
}

.logout-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Confirmation screen */
.confirm-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    margin: 4rem auto 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.confirm-thumb {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.confirm-panel label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    margin: 1rem 0 0.25rem;
}

.confirm-panel select,
.confirm-panel input[type="text"],
.confirm-panel textarea {
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.confirm-panel textarea {
    resize: vertical;
}

.read-only-field {
    margin: 0.75rem 0;
}

.read-only-field .label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    display: block;
    margin-bottom: 0.25rem;
}

.tag {
    display: inline-block;
    background: #e5e7eb;
    color: #374151;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0.15rem;
}

.actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-confirm {
    flex: 1;
    min-height: 48px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-confirm:active {
    background: #1d4ed8;
}

.btn-reanalyze,
.btn-retry {
    flex: 1;
    min-height: 48px;
    background: #fff;
    color: #333;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
}

.btn-reanalyze:active,
.btn-retry:active {
    background: #f3f4f6;
}

.htmx-indicator {
    display: none;
    text-align: center;
    color: #666;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.htmx-request .htmx-indicator {
    display: block;
}

.error-state {
    text-align: center;
    padding: 2rem 1.5rem;
}

.error-state .error-message {
    margin-bottom: 1.5rem;
}

/* Wardrobe grid */
.wardrobe {
    align-self: flex-start;
    width: 100%;
    max-width: 960px;
    margin: 4rem auto 1rem;
    padding: 0 0.75rem;
}

.wardrobe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.wardrobe-header h1 {
    font-size: 1.4rem;
}

.btn-add {
    display: inline-block;
    background: #2563eb;
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

.category-filter {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-filter a {
    flex: none;
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.85rem;
    min-height: 40px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
}

.category-filter a.active {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.item-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 0.5rem;
}

.item-card {
    position: relative;
    display: block;
    aspect-ratio: 1;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 0.85rem;
}

.unfinished-marker {
    position: absolute;
    left: 0.3rem;
    bottom: 0.3rem;
    background: #f59e0b;
    color: #111;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.empty-state,
.empty-category {
    text-align: center;
    color: #666;
    padding: 3rem 1rem;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* Item detail */
.item-detail {
    align-self: flex-start;
    width: 100%;
    max-width: 480px;
    margin: 4rem auto 1rem;
    padding: 0 0.75rem;
}

.back-link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.fullsize-link {
    display: block;
}

.item-photo {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #fff;
    border-radius: 12px;
    display: block;
}

.item-photo-missing {
    padding: 3rem 1rem;
    text-align: center;
    color: #999;
    background: #fff;
    border-radius: 12px;
}

.item-panel {
    margin-top: 1rem;
}

.unfinished-note {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
}

.saved-notice {
    color: #166534;
    font-weight: 600;
}

.field-error {
    color: #991b1b;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.hint {
    font-weight: 400;
    color: #888;
}

/* Delete */
.delete-zone {
    margin: 1.5rem 0 2rem;
    text-align: center;
}

.delete-zone .actions {
    align-items: center;
    justify-content: center;
}

.btn-delete {
    background: none;
    border: none;
    color: #b91c1c;
    font-size: 0.95rem;
    min-height: 44px;
    cursor: pointer;
}

.btn-danger {
    min-height: 48px;
    padding: 0 1.25rem;
    background: #b91c1c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.delete-cancel {
    color: #333;
    padding: 0.75rem 1rem;
}

/* Upload screen (KLYD-018, KLYD-030): two choices, one form field. */
.upload-container {
    align-self: flex-start;
    width: 100%;
    max-width: 480px;
    margin: 4rem auto 1rem;
    padding: 0 0.75rem;
}

.upload-container h1 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.camera-btn,
.picker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-bottom: 0.6rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.camera-btn {
    background: #2563eb;
    color: #fff;
}

.picker-btn {
    background: #fff;
    color: #2563eb;
    border: 1px solid #2563eb;
}

#preview-container {
    margin: 0.75rem 0;
}

#preview-img {
    display: block;
    max-width: 100%;
    max-height: 50vh;
    margin: 0 auto;
    border-radius: 8px;
}

#submit-btn {
    width: 100%;
    min-height: 48px;
    border: none;
    border-radius: 8px;
    background: #111827;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

#submit-btn:disabled {
    background: #9ca3af;
}
