/* Kestrel — dark instrument panel.
   Ground is a violet-tinted dusk rather than neutral black, so the accent sits
   inside the palette instead of on top of it. Plex Mono carries every number. */

:root {
    --ink: #0b0916;
    --surface: #14111f;
    --surface-2: #1c1830;
    --line: #2a2440;
    --line-soft: #221d36;
    --text: #edeaf6;
    --muted: #8b84a6;

    --accent: #7c47ff;
    --accent-soft: #7c47ff26;
    --accent-line: #7c47ff59;

    --online: #35d6a4;
    --busy: #9b6dff;
    --resting: #e8a33d;
    --offline: #5a5670;
    --danger: #ff5c7a;

    --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --cond: 'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

    --radius: 14px;
    --radius-sm: 9px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--text);
    font: 400 15px/1.55 var(--sans);
    -webkit-font-smoothing: antialiased;
}

/* A single wash of accent behind the page, so the dark is never flat. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(120% 60% at 50% -10%, #7c47ff1f, transparent 70%);
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2 {
    margin: 0;
    font-weight: 600;
}

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

.mono {
    font-family: var(--mono);
    font-size: 0.86em;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 24px;
    height: 60px;
    background: #0b0916d9;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--cond);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.mark {
    width: 21px;
    height: 21px;
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 4px;
    margin-right: auto;
}

.nav__link {
    padding: 7px 13px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
}

.nav__link:hover {
    color: var(--text);
    background: var(--surface);
}

.nav__link--on {
    color: var(--text);
    background: var(--accent-soft);
}

.main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 24px 90px;
    position: relative;
}

.main--bare {
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 24px;
}

/* ------------------------------------------------------------------- heads */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 26px;
}

.eyebrow {
    margin: 0 0 6px;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--muted);
}

.page-title {
    font-family: var(--cond);
    font-size: 30px;
    letter-spacing: -0.01em;
}

.backlink {
    display: inline-block;
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 14px;
}

.backlink:hover {
    color: var(--text);
}

/* ------------------------------------------------------------------ inputs */

.input {
    width: 100%;
    padding: 10px 13px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: 400 14px/1.4 var(--sans);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
    color: #6b6486;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.field {
    display: block;
    margin-bottom: 20px;
}

.field__label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 500;
}

.field__hint {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.add {
    display: flex;
    gap: 9px;
}

.add .input {
    width: 262px;
}

.btn {
    padding: 10px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: 500 14px var(--sans);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
    background: #241f3c;
    border-color: var(--accent-line);
}

.btn:active {
    transform: translateY(1px);
}

.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn--primary:hover {
    background: #8d5dff;
    border-color: #8d5dff;
}

.btn--ghost {
    background: none;
    border-color: transparent;
    color: var(--muted);
}

.btn--ghost:hover {
    background: var(--surface);
    color: var(--text);
}

.btn--danger {
    border-color: #ff5c7a4d;
    color: var(--danger);
}

.btn--danger:hover {
    background: #ff5c7a1a;
    border-color: var(--danger);
}

.btn--block {
    width: 100%;
    margin-top: 4px;
}

/* ----------------------------------------------------------------- banners */

.banner {
    margin: 0 0 18px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-size: 14px;
}

.banner--error {
    background: #ff5c7a14;
    border-color: #ff5c7a40;
    color: #ffa8b9;
}

.banner--ok {
    background: #35d6a414;
    border-color: #35d6a440;
    color: #7ee9c4;
}

/* ------------------------------------------------------------------- cards */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: linear-gradient(180deg, var(--surface), #131020);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
}

.card:hover {
    border-color: var(--line);
}

.card--paused {
    opacity: 0.62;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card__who {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.card__names {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.card__name {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card__who:hover .card__name {
    color: #c3aeff;
}

.card__id {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
}

.card__stats {
    display: flex;
    gap: 26px;
    align-items: baseline;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.stat__value {
    font-family: var(--mono);
    font-size: 25px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.stat__value--up {
    color: var(--online);
}

.stat__label {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.card__latest {
    margin: 0;
    padding-top: 13px;
    border-top: 1px solid var(--line-soft);
    font-size: 13.5px;
    color: #cfc9e4;
}

.card__latest-time {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    margin-right: 7px;
}

/* ------------------------------------------------------ freshness stamp */

.card__status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex: none;
}

.checked {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
}

.checked__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex: none;
    background: var(--offline);
}

/* A live check breathes; a stalled or failed one holds still and changes hue,
   so a problem reads differently from a working account at a glance. */
.checked--ok .checked__dot {
    background: var(--online);
    animation: pulse 2.4s ease-in-out infinite;
}

.checked--stale {
    color: var(--resting);
}

.checked--stale .checked__dot {
    background: var(--resting);
}

.checked--fail {
    color: var(--danger);
}

.checked--fail .checked__dot {
    background: var(--danger);
}

.eyebrow__since {
    color: var(--muted);
}

.tag {
    align-self: flex-start;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tag--warn {
    background: #e8a33d1f;
    color: var(--resting);
}

/* ----------------------------------------------------------------- avatars */

.avatar {
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    background: var(--surface-2);
}

.avatar--xs {
    width: 18px;
    height: 18px;
}

.avatar--md {
    width: 38px;
    height: 38px;
}

.avatar--lg {
    width: 62px;
    height: 62px;
}

.avatar--empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-family: var(--cond);
    font-weight: 700;
}

/* ------------------------------------------------------------------- pills */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    border: 1px solid;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.pill--online {
    color: var(--online);
    background: #35d6a414;
    border-color: #35d6a440;
}

/* The live state is the only thing that moves. */
.pill--online .dot {
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        opacity: 0.35;
    }
}

.pill--in_the_game {
    color: var(--busy);
    background: #9b6dff14;
    border-color: #9b6dff40;
}

.pill--resting {
    color: var(--resting);
    background: #e8a33d14;
    border-color: #e8a33d40;
}

.pill--offline,
.pill--unknown {
    color: var(--muted);
    background: #5a567014;
    border-color: #5a567047;
}

.dot--online {
    color: var(--online);
}

.dot--busy {
    color: var(--busy);
}

.dot--resting {
    color: var(--resting);
}

.dot--offline {
    color: var(--offline);
}

/* ------------------------------------------- presence strip (the signature) */

.strip {
    display: flex;
    height: 24px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-2);
    box-shadow: inset 0 0 0 1px #ffffff0a;
}

.band {
    height: 100%;
    transition: filter 0.15s;
}

.band:hover {
    filter: brightness(1.3);
}

.band--online {
    background: linear-gradient(180deg, #3ce0ad, var(--online));
}

.band--in_the_game {
    background: linear-gradient(180deg, #ab84ff, var(--busy));
}

.band--resting {
    background: linear-gradient(180deg, #f0b153, var(--resting));
}

.band--offline,
.band--unknown {
    background: repeating-linear-gradient(
        -45deg,
        #241f3a,
        #241f3a 4px,
        #1e1a30 4px,
        #1e1a30 8px
    );
}

.strip__legend {
    display: flex;
    justify-content: space-between;
    margin: 6px 0 0;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.legend {
    display: flex;
    gap: 18px;
    margin: 14px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ----------------------------------------------------------------- toggles */

.card__toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 14px;
    padding-top: 13px;
    border-top: 1px solid var(--line-soft);
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle__track {
    position: relative;
    width: 28px;
    height: 16px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    transition: background 0.18s, border-color 0.18s;
}

.toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--muted);
    transition: transform 0.18s, background 0.18s;
}

.toggle input:checked + .toggle__track {
    background: var(--accent);
    border-color: var(--accent);
}

.toggle input:checked + .toggle__track .toggle__thumb {
    transform: translateX(12px);
    background: #fff;
}

.toggle input:focus-visible + .toggle__track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.toggle__label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.toggle input:checked ~ .toggle__label {
    color: var(--text);
}

/* ------------------------------------------------------------------ panels */

.panel {
    padding: 20px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.panel__title {
    margin-bottom: 14px;
    font-family: var(--cond);
    font-size: 17px;
    letter-spacing: 0.01em;
}

.panel--danger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    border-color: #ff5c7a26;
}

.panel--danger .panel__title {
    margin-bottom: 4px;
}

.panel--danger p {
    margin: 0;
    font-size: 13.5px;
}

.form__actions {
    display: flex;
    gap: 10px;
}

/* ----------------------------------------------------------------- account */

.account {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.account__meta {
    margin-right: auto;
}

.account__ids {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0 0;
}

.account__now {
    text-align: right;
}

.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.figure {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
}

.figure__value {
    font-family: var(--mono);
    font-size: 27px;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.figure__label {
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ------------------------------------------------------------------ tables */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    padding: 0 0 9px;
    text-align: left;
    font-family: var(--mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line-soft);
}

.table td {
    padding: 9px 0;
    border-bottom: 1px solid var(--line-soft);
}

.table tr:last-child td {
    border-bottom: none;
}

.table__tag {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    vertical-align: 1px;
}

.table .num {
    text-align: right;
    font-family: var(--mono);
    font-size: 13px;
}

/* ------------------------------------------------------------------- chips */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.chips__item {
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.chips__item:hover {
    color: var(--text);
    border-color: var(--accent-line);
}

.chips__item--on {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

/* ---------------------------------------------------------------- timeline */

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}

.timeline__day {
    margin: 22px 0 12px;
    font-family: var(--mono);
    font-size: 10.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.timeline__day:first-child {
    margin-top: 0;
}

.timeline__row {
    display: grid;
    grid-template-columns: 52px 16px 1fr;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 14px;
}

.timeline__time {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

/* The rail: a hairline behind the nodes, so events read as one sequence.
   The cell stretches to the row's content box, and the line is pulled out by
   the row padding on both sides so it meets the next row without a gap. */
.timeline__node {
    position: relative;
    display: grid;
    place-items: center;
    align-self: stretch;
}

.timeline__node::before {
    content: '';
    position: absolute;
    top: -7px;
    bottom: -7px;
    width: 1px;
    background: var(--line);
}

/* Stop the rail at the first and last event of each day rather than letting it
   run into the date heading. */
.timeline__day + .timeline__row .timeline__node::before {
    top: 50%;
}

.timeline__row:has(+ .timeline__day) .timeline__node::before,
.timeline__row:last-child .timeline__node::before {
    bottom: 50%;
}

.timeline__node::after {
    content: '';
    position: relative;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--offline);
    box-shadow: 0 0 0 3px var(--ink);
}

.timeline__row--orders .timeline__node::after,
.timeline__row--product_orders .timeline__node::after {
    background: var(--accent);
}

.timeline__row--status .timeline__node::after {
    background: var(--online);
}

.timeline__row--take_order .timeline__node::after {
    background: var(--resting);
}

.timeline__body {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.timeline__who {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px 3px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 12.5px;
    color: #cfc9e4;
}

.timeline__who:hover {
    color: #c3aeff;
}

.empty {
    margin: 0;
    padding: 44px 20px;
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

/* ------------------------------------------------------------------- login */

.login {
    width: 100%;
    max-width: 344px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    text-align: center;
}

.login__mark {
    width: 40px;
    height: 40px;
    color: var(--accent);
}

.login__title {
    margin: 12px 0 4px;
    font-family: var(--cond);
    font-size: 25px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.login__hint {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 13.5px;
}

.login .field {
    text-align: left;
    margin-bottom: 14px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
    .topbar {
        gap: 6px;
        padding: 0 12px;
    }

    .brand span {
        display: none;
    }

    /* The bar must never push the page sideways: shrink the controls, and let
       the links scroll among themselves if they still do not fit. */
    .nav {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav::-webkit-scrollbar {
        display: none;
    }

    .nav__link {
        padding: 7px 9px;
        font-size: 13px;
    }

    .btn--ghost {
        padding: 8px 6px;
        font-size: 13px;
    }

    .main {
        padding: 24px 16px 70px;
    }

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

    .add {
        width: 100%;
    }

    .add .input {
        width: auto;
        flex: 1;
    }

    .timeline__row {
        grid-template-columns: 46px 16px 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
