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

:root {
    --primary: #143C78;
    --primary-dark: #0E2D5A;
    --primary-light: #1E5CB8;
    --purple: #8C1478;
    --pink: #F01478;
    --gold: #F0B43C;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #F0B43C;
    --bg: #f4f6fa;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #d4dcec;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.logo-img {
    height: 36px;
    width: auto;
}

.logo-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.logo-text::after {
    content: 'STGILDAS';
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--purple);
    letter-spacing: 0.1em;
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.875rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--bg);
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    font-weight: 600;
}

.header {
    border-bottom: 2px solid var(--primary);
}

.nav-user {
    font-size: 0.875rem;
    color: var(--text-light);
    padding: 0 8px;
}

.nav-logout {
    color: var(--danger);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    gap: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: 0.3s;
}

/* Main */
.main {
    flex: 1;
    padding: 24px 0;
}

/* Hero */
.hero {
    text-align: center;
    padding: 40px 0 32px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    margin: -24px -16px 0;
    padding-left: 16px;
    padding-right: 16px;
    color: white;
    border-bottom: 4px solid var(--gold);
}

.hero h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    color: white;
}

.hero p {
    color: rgba(255,255,255,0.85);
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 0;
    justify-content: center;
}

.filter-btn {
    text-decoration: none;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow);
}

.filter-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

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

.filter-btn.active:hover {
    background: var(--primary-dark);
    color: white;
}

.badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.filter-btn.active .badge {
    background: rgba(255,255,255,0.3);
}

/* Mosaic grid */
.mosaic {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 16px 0;
}

.mosaic-item {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.mosaic-image {
    aspect-ratio: 1;
    overflow: hidden;
    background: #f1f5f9;
}

.mosaic-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-orientation: from-image;
}

.no-photo {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.875rem;
    background: #f1f5f9;
}

.mosaic-label {
    padding: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-light);
    grid-column: 1 / -1;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.modal-sm {
    max-width: 450px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
}

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

.modal-loader {
    text-align: center;
    padding: 48px;
    color: var(--text-light);
}

/* Item detail in modal */
.item-detail-images {
    padding: 16px;
}

.detail-main-photo {
    width: 100%;
    border-radius: 8px;
    background: #f1f5f9;
}

.detail-photo-main {
    width: 100%;
    max-height: 500px;
    display: block;
    object-fit: contain;
    object-position: center;
}

.detail-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.detail-thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
    image-orientation: from-image;
}

.detail-thumb:hover {
    opacity: 1;
}

.item-detail-info {
    padding: 0 16px 16px;
}

.item-detail-info h2 {
    margin-bottom: 8px;
}

.item-description {
    color: var(--text-light);
    margin-bottom: 8px;
}

.item-date {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 16px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(20,60,120,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-primary.\--pink {
    background: var(--pink);
}

.btn-primary.\--pink:hover {
    background: #c01060;
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-claim {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    font-weight: 600;
    padding: 14px 20px;
    font-size: 1rem;
}

.btn-claim:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--purple));
}

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

.btn-success:hover {
    background: #15803d;
}

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

.btn-danger:hover {
    background: #b91c1c;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover td {
    background: var(--bg);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card.accent {
    border-color: var(--pink);
    background: #fef0f6;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-value.purple {
    color: var(--purple);
}

.stat-card .stat-value.gold {
    color: var(--gold);
}

.stat-card .stat-value.pink {
    color: var(--pink);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.stat-card.accent .stat-value {
    color: var(--pink);
}

.stats-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 4px;
    color: var(--primary);
}

.login-card h1::before {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--pink));
    margin: 0 auto 16px;
    border-radius: 2px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-card .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--purple));
}

.login-card .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--purple));
}

/* Claims */
.claims-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.claim-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.claim-photo {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0;
    background: #f1f5f9;
    image-orientation: from-image;
}

.claim-info {
    flex: 1;
    min-width: 0;
}

.claim-info strong {
    display: block;
    margin-bottom: 2px;
}

.claim-info p {
    font-size: 0.85rem;
    color: var(--text-light);
}

.claim-date {
    font-size: 0.75rem;
}

.claim-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* Photo upload */
.photo-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg);
}

.photo-upload-area:hover,
.photo-upload-area.dragover {
    border-color: var(--primary);
    background: #e8eef8;
}

.photo-upload-area p {
    color: var(--text-light);
}

.photo-hint {
    font-size: 0.8rem;
    margin-top: 4px;
}

.photo-input {
    display: none;
}

.photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Form inline */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* Badge variants */
.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef9e7;
    color: #92400e;
}

.badge-danger {
    background: #fef2f2;
    color: #991b1b;
}

/* Actions cell */
.actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Footer */
.footer {
    background: var(--primary);
    padding: 16px 0;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.8);
    margin-top: auto;
}

/* Utilities */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-light { color: var(--text-light); }

/* Responsive */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 12px 16px;
        box-shadow: var(--shadow-lg);
    }

    .nav.active {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px;
    }

    .nav-user {
        padding: 12px;
        border-top: 1px solid var(--border);
        width: 100%;
    }

    .mosaic {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .hero {
        margin: -24px -16px 0;
        padding-left: 16px;
        padding-right: 16px;
        border-radius: 0;
    }

    .hero h1 {
        font-size: 1.4rem;
    }

    .claim-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .claim-photo {
        width: 100%;
        height: 160px;
    }

    .claim-actions {
        width: 100%;
        justify-content: stretch;
    }

    .claim-actions .btn {
        flex: 1;
    }

    .form-inline {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .login-card {
        padding: 24px 16px;
        box-shadow: none;
        border: none;
    }

    .login-container {
        min-height: auto;
        padding-top: 24px;
    }

    .modal-content {
        margin: 0;
        border-radius: var(--radius);
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .mosaic {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .filter-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
