* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 0 30px;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #f8fafc;
}

.header p {
    color: #94a3b8;
    margin-top: 8px;
}

/* Cards */
.card {
    background: #1e293b;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
    border: 1px solid #334155;
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #f1f5f9;
}

/* Status Card */
.status-card.safe { border-left: 4px solid #22c55e; }
.status-card.warning { border-left: 4px solid #f59e0b; }
.status-card.danger { border-left: 4px solid #ef4444; }

.message {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Progress Bar */
.progress-bar-container {
    background: #334155;
    border-radius: 999px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.progress-bar.safe { background: #22c55e; }
.progress-bar.warning { background: #f59e0b; }
.progress-bar.danger { background: #ef4444; }

.progress-text {
    text-align: right;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 25px;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.stat h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 4px;
}

.stat p {
    font-size: 0.85rem;
    color: #94a3b8;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #94a3b8;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #6366f1;
}

.btn {
    width: 100%;
    padding: 14px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.btn:hover {
    background: #4f46e5;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 10px 12px;
    background: #0f172a;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
   padding: 12px;
    border-top: 1px solid #334155;
    color: #e2e8f0;
    vertical-align: middle;
}

tr:hover td {
    background: #334155;
}

.no-data {
    text-align: center;
    color: #94a3b8;
    padding: 30px 0;
}

/* Delete Button */
/* Make delete button smaller and inline */
.btn-delete {
    padding: 4px 10px;
    background: transparent;
    color: #ef4444;
    border: 1px solid #ef4444;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
}

/* Fortnight Period */
.fortnight-period {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 20px;
}

.fortnight-period strong {
    color: #e2e8f0;
}

/* Date picker */
input[type="date"] {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
}

input[type="date"]:focus {
    border-color: #6366f1;
}

/* Fortnight Navigation */
.fortnight-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: #0f172a;
    border-radius: 10px;
    padding: 12px 16px;
}

.fortnight-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.fortnight-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6366f1;
    font-weight: 600;
}

.fortnight-period {
    font-size: 0.95rem;
    color: #94a3b8;
}

.fortnight-period strong {
    color: #e2e8f0;
}

.nav-arrow {
    font-size: 1.4rem;
    color: #6366f1;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #6366f1;
    transition: all 0.2s;
    line-height: 1;
}

.nav-arrow:hover {
    background: #6366f1;
    color: white;
}

.nav-arrow.disabled {
    color: #334155;
    border-color: #334155;
    cursor: not-allowed;
    pointer-events: none;
}

/* Read only lock */
.read-only {
    font-size: 0.85rem;
    color: #475569;
}

/* Settings button */
.settings-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

/* Academic start info */
.academic-start-info {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #64748b;
}

.academic-start-info strong {
    color: #94a3b8;
}

/* Setup hint */
.setup-hint {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Info card */
.info-card {
    border-left: 4px solid #6366f1;
}

/* Error card */
.error-card {
    border-left: 4px solid #ef4444;
    color: #ef4444;
}

/* Main Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}

.left-column { min-width: 0; }
.right-column { position: sticky; top: 20px; }

/* Calendar */
.calendar-card h2 {
    margin-bottom: 16px;
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.cal-header {
    text-align: center;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 600;
    padding: 4px 0;
    text-transform: uppercase;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    border-radius: 6px;
    color: #475569;
    background: transparent;
    cursor: default;
}

.cal-day.outside {
    color: #334155;
}

.cal-day.in-fortnight {
    background: #1e3a5f;
    color: #93c5fd;
}

.cal-day.worked {
    background: #14532d;
    color: #86efac;
    font-weight: 600;
}

.cal-day.today {
    outline: 2px solid #6366f1;
    outline-offset: -2px;
    font-weight: 700;
    color: #a5b4fc;
}

.cal-day.empty {
    background: transparent;
}

/* Legend */
.cal-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #1e293b;
    padding-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.legend-dot.in-fortnight { background: #1e3a5f; }
.legend-dot.worked { background: #14532d; }
.legend-dot.today { outline: 2px solid #6366f1; border-radius: 4px; }

/* Responsive */
@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    .right-column {
        position: static;
    }
}

/* Calendar Navigation */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cal-nav h2 {
    margin: 0;
    font-size: 1rem;
    text-align: center;
}

.cal-nav-arrow {
    font-size: 1rem;
    color: #6366f1;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #6366f1;
    transition: all 0.2s;
    line-height: 1.4;
}

.cal-nav-arrow:hover {
    background: #6366f1;
    color: white;
}

/* Break mode status card */
.status-card.break {
    border-left: 4px solid #f59e0b;
}

/* Break Toggle */
.break-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.break-label {
    font-size: 0.9rem;
    color: #94a3b8;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #334155;
    border-radius: 999px;
    transition: 0.3s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #f59e0b;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Input Mode Toggle */
.input-mode-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-label {
    font-size: 0.85rem;
    color: #94a3b8;
    white-space: nowrap;
}

.mode-buttons {
    display: flex;
    gap: 8px;
}

.mode-btn {
    padding: 6px 14px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.mode-btn:hover:not(.active) {
    border-color: #6366f1;
    color: #6366f1;
}

/* Time Inputs */
.time-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.time-input-group input {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.time-input-group input:focus {
    border-color: #6366f1;
}

.time-unit {
    font-size: 0.9rem;
    color: #94a3b8;
    white-space: nowrap;
}

/* Converted value display */
.converted-value {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #94a3b8;
}

.converted-value strong {
    color: #6366f1;
    font-size: 1rem;
}

/* History header */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.history-header h2 {
    margin-bottom: 0;
}

/* Export button */
.btn-export {
    padding: 8px 16px;
    background: transparent;
    color: #22c55e;
    border: 1px solid #22c55e;
    border-radius: 8px;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-export:hover {
    background: #22c55e;
    color: white;
}

/* Analytics Summary Cards */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #334155;
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 8px;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 4px;
}

.summary-sub {
    font-size: 0.8rem;
    color: #64748b;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card canvas {
    max-height: 300px;
}

/* Range Buttons */
.range-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.range-btn {
    padding: 8px 16px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.range-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.range-btn.active {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* Responsive */
@media (max-width: 768px) {
    .analytics-summary {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
}

/* ── Mobile Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {

    body {
        padding: 10px;
    }

    .container {
        padding: 0;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    /* Stack main layout vertically */
    .main-layout {
        grid-template-columns: 1fr;
    }

    .right-column {
        position: static;
    }

    /* Stack stats vertically */
    .stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat h2 {
        font-size: 1.4rem;
    }

    /* Fortnight nav */
    .fortnight-nav {
        padding: 8px;
    }

    .fortnight-period {
        font-size: 0.8rem;
    }

    /* Cards */
    .card {
        padding: 16px;
        border-radius: 12px;
    }

    /* Table scroll on mobile */
    .card table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Form inputs full width */
    .form-group input {
        font-size: 16px;
    }

    /* Analytics summary */
    .analytics-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .summary-value {
        font-size: 1.5rem;
    }

    /* Charts full width */
    .charts-row {
        grid-template-columns: 1fr;
    }

    /* Range buttons wrap */
    .range-buttons {
        gap: 6px;
    }

    .range-btn {
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    /* Break toggle */
    .break-toggle-container {
        flex-direction: row;
        gap: 8px;
    }

    /* History header */
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Mode buttons */
    .mode-buttons {
        flex-wrap: wrap;
    }

    /* Time inputs */
    .time-inputs {
        gap: 8px;
    }

    /* Calendar */
    .cal-day {
        font-size: 0.75rem;
    }

    .cal-header {
        font-size: 0.65rem;
    }
}

@media (max-width: 400px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .analytics-summary {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.3rem;
    }
}

/* Admin badges */
.admin-badge {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-badge {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

/* Notification Settings */
.notification-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid #1e293b;
    gap: 20px;
}

.notification-row.master {
    background: #0f172a;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #334155;
    margin-bottom: 8px;
}

.notif-title {
    font-size: 0.95rem;
    color: #f1f5f9;
    font-weight: 600;
    margin: 0 0 4px;
}

.notif-desc {
    font-size: 0.82rem;
    color: #64748b;
    margin: 0;
}

.notif-divider {
    height: 1px;
    background: #334155;
    margin: 8px 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #1e293b;
    border-radius: 16px;
    padding: 32px;
    width: 90%;
    max-width: 480px;
    border: 1px solid #334155;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    margin: 0;
    color: #f1f5f9;
}

.modal-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #334155;
    color: #f1f5f9;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
    margin-top: 0;
}

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #334155;
    color: #f1f5f9;
}

/* Edit button */
.btn-edit {
    padding: 4px 10px;
    background: transparent;
    color: #6366f1;
    border: 1px solid #6366f1;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-edit:hover {
    background: #6366f1;
    color: white;
}

/* Action buttons group */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Selected calendar day */
.cal-day.selected {
    outline: 2px solid #f59e0b;
    outline-offset: -2px;
    font-weight: 700;
    cursor: pointer;
}

/* Make all calendar days look clickable */
.cal-day:not(.empty) {
    cursor: pointer;
    transition: opacity 0.15s;
}

.cal-day:not(.empty):hover {
    opacity: 0.8;
}

/* Legend dot for selected */
.legend-dot.selected {
    outline: 2px solid #f59e0b;
    outline-offset: 1px;
    border-radius: 4px;
}

/* Job select dropdown */
.job-select {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #f1f5f9;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    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 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

.job-select:focus {
    border-color: #6366f1;
}

.job-select option {
    background: #1e293b;
    color: #f1f5f9;
}