:root {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --ink: #171717;
    --muted: #555;
    --brand: #ff7900;
    --brand-ink: #ffffff;
    --line: #e5e5e5;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    cursor: pointer;
}

input, textarea {
    font: inherit;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── top bar ─────────────────────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    /* Above the fixed bottom bar so the More menu's backdrop covers the whole page. */
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

/* Store identity (logo + name) on the left of the top bar. */
.identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.identity-logo {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    object-fit: cover;
    /* Shows through while a store photo loads; the brand SVG has its own tile. */
    background: var(--line);
}

.identity-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}

.identity-name {
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.identity-sub {
    font-size: 12px;
    color: var(--muted);
}

/* "More" menu: store info, news, documents and the language choice. */
.more {
    position: relative;
    flex: 0 0 auto;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
}

.icon-button:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.icon-button-active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

.icon-button .icon {
    width: 20px;
    height: 20px;
}

/* A click anywhere outside the panel lands here and closes it. */
.more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
}

.more-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 210px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

.more-item {
    text-align: left;
    border: none;
    background: none;
    color: var(--ink);
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
}

.more-item:hover {
    background: #f3f4f6;
}

.more-item.active {
    color: var(--brand);
    font-weight: 650;
}

@media (prefers-color-scheme: dark) {
    .more-item:hover {
        background: #3a3a3a;
    }

    .more-item.active {
        color: var(--brand-ink);
    }
}

.more-sep {
    height: 1px;
    background: var(--line);
    margin: 4px 2px;
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    display: block;
}

.chip {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.3;
}

.chip:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.chip-active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

.chip-active:hover {
    color: var(--brand-ink);
}

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

/* ── body ────────────────────────────────────────────────────────────── */

.body {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    /* Leave room for the fixed action bar. */
    padding: 24px 20px 104px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* The operator board and the KDS are work surfaces, not reading pages: they use the whole
   window so their columns have room. Every other console page keeps the readable measure. */
.body-wide {
    max-width: none;
}

/* Always-visible action bar: orders and cart on the left, the platform logo on the right. */
.bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.bottom-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
}

.bottom-action:hover:not(:disabled) {
    border-color: var(--brand);
    color: var(--brand);
}

.bottom-cart:not(:disabled) {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-ink);
}

.bottom-cart:not(:disabled):hover {
    background: #d96500;
    color: var(--brand-ink);
}

.bottom-count {
    font-variant-numeric: tabular-nums;
}

.bottom-spacer {
    flex: 1;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    border: none;
    background: none;
    color: inherit;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}

.brand-link:hover {
    opacity: 0.85;
}

.brand-logo {
    /* The KaiOrder wordmark (172:37), switched light/dark by the <picture> wrapper. */
    height: 26px;
    width: auto;
    display: block;
}

.brand-footer {
    /* The small attribution an embedded Tui draws in its bottom bar. */
    height: 18px;
    width: auto;
    display: block;
}

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

.small {
    font-size: 13px;
}

h1, h2, h3 {
    margin: 0;
    letter-spacing: -0.015em;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 17px;
}

h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.notice {
    border: 1px solid var(--line);
    background: #fffbeb;
    color: #92400e;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}

.banner {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.applied {
    color: var(--brand);
    font-size: 13px;
}

/* The deployment prompt: informational, never destructive. */
.version-banner {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    justify-content: space-between;
}

.state {
    border: 1px dashed var(--line);
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
}

.state-scan {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 20px;
}

/* ── layout helpers ──────────────────────────────────────────────────── */

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

.row-wrap {
    flex-wrap: wrap;
}

.row-center {
    justify-content: center;
}

.row-between {
    justify-content: space-between;
}

.row-baseline {
    align-items: baseline;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field {
    gap: 6px;
}

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

.text-input {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--surface);
    color: var(--ink);
    width: 100%;
}

.text-input:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

/* Multiline field (the contact form's content box): the rows set the height, the visitor
   may make it taller. */
.text-area {
    resize: vertical;
    min-height: 140px;
    line-height: 1.5;
}

/* The contact form's confirmation — all that is left once the form is replaced. */
.contact-sent {
    color: var(--brand);
    font-weight: 600;
}

.primary {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: var(--brand-ink);
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
}

.primary:hover {
    background: #d96500;
}

.wide {
    width: 100%;
}

.link-button {
    border: none;
    background: none;
    color: var(--brand);
    padding: 4px 0;
    font-size: 14px;
}

.link-button:hover {
    text-decoration: underline;
}

/* ── screen header ───────────────────────────────────────────────────── */

.screen-head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.screen-head h1 {
    font-size: 20px;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--line);
}

/* ── store list ──────────────────────────────────────────────────────── */

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

.store-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    text-align: left;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: inherit;
}

.store-card:hover {
    border-color: var(--brand);
    box-shadow: 0 1px 2px rgba(255, 121, 0, 0.12);
}

.store-name {
    font-size: 16px;
    font-weight: 600;
}

.store-sub {
    font-size: 13px;
    color: var(--muted);
}

/* ── menu ────────────────────────────────────────────────────────────── */

.menu-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-head h1 {
    font-size: 26px;
}

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

.product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.thumb {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--line);
}

.thumb.small {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 8px;
}

.product-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.product-name {
    font-weight: 600;
    font-size: 15px;
}

.product-desc {
    font-size: 13px;
    color: var(--muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.price {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.add {
    border: 1px solid var(--brand);
    background: var(--brand);
    color: var(--brand-ink);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
}

.add:hover {
    background: #d96500;
}

/* ── pills ───────────────────────────────────────────────────────────── */

.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    background: #f3f4f6;
    color: #374151;
}

.pill-open,
.pill-ready,
.pill-completed {
    background: #ecfdf5;
    color: #065f46;
}

.pill-closed,
.pill-cancelled {
    background: #fef2f2;
    color: #991b1b;
}

.pill-new {
    background: #eff6ff;
    color: #1d4ed8;
}

.pill-confirmed {
    background: #eef2ff;
    color: #4338ca;
}

.pill-preparing {
    background: #fffbeb;
    color: #92400e;
}

.pill-served {
    background: #f5f3ff;
    color: #5b21b6;
}

/* ── cart & checkout ─────────────────────────────────────────────────── */

.cart-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-line-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.cart-line-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cart-line-name {
    font-weight: 600;
    font-size: 15px;
}

.cart-line-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-line-total {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 72px;
    text-align: right;
}

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

.qty-button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    line-height: 1;
    font-size: 16px;
}

.qty-button:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.qty-value {
    min-width: 24px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.qty-input {
    width: 76px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.qty-input:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.amount-strong {
    font-weight: 650;
    font-size: 16px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.copy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

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

.copy-label {
    font-size: 12px;
    color: var(--muted);
}

.copy-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ── orders ──────────────────────────────────────────────────────────── */

.orders {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-card {
    gap: 10px;
}

.order-number {
    font-weight: 650;
    font-size: 15px;
}

.order-item {
    display: flex;
    align-items: center;
    /* A narrow card wraps the status and actions under the name instead of squeezing the
       name to nothing (where its text used to draw over the status pill). */
    flex-wrap: wrap;
    gap: 6px 10px;
    padding-top: 4px;
}

.order-item-name {
    /* The basis is the width the name insists on: when the rest does not fit beside it,
       it moves to its own row (and in an even narrower card, takes the row alone). */
    flex: 1 1 160px;
    min-width: 0;
}

.order-item-total {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}

/* ── news / profile ──────────────────────────────────────────────────── */

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

.news-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.news-item h3 {
    text-transform: none;
    letter-spacing: 0;
    font-size: 15px;
    color: var(--ink);
}

.news-item p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

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

.hours-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

/* ── markdown (site documents) ───────────────────────────────────────── */

.markdown {
    max-width: 44rem;
    line-height: 1.6;
    font-size: 15px;
}

.markdown h1 {
    font-size: 26px;
    margin: 0 0 12px;
}

.markdown h2 {
    font-size: 20px;
    margin: 24px 0 8px;
}

.markdown h3 {
    font-size: 16px;
    margin: 20px 0 6px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
}

.markdown p,
.markdown ul,
.markdown ol {
    margin: 0 0 12px;
}

.markdown ul,
.markdown ol {
    padding-left: 22px;
}

.markdown li {
    margin-bottom: 4px;
}

.markdown a {
    color: var(--brand);
}

.markdown code {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.9em;
}

.markdown pre {
    background: #111827;
    color: #f9fafb;
    border-radius: 10px;
    padding: 12px 14px;
    overflow-x: auto;
}

.markdown pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown blockquote {
    margin: 0 0 12px;
    padding-left: 12px;
    border-left: 3px solid var(--line);
    color: var(--muted);
}

.markdown table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 12px;
}

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

@media (max-width: 560px) {
    .body {
        padding: 18px 14px 100px;
    }

    .thumb {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .cart-line-row {
        flex-wrap: wrap;
    }

    .cart-line-side {
        width: 100%;
        justify-content: space-between;
    }
}


/* ── owner console ───────────────────────────────────────────────────── */

.auth {
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    text-align: left;
}

.auth-logo {
    width: 56px;
    height: 56px;
    display: block;
}

.auth h1 {
    font-size: 26px;
}

.tabs {
    gap: 8px;
}

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

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.list-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.list-title {
    font-weight: 600;
    font-size: 15px;
}

.list-trailing {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}

.metrics {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.metric {
    flex: 1 1 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.metric-value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.metric-label {
    font-size: 12px;
    color: var(--muted);
}

.board {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.board-column {
    flex: 1 1 260px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.board-column .order-card {
    gap: 6px;
}

.board-column .order-number {
    font-size: 15px;
}

@media (max-width: 760px) {
    .board-column {
        flex-basis: 100%;
    }
}


/* ── editors ─────────────────────────────────────────────────────────── */

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

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow: auto;
}

.dialog {
    background: var(--surface);
    border-radius: 14px;
    padding: 18px;
    width: min(560px, 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
}

.dialog h2 {
    font-size: 18px;
}

.primary.danger {
    background: #b91c1c;
    border-color: #b91c1c;
}

.primary.danger:hover {
    background: #991b1b;
}


.qr-image {
    width: 240px;
    height: 240px;
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.link-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    word-break: break-all;
}


/* ── platform site ───────────────────────────────────────────────────── */

.home {
    max-width: 54rem;
}

.site-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 24px 16px 32px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── system dark theme ───────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #171717;
        --surface: #1f1f1f;
        --ink: #f7f7f5;
        --muted: #aaa;
        --brand: #ff7900;
        --brand-ink: #ffffff;
        --line: #333333;
    }

    .notice {
        background: #3a2e0a;
        color: #fcd34d;
    }

    .banner {
        background: #3a1a1a;
        color: #fca5a5;
    }

    .cart-badge,
    .chip-cart {
        background: #064e3b;
        color: #6ee7b7;
        border-color: #065f46;
    }

    .chip-active {
        background: var(--brand);
        color: var(--brand-ink);
    }

    .thumb {
        background: #3a3a3a;
    }

    .markdown code {
        background: #3a3a3a;
    }

    .markdown pre {
        background: #161b22;
        color: #f7f7f5;
    }

    .metric-value {
        color: var(--ink);
    }
}


/* ── demos: the embedded apps ────────────────────────────────────────── */

/*
 * The Demos pages render `showcase/webAppKilua` (which in turn mounts the real Tui and Kea
 * web apps), but a Kilua module's `jsMain/resources` are only copied into *its own*
 * distribution — this page loads Korora's `styles.css` alone. So the device chrome the
 * showcase draws and the app rules the embedded customers/console need belong here.
 * Copied from `showcase/webAppKilua/.../styles.css` and `tui/webAppKilua/.../styles.css`:
 * keep the two in step when either changes (the demo must look exactly like the real app).
 */

.showcase {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
}

/* The bare `/demos/raw/<id>` and `/demos/screen/<id>` variants render the showcase
   directly under `#root` (no site shell), so it must fill the viewport height itself. */
#root > .showcase {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Inside the site shell, fill the remaining body height instead. The app/body only get a
   definite height on a demo page (Safari needs `height`, not `min-height`, for the flex
   percentage chain), so scope it with `:has` and leave every other page scrolling normally. */
.app:has(> .body > .showcase) {
    height: 100vh;
    height: 100dvh;
}
.app:has(> .body > .showcase) > .body {
    min-height: 0;
    overflow: hidden;
}

.body > .showcase {
    flex: 1 1 0;
    min-height: 0;
}

.showcase-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.showcase-head .brand-logo {
    height: 26px;
    width: auto;
    display: block;
}

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

.demo-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    text-align: left;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: inherit;
}

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

.demo-title {
    font-size: 16px;
    font-weight: 600;
}

.demo-desc {
    font-size: 13px;
    color: var(--muted);
}

.devices {
    display: flex;
    gap: 16px;
    align-items: stretch;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-height: 0;
}

/* Device frames: a phone/tablet bezel around the embedded app, mirroring the compose
   TabletFrame/PhoneFrame. Size is responsive (aspect-ratio) so it is never hard-capped. */
.device {
    position: relative;
    box-sizing: border-box;
    padding: 3px;
    background: #171719;
    border-radius: 18px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex: 1 1 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.device-phone {
    border-radius: 44px;
    padding: 7px;
}

.device-board, .device-console {
    border-radius: 20px;
    padding: 5px;
}

/* Phone home indicator, drawn over the bottom of the screen. */
.device-phone::after {
    content: "";
    position: absolute;
    z-index: 50;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 4px;
    border-radius: 2px;
    background: rgba(120, 120, 120, 0.55);
}

.device-board::before, .device-console::before {
    content: "";
    position: absolute;
    z-index: 50;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2a2a2c;
}

.device .app {
    height: 100%;
    min-height: 0;
    border-radius: 38px;
    overflow: hidden;
    background: var(--surface);
    position: relative;
}

.device-board .app, .device-console .app {
    border-radius: 15px;
}

/* Placeholder while a scene is being prepared (`…`). */
.device-wait {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
}

/* Invisible input shield: the demo is a recording, so a visitor may scroll it but never
   tap the app underneath. */
.device-blocker {
    position: absolute;
    inset: 0;
    z-index: 100;
    background: transparent;
    cursor: default;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Raw (unframed) demo: the app fills the viewport, no device chrome, size limit or
   rounded corners. The pane is the scroll port's parent, so the shield still forwards
   wheel/touch scrolling to the embedded app's own `.body`. */
.demo-raw {
    position: fixed;
    inset: 0;
    display: flex;
    gap: 0;
    background: var(--bg);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.demo-raw ::selection, .device ::selection, .device-blocker ::selection {
    background: transparent;
    color: inherit;
}

.demo-raw-pane {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.demo-raw-pane {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    height: 100%;
}

.demo-raw-wait {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--muted);
}

@media (max-width: 760px) {
    .device, .device-phone, .device-board, .device-console { width: 100%; }
}

/* ── the embedded customer app (Tui in a demo frame) ─────────────────── */

/* The shell fills its demo frame instead of the viewport: the page inside does not take
   100vh, and the action bar sticks to the frame rather than the window. */
.app-embedded {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: clip;
}

.app-embedded .topbar {
    position: sticky;
    flex-shrink: 0;
}

.app-embedded .body {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    /* No top padding: this element is the frame's scroll port, and a sticky child is clamped
       to its content box, so padding here leaves a strip above the pinned category bar where
       the list keeps scrolling behind it. The space moves to the first child instead, where
       it scrolls away exactly like the real app's padding does. */
    padding-top: 0;
    /* The action bar is absolute inside the frame, so keep the last row clear of it. */
    padding-bottom: 88px;
}

.app-embedded .body > :first-child {
    margin-top: 24px;
}

.app-embedded .bottombar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
}

.app-embedded .dialog-backdrop {
    position: absolute;
}

/* The frame's `.body` is its own scroll port: the top bar above it does not scroll, so the
   category bar pins to the very top of the frame instead of under a 64px top bar. */
.app-embedded .category-bar {
    top: 0;
}

.topbar.topbar-scrolled {
    padding: 6px 20px;
}

.topbar.topbar-scrolled .identity-logo {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
}

.topbar.topbar-scrolled .identity-name {
    font-size: 14px;
}

/* ── menu category bar ───────────────────────────────────────────────── */

.category-bar {
    position: sticky;
    top: 64px;
    z-index: 10;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
    /* The bar is a flex item of `.body`. In a demo frame `.body` has a fixed height (it is
       the scroll pane), and a nested flex container has no content-based minimum, so without
       this the browser shrinks the bar to a sliver (17px instead of 47px). */
    flex-shrink: 0;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.category-chip.active {
    background: var(--brand);
    color: var(--brand-ink);
    border-color: var(--brand);
}

/* ── announcement ────────────────────────────────────────────────────── */

.announcement {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
}

.announcement-title {
    font-weight: 600;
    font-size: 14px;
}

.announcement-body {
    font-size: 13px;
    color: var(--muted);
}

.product-detail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    background: var(--surface-2, #e5e7eb);
}

.qty-value {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
}
/* Demo narration: floats above the device being discussed. */
.demo-caption {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 8px 14px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    border: 1px solid var(--brand);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    z-index: 101;
    pointer-events: none;
    backdrop-filter: blur(4px);
}

.demo-caption-inline {
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
