/* Kitchen Display - light theme, --ds-* tokens only */

.kds-page {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
    padding: var(--ds-space-3) var(--ds-space-6) var(--ds-space-6);
    background: var(--ds-canvas);
    /* No calc(100vh - n): that n is a guess at the chrome above, and it
       clips or leaves a gap the moment the chrome changes. The shell already
       bounds this; fill it. */
    min-height: 0;
    flex: 1 1 auto;
    box-sizing: border-box;
}

.kds-kanban {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--ds-space-4);
    flex: 1 1 auto;
    min-height: 0;
    margin-block-end: 0;
}

@media (max-width: 900px) {
    .kds-kanban {
        grid-template-columns: 1fr;
    }
}

.kds-column {
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-1);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.kds-column-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    border-block-end: 1px solid var(--ds-border-default);
    background: var(--ds-bg-inset);
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
}

.kds-column-title {
    margin: 0;
    font-size: var(--ds-text-md);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text-primary);
    line-height: 1.3;
}

.kds-column-stations {
    display: block;
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-fw-medium);
    color: var(--ds-text-secondary);
    margin-block-start: 2px;
}

.kds-station-head {
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--ds-space-1) 0;
    border-block-end: 1px solid var(--ds-border-default);
    margin-block-end: var(--ds-space-1);
}

.kds-column-count {
    font-size: var(--ds-text-xs);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text-secondary);
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-pill);
    padding: 2px 8px;
    font-variant-numeric: tabular-nums;
}

.kds-column-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--ds-space-3);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
}

.kds-column-empty {
    flex: 1;
    min-height: 120px;
}

.kds-ticket {
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-md);
    padding: var(--ds-space-3);
    background: var(--ds-bg-surface);
    box-shadow: var(--ds-shadow-1);
}

/* Where it is going, first and on its own line.
   This was buried in the pipe-joined meta row at 10.5px grey -- the one thing
   a runner reads the ticket for, set smaller and fainter than everything
   around it. */
.kds-ticket-dest {
    display: inline-block;
    font-weight: var(--ds-fw-bold);
    /* Level with the dish name, not below it: the cook reads the name, the
       runner reads this, and neither of them is the junior partner. */
    font-size: var(--ds-text-md);
    color: var(--ds-text-primary);
    background: var(--ds-bg-inset);
    border-radius: var(--ds-radius-sm);
    padding: 2px 8px;
    margin-block-end: var(--ds-space-2);
    line-height: 1.3;
}

.kds-ticket-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ds-space-2);
    margin-block-end: var(--ds-space-2);
}

/* Read from a metre away with both hands busy, not from a desk chair.
   Measured on the till, the dish name was 12.25px -- the most important text
   on the screen set smaller than body copy on a website. */
.kds-ticket-name {
    font-weight: var(--ds-fw-bold);
    color: var(--ds-text-primary);
    font-size: var(--ds-text-md);
    line-height: 1.25;
}

.kds-ticket-qty {
    font-family: var(--ds-font-mono);
    font-weight: var(--ds-fw-bold);
    color: var(--ds-primary);
    white-space: nowrap;
    font-size: var(--ds-text-lg);
}

.kds-ticket-meta {
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-xs);
    margin-block-end: var(--ds-space-1);
    line-height: 1.4;
}

.kds-ticket-notes,
.kds-ticket-mods,
.kds-ticket-partof {
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
    margin-block-end: var(--ds-space-1);
}

/*
 * What goes in this drink. Carries the ticket's own text colour rather than
 * the muted one the meta lines use: it is an instruction to make something,
 * not a label, and a kitchen screen is read at arm's length across a counter.
 */
.kds-ticket-addons {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    margin-block-end: var(--ds-space-1);
}

.kds-ticket-timer {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-1);
    font-family: var(--ds-font-mono);
    font-size: var(--ds-text-sm);
    color: var(--ds-text-tertiary);
    margin-block-end: var(--ds-space-3);
    padding: 2px 8px;
    border-radius: var(--ds-radius-sm);
    background: var(--ds-bg-inset);
}

.kds-ticket-timer.is-warn {
    color: var(--ds-warning);
    background: color-mix(in srgb, var(--ds-warning) 12%, var(--ds-bg-inset));
    font-weight: var(--ds-fw-semibold);
}

.kds-ticket-timer.is-late {
    color: var(--ds-danger);
    background: color-mix(in srgb, var(--ds-danger) 12%, var(--ds-bg-inset));
    font-weight: var(--ds-fw-bold);
}

.kds-ticket.kds-status-preparing {
    border-inline-start: 3px solid var(--ds-primary);
}

.kds-ticket.kds-status-ready {
    border-inline-start: 3px solid var(--ds-success);
}

/* 40px was under the 44px minimum, in the one room in the building where
   hands are wet, floury or gloved and the screen gets knuckled. */
.kds-bump-btn {
    width: auto;
    min-width: 120px;
    height: 52px;
    min-height: 52px;
    padding-inline: var(--ds-space-4);
    align-self: flex-start;
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-fw-semibold);
    border-radius: var(--ds-radius-md);
    border: 1px solid transparent;
}

.kds-bump-pending {
    background: var(--ds-primary);
    border-color: var(--ds-primary);
    color: var(--ds-text-on-primary, var(--ds-sidebar-pill));
}

.kds-bump-pending:hover {
    background: var(--ds-primary-hover, var(--ds-primary));
}

.kds-bump-preparing {
    background: var(--ds-success);
    border-color: var(--ds-success);
    color: var(--ds-text-on-primary, #fff);
}

.kds-bump-ready {
    background: var(--ds-bg-surface);
    border-color: var(--ds-border-default);
    color: var(--ds-text-primary);
}

.kds-bump-ready:hover {
    background: var(--ds-bg-inset);
}

.kds-empty {
    text-align: center;
    padding: var(--ds-space-10) var(--ds-space-4);
}

/* A <details> now: station mapping is set up once and never touched during
   service, and open by default it held 220px of a 730px screen -- 35% of the
   kitchen display -- above a board that was scrolling 1687px of tickets
   through 306px. */
.kds-mapping {
    flex: 0 0 auto;
    max-height: 220px;
    overflow: auto;
    margin-block-start: var(--ds-space-2);
}

.kds-mapping-summary {
    cursor: pointer;
    font-weight: var(--ds-fw-semibold);
    font-size: var(--ds-text-md);
    color: var(--ds-text-primary);
    list-style-position: inside;
}

.kds-mapping:not([open]) {
    padding-block: var(--ds-space-3);
}

.kds-mapping-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto;
    gap: var(--ds-space-2);
    align-items: center;
    margin-block-end: var(--ds-space-2);
}

.kds-mapping-row:last-child {
    margin-block-end: 0;
}

.kds-mapping-label {
    font-weight: var(--ds-fw-medium);
    color: var(--ds-text-primary);
}

.kds-station-input {
    min-height: var(--ds-touch-target);
}

.kds-station-save {
    min-height: var(--ds-touch-target);
}

@media (max-width: 640px) {
    .kds-mapping-row {
        grid-template-columns: 1fr;
    }
}
