/* ==========================================
   ChantierTrack — Design System
   Conservative, Professional, Modern
   ========================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #13161b;
    --bg-secondary: #1a1d23;
    --bg-card: #21252d;
    --bg-card-hover: #282d37;
    --bg-input: #2a2f3a;
    --bg-input-focus: #323844;

    --text-primary: #e8eaed;
    --text-secondary: #9aa0ab;
    --text-muted: #6b7280;
    --text-accent: #c9cdd4;

    --border: #2e3440;
    --border-focus: #4a5568;
    --border-subtle: #252a33;

    --accent: #5b7fb5;
    --accent-hover: #6d91c7;
    --accent-glow: rgba(91, 127, 181, 0.15);

    --success: #4a9e6e;
    --success-bg: rgba(74, 158, 110, 0.12);
    --warning: #c9943a;
    --warning-bg: rgba(201, 148, 58, 0.12);
    --danger: #c75050;
    --danger-bg: rgba(199, 80, 80, 0.12);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.2);
    --transition: 0.2s ease;

    --glass-bg: rgba(33, 37, 45, 0.85);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-blur: 16px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(91, 127, 181, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(91, 127, 181, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* --- Header --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    max-width: 900px;
    margin: 0 auto;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.app-title {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.app-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    position: relative;
}

.btn-icon:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
}

.badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}

/* --- Tab Navigation --- */
.tab-nav {
    display: flex;
    gap: 0;
    padding: 0 20px;
    max-width: 900px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex: 1;
    padding: 12px 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 40px;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-focus);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    background: var(--bg-input-focus);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa0ab' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.required-star {
    color: var(--danger);
    font-weight: 700;
}

/* --- Hours + Photos Section --- */
.hours-photos-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.section-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.section-info strong {
    color: var(--warning);
}

.time-photo-block {
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    overflow: hidden;
}

.time-photo-header {
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.before-header {
    background: rgba(91, 127, 181, 0.15);
    color: var(--accent);
}

.after-header {
    background: rgba(74, 158, 110, 0.15);
    color: var(--success);
}

.time-label {
    font-size: 0.8rem;
}

.time-photo-row {
    display: flex;
    gap: 14px;
    padding: 14px;
    align-items: flex-start;
}

.hours-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.hours-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.hours-badge {
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent-hover);
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1.15rem;
    text-align: center;
}

/* --- Photo Upload (compact inside time blocks) --- */
.photo-dropzone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.photo-dropzone.compact {
    padding: 16px 12px;
}

.photo-dropzone:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100% !important;
    height: 100% !important;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    pointer-events: none;
}

.dropzone-icon {
    font-size: 1.6rem;
    opacity: 0.7;
}

.photo-previews {
    display: flex;
    gap: 8px;
    padding: 0 14px 10px;
    flex-wrap: wrap;
}

.photo-preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .exif-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    font-size: 0.55rem;
    color: #fff;
    padding: 2px 4px;
    text-align: center;
}

/* --- Buttons --- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-large {
    padding: 16px 24px;
    font-size: 1.05rem;
    border-radius: var(--radius);
}

.btn-small {
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-small:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: var(--transition);
}

.btn-text:hover {
    color: var(--accent-hover);
}

.btn-sms {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-sms:hover {
    background: #3d8a5e;
}

.btn-close {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: var(--transition);
}

.btn-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Materials Section (Free Text) --- */
.materials-section {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.materials-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.material-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-accent);
}

.material-tag .remove-mat {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
}

.material-tag .remove-mat:hover {
    color: var(--danger);
}

.material-add-grid-4 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 2fr auto;
    gap: 8px;
    align-items: center;
}

@media (max-width: 600px) {
    .material-add-grid-4 {
        grid-template-columns: 1fr 1fr;
    }

    .material-add-grid-4 button {
        grid-column: span 2;
    }
}

.btn-add-material {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-add-material:hover {
    background: var(--accent-hover);
}

/* --- Entries List --- */
.entries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entry-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    transition: var(--transition);
    cursor: pointer;
}

.entry-item:hover {
    background: var(--bg-input-focus);
    border-color: var(--border);
}

.entry-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pending {
    background: var(--warning);
}

.status-validated {
    background: var(--success);
}

.status-alert {
    background: var(--danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(199, 80, 80, 0.4);
    }

    50% {
        opacity: 0.9;
        box-shadow: 0 0 0 6px rgba(199, 80, 80, 0);
    }
}

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-company {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.entry-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.entry-hours {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent);
    white-space: nowrap;
}

.entry-actions {
    display: flex;
    gap: 6px;
}

.btn-action {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--bg-card-hover);
}

.btn-action.delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-card.stat-alert {
    border-color: rgba(199, 80, 80, 0.3);
    background: var(--danger-bg);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.stat-alert .stat-value {
    color: var(--danger);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Company Breakdown --- */
.company-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.company-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}

.company-name {
    font-weight: 600;
    flex: 1;
    font-size: 0.9rem;
}

.company-hours {
    font-weight: 700;
    color: var(--accent);
    font-size: 1rem;
}

.company-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-ok {
    background: var(--success-bg);
    color: var(--success);
}

.badge-alert {
    background: var(--danger-bg);
    color: var(--danger);
}

.hours-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
    width: 100%;
}

.hours-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
    transition: width 0.5s ease;
}

/* --- Table --- */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.data-table tbody tr {
    transition: var(--transition);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: var(--bg-input);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.status-pending-badge {
    background: var(--warning-bg);
    color: var(--warning);
}

.status-validated-badge {
    background: var(--success-bg);
    color: var(--success);
}

.status-alert-badge {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Charts (Performance) --- */
.chart-section {
    margin-bottom: 10px;
}

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.chart-container {
    width: 100%;
    min-height: 60px;
}

/* Horizontal bar chart */
.h-bar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.h-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.h-bar-label {
    flex: 0 0 130px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.h-bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.h-bar-fill {
    height: 100%;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    min-width: 40px;
}

.h-bar-fill.bar-accent {
    background: linear-gradient(90deg, var(--accent), #7a9fd4);
}

.h-bar-fill.bar-success {
    background: linear-gradient(90deg, var(--success), #62c48a);
}

.h-bar-fill.bar-warning {
    background: linear-gradient(90deg, var(--warning), #d9ae5a);
}

.h-bar-fill.bar-danger {
    background: linear-gradient(90deg, var(--danger), #d97070);
}

.h-bar-value {
    flex: 0 0 60px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

/* Donut ring chart (CSS-only) */
.donut-chart-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.donut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.donut-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.donut-ring-inner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.donut-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 100px;
}

/* Sparkline daily chart */
.daily-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding: 0 4px;
}

.daily-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    gap: 4px;
}

.daily-bar {
    width: 100%;
    max-width: 32px;
    border-radius: 4px 4px 0 0;
    background: var(--accent);
    transition: height 0.6s ease;
    min-height: 4px;
}

.daily-bar:hover {
    background: var(--accent-hover);
}

.daily-bar-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    transform: rotate(-45deg);
    transform-origin: top center;
    margin-top: 4px;
}

.daily-bar-value {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* --- Alerts --- */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    background: var(--danger-bg);
    border: 1px solid rgba(199, 80, 80, 0.2);
    border-radius: var(--radius);
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.alert-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.alert-sms-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 14px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
}

.alert-sms-btn:hover {
    background: #3d8a5e;
}

.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.success-state {
    color: var(--success);
}

/* --- Materials Report --- */
.materials-report {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.material-report-name {
    font-size: 0.85rem;
    color: var(--text-accent);
}

.material-report-qty {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--accent);
}

/* --- Date Filter --- */
.date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-input {
    max-width: 140px;
    padding: 6px 10px !important;
    font-size: 0.82rem !important;
}

.today-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow);
    max-height: 85vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body small {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* --- Detail Modal --- */
.detail-section {
    margin-bottom: 16px;
}

.detail-section h3 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-item {
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.detail-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.detail-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.detail-photos {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.detail-photo {
    width: 100px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.detail-photo:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    box-shadow: var(--shadow);
    max-width: 320px;
}

.toast-success {
    background: var(--success);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .header-content {
        padding: 10px 16px;
    }

    .tab-nav {
        padding: 0 10px;
    }

    .main-content {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: var(--radius);
    }

    .form-row {
        flex-direction: column;
    }

    .time-photo-row {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .date-filter {
        flex-wrap: wrap;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .material-add-row-free {
        flex-wrap: wrap;
    }

    .h-bar-label {
        flex: 0 0 80px;
        font-size: 0.7rem;
    }

    .donut-chart-grid {
        gap: 14px;
    }

    .tab-btn {
        font-size: 0.74rem;
        padding: 10px 6px;
    }

    .modal {
        max-height: 92vh;
        border-radius: var(--radius);
    }

    input,
    select,
    textarea,
    .btn-primary {
        min-height: 48px;
        font-size: 1rem;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-focus);
}