:root {
    --deep: #170805;
    --panel: #fffdf8;
    --paper: #fff8f0;
    --line: #eadfd3;
    --muted: #7a5c4a;
    --text: #1a0e08;
    --orange: #e8621a;
    --amber: #f5a623;
    --gold: #f7c948;
    --green: #159c67;
    --red: #c0392b;
    --shadow: 0 18px 60px rgba(26, 14, 8, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "DM Sans", sans-serif;
    color: var(--text);
    background: var(--paper);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.hidden { display: none !important; }

.eyebrow {
    margin: 0 0 8px;
    color: var(--orange);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(120deg, rgba(23, 8, 5, 0.92), rgba(23, 8, 5, 0.68)),
        url("../img/hero.png") center top / cover;
}

.login-panel {
    width: min(420px, 100%);
    background: rgba(255, 253, 248, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 8px;
    padding: 36px;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 86px;
    height: 58px;
    object-fit: contain;
    margin-bottom: 18px;
}

.login-panel h1,
.topbar h2,
.panel h3,
.modal h3 {
    margin: 0;
    font-family: "Playfair Display", serif;
}

.login-panel h1 {
    font-size: 2.4rem;
}

.login-copy {
    color: var(--muted);
    line-height: 1.6;
}

.stack-form,
.form-grid {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--text);
    background: #fff;
    outline: none;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(232, 98, 26, 0.12);
}

.form-message {
    min-height: 20px;
    margin: 0;
    color: var(--red);
    font-size: 0.86rem;
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text);
    background: #fff;
    text-decoration: none;
    font-weight: 700;
}

.form-hint {
    border: 1px solid rgba(232, 98, 26, 0.28);
    border-radius: 8px;
    padding: 11px 13px;
    color: #8a3c0d;
    background: rgba(245, 166, 35, 0.12);
    font-size: 0.86rem;
    line-height: 1.45;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 18px;
    background: var(--deep);
    color: #fffdf8;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.brand img {
    width: 52px;
    height: 38px;
    object-fit: contain;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    color: rgba(255, 253, 248, 0.5);
    font-size: 0.76rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.admin-nav {
    display: grid;
    gap: 8px;
}

.nav-item,
.ghost-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 8px;
    padding: 12px 14px;
    color: rgba(255, 253, 248, 0.7);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.nav-item.active,
.nav-item:hover,
.ghost-btn:hover {
    color: var(--deep);
    background: linear-gradient(135deg, var(--orange), var(--amber));
}

.ghost-btn {
    margin-top: auto;
}

.site-back-link {
    margin-top: auto;
    text-decoration: none;
}

.site-back-link + .ghost-btn {
    margin-top: 0;
}

.workspace {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.topbar h2 {
    font-size: 2rem;
}

.topbar-actions,
.modal-actions,
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.notification-wrap {
    position: relative;
}

.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border: 2px solid var(--paper);
    border-radius: 999px;
    color: #fff;
    background: var(--red);
    font-size: 0.7rem;
}

.notification-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 20;
    width: min(360px, calc(100vw - 36px));
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.notification-item {
    display: grid;
    grid-template-columns: 1fr 34px;
    gap: 8px;
}

.notification-main {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.notification-main strong,
.notification-main span {
    display: block;
}

.notification-main span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.84rem;
}

.notification-dismiss {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    cursor: pointer;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.whatsapp-btn,
.icon-btn,
.text-btn {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
}

.primary-btn,
.secondary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn {
    padding: 12px 16px;
    color: var(--deep);
    background: linear-gradient(135deg, var(--orange), var(--amber));
}

.secondary-btn {
    padding: 12px 16px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
}

.danger-btn {
    padding: 12px 16px;
    color: #fff;
    background: var(--red);
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #fff;
    background: var(--green);
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
}

.text-btn {
    color: var(--orange);
    background: transparent;
}

.setup-warning {
    margin-bottom: 18px;
    border: 1px solid rgba(192, 57, 43, 0.25);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--red);
    background: rgba(192, 57, 43, 0.08);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric-card,
.panel,
.table-wrap,
.kanban-column,
.scooter-card,
.calendar-day {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(26, 14, 8, 0.04);
}

.metric-card {
    padding: 20px;
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
}

.loading-text {
    color: var(--muted);
    font-size: 1.3rem;
}

.skeleton-row {
    height: 52px;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(234, 223, 211, 0.5), rgba(255, 255, 255, 0.9), rgba(234, 223, 211, 0.5));
    background-size: 240% 100%;
    animation: skeletonPulse 1.1s ease-in-out infinite;
}

.skeleton-row.short {
    width: 64%;
}

@keyframes skeletonPulse {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.attention-panel {
    grid-column: 1 / -1;
    border-color: rgba(232, 98, 26, 0.28);
}

.attention-row {
    text-align: left;
    border-left: 4px solid var(--orange);
}

.panel {
    padding: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.compact-list {
    display: grid;
    gap: 10px;
}

.empty-state {
    color: var(--muted);
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    text-align: center;
}

.mini-row,
.lead-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.mini-row strong,
.lead-card strong {
    display: block;
}

.mini-row span,
.lead-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.86rem;
}

.toolbar {
    margin-bottom: 16px;
}

.toolbar input {
    max-width: 360px;
}

.toolbar select {
    max-width: 210px;
}

.kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(240px, 1fr));
    gap: 14px;
}

.kanban-column {
    min-height: 260px;
    padding: 14px;
}

.kanban-column h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 12px;
    font-size: 1rem;
}

.lead-card {
    display: grid;
    gap: 10px;
    margin-bottom: 10px;
}

.lead-card footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.scooter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.scooter-card {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    padding: 16px;
    cursor: pointer;
}

.scooter-card strong,
.scooter-card span {
    display: block;
}

.scooter-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
}

.scooter-card footer {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.scooter-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--deep);
    background: linear-gradient(135deg, var(--orange), var(--amber));
}

.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.calendar-toolbar h3 {
    min-width: 220px;
    margin: 0;
    text-align: center;
    font-family: "Playfair Display", serif;
    font-size: 1.6rem;
}

.segmented-control {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.segmented-control button {
    border: 0;
    padding: 10px 14px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.segmented-control button.active {
    color: var(--deep);
    background: linear-gradient(135deg, var(--orange), var(--amber));
}

.calendar-filter {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--text);
    background: #fff;
    font: inherit;
    font-weight: 700;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: 8px;
    overflow-x: auto;
}

.calendar-weekday {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-align: center;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 118px;
    padding: 10px;
}

.calendar-day.muted {
    opacity: 0.48;
}

.calendar-day.today {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(232, 98, 26, 0.14);
}

.calendar-date {
    margin-bottom: 8px;
    color: var(--muted);
    font-weight: 700;
}

.calendar-event {
    width: 100%;
    display: block;
    margin-bottom: 6px;
    border: 0;
    border-radius: 7px;
    padding: 7px 8px;
    color: var(--deep);
    background: rgba(247, 201, 72, 0.34);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    text-align: left;
}

.calendar-event.event-confirmed {
    color: #0f3a5c;
    background: rgba(75, 151, 214, 0.24);
    border-left: 3px solid #2f80c7;
}

.calendar-event.event-return {
    color: #145c38;
    background: rgba(21, 156, 103, 0.22);
    border-left: 3px solid var(--green);
}

.calendar-event.event-pending {
    color: #7a4b00;
    background: rgba(247, 201, 72, 0.34);
    border-left: 3px solid var(--amber);
}

.calendar-event.event-active {
    color: #4d3b28;
    background: rgba(234, 223, 211, 0.75);
    border-left: 3px solid var(--muted);
}

.calendar-event.event-unassigned {
    color: #8a1f17;
    background: rgba(192, 57, 43, 0.14);
    border-left: 3px solid var(--red);
}

.calendar-more {
    color: var(--muted);
    font-size: 0.76rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border-radius: 999px;
    padding: 5px 9px;
    color: var(--deep);
    background: rgba(247, 201, 72, 0.28);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: capitalize;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    color: #4d3b28;
    background: rgba(234, 223, 211, 0.8);
}

.status-confirmed,
.status-active {
    color: #0f3a5c;
    background: rgba(75, 151, 214, 0.22);
}

.status-completed,
.status-available,
.payment-paid {
    color: #145c38;
    background: rgba(21, 156, 103, 0.18);
}

.status-pending,
.status-reserved,
.payment-deposit {
    color: #7a4b00;
    background: rgba(247, 201, 72, 0.32);
}

.status-cancelled,
.status-lost,
.status-unavailable,
.payment-unpaid,
.payment-refunded {
    color: #8a1f17;
    background: rgba(192, 57, 43, 0.14);
}

.status-maintenance {
    color: #6c3b00;
    background: rgba(232, 98, 26, 0.18);
}

.table-wrap {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

td small {
    display: block;
    color: var(--muted);
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal {
    width: min(900px, calc(100vw - 30px));
    max-height: calc(100vh - 30px);
    border: 0;
    border-radius: 8px;
    padding: 0;
    background: transparent;
}

.modal::backdrop {
    background: rgba(23, 8, 5, 0.62);
}

.modal-card {
    max-height: calc(100vh - 30px);
    overflow: auto;
    padding: 24px;
    background: var(--panel);
    border-radius: 8px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

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

.form-grid .wide {
    grid-column: 1 / -1;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 980px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .admin-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ghost-btn {
        margin-top: 0;
    }

    .metric-grid,
    .dashboard-grid,
    .kanban,
    .scooter-grid {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        grid-template-columns: repeat(7, minmax(96px, 1fr));
    }
}

@media (max-width: 680px) {
    .workspace {
        padding: 18px;
    }

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

    .topbar-actions > button {
        flex: 1 1 auto;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav {
        grid-template-columns: 1fr;
    }
}
