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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #0f0f0f;
    color: #f0f0f0;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* ── Login ── */
#login-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    gap: 1.5rem;
}

.login-logo {
    width: 220px;
    max-width: 100%;
    height: auto;
}

.card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.subtitle {
    color: #888;
    font-size: 0.95rem;
}

/* ── Inputs ── */
input:not([type="checkbox"]) {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #f0f0f0;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    width: 100%;
    outline: none;
}

input:not([type="checkbox"]):focus {
    border-color: #555;
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
}

/* ── Buttons ── */
button {
    background: #2563eb;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    width: 100%;
    transition: background 0.15s;
}

button:hover {
    background: #1d4ed8;
}

/* ── Error message ── */
.error {
    color: #f87171;
    font-size: 0.9rem;
}

/* ── App header ── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.header-logo {
    height: 30px;
    width: auto;
    max-width: 160px;
}

header button {
    width: auto;
    padding: 0.5rem 1rem;
    background: #2a2a2a;
    font-size: 0.9rem;
}

header button:hover {
    background: #333;
}

/* ── Main content area ── */
main {
    padding: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

/* ── Rental rows ── */
.rental-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
    min-width: 0;
}

.rental-row.outside {
    background: #111111;
    border-color: #1e1e1e;
}

.rental-row.overdue {
    border-color: #dc2626;
    background: #1f0f0f;
}

.rental-row.bring-in {
    border-color: #d97706;
    background: #1a1400;
}

.rental-row.paused {
    border-color: #6366f1;
    background: #0f0f1f;
}

/* ── Row blocks (individual info segments) ── */
.block {
    white-space: nowrap;
    font-size: 0.9rem;
    color: #ccc;
}

.block.type {
    font-weight: 700;
    font-size: 1rem;
    color: #f0f0f0;
    min-width: 2rem;
}

.block.duration {
    color: #888;
}

.block.note {
    color: #666;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.out-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    background: #1a2a1a;
    color: #6b9e6b;
    flex-shrink: 0;
}

.block.timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.block.timer.overdue-text {
    color: #f87171;
}

.block.timer.bring-in-text {
    color: #fbbf24;
}

.block.timer.paused-text {
    color: #818cf8;
}

/* ── Spacer pushes action button to the right ── */
.spacer {
    flex: 1;
}

/* ── Action buttons inside rows ── */
.row-btn {
    width: auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.row-btn.assign {
    background: #2563eb;
}

.row-btn.assign:hover {
    background: #1d4ed8;
}

.row-btn.close {
    background: #16a34a;
}

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

.row-btn.confirm {
    background: #2563eb;
}

.row-btn.confirm:hover {
    background: #1d4ed8;
}

.row-btn.cancel {
    background: #2a2a2a;
}

.row-btn.cancel:hover {
    background: #333;
}

.row-btn.pause {
    background: #4f46e5;
}

.row-btn.pause:hover {
    background: #4338ca;
}

.row-btn.resume {
    background: #0e7490;
}

.row-btn.resume:hover {
    background: #0c6480;
}

.row-btn.add-time {
    background: #2a2a2a;
    color: #a3a3a3;
}

.row-btn.add-time:hover {
    background: #333;
    color: #f0f0f0;
}

.row-btn.swap {
    background: #2a2a2a;
    color: #a3a3a3;
}

.row-btn.swap:hover {
    background: #333;
    color: #f0f0f0;
}

/* ── Create row inputs ── */
.create-row select,
.create-row input[type="text"] {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 6px;
    color: #f0f0f0;
    font-size: 0.85rem;
    padding: 0.4rem 0.6rem;
    outline: none;
}

.create-row select:focus,
.create-row input[type="text"]:focus {
    border-color: #555;
}

/* ── App nav ── */
#app-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    width: auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: #2a2a2a;
}

.nav-btn:hover {
    background: #333;
}

.nav-btn.active {
    background: #2563eb;
}

.nav-btn.active:hover {
    background: #1d4ed8;
}

/* ── Employee rows ── */
.employee-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
}

.employee-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f0f0f0;
}

.role-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.role-badge.owner {
    background: #78350f;
    color: #fcd34d;
}

.role-badge.staff {
    background: #1e3a5f;
    color: #93c5fd;
}

/* ── Token notice ── */
.token-notice {
    background: #0f2010;
    border: 1px solid #16a34a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.token-notice p {
    color: #86efac;
    font-size: 0.875rem;
}

.token-notice p strong {
    color: #f0f0f0;
}

.token-value {
    background: #0f0f0f;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    color: #f0f0f0;
    word-break: break-all;
}

.token-notice-actions {
    display: flex;
    gap: 0.5rem;
}

.token-notice-actions button {
    width: auto;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: #1a3320;
    border: 1px solid #16a34a;
    color: #86efac;
}

.token-notice-actions button:hover {
    background: #1f3d28;
}

/* ── Create employee form ── */
.create-employee-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.create-employee-form input {
    flex: 1;
    min-width: 140px;
}

.create-employee-form select {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #f0f0f0;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    outline: none;
    flex-shrink: 0;
}

.create-employee-form select:focus {
    border-color: #555;
}

.create-employee-form button {
    width: auto;
    padding: 0.75rem 1.2rem;
    flex-shrink: 0;
}

/* ── Vehicle rows ── */
.vehicle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
}

.vehicle-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #f0f0f0;
}

/* ── Vehicle status badges ── */
.status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.status-badge.available {
    background: #052e16;
    color: #86efac;
}

.status-badge.rented {
    background: #1e3a5f;
    color: #93c5fd;
}

.status-badge.in_maintenance {
    background: #422006;
    color: #fbbf24;
}

/* ── Maintenance toggle buttons ── */
.row-btn.set-maintenance {
    background: #78350f;
    color: #fbbf24;
}

.row-btn.set-maintenance:hover {
    background: #92400e;
}

.row-btn.set-available {
    background: #16a34a;
}

.row-btn.set-available:hover {
    background: #15803d;
}

/* ── Create vehicle form ── */
.create-vehicle-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.create-vehicle-form select {
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #f0f0f0;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    outline: none;
    flex-shrink: 0;
}

.create-vehicle-form select:focus {
    border-color: #555;
}

.create-vehicle-form input[type="number"] {
    width: 100px;
    flex-shrink: 0;
}

.create-vehicle-form button {
    width: auto;
    padding: 0.75rem 1.2rem;
    flex-shrink: 0;
}

/* ── Add rental button ── */
.add-btn {
    width: 100%;
    background: #1a1a1a;
    border: 1px dashed #333;
    border-radius: 8px;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1rem;
    margin-top: 0.25rem;
    transition: border-color 0.15s, color 0.15s;
}

.add-btn:hover {
    border-color: #555;
    color: #888;
    background: #1a1a1a;
}

/* ── Mobile: rows wrap to two lines ── */
@media (max-width: 600px) {
    /* ── Header ── */
    header {
        padding: 0.6rem 0.75rem;
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    /* Push the nav to its own second line, full width */
    #app-nav {
        order: 3;
        width: 100%;
    }

    .header-logo {
        max-width: 110px;
    }

    .nav-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

    header button#logout-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* ── Rental rows ── */
    .rental-row {
        flex-wrap: wrap;
    }

    /* ── Vehicle rows ── */
    .vehicle-row {
        flex-wrap: wrap;
    }

    .spacer {
        display: none;
    }

    .row-btn {
        width: 100%;
        margin-top: 0.4rem;
        text-align: center;
    }
}