

/* Strict Apple HIG */
:root {
    /* Light Mode */
    --bg-main: #F2F2F7;
    --bg-card: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --border-color: #E5E5EA;
    
    /* HIG System Colors */
    --sys-blue: #007AFF;
    --sys-green: #34C759;
    --sys-red: #FF3B30;
    --sys-purple: #AF52DE;
    --sys-gray: #8E8E93;

    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --border-radius-card: 16px;
    --border-radius-sm: 10px;
    
    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --transition: 0.2s ease-in-out;
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-main: #000000;
    --bg-card: #1C1C1E;
    --text-primary: #FFFFFF;
    --text-secondary: #EBEBF5;
    --border-color: #38383A;
    
    --sys-blue: #0A84FF;
    --sys-green: #30D158;
    --sys-red: #FF453A;
    --sys-purple: #BF5AF2;
    --sys-gray: #98989D;

    --card-shadow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font-main); }

body { background-color: var(--bg-main); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; transition: background-color var(--transition), color var(--transition); }

.app-container { display: flex; min-height: 100vh; }
.app-container.no-sidebar .sidebar { display: none; }

.main-content {
    flex: 1; padding: 32px 48px; display: flex; flex-direction: column; gap: 24px;
    height: 100vh; overflow-y: auto;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius-card);
    box-shadow: var(--card-shadow);
    padding: 24px;
    transition: background-color var(--transition), box-shadow var(--transition);
}

.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }
.page-title-box { position: relative; }
.date-nav { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.date-nav-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.date-display-btn {
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--sys-gray);
    padding: 0 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.custom-date-picker {
    position: fixed;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 10px;
    z-index: 80;
}
.custom-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.custom-picker-header strong { font-size: 13px; color: var(--text-primary); }
.picker-month-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
}
.custom-picker-weekdays,
.custom-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.custom-picker-weekdays span {
    font-size: 11px;
    color: var(--sys-gray);
    text-align: center;
}
.picker-day {
    height: 37px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    position: relative;
}
.picker-day.outside { opacity: 0.35; }
.picker-day.status-partial { border-color: #f59e0b; }
.picker-day.status-goal-hit { border-color: #22c55e; }
.picker-day.status-goal-miss { border-color: #ef4444; }
.picker-day.today {
    border-color: var(--sys-blue);
    border-width: 1px;
}
.picker-day.selected {
    border-width: 2px;
    border-color: var(--sys-blue);
    background: color-mix(in srgb, var(--sys-blue) 24%, var(--bg-main));
}
.picker-day.today.selected {
    border-color: var(--sys-blue);
    border-width: 2px;
    background: color-mix(in srgb, var(--sys-blue) 24%, var(--bg-main));
}
.picker-day.selected.status-partial {
    border-color: #f59e0b;
    background: color-mix(in srgb, #f59e0b 24%, var(--bg-main));
}
.picker-day.selected.status-goal-hit {
    border-color: #22c55e;
    background: color-mix(in srgb, #22c55e 24%, var(--bg-main));
}
.picker-day.selected.status-goal-miss {
    border-color: #ef4444;
    background: color-mix(in srgb, #ef4444 24%, var(--bg-main));
}
.picker-day.today.selected.status-partial,
.picker-day.today.selected.status-goal-hit,
.picker-day.today.selected.status-goal-miss {
    border-color: var(--sys-blue);
    background: color-mix(in srgb, var(--sys-blue) 24%, var(--bg-main));
}
.picker-day.status-partial::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}
.picker-day.status-partial::after { background: #f59e0b; }
.custom-picker-legend {
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--sys-gray);
}
.legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.legend-dot.partial { background: #f59e0b; }
.legend-dot.goal-hit { background: #22c55e; }
.legend-dot.goal-miss { background: #ef4444; }

.header-actions { display: flex; align-items: center; gap: 16px; }
.action-btn {
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--sys-blue);
    background: var(--sys-blue);
    color: #fff;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: var(--transition);
}
.action-btn.secondary {
    border-color: var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
}
.action-btn:hover { transform: translateY(-1px); }
.mobile-fab-wrap { display: none; }
.modal-open .mobile-fab-wrap {
    opacity: 0;
    pointer-events: none;
}

.theme-toggle {
    background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-primary);
    border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; cursor: pointer; box-shadow: var(--card-shadow); transition: var(--transition);
}
.theme-toggle:hover { transform: scale(1.05); }

.user-profile img { border-radius: 50%; width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--border-color); }

/* Summaries */
.summary-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.summary-card { display: flex; flex-direction: column; gap: 4px; padding: 20px; }

.card-icon-box { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
}
.card-icon.global { background-color: var(--sys-gray); }
.card-icon.blue { background-color: var(--sys-blue); }
.card-icon.purple { background-color: var(--sys-purple); }

.card-title { font-size: 14px; color: var(--sys-gray); font-weight: 600; text-transform: uppercase; letter-spacing: -0.2px; }
.card-value { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; color: var(--text-primary); }
.card-meta-text { font-size: 14px; color: var(--sys-gray); font-weight: 500;}
.card-meta-text strong { color: var(--text-primary); font-weight: 700; }

.perf-badge { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; margin-top: 4px; }
.perf-badge i { font-size: 18px; }
.perf-badge.positive { color: var(--sys-green); }
.perf-badge.negative { color: var(--sys-red); }

/* Progress bar (Solid HIG) */
.progress-bar {
    width: 100%; height: 6px; background-color: var(--border-color);
    border-radius: 3px; overflow: hidden; margin-top: 12px;
}
.progress { height: 100%; border-radius: 3px; }
.progress.blue { background-color: var(--sys-blue); }
.progress.purple { background-color: var(--sys-purple); }

/* Shifts Grid */
.shift-cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.shift-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: var(--border-radius-card); }
.shift-card--empty { min-height: 100%; }

.shift-header {
    display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; letter-spacing: -0.3px;
    color: var(--text-primary); padding-bottom: 12px; border-bottom: 1px solid var(--border-color);
}
.shift-header i { font-size: 20px; color: var(--sys-blue); }
.shift-edit-btn {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--sys-blue);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    cursor: pointer;
}
.shift-card:hover .shift-edit-btn {
    opacity: 1;
    pointer-events: auto;
}
.shift-employee {
    margin-left: 8px;
    font-size: 11px;
    color: var(--sys-gray);
    font-weight: 500;
}

.shift-section { display: flex; flex-direction: column; gap: 6px; position: relative; }
.shift-section--empty { flex: 1; justify-content: center; }
.shift-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--sys-gray); font-weight: 600; margin-bottom: 4px; margin-top: 8px; }
.shift-section-heading { display: flex; justify-content: space-between; align-items: center; }
.shift-expand-btn {
    border: none;
    background: transparent;
    color: var(--sys-blue);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    padding: 0;
}
.shift-expand-btn--pagos { color: var(--sys-blue); }
.shift-expand-btn--cargas { color: var(--sys-blue); }
.shift-entry-extra--pagos,
.shift-entry-extra--cargas {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: absolute;
    top: calc(100% + 2px);
    left: -7px;
    right: -12px;
    z-index: 8;
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 6px 4px 6px 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: max-height var(--transition), opacity var(--transition), transform var(--transition);
}
.shift-entry-extra--pagos.expanded {
    max-height: 245px;
    overflow-y: auto;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    scrollbar-gutter: stable;
}

.shift-entry-extra--cargas.expanded {
    max-height: 159px;
    overflow-y: auto;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    scrollbar-gutter: stable;
}

.shift-row {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 14px; padding: 10px 12px; background-color: var(--bg-card);
    border-radius: var(--border-radius-sm); border: 1px solid var(--border-color);
}
.shift-row span:first-child { color: var(--text-primary); font-weight: 500; }
.shift-row span:last-child { font-weight: 600; color: var(--sys-green); }
.shift-row small { font-size: 11px; color: var(--sys-gray); font-weight: 400; margin-left: 6px; }

.shift-row.negative span:last-child { color: var(--sys-red); }
.shift-row.neutral { justify-content: center; background-color: transparent; border: 1px dashed var(--border-color); }
.shift-row.neutral span { color: var(--sys-gray); font-style: italic;}

.shift-divider { height: 1px; background-color: var(--border-color); margin: 8px 0; }
.shift-total { display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: var(--text-primary); font-weight: 600; }
.shift-total strong { font-size: 20px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px;}

.shift-compare { margin-top: auto; padding-top: 12px; }
.compare-box {
    display: flex; flex-direction: column; gap: 6px; padding: 12px;
    background-color: var(--bg-main); border-radius: var(--border-radius-sm); border: 1px solid var(--border-color); text-align: center;
}
.compare-label { font-size: 12px; color: var(--sys-gray); font-weight: 500; }
.compare-values { display: flex; justify-content: center; align-items: center; gap: 8px; }
.compare-abs { font-size: 15px; font-weight: 600; }
.compare-percent { font-size: 15px; font-weight: 600; }
.positive-text { color: var(--sys-green); display: flex; align-items: center; gap: 2px;}
.negative-text { color: var(--sys-red); display: flex; align-items: center; gap: 2px;}

/* Charts Area */
.charts-area { display: flex; flex-direction: column; gap: 20px; margin-bottom: 20px; }
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.charts-row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.span-2 { grid-column: span 2; }
.chart-card h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 2px; }
.chart-subtitle { font-size: 14px; color: var(--sys-gray); margin-bottom: 16px; font-weight: 500;}
.simple-cost-list {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-main);
    padding: 12px;
}
.simple-cost-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.simple-cost-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.simple-cost-header span {
    font-size: 14px;
    font-weight: 700;
    color: var(--sys-red);
}
.simple-cost-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 255px;
    overflow-y: auto;
    min-height: 0;
    scrollbar-gutter: stable;
    padding-right: 4px;
    overscroll-behavior: contain;
}
.cost-item {
    position: relative;
    display: block;
    border-left: 3px solid var(--sys-blue);
    padding: 0;
    overflow: clip;
}
.cost-item-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 10px 10px 12px;
    transition: transform var(--transition);
    background: var(--bg-card);
    line-height: 1.2;
}
.cost-item-label {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.cost-item-value {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: opacity var(--transition);
    line-height: 1.2;
}
.cost-item-value.negative { color: var(--sys-red); }
.cost-item-actions {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: color-mix(in srgb, var(--bg-main) 88%, transparent);
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}
.cost-item-actions button {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
}
.cost-item:hover .cost-item-actions {
    opacity: 1 !important;
    pointer-events: auto;
}
.cost-item:hover .cost-item-content { transform: none; }
.cost-item:hover .cost-item-value { opacity: 1; }

.modal-date-nav {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 6px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-main);
    padding: 3px;
}
.modal-date-nav .date-display-btn {
    width: 100%;
    justify-content: center;
    border: none;
    background: transparent;
    height: 100%;
}
.modal-date-nav .date-nav-btn {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    background: var(--bg-card);
    border-color: var(--border-color);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 40;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}
.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    width: min(680px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: scroll;
    scrollbar-gutter: stable;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 20px;
}
.modal-card--output { width: min(520px, 100%); }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.modal-header h3 {
    font-size: 20px;
    letter-spacing: -0.4px;
}
.modal-close-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
}
.modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 6px;
}
.modal-grid {
    display: grid;
    gap: 10px;
}
.modal-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-grid.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-group span {
    color: var(--sys-gray);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.chip-inline-value { color: var(--text-primary); font-size: 13px; font-weight: 700; }
.field-date-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    gap: 6px;
}
.field-date-btn {
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
}
.field-group input,
.field-group select {
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}
.field-group select {
    appearance: none;
    padding-right: 36px;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-primary) 50%), linear-gradient(135deg, var(--text-primary) 50%, transparent 50%);
    background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}
.field-group input:focus,
.field-group select:focus {
    border-color: var(--sys-blue);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--sys-blue) 22%, transparent);
}
.field-group-btn { justify-content: flex-end; }
.field-group-btn .mini-btn { height: 40px; width: 100%; }
.add-row-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--sys-blue);
    font-size: 18px;
    font-weight: 700;
    align-self: center;
    cursor: pointer;
}
.mini-btn {
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 0 10px;
    cursor: pointer;
}
.form-section {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-main);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.form-section-head h4 {
    font-size: 14px;
    letter-spacing: -0.2px;
}
.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dynamic-list .entry-row { margin-top: 4px; }
.dynamic-list .entry-row:first-child { margin-top: 0; }
.dynamic-list .entry-row:first-child .remove-row-btn {
    visibility: hidden;
    pointer-events: none;
}
.entry-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px 32px;
    gap: 8px;
}
.entry-row input {
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0 10px;
    font-size: 13px;
    outline: none;
}
.entry-row input:focus {
    border-color: var(--sys-blue);
}
.entry-row .remove-row-btn {
    width: 32px;
    height: 32px;
    border: 1px solid color-mix(in srgb, var(--sys-red) 70%, transparent);
    background: color-mix(in srgb, var(--sys-red) 16%, transparent);
    color: var(--sys-red);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}
.field-total {
    color: var(--sys-gray);
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}
.field-total strong {
    color: var(--text-primary);
    font-weight: 700;
}
.field-total.grand-total {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}
.chips-convert-box {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    color: var(--sys-gray);
    font-size: 13px;
}
.chips-convert-box span:nth-child(1) { grid-column: 1; }
.chips-convert-box span:nth-child(2) { grid-column: 2; }
.chips-convert-box strong {
    color: var(--text-primary);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2px;
}
.hidden { display: none !important; }

[data-theme="dark"] input[type="date"] { color-scheme: dark; }
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.25);
    opacity: 0.95;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--sys-gray); }

/* Apexcharts overrides */
.apexcharts-text { fill: var(--sys-gray) !important; font-family: var(--font-main) !important; font-weight: 500; }
.apexcharts-tooltip {
    background: var(--bg-card) !important; border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important; border-radius: var(--border-radius-sm) !important; box-shadow: var(--card-shadow) !important;
}
.apexcharts-tooltip-title { background: var(--bg-main) !important; border-bottom: 1px solid var(--border-color) !important; font-weight: 600 !important; font-family: var(--font-main) !important;}
.apexcharts-gridline { stroke: var(--border-color) !important; stroke-dasharray: 4; }
.apexcharts-legend-text { color: var(--sys-gray) !important; font-family: var(--font-main) !important; }

/* Responsive Grid */
@media (max-width: 1400px) {
    .shift-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
    .top-bar { justify-content: center; position: relative; }
    .page-title-box { display: flex; flex-direction: column; align-items: center; width: 100%; }
    .page-title { text-align: center; }
    .date-nav { justify-content: center; width: 100%; margin-top: 12px; }
    .date-nav-btn { width: 36px; height: 36px; }
    .date-display-btn { height: 36px; font-size: 16px; min-width: 170px; }
    .custom-date-picker {
        width: min(360px, calc(100vw - 20px));
        left: 50% !important;
        transform: translateX(-50%);
    }
    .picker-day { height: 40px; font-size: 13px; }
    .theme-toggle { display: none; }
    .header-actions { display: none; }
    .mobile-fab-wrap {
        display: block;
        position: fixed;
        right: 18px;
        bottom: 22px;
        z-index: 28;
    }
    .mobile-fab-main {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: 1px solid var(--sys-blue);
        background: var(--sys-blue);
        color: #fff;
        font-size: 26px;
        box-shadow: var(--card-shadow);
        cursor: pointer;
        transition: transform var(--transition);
    }
    .mobile-fab-wrap.open .mobile-fab-main { transform: rotate(45deg); }
    .mobile-fab-menu {
        position: absolute;
        right: 0;
        bottom: 66px;
        display: flex;
        flex-direction: column;
        gap: 8px;
        transform: translateY(8px) scale(0.96);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition), transform var(--transition);
    }
    .mobile-fab-wrap.open .mobile-fab-menu {
        transform: translateY(0) scale(1);
        opacity: 1;
        pointer-events: auto;
    }
    .mobile-fab-option {
        height: 38px;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: var(--bg-card);
        color: var(--text-primary);
        padding: 0 12px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
    }
    .shift-cards-grid { grid-template-columns: 1fr; }
    .summary-cards { grid-template-columns: 1fr; }
    .charts-row { grid-template-columns: 1fr; }
    .charts-row-4 { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .header-actions { flex-wrap: wrap; justify-content: flex-end; }
    .modal-grid.two-cols,
    .modal-grid.three-cols { grid-template-columns: 1fr; }
    .entry-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; align-items: center; }
    .main-content { padding: 24px; }
    .modal-overlay { padding: 0; }
    .modal-card {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 16px 14px 0;
    }
    .modal-header { margin-bottom: 10px; }
    .modal-close-btn {
        position: fixed;
        top: 10px;
        right: 12px;
        z-index: 60;
    }
    .modal-header h3 { padding-right: 48px; }
    .modal-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 55;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--bg-card) 92%, transparent);
        border-top: 1px solid var(--border-color);
    }
    .modal-actions .action-btn.secondary { display: none; }
    .modal-actions .action-btn {
        width: 100%;
        justify-content: center;
        height: 46px;
        font-size: 15px;
    }
    .modal-body { padding-bottom: 92px; }
    .add-row-btn { position: relative; z-index: 1; }
    .field-date-btn { display: none; }
    .field-date-wrap { display: none; }
    .modal-date-nav { margin-top: 2px; }
    .cost-item {
        touch-action: pan-y;
        --swipe-offset: 0px;
        --swipe-progress: 0;
    }
    .cost-item-actions { opacity: var(--swipe-progress); }
    .cost-item.swiped .cost-item-actions { pointer-events: auto; }
    .cost-item.swiped .cost-item-content { transform: translateX(var(--swipe-offset)); }
    .cost-item.swiped .cost-item-value { opacity: calc(1 - var(--swipe-progress)); }
    .shift-edit-btn {
        opacity: 1;
        pointer-events: auto;
    }
}
