/* =========================================================
   EMBER & COPPER — Restaurant Service Console
   Design tokens
   ========================================================= */

:root {
    --ink: #15171A;
    --ink-2: #1D2023;
    --ink-3: #262A2E;
    --paper: #F6F2EA;
    --paper-dim: #E7E1D5;
    --copper: #C1652F;
    --copper-hi: #E58A4F;
    --sage: #74856A;
    --rust: #B5482F;
    --line: rgba(246, 242, 234, 0.09);
    --line-soft: rgba(246, 242, 234, 0.05);
    --text-hi: #F6F2EA;
    --text-mid: #B9B3A6;
    --text-dim: #756F63;
    --display: 'Fraunces', serif;
    --body: 'Inter', sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --radius: 10px;
    --radius-lg: 16px;
}

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

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--ink);
    color: var(--text-hi);
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
select {
    font-family: inherit;
}

h1,
h2,
h3,
h4 {
    font-family: var(--display);
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

::selection {
    background: var(--copper);
    color: var(--ink);
}


/* =========================== LAYOUT =========================== */

.app {
    display: grid;
    grid-template-columns: 264px 1fr;
    min-height: 100vh;
}


/* -------- Sidebar / "the rail" -------- */

.rail {
    background: linear-gradient(180deg, #101214, #17191c 60%, #101214);
    border-right: 1px solid var(--line);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    position: sticky;
    top: 0;
    height: 100vh;
}

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

.rail-mark {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: conic-gradient(from 210deg, var(--copper), var(--copper-hi), var(--rust), var(--copper));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    flex-shrink: 0;
}

.rail-brand-text strong {
    display: block;
    font-family: var(--display);
    font-size: 16.5px;
    letter-spacing: 0.01em;
}

.rail-brand-text small {
    color: var(--text-dim);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.rail-link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    color: var(--text-mid);
    text-align: left;
    padding: 11px 12px;
    border-radius: 8px;
    font-size: 14.5px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}

.rail-num {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    width: 20px;
    flex-shrink: 0;
}

.rail-link:hover {
    background: var(--line-soft);
    color: var(--text-hi);
}

.rail-link.is-active {
    background: var(--ink-3);
    color: var(--copper-hi);
}

.rail-link.is-active .rail-num {
    color: var(--copper);
}

.rail-shift {
    border-top: 1px dashed var(--line);
    padding-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rail-shift small {
    color: var(--text-dim);
    font-size: 10.5px;
    letter-spacing: 0.14em;
}

.rail-shift strong {
    font-family: var(--mono);
    font-size: 20px;
    color: var(--text-hi);
}

.rail-shift span {
    color: var(--text-dim);
    font-size: 12px;
}


/* -------- Stage / main content -------- */

.stage {
    padding: 32px 40px 60px;
    max-width: 1320px;
}

.stage-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.stage-top-title h1 {
    font-size: 30px;
}

.stage-top-title p {
    margin: 4px 0 0;
    color: var(--text-mid);
    font-size: 14px;
}

.stage-top-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search input {
    background: var(--ink-2);
    border: 1px solid var(--line);
    color: var(--text-hi);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13.5px;
    width: 240px;
    outline: none;
}

.search input::placeholder {
    color: var(--text-dim);
}

.search input:focus {
    border-color: var(--copper);
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform .12s ease, background .15s ease, opacity .15s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--copper);
    color: #1A0F08;
}

.btn-primary:hover {
    background: var(--copper-hi);
}

.btn-ghost {
    background: var(--ink-2);
    color: var(--text-hi);
    border: 1px solid var(--line);
}

.btn-ghost:hover {
    border-color: var(--copper);
    color: var(--copper-hi);
}

.btn-sm {
    padding: 7px 12px;
    font-size: 12.5px;
}

.btn-danger {
    background: transparent;
    color: var(--rust);
    border: 1px solid rgba(181, 72, 47, 0.4);
}

.btn-danger:hover {
    background: rgba(181, 72, 47, 0.12);
}


/* views */

.view {
    display: none;
}

.view.is-active {
    display: block;
    animation: rise .35s ease;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}


/* =========================== STATS =========================== */

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card--accent {
    border-color: rgba(193, 101, 47, 0.4);
    background: linear-gradient(160deg, #241A12, #1D2023 60%);
}

.stat-label {
    font-size: 12px;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-value {
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 700;
}

.stat-foot {
    font-size: 12px;
    color: var(--text-dim);
}


/* =========================== PANELS =========================== */

.dash-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.dash-grid--billing {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
}

.panel {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.panel-flush {
    padding-bottom: 8px;
}

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

.panel-tag {
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--mono);
}

.chip-filter {
    display: flex;
    gap: 6px;
}

.chip {
    background: none;
    border: 1px solid var(--line);
    color: var(--text-mid);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12.5px;
}

.chip.is-active {
    background: var(--copper);
    border-color: var(--copper);
    color: #1A0F08;
    font-weight: 600;
}


/* =========================== TICKET RAIL (signature element) =========================== */

.ticket-rail {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    padding: 6px 4px 20px;
    min-height: 80px;
}

.ticket-rail--wide {
    gap: 26px;
}

.ticket-rail:empty::after,
.ticket-rail.is-empty::after {
    content: "No tickets on the rail right now.";
    color: var(--text-dim);
    font-size: 13.5px;
    padding: 20px;
}

.ticket {
    position: relative;
    width: 220px;
    background: var(--paper);
    color: #2A2418;
    border-radius: 2px;
    padding: 16px 16px 14px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
    transform: rotate(var(--tilt, -1.2deg));
    transition: transform .18s ease, box-shadow .18s ease;
    font-family: var(--mono);
}

.ticket:hover {
    transform: rotate(0deg) translateY(-3px);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
}

.ticket::before {
    /* pin */
    content: "";
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, var(--copper-hi), var(--rust));
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ticket::after {
    /* perforation */
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 34px;
    border-top: 2px dotted rgba(42, 36, 24, 0.28);
}

.ticket-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-family: var(--body);
}

.ticket-num {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 13px;
}

.ticket-table {
    font-size: 11px;
    color: #6b5f47;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.ticket-items {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 12.5px;
    line-height: 1.7;
}

.ticket-items li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ticket-items li span:last-child {
    color: #6b5f47;
}

.ticket-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    font-family: var(--body);
}

.ticket-time {
    font-size: 11px;
    color: #847A64;
}

.badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--body);
}

.badge-firing {
    background: #F3D7C4;
    color: #8A3D14;
}

.badge-ready {
    background: #D6E2CE;
    color: #40551F;
}

.badge-served {
    background: #DADADA;
    color: #4A4A4A;
}

.badge-paid {
    background: #D8D0BE;
    color: #5A4E33;
}

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

.ticket-actions button {
    flex: 1;
    border: 1px solid rgba(42, 36, 24, 0.2);
    background: transparent;
    color: #3A3220;
    font-size: 11px;
    padding: 6px 4px;
    border-radius: 6px;
    font-family: var(--body);
    font-weight: 600;
}

.ticket-actions button:hover {
    background: rgba(42, 36, 24, 0.08);
}


/* =========================== BEST SELLERS BARS =========================== */

.bar-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bar-row {
    display: grid;
    grid-template-columns: 110px 1fr 50px;
    align-items: center;
    gap: 10px;
}

.bar-row-name {
    font-size: 12.5px;
    color: var(--text-mid);
}

.bar-track {
    height: 9px;
    background: var(--ink-3);
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--copper), var(--copper-hi));
    border-radius: 6px;
}

.bar-row-count {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    text-align: right;
}


/* =========================== FLOOR / TABLES =========================== */

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

.table-card {
    border-radius: var(--radius-lg);
    padding: 16px;
    text-align: center;
    border: 1px solid var(--line);
    background: var(--ink-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform .15s ease;
}

.table-card:hover {
    transform: translateY(-3px);
}

.table-shape {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 16px;
    border: 2px solid var(--line);
}

.table-card[data-status="available"] .table-shape {
    background: rgba(116, 133, 106, 0.15);
    border-color: var(--sage);
    color: var(--sage);
}

.table-card[data-status="occupied"] .table-shape {
    background: rgba(193, 101, 47, 0.15);
    border-color: var(--copper);
    color: var(--copper-hi);
}

.table-card[data-status="reserved"] .table-shape {
    background: rgba(181, 72, 47, 0.12);
    border-color: var(--rust);
    color: #D98165;
}

.table-seats {
    font-size: 11.5px;
    color: var(--text-dim);
}

.table-status {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.table-card[data-status="available"] .table-status {
    color: var(--sage);
}

.table-card[data-status="occupied"] .table-status {
    color: var(--copper-hi);
}

.table-card[data-status="reserved"] .table-status {
    color: #D98165;
}


/* =========================== MENU BOARD =========================== */

.menu-board {
    display: flex;
    flex-direction: column;
}

.menu-category {
    margin-bottom: 6px;
}

.menu-category-title {
    font-family: var(--display);
    font-size: 15px;
    color: var(--copper-hi);
    padding: 14px 0 8px;
    border-bottom: 1px dashed var(--line);
}

.menu-item-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--line-soft);
}

.menu-item-name {
    font-size: 14.5px;
}

.menu-item-price {
    font-family: var(--mono);
    color: var(--text-mid);
}

.avail-toggle {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: none;
    color: var(--text-dim);
}

.avail-toggle.is-on {
    color: var(--sage);
    border-color: var(--sage);
}

.avail-toggle.is-off {
    color: var(--rust);
    border-color: rgba(181, 72, 47, 0.4);
}

.menu-item-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    background: none;
    border: 1px solid var(--line);
    color: var(--text-mid);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    font-size: 13px;
}

.icon-btn:hover {
    color: var(--copper-hi);
    border-color: var(--copper);
}


/* =========================== BILLING =========================== */

.settle-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 8px;
}

.settle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--ink-3);
    cursor: pointer;
    transition: border-color .15s ease;
}

.settle-row:hover {
    border-color: var(--copper);
}

.settle-row.is-selected {
    border-color: var(--copper);
    background: rgba(193, 101, 47, 0.1);
}

.settle-row-left strong {
    font-family: var(--mono);
    font-size: 13px;
}

.settle-row-left span {
    display: block;
    font-size: 11.5px;
    color: var(--text-dim);
}

.settle-row-amount {
    font-family: var(--mono);
    color: var(--copper-hi);
    font-weight: 700;
}

.bill-empty {
    color: var(--text-dim);
    font-size: 13.5px;
    padding: 30px 4px;
    text-align: center;
}

.bill-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.bill-line {
    display: flex;
    justify-content: space-between;
    font-size: 13.5px;
    color: var(--text-mid);
}

.bill-line span:last-child {
    font-family: var(--mono);
    color: var(--text-hi);
}

.bill-divider {
    border-top: 1px dashed var(--line);
    margin: 10px 0;
}

.bill-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 17px;
    font-weight: 700;
}

.bill-total-row span:last-child {
    font-family: var(--mono);
    color: var(--copper-hi);
}

.ledger {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ledger th {
    text-align: left;
    padding: 10px 8px;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--line);
}

.ledger td {
    padding: 11px 8px;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--mono);
    font-size: 12.5px;
}

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


/* =========================== MODALS =========================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 11, 12, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal-backdrop.is-open {
    display: flex;
}

.modal {
    background: var(--ink-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    display: none;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.modal.is-open {
    display: flex;
}

.modal-sm {
    max-width: 420px;
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-mid);
    font-size: 22px;
    line-height: 1;
}

.modal-body {
    padding: 20px 22px;
    overflow-y: auto;
}

.modal-foot {
    padding: 16px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-mid);
}

.field input,
.field select {
    background: var(--ink-3);
    border: 1px solid var(--line);
    color: var(--text-hi);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: var(--copper);
}

.field-check {
    flex-direction: row;
    align-items: center;
}

.field-check input {
    width: auto;
}

.order-builder {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 18px;
    margin-top: 8px;
}

.order-builder-menu {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 6px;
}

.pick-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
}

.pick-item button {
    background: var(--copper);
    color: #1A0F08;
    border: none;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    font-weight: 700;
}

.order-builder-cart h4 {
    font-size: 13px;
    color: var(--text-mid);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 10px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 230px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.cart-empty {
    color: var(--text-dim);
    font-size: 13px;
}

.cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    background: var(--ink-3);
    padding: 8px 10px;
    border-radius: 8px;
}

.cart-row button {
    background: none;
    border: none;
    color: var(--rust);
    font-size: 15px;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    font-size: 15px;
    font-weight: 700;
}

.cart-total strong {
    font-family: var(--mono);
    color: var(--copper-hi);
}


/* =========================== TOAST =========================== */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink-3);
    border: 1px solid var(--copper);
    color: var(--text-hi);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13.5px;
    opacity: 0;
    pointer-events: none;
    transition: all .25s ease;
    z-index: 200;
}

.toast.is-shown {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* =========================== RESPONSIVE =========================== */

@media (max-width:1080px) {
    .dash-grid,
    .dash-grid--billing {
        grid-template-columns: 1fr;
    }
    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .order-builder {
        grid-template-columns: 1fr;
    }
}

@media (max-width:820px) {
    .app {
        grid-template-columns: 1fr;
    }
    .rail {
        position: relative;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 16px 20px;
        gap: 20px;
    }
    .rail-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    .rail-shift {
        display: none;
    }
    .stage {
        padding: 22px 18px 50px;
    }
    .stat-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}