:root {
    color-scheme: light dark;
    --bg: #0b132b;
    --card: #1c2541;
    --accent: #3a86ff;
    --text: #e9edf5;
    --muted: #9aa7c2;
    --border: #24345b;
    --success: #4caf50;
    --error: #ff6b6b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
    radial-gradient(circle at 20% 20%, rgba(58, 134, 255, 0.15), transparent 32%),
    radial-gradient(circle at 80% 0%, rgba(76, 175, 80, 0.14), transparent 28%),
    radial-gradient(circle at 60% 60%, rgba(124, 93, 255, 0.12), transparent 35%),
    var(--bg);
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 16px 40px;
}

a {
    color: #fff;
    text-decoration: none;
}

a:hover {
    color: #dfe6ff;
}

.wrapper {
    width: min(420px, 100%);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.card h1 {
    margin: 0 0 4px;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.card p.subtitle {
    margin: 0 0 20px;
    color: var(--muted);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #11182d;
    color: var(--text);
    font-size: 16px;
}

input:focus {
    outline: 2px solid var(--accent);
    border-color: transparent;
}

button {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    background: linear-gradient(135deg, #3a86ff, #7c5dff);
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.35);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.status {
    border-radius: 10px;
    padding: 12px;
    margin-top: 12px;
    border: 1px solid var(--border);
}

.status.success { border-color: rgba(76, 175, 80, 0.4); color: var(--success); }
.status.error { border-color: rgba(255, 107, 107, 0.4); color: var(--error); }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(122, 140, 176, 0.1);
    border: 1px solid var(--border);
    margin: 8px 0 12px;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.actions a {
    flex: 1 1 auto;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    background: #11182d;
    color: var(--text);
    border: 1px solid var(--border);
    text-decoration: none;
    font-weight: 600;
}

.notice {
    margin-top: 16px;
    font-size: 14px;
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

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

th {
    color: var(--muted);
    font-weight: 600;
}

.app-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 24px;
    background: #0f1529;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.app-header__brand .brand-link {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 18px;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.app-nav__link {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #11182d;
    color: #fff;
    font-weight: 600;
    transition: all 0.15s ease;
}

.app-nav__link:hover {
    transform: translateY(-1px);
}

.app-nav__link.active {
    background: linear-gradient(135deg, #3a86ff, #7c5dff);
    border-color: transparent;
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.35);
}

.app-nav__link--ghost {
    background: transparent;
    border-style: dashed;
}

.app-nav__link--ghost:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.04);
}

.app-main {
    width: 100%;
    max-width: 1200px;
}

@media (max-width: 720px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-nav {
        width: 100%;
    }
}

.content-centered {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-row {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: flex-start;
}

.section-nav {
    display: flex;
    gap: 8px;
    margin: 4px 0 4px;
}

.card h2 {
    margin-top: 0;
    margin-bottom: 12px;
}

.muted span.label {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.grid-form {
    display: grid;
    gap: 10px;
}

.btn-primary {
    display: inline-block;
    width: auto;
    text-align: center;
    padding: 10px 12px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #3a86ff, #7c5dff);
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.35);
}

.btn-secondary {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #11182d;
    color: var(--text);
    cursor: pointer;
    width: auto;
}

.table-responsive {
    overflow-x: auto;
}

td input[type="text"] {
    width: 100%;
}


.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    min-width: 60px;
    text-transform: lowercase;
    font-size: 14px;
    letter-spacing: 0.01em;
}

.status-refresh {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    border-radius: 999px;
    transition: color 0.12s ease, background 0.12s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 16px;
    margin-top: 0;
}

.status-refresh:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.status-refresh:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.status-refresh.is-loading {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.history-toolbar {
    margin: 12px 0 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.history-filter {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.history-filter__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-filter select {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #11182d;
    color: var(--text);
    min-width: 220px;
}

.history-total {
    font-weight: 600;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-header {
    display: grid;
    grid-template-columns: 2fr 1.1fr 0.9fr 1.2fr;
    gap: 12px;
    padding: 6px 12px;
    color: var(--muted-text);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.history-row {
    background: #0f1529;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 2fr 1.1fr 0.9fr 1.2fr;
    gap: 12px;
    align-items: center;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.history-row .small {
    line-height: 1.4;
}

.history-title {
    font-weight: 700;
    margin-bottom: 3px;
}

.history-phone {
    font-weight: 600;
    white-space: nowrap;
}

.history-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.history-actions-cell {
    text-align: right;
}

.history-actions .btn-secondary {
    margin-top: 0;
}

.history-dates {
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-pagination {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #11182d;
    color: var(--text);
    font-weight: 700;
    min-width: 38px;
    text-decoration: none;
}

.page-link.active {
    background: linear-gradient(135deg, #3a86ff, #7c5dff);
    border-color: #3a86ff;
    color: #fff;
}

.page-link.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.page-dots {
    padding: 0 4px;
    color: var(--muted);
    font-weight: 700;
}

@media (max-width: 900px) {
    .history-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .history-filter {
        width: 100%;
    }

    .history-filter button,
    .history-filter select {
        width: 100%;
    }

    .history-header,
    .history-row {
        grid-template-columns: 1.4fr 1fr 0.9fr;
    }

    .history-actions-cell {
        display: none;
    }

    .history-actions {
        grid-column: 1 / -1;
        grid-template-columns: 1fr auto;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .history-header {
        display: none;
    }

    .history-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "project project"
            "phone status"
            "dates actions";
    }

    .history-project { grid-area: project; }
    .history-phone { grid-area: phone; }
    .history-status { grid-area: status; }
    .history-actions { grid-area: actions; }
    .history-dates { grid-area: dates; }

    .history-actions {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .history-dates {
        margin-top: 2px;
    }
}

.status-ok {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success);
}

.status-fail {
    background: rgba(255, 107, 107, 0.2);
    color: var(--error);
}

.status-warn {
    background: rgba(255, 193, 7, 0.2);
    color: #ffdd8a;
}

.tab-link {
    padding: 10px 14px;
    border-radius: 12px;
    background: #11182d;
    border: 1px solid var(--border);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.tab-link.active {
    background: linear-gradient(135deg, #3a86ff, #7c5dff);
    color: #fff;
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.35);
    border-color: transparent;
}

.tab-link .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.4);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #11182d;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    width: min(420px, 90%);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal.modal-logs {
    width: min(960px, 95%);
}

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

.modal-body {
    max-height: 70vh;
    overflow: auto;
}

.modal h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.modal-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.input-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

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

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.small {
    font-size: 12px;
}

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

.stat-card {
    background: #11182d;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 4px;
}

.stat-value {
    font-weight: 700;
    font-size: 16px;
}

.stats-filter {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.stats-range-input {
    width: 280px;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 8px 0 4px;
}

.stats-chart {
    margin: 12px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
}

.stats-chart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.stats-view-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-view-toggle__btn {
    width: fit-content;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.stats-view-toggle__btn:hover {
    background: rgba(255, 255, 255, 0.07);
}

.stats-view-toggle__btn.active {
    background: #3a86ff;
    border-color: #3a86ff;
}

.stats-chart__empty {
    margin-top: 8px;
}

.stats-chart canvas {
    display: block;
    width: 100% !important;
    height: 220px;
    max-height: 260px;
}

.stats-table th,
.stats-table td {
    white-space: nowrap;
}

.stats-table td:first-child,
.stats-table th:first-child {
    white-space: normal;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 12px;
}

.alert.success { border-color: rgba(76, 175, 80, 0.4); color: var(--success); }
.alert.error { border-color: rgba(255, 107, 107, 0.4); color: var(--error); }
.alert.muted { color: var(--muted); }

.daterangepicker {
    border: none !important;
    background-color: #0f1529 !important;
}

.daterangepicker .drp-buttons {
    border-top: 1px solid #23345b !important;
}

.daterangepicker.show-ranges.ltr .drp-calendar.left {
    border-left: 1px solid #23345b !important;
}

.daterangepicker .calendar-table {
    background-color: #202945 !important;
    border: 1px solid #23345b !important;
}

.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
    background-color: #0f1529 !important;
    color: #404a69 !important;
}

.daterangepicker td.active, .daterangepicker td.active:hover {
    background-color: #4f78fc !important;
}

.daterangepicker td.available:hover, .daterangepicker th.available:hover, .daterangepicker .ranges li:hover {
    background-color: #fff !important;
    color: #000 !important;
}

.daterangepicker .drp-buttons .btn {
    display: inline-flex;
    width: fit-content;
}

.daterangepicker .ranges li.active {
    background-color: #4f78fc !important;
}

.daterangepicker:before {
    border-bottom: 7px solid #0f1529 !important;
}

.daterangepicker:after {
    border-bottom: 7px solid #0f1529 !important;
}
