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

:root {
    --bg: #f4f5fb;
    --panel: #ffffff;
    --border: rgba(28, 35, 52, 0.08);
    --text: #1a1f30;
    --muted: #6b7280;
    --purple: #6d12c7;
    --purple-dark: #4b0a90;
    --purple-soft: #8f3ef4;
    --green: #10b981;
    --red: #ef4444;
    --blue: #2563eb;
    --orange: #f59e0b;
    --shadow: 0 4px 24px rgba(20, 24, 40, 0.07);
    --shadow-lg: 0 10px 40px rgba(20, 24, 40, 0.11);
    --radius: 20px;
    --radius-sm: 12px;
    --sidebar-w: 260px;
    --topbar-h: 64px;
}

html,
body {
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
}

/* ── Shell ────────────────────────────────────────────────────── */
.shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(160deg, #1e0b4b 0%, #3b0d8f 45%, var(--purple-dark) 100%);
    color: #fff;
    padding: 24px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 4px 0 32px rgba(75, 10, 144, 0.22);
    z-index: 100;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 6px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    text-decoration: none;
    color: #fff;
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.brand-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    transition: background 0.18s, color 0.18s;
    font-weight: 600;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


.footer-small {
    font-size: 11px;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.footer-title {
    font-size: 14px;
    font-weight: 700;
    margin-top: 4px;
}

.footer-version {
    font-size: 11px;
    opacity: 0.5;
    margin-top: 3px;
}

/* ── Mobile topbar ────────────────────────────────────────────── */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: linear-gradient(90deg, #1e0b4b 0%, #3b0d8f 100%);
    color: #fff;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 16px rgba(75, 10, 144, 0.25);
}

.mobile-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.hamburger {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.22s;
}

.hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
    opacity: 0;
}

.hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Overlay ──────────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}

.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Main ─────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 28px 28px 48px;
    min-width: 0;
    margin-left: var(--sidebar-w);
}

/* ── Topbar ───────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 26px;
}

.eyebrow {
    color: var(--purple);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 4px;
}

.page-title {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.3px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-chip {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    color: var(--muted);
    font-size: 13px;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.topbar-status {
    display: flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.topbar-online {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.topbar-offline {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.22);
}

/* ── Pulse dots ───────────────────────────────────────────────── */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.pulse-green {
    background: var(--green);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
}

.pulse-red {
    background: var(--red);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    animation: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ── Hero panel ───────────────────────────────────────────────── */
.hero-panel {
    background:
        radial-gradient(circle at top right, rgba(143, 62, 244, 0.12), transparent 40%),
        linear-gradient(180deg, #ffffff 0%, #f9f8ff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    justify-content: space-between;
    gap: 28px;
    align-items: center;
    margin-bottom: 22px;
    box-shadow: var(--shadow-lg);
}

.hero-copy h2 {
    margin: 6px 0 10px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.hero-copy p {
    color: var(--muted);
    max-width: 700px;
    line-height: 1.65;
    font-size: 14px;
}

.hero-kicker {
    color: var(--purple);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

.hero-badge-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 220px;
}

.mini-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(109, 18, 199, 0.07);
    color: var(--purple-dark);
    border: 1px solid rgba(109, 18, 199, 0.13);
    border-radius: 999px;
    padding: 11px 14px;
    font-weight: 700;
    font-size: 13px;
}

.mini-pill.online {
    background: rgba(16, 185, 129, 0.10);
    color: #047857;
    border-color: rgba(16, 185, 129, 0.22);
}

.mini-pill.offline {
    background: rgba(239, 68, 68, 0.09);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.20);
}

/* ── Cards grid ───────────────────────────────────────────────── */
.cards-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.cards-grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

/* ── Info card ────────────────────────────────────────────────── */
.info-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.info-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--purple) 0%, var(--purple-soft) 100%);
    opacity: 0.5;
    border-radius: var(--radius) var(--radius) 0 0;
}

.card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.card-icon-blue {
    background: rgba(37, 99, 235, 0.10);
    color: var(--blue);
}

.card-icon-green {
    background: rgba(16, 185, 129, 0.10);
    color: var(--green);
}

.card-icon-purple {
    background: rgba(109, 18, 199, 0.10);
    color: var(--purple);
}

.card-icon-orange {
    background: rgba(245, 158, 11, 0.10);
    color: var(--orange);
}

.card-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 600;
}

.card-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
}

.card-value.compact {
    font-size: 18px;
}

.card-value.value-green {
    color: #047857;
}

.card-value.value-red {
    color: #b91c1c;
}

.card-sub {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.card-sub.ok {
    color: #047857;
}

.card-sub.bad {
    color: #b91c1c;
}

/* ── Panel card ───────────────────────────────────────────────── */
.panel-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

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

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
}

.panel-chip {
    background: rgba(109, 18, 199, 0.08);
    color: var(--purple-dark);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.debug-chip {
    background: rgba(30, 30, 60, 0.07);
    color: var(--muted);
}

/* ── Progress ─────────────────────────────────────────────────── */
.progress-block {
    margin-bottom: 20px;
}

.progress-track {
    width: 100%;
    height: 14px;
    background: #ecedf5;
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--purple) 0%, var(--purple-soft) 100%);
    border-radius: 999px;
    transition: width 0.6s ease;
}

.progress-caption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

/* ── Route steps ──────────────────────────────────────────────── */
.route-steps {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.route-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-radius: var(--radius-sm);
    background: #f4f5fb;
    border: 1px solid #e8eaf2;
}

.route-step.done {
    background: rgba(16, 185, 129, 0.11);
    border-color: rgba(16, 185, 129, 0.22);
}

.route-step.current {
    background: rgba(37, 99, 235, 0.10);
    border-color: rgba(37, 99, 235, 0.20);
}

.route-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c5ccd9;
}

.route-step.done .route-dot {
    background: var(--green);
}

.route-step.current .route-dot {
    background: var(--blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.route-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

/* ── Status list ──────────────────────────────────────────────── */
.status-list {
    display: grid;
    gap: 0;
}

.status-row,
.summary-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid #eef1f6;
    font-size: 14px;
}

.status-row:last-child,
.summary-line:last-child {
    border-bottom: none;
}

.status-row span,
.summary-line span {
    color: var(--muted);
}

/* ── Badges ───────────────────────────────────────────────────── */
.badge-ok {
    color: #047857;
}

.badge-warn {
    color: #b45309;
}

.badge-danger {
    color: #b91c1c;
}

.badge-neutral {
    color: var(--muted);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button-row.full {
    grid-column: 1 / -1;
}

.btn {
    appearance: none;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.13);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: linear-gradient(90deg, var(--purple) 0%, var(--purple-soft) 100%);
    color: white;
}

.btn.danger {
    background: linear-gradient(90deg, #c0203d 0%, var(--red) 100%);
    color: white;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 700;
    font-size: 13px;
    color: #2a3045;
}

label span {
    font-weight: 600;
}

input,
select {
    border: 1px solid #d6dae8;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    outline: none;
    background: white;
    font-family: inherit;
    color: var(--text);
    transition: border-color 0.18s, box-shadow 0.18s;
}

input:focus {
    border-color: var(--purple-soft);
    box-shadow: 0 0 0 4px rgba(143, 62, 244, 0.11);
}

code {
    background: rgba(109, 18, 199, 0.07);
    color: var(--purple-dark);
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 13px;
}

/* ── Route card / Mission box ─────────────────────────────────── */
.route-card,
.mission-summary-box {
    margin-top: 20px;
    padding: 18px;
    border-radius: var(--radius-sm);
    background: #f7f6ff;
    border: 1px solid rgba(109, 18, 199, 0.10);
}

.route-title {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--purple-dark);
}

.route-description {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
    margin-bottom: 16px;
}

/* ── Pre / code blocks ────────────────────────────────────────── */
pre {
    background: #0e1521;
    color: #ccd6e8;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1280px) {
    .cards-grid.four {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .cards-grid.two {
        grid-template-columns: 1fr;
    }

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

    .hero-badge-group {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        padding-top: 80px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .sidebar-overlay.visible {
        pointer-events: auto;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(var(--topbar-h) + 16px);
        position: relative;
        z-index: 1;
    }

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

    .topbar {
        margin-bottom: 12px;
    }

    .topbar .eyebrow {
        display: none;
    }

    .topbar .page-title {
        font-size: 22px;
    }
}

@media (max-width: 680px) {
    .cards-grid.four {
        grid-template-columns: 1fr;
    }

    .cards-grid.two {
        grid-template-columns: 1fr;
    }

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

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

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

    .page-title {
        font-size: 24px;
    }

    .hero-copy h2 {
        font-size: 20px;
    }

    .hero-panel {
        padding: 20px;
    }
}

/* ── Fix mobile interactions ─────────────────────────────────── */
button,
.btn,
input,
select {
    touch-action: manipulation;
}

button,
.btn {
    position: relative;
    z-index: 20;
}

.dpad-btn {
    position: absolute;
    z-index: 30;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.panel-card,
.hero-panel,
form {
    position: relative;
    z-index: 1;
}

/* ── User identity in sidebar ─────────────────────────────────── */

.brand-user-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-user-text .brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-username {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.62);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Profile page ─────────────────────────────────────────────── */

.profile-shell {
    max-width: 760px;
    margin: 0 auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 78px;
    height: 78px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    color: #fff;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;

    background:
        linear-gradient(135deg,
            var(--purple),
            var(--purple-soft));

    box-shadow:
        0 10px 28px rgba(109, 18, 199, 0.26);
}

.profile-name {
    font-size: 25px;
    font-weight: 800;
    line-height: 1.2;
}

.profile-username {
    margin-top: 5px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.profile-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.profile-role {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 5px 10px;
    border-radius: 999px;

    color: var(--purple-dark);
    background: rgba(109, 18, 199, 0.09);

    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

/* ── Operations mission summary ───────────────────────────────── */

.operations-summary {
    margin-bottom: 18px;
}

.operations-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.operations-empty-route {
    padding: 10px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-body {
    min-height: 100vh;
    font-family: 'Inter', Arial, sans-serif;
    background: var(--bg);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 64px;
    color: #fff;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.16), transparent 30%),
        linear-gradient(145deg, #1e0b4b 0%, #4b0a90 52%, #7c22d9 100%);
}

.auth-visual-content {
    position: relative;
    z-index: 2;
    max-width: 560px;
}

.auth-kicker {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.72);
    margin-bottom: 20px;
}

.auth-visual h1 {
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.05;
    letter-spacing: -1.4px;
    margin-bottom: 22px;
}

.auth-visual p {
    max-width: 520px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 16px;
    line-height: 1.7;
}

.auth-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    background: rgba(255, 255, 255, 0.09);
}

.auth-orb-one {
    width: 260px;
    height: 260px;
    right: -60px;
    top: -40px;
}

.auth-orb-two {
    width: 180px;
    height: 180px;
    left: -50px;
    bottom: -40px;
}

.auth-form-side {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 44px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 36px;
    box-shadow: var(--shadow-lg);
}

.auth-card-header {
    margin-bottom: 26px;
}

.auth-card-header h2 {
    font-size: 30px;
    font-weight: 800;
    margin: 12px 0 8px;
}

.auth-card-header p {
    color: var(--muted);
}

.auth-badge {
    display: inline-flex;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(109, 18, 199, 0.09);
    color: var(--purple-dark);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-field span {
    font-size: 13px;
    font-weight: 800;
    color: #2a3045;
}

.auth-field input {
    width: 100%;
    padding: 14px 15px;
    border: 1px solid #d8dce8;
    border-radius: 12px;
    font: inherit;
    background: #fbfbfe;
    transition:
        border-color 0.18s,
        box-shadow 0.18s,
        transform 0.18s;
}

.auth-field input:focus {
    outline: none;
    border-color: rgba(109, 18, 199, 0.55);
    box-shadow: 0 0 0 4px rgba(109, 18, 199, 0.10);
    transform: translateY(-1px);
}

.auth-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--purple), var(--purple-soft));
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(109, 18, 199, 0.24);
    transition:
        transform 0.18s,
        box-shadow 0.18s;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(109, 18, 199, 0.30);
}

.auth-alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 13px;
    font-weight: 700;
}

.password-page {
    min-height: calc(100vh - 56px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-layout {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    overflow: hidden;
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.password-visual {
    padding: 48px;
    color: #fff;
    background: linear-gradient(145deg, #1e0b4b, #6d12c7);
}

.password-visual h1 {
    margin: 18px 0 14px;
    font-size: 34px;
    line-height: 1.15;
}

.password-visual p {
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.65;
}

.password-card {
    padding: 48px;
}

@media (max-width: 900px) {

    .auth-shell,
    .password-layout {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 280px;
        padding: 40px 28px;
    }

    .auth-form-side,
    .password-card {
        padding: 28px;
    }

    .password-visual {
        padding: 34px 28px;
    }
}

.robot-logo-image {
    display: block;
    width: 90px;
    height: 90px;
    object-fit: contain;
}

/* =========================================================
   USERS PAGE
========================================================= */

.users-hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.users-hero h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
}

.users-hero p {
    margin: 8px 0 0;
    color: var(--muted);
}

.users-summary {
    min-width: 110px;
    padding: 14px 18px;
    border-radius: 16px;
    background: rgba(109, 18, 199, 0.08);
    border: 1px solid rgba(109, 18, 199, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.users-summary-value {
    font-size: 24px;
    font-weight: 900;
    color: var(--purple-dark);
}

.users-summary-label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}

.users-alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
}

.users-alert-success {
    color: #047857;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.16);
}

.users-alert-error {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.16);
}

.users-section-description {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.users-create-card,
.users-list-card {
    margin-bottom: 18px;
}

.users-create-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.users-create-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.users-create-form label>span {
    font-size: 12px;
    font-weight: 800;
    color: #2a3045;
}

.users-create-form input,
.users-create-form select {
    width: 100%;
}

.users-full-width {
    grid-column: 1 / -1;
}

.users-primary-button {
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    background: linear-gradient(90deg,
            var(--purple),
            var(--purple-soft));
    box-shadow: 0 5px 16px rgba(109, 18, 199, 0.20);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.users-primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(109, 18, 199, 0.26);
}

.users-list-header {
    align-items: flex-start;
}

.users-toolbar {
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px;
    gap: 12px;
}

.users-search-wrapper {
    position: relative;
}

.users-search-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.users-search-wrapper input {
    width: 100%;
    padding-left: 44px;
}

.users-toolbar select {
    width: 100%;
}

.users-table-wrapper {
    overflow-x: auto;
    border: 1px solid rgba(109, 18, 199, 0.12);
    border-radius: 14px;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
}

.users-table thead {
    background: linear-gradient(90deg,
            rgba(109, 18, 199, 0.07),
            rgba(143, 62, 244, 0.05));
}

.users-table th {
    padding: 13px 12px;
    text-align: left;
    color: #3f465d;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    border-bottom: 1px solid rgba(109, 18, 199, 0.12);
}

.users-table td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(109, 18, 199, 0.08);
}

.users-table tbody tr:last-child td {
    border-bottom: 0;
}

.users-table-row {
    transition: background 0.2s ease;
}

.users-table-row:hover {
    background: rgba(109, 18, 199, 0.025);
}

.users-table input,
.users-table select {
    width: 100%;
    min-width: 130px;
    padding: 9px 10px;
    border-radius: 8px;
}

.users-update-form {
    display: contents;
}

.users-actions-column {
    width: 245px;
}

.users-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.users-actions form {
    margin: 0;
}

.users-action-button {
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 800;
    transition:
        transform 0.15s ease,
        opacity 0.15s ease;
}

.users-action-button:hover {
    transform: translateY(-1px);
}

.users-save-button {
    color: white;
    background: var(--purple);
}

.users-password-button {
    color: #92400e;
    background: #fef3c7;
}

.users-delete-button {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.10);
}

.users-login-info {
    display: flex;
    align-items: center;
    gap: 7px;
}

.users-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.users-status-online {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.users-status-inactive {
    background: #9ca3af;
}

.users-last-login {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.users-password-warning {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 7px;
    border-radius: 6px;
    color: #92400e;
    background: #fef3c7;
    font-size: 10px;
    font-weight: 800;
}

.users-password-row td {
    padding: 12px;
    background: rgba(245, 158, 11, 0.045);
}

.users-password-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.users-password-form>div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.users-password-form strong {
    font-size: 12px;
}

.users-password-form span {
    color: var(--muted);
    font-size: 11px;
}

.users-reset-button {
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    color: #92400e;
    background: #fef3c7;
    font-family: inherit;
    font-weight: 800;
    white-space: nowrap;
}

.users-empty-state {
    display: none;
    padding: 34px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.users-pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#users-pagination-info {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.users-pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.users-page-numbers {
    display: flex;
    gap: 5px;
}

.users-page-button,
.users-page-number {
    min-width: 36px;
    height: 36px;
    padding: 0 11px;
    border: 1px solid rgba(109, 18, 199, 0.14);
    border-radius: 8px;
    color: var(--purple-dark);
    background: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
}

.users-page-number.active {
    color: white;
    border-color: var(--purple);
    background: var(--purple);
}

.users-page-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

@media (max-width: 900px) {
    .users-create-form {
        grid-template-columns: 1fr;
    }

    .users-full-width {
        grid-column: auto;
    }

    .users-toolbar {
        grid-template-columns: 1fr;
    }

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

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

@media (max-width: 640px) {
    .users-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .users-summary {
        width: 100%;
    }

    .users-pagination-controls {
        width: 100%;
        justify-content: space-between;
    }

    .users-page-numbers {
        overflow-x: auto;
    }
}




/* ── Simple robot status ─────────────────────────────────────── */

.sidebar-simple-status {
    margin: -4px 6px 0;
    min-height: 46px;
    padding: 11px 14px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border-radius: 14px;

    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.85);

    font-size: 13px;
    font-weight: 600;

    box-shadow:
        0 8px 22px rgba(15, 4, 46, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.sidebar-simple-status strong {
    font-weight: 800;
}

.sidebar-simple-status.online {
    color: #047857;
    border-color: rgba(16, 185, 129, 0.32);
}

.sidebar-simple-status.offline {
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.30);
}


/* ── Sidebar footer ───────────────────────────────────────────── */

.sidebar-footer {
    margin-top: auto;
    padding: 18px 13px 0;

    border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-powered {
    padding: 0;
}

.sidebar-powered .footer-small {
    margin: 0;
    color: rgba(255, 255, 255, 0.52);
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.sidebar-powered .footer-title {
    margin-top: 2px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}



/* ── Login logo ──────────────────────────────────────────────── */

.login-logo-wrapper {
    display: flex;
    justify-content: center;

    margin: -6px 0 22px;
}

.login-logo-image {
    display: block;

    width: 150px;
    max-width: 70%;
    height: auto;
    max-height: 90px;

    object-fit: contain;
}
/* ==============================================================
   HISTORY
   ============================================================== */

.history-hero {
    flex-direction: row;
    align-items: center;
}

.history-hero h2 {
    margin: 6px 0 8px;
    font-size: 28px;
    font-weight: 800;
}

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

.history-hero-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.history-filter-card,
.history-section-card {
    margin-bottom: 18px;
}

.history-filter-content {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.history-filter-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.history-filter-description,
.history-section-subtitle {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.history-period-label {
    min-width: 220px;
}

.history-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.history-table th {
    padding: 11px 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid #ecedf5;
}

.history-table td {
    padding: 13px 12px;
    vertical-align: middle;
    border-bottom: 1px solid #eef1f6;
}

.history-order-row {
    transition: background 0.18s ease;
}

.history-order-row:hover {
    background: rgba(109, 18, 199, 0.025);
}

.history-muted-cell {
    color: var(--muted);
    white-space: nowrap;
    font-size: 12px;
}

.history-order-code {
    display: inline-block;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 5px 8px;
    border-radius: 7px;
    background: #f5f3ff;
    color: var(--purple-dark);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.history-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.history-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.history-status-completed {
    color: #047857;
    background: rgba(16, 185, 129, 0.11);
    border: 1px solid rgba(16, 185, 129, 0.20);
}

.history-status-running {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.23);
}

.history-status-running .history-status-dot {
    animation: pulse 1.8s infinite;
}

.history-status-interrupted,
.history-status-cancelled,
.history-status-error {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.10);
    border: 1px solid rgba(239, 68, 68, 0.20);
}

.history-status-neutral {
    color: var(--muted);
    background: rgba(107, 114, 128, 0.09);
    border: 1px solid rgba(107, 114, 128, 0.18);
}

.history-route-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 118px;
    padding: 8px 10px;
    border: 1px solid rgba(109, 18, 199, 0.18);
    border-radius: 10px;
    background: linear-gradient(
        180deg,
        #ffffff,
        #f8f6ff
    );
    color: var(--purple-dark);
    font-family: inherit;
    cursor: pointer;
    transition:
        transform 0.16s,
        border-color 0.16s,
        box-shadow 0.16s;
}

.history-route-button:hover,
.history-route-button.expanded {
    transform: translateY(-1px);
    border-color: rgba(109, 18, 199, 0.38);
    box-shadow: 0 5px 16px rgba(109, 18, 199, 0.12);
}

.history-route-label {
    font-weight: 900;
    letter-spacing: 0.04em;
}

.history-route-meta {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.history-route-chevron {
    margin-left: auto;
    font-size: 18px;
    line-height: 1;
    transform: rotate(90deg);
    transition: transform 0.18s;
}

.history-route-button.expanded .history-route-chevron {
    transform: rotate(-90deg);
}

.history-error-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 9px;
    font-weight: 900;
}

.history-error-count.no-errors {
    color: #047857;
    background: rgba(16, 185, 129, 0.10);
}

.history-error-count.has-errors {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.11);
}

.history-battery-cell {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.history-details-row {
    display: none;
}

.history-details-row.open {
    display: table-row;
}

.history-details-row > td {
    padding: 0 !important;
    background: #faf9ff;
    border-bottom: 1px solid rgba(109, 18, 199, 0.15);
}

.history-details-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 18px;
    animation: historyDetailsIn 0.2s ease;
}

@keyframes historyDetailsIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-interruption-box {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 13px 15px;
    border-radius: 12px;
    color: #991b1b;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.17);
}

.history-interruption-box strong {
    font-size: 12px;
}

.history-interruption-box span {
    font-size: 12px;
}

.history-detail-card {
    min-width: 0;
    padding: 15px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 3px 12px rgba(20, 24, 40, 0.04);
}

.history-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 13px;
    font-size: 13px;
    font-weight: 900;
}

.history-detail-heading span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 25px;
    height: 25px;
    padding: 0 7px;
    border-radius: 8px;
    color: var(--purple-dark);
    background: rgba(109, 18, 199, 0.08);
    font-size: 11px;
}

.history-node-flow,
.history-action-list,
.history-error-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-node-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border-radius: 9px;
    background: #f7f6ff;
}

.history-node-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 23px;
    height: 23px;
    border-radius: 50%;
    color: white;
    background: var(--purple);
    font-size: 10px;
    font-weight: 900;
}

.history-node-label {
    font-weight: 800;
}

.history-node-sequence {
    margin-left: auto;
    color: var(--muted);
    font-size: 10px;
}

.history-action-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px;
    border-radius: 10px;
    border: 1px solid #edf0f5;
}

.history-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: white;
    background: linear-gradient(
        135deg,
        var(--purple),
        var(--purple-soft)
    );
    font-size: 11px;
    font-weight: 900;
}

.history-action-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.history-action-copy strong {
    font-size: 12px;
}

.history-action-copy span {
    color: var(--muted);
    font-size: 10px;
}

.history-action-status {
    margin-left: auto;
    padding: 5px 7px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 900;
    white-space: nowrap;
}

.history-action-finished {
    color: #047857;
    background: rgba(16, 185, 129, 0.10);
}

.history-action-failed {
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.10);
}

.history-action-running {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
}

.history-action-waiting {
    color: var(--muted);
    background: rgba(107, 114, 128, 0.09);
}

.history-error-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 10px;
    border-radius: 9px;
    color: #991b1b;
    background: rgba(239, 68, 68, 0.07);
}

.history-error-item strong {
    font-size: 11px;
}

.history-error-item span {
    font-size: 10px;
    opacity: 0.75;
}

.history-detail-success {
    padding: 10px;
    border-radius: 9px;
    color: #047857;
    background: rgba(16, 185, 129, 0.08);
    font-size: 11px;
    font-weight: 700;
}

.history-detail-empty {
    padding: 10px;
    border-radius: 9px;
    color: var(--muted);
    background: #f7f8fb;
    font-size: 11px;
}

.history-node-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 5px 8px;
    border-radius: 8px;
    color: var(--purple-dark);
    background: rgba(109, 18, 199, 0.08);
    font-weight: 800;
}

.history-empty-cell,
.history-error-cell {
    padding: 34px !important;
    text-align: center;
    color: var(--muted);
}

.history-error-cell {
    color: #b91c1c;
}

.history-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.history-pagination span {
    padding: 0 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.history-pagination button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 1050px) {
    .history-details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .history-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-hero-pills {
        justify-content: flex-start;
    }

    .history-filter-content {
        flex-direction: column;
        align-items: stretch;
    }

    .history-period-label {
        min-width: 0;
        width: 100%;
    }

    .history-table {
        min-width: 900px;
    }

    .history-pagination {
        justify-content: center;
    }
}