:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-dark: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --error: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
    position: relative;
    overflow-x: hidden;
}

.overlay {
    position: fixed;
    inset: -50%;
    width: auto;
    height: auto;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.container {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 3rem;  /* slightly larger padding for ipad */
    width: 100%;
    max-width: 700px; /* Expands nicely on iPads */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input[type="text"] {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input[type="text"]::placeholder {
    color: #475569;
}

.submission-note {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.875rem 1rem;
    color: var(--text-main);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
}

.submission-note:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.submission-note::placeholder {
    color: #64748b;
}

.submission-note-help {
    display: block;
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.radio-card {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.card-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 3.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.radio-card:hover .card-content {
    background: var(--surface-hover);
}

.radio-card input:checked + .card-content {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
    color: #60a5fa;
    box-shadow: inset 0 0 0 1px var(--primary);
}

.file-upload-wrapper {
    position: relative;
    width: 100%;
    height: 8rem;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.file-upload-wrapper:hover {
    border-color: #64748b;
    background: var(--surface-hover);
}

.file-upload-wrapper:focus-within {
    border-color: var(--primary);
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.upload-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    pointer-events: none;
    color: var(--text-muted);
}

.upload-ui svg {
    color: #64748b;
}

.file-name {
    font-size: 0.9rem;
    text-align: center;
    padding: 0 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.file-name.selected {
    color: var(--primary);
    font-weight: 500;
}

button[type="submit"] {
    width: 100%;
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    margin-top: 2rem;
}

button[type="submit"]:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3);
}

button[type="submit"]:disabled {
    background: var(--surface);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.hidden {
    display: none !important;
}

/* Success Card */
.success-card {
    text-align: center;
    padding: 2rem 0;
    animation: fadeIn 0.4s ease-out;
}

.success-card svg {
    margin-bottom: 1.5rem;
}

.success-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--success);
}

.success-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.secondary-btn {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.error-card {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 12px;
    color: #fca5a5;
    text-align: center;
    font-size: 0.9rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

@media (max-width: 640px) { /* Triggers on iPhones/Mobile */
    .container {
        padding: 1.5rem;
        border-radius: 20px;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}

.task-badge {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Custom Autocomplete */
.autocomplete-container {
    position: relative;
}
.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.autocomplete-items div {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1rem;
}
.autocomplete-items div:last-child {
    border-bottom: none;
}
.autocomplete-items div:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

/* Photo Queue */
.photo-queue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
}
.photo-queue-item button {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
}

/* === Cleaning task row system (shared) === */
.clean-task-stack {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.clean-task-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
    margin: 1.15rem 0 0.55rem;
    padding: 0 0.15rem 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.clean-task-section-label:first-child {
    margin-top: 0;
}

.clean-callout {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.9rem;
    font-size: 0.8rem;
    color: #1e3a5f;
    line-height: 1.5;
}

.clean-callout strong {
    color: #172033;
}

.clean-callout-note {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.76rem;
    color: #334155;
}

.task-uniform-grid {
    display: grid;
    grid-template-columns: 1.1rem minmax(0, 1fr) 4.6rem;
    grid-template-rows: auto auto;
    grid-template-areas:
        "mark title action"
        "mark meta action";
    align-items: center;
    column-gap: 0.8rem;
    row-gap: 0.32rem;
    width: 100%;
    min-height: 4.35rem;
    padding: 0.9rem 1rem;
    box-sizing: border-box;
}

.task-uniform-grid--own,
.task-uniform-grid--single {
    grid-template-areas: "mark title action";
    grid-template-rows: auto;
    min-height: 3.65rem;
}

.task-uniform-grid--wide-action {
    grid-template-columns: 1.1rem minmax(0, 1fr) auto;
}

.task-row-marker {
    grid-area: mark;
    align-self: center;
    justify-self: center;
    flex-shrink: 0;
}

.task-select-dot {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(148, 163, 184, 0.45);
    border-radius: 50%;
    transition: border-color 0.15s, background 0.15s;
}

.task-row-marker--dot {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: rgba(251, 146, 60, 0.8);
}

.task-row-marker--muted {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.35);
}

.task-name-text {
    grid-area: title;
    align-self: center;
    min-width: 0;
    color: #f8fafc;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.task-uniform-grid:not(.task-uniform-grid--own):not(.task-uniform-grid--single) .task-name-text {
    align-self: end;
}

.task-option-meta {
    grid-area: meta;
    align-self: start;
    min-width: 0;
    margin: 0;
}

.task-uniform-grid--own .task-option-meta,
.task-uniform-grid--single .task-option-meta {
    display: none;
}

.task-meta-pill {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-meta-pill .pill-prefix {
    margin-right: 0.28rem;
    font-weight: 700;
}

.task-meta-pill--cover {
    background: rgba(251, 146, 60, 0.1);
    border: 1px solid rgba(251, 146, 60, 0.24);
    color: #fdba74;
}

.task-meta-pill--cover .pill-prefix {
    color: #f59e0b;
}

.task-meta-pill--person {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.22);
    color: #93c5fd;
}

.task-meta-pill--person .pill-prefix {
    color: #60a5fa;
}

.task-row-action,
.desc-btn {
    grid-area: action;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.6rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.5rem 0.35rem;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: center;
    justify-self: end;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.task-row-action:hover,
.desc-btn:hover {
    color: var(--text-main);
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.08);
}

.task-action-row {
    grid-area: action;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 0.35rem;
    min-width: 0;
    align-self: center;
    justify-self: end;
}

.task-action-row .desc-btn,
.task-action-row .task-row-action {
    grid-area: auto;
    width: 4.6rem;
}

.task-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}

.task-status-pill.done {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.task-status-pill.ready {
    background: rgba(251, 191, 36, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(251, 191, 36, 0.35);
}

.clean-task-row {
    display: block;
    width: 100%;
    background: rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(51, 65, 85, 0.95);
    border-radius: 12px;
    color: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.clean-task-row--tap {
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.clean-task-row--tap:hover {
    border-color: rgba(251, 146, 60, 0.35);
    background: rgba(251, 146, 60, 0.04);
}

.clean-task-row--static {
    padding: 0;
}

.clean-verify-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.desc-modal {
    display: none !important;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.desc-modal.open {
    display: flex !important;
}

.desc-modal-content {
    background: var(--surface, #1e293b);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

.desc-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.desc-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.desc-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.desc-modal-body {
    font-size: 0.9rem;
    color: var(--text-main);
    line-height: 1.55;
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
}

.desc-modal-body.empty {
    color: var(--text-muted);
    font-style: italic;
}

.clean-primary-btn {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 1px solid rgba(96, 165, 250, 0.32);
    border-radius: 10px;
    color: #f8fafc;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.clean-primary-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.clean-primary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.approve-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.approve-btn:hover {
    opacity: 0.9;
}

@media (max-width: 520px) {
    .task-uniform-grid {
        column-gap: 0.65rem;
        padding: 0.82rem 0.85rem;
        min-height: 4.1rem;
    }

    .task-uniform-grid--own,
    .task-uniform-grid--single {
        min-height: 3.45rem;
    }

    .task-name-text {
        font-size: 0.92rem;
    }
}
