:root {
    --bg: #0d1411;
    --bg-pattern: #17241e;
    --surface: #14201b;
    --surface-soft: #192820;
    --surface-strong: #08110d;
    --text: #edf7f1;
    --muted: #a9b9af;
    --line: #26392f;
    --accent: #34b183;
    --accent-2: #e6a84a;
    --blue: #2563eb;
    --red: #dc2626;
    --purple: #7c3aed;
    --radius: 8px;
    --shadow: 0 16px 38px rgba(0, 0, 0, 0.38);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.28);
    --sidebar-width: 244px;
    --sidebar-collapsed-width: 78px;
}

* { box-sizing: border-box; }

html,
body {
    margin: 0;
    min-height: 100%;
}

body.theme-dark {
    color-scheme: dark;
}

body {
    color: var(--text);
    background:
        linear-gradient(90deg, rgba(31, 122, 92, 0.045) 1px, transparent 1px),
        linear-gradient(180deg, rgba(217, 154, 43, 0.045) 1px, transparent 1px),
        var(--bg);
    background-size: 44px 44px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Tahoma", sans-serif;
    letter-spacing: 0;
    padding-bottom: 78px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; display: block; }

.app-shell {
    min-height: 100vh;
}

.side-nav {
    display: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.topbar-page {
    flex: 1 1 280px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-page h1,
.topbar-page strong {
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(18px, 2vw, 25px);
    line-height: 1.12;
}

.topbar-kicker {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
}

.topbar-controls {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.topbar-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
}

.tenant-context-pill {
    max-width: 220px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-action-form {
    max-width: min(560px, 46vw);
    overflow-x: auto;
    padding-block: 2px;
}

.header-action-form .action-button,
.topbar-actions .button,
.topbar-actions .ghost-button {
    min-height: 38px;
    padding: 7px 10px;
    box-shadow: none;
}

.topbar-title-with-icon {
    min-width: 0;
}

.topbar .page-title-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
}

.topbar .page-title-icon .svg-icon {
    width: 22px;
    height: 22px;
}

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

.tenant-switcher label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenant-switcher select {
    width: min(260px, 34vw);
}

body.theme-dark .topbar,
body.theme-dark .side-nav,
body.theme-dark .bottom-nav {
    background: rgba(16, 27, 22, 0.9);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.brand-mark,
.visual-icon,
.metric i,
.side-links span,
.bottom-nav span {
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    font-style: normal;
    font-weight: 900;
    letter-spacing: 0;
}

.svg-icon {
    width: 1.15em;
    height: 1.15em;
    display: block;
}

.brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    background: linear-gradient(145deg, var(--accent), #144f3f);
    color: #fff;
    box-shadow: 0 10px 18px rgba(31, 122, 92, 0.22);
}

.brand strong,
.brand small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
}

.top-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
}

.profile-menu {
    position: relative;
}

.profile-summary {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px 6px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    cursor: pointer;
    list-style: none;
}

.profile-summary::-webkit-details-marker {
    display: none;
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-weight: 900;
}

.profile-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 900;
}

.profile-menu-panel {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    z-index: 80;
    display: grid;
    gap: 6px;
    width: 220px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.profile-menu-item,
.profile-menu-form button {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.profile-menu-item.active,
.profile-menu-item:hover,
.profile-menu-form button:hover {
    border-color: var(--line);
    background: var(--surface-soft);
}

.profile-menu-form {
    margin: 0;
}

.floating-messages {
    position: fixed;
    inset-inline-end: 16px;
    top: 76px;
    z-index: 90;
    display: grid;
    gap: 8px;
    width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}

.floating-messages .message {
    box-shadow: var(--shadow-soft);
}

.top-actions a,
.top-action-form button,
.side-toggle,
.button,
.ghost-button,
.mini-btn,
.ticket-actions button {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    font-weight: 800;
    transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.side-toggle {
    display: none;
}

.top-actions a.active,
.button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.top-action-form {
    margin: 0;
}

body.theme-dark .top-actions a,
body.theme-dark .ghost-button,
body.theme-dark .mini-btn,
body.theme-dark .ticket-actions button {
    background: var(--surface-soft);
}

.ghost-button {
    background: rgba(255, 255, 255, 0.72);
}

.button:hover,
.ghost-button:hover,
.mini-btn:hover,
.ticket-actions button:hover,
.module-card:hover,
.product-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
}

.page {
    width: min(1220px, 100%);
    margin: 0 auto;
    padding: 16px;
}

.hero-panel,
.panel,
.metric,
.module-card,
.ticket,
.product-card {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

body.theme-dark .hero-panel,
body.theme-dark .panel,
body.theme-dark .metric,
body.theme-dark .module-card,
body.theme-dark .ticket,
body.theme-dark .product-card,
body.theme-dark .screen-title {
    background: rgba(20, 32, 27, 0.94);
}

.hero-panel {
    padding: clamp(18px, 4vw, 34px);
    margin-bottom: 16px;
}

.visual-hero {
    display: grid;
    gap: 18px;
    overflow: hidden;
    position: relative;
}

.visual-hero::after {
    content: "";
    position: absolute;
    inset-inline-end: -90px;
    top: -120px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 154, 43, 0.28), transparent 68%);
    pointer-events: none;
}

.hero-copy,
.hero-visual-card {
    position: relative;
    z-index: 1;
}

.hero-panel h1,
.section-head h1,
.section-head h2 {
    margin: 0;
    line-height: 1.1;
}

.hero-panel h1 {
    font-size: clamp(32px, 8vw, 58px);
    letter-spacing: 0;
}

.hero-panel p {
    max-width: 760px;
    color: var(--muted);
    line-height: 1.65;
}

.hero-panel p,
.module-card p,
.panel p,
.ticket p,
.row-item,
.product-info,
.card-kicker {
    unicode-bidi: plaintext;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.hero-visual-card {
    display: grid;
    gap: 10px;
    align-content: start;
    min-height: 210px;
    padding: 12px;
    background: var(--surface-strong);
    border-radius: var(--radius);
    color: #fff;
    box-shadow: var(--shadow);
}

.hero-visual-card span {
    color: rgba(255, 255, 255, 0.72);
}

.hero-media {
    min-height: 154px;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 12px;
}

.compact-module-head,
.compact-page-head {
    align-items: center;
    min-height: 58px;
    margin: 4px 0 12px;
}

.compact-module-head h1,
.compact-page-head h1 {
    font-size: clamp(24px, 3vw, 36px);
}

.screen-title {
    padding: 14px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

body.theme-dark .screen-title {
    background: rgba(20, 32, 27, 0.86);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.metric {
    min-height: 104px;
    padding: 12px;
    position: relative;
    overflow: hidden;
}

.metric::before,
.module-card::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 0;
    height: 3px;
    background: var(--card-accent, var(--accent));
}

.metric i {
    width: 32px;
    height: 32px;
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 14%, #fff);
    color: var(--card-accent, var(--accent));
    font-size: 11px;
    margin-bottom: 12px;
}

body.theme-dark .metric i,
body.theme-dark .visual-icon,
body.theme-dark .price-pill {
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 22%, #121d18);
}

.metric span,
.card-kicker,
.ticket span,
.row-item span,
.product-card small,
.price-pill {
    color: var(--muted);
    font-size: 13px;
}

.metric strong {
    display: block;
    font-size: clamp(22px, 7vw, 34px);
    margin-top: 2px;
}

.module-grid,
.product-grid,
.kds-grid,
.split-grid,
.dashboard-grid,
.pos-layout,
.pos-workspace,
.owner-grid {
    display: grid;
    gap: 12px;
}

.module-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.module-card,
.panel,
.ticket {
    padding: 16px;
}

.module-card {
    position: relative;
    min-height: 170px;
    overflow: hidden;
}

.visual-card {
    display: grid;
    align-content: start;
    gap: 8px;
}

.visual-icon {
    width: 44px;
    height: 44px;
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 16%, #fff);
    color: var(--card-accent, var(--accent));
    border: 1px solid color-mix(in srgb, var(--card-accent, var(--accent)) 24%, #fff);
    font-size: 12px;
    position: relative;
}

.visual-icon .svg-icon {
    width: 24px;
    height: 24px;
}

.visual-icon small {
    position: absolute;
    inset-inline-end: -5px;
    bottom: -6px;
    min-width: 18px;
    min-height: 18px;
    padding: 2px;
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 9px;
    line-height: 1;
    display: grid;
    place-items: center;
}

.module-card strong,
.panel h2,
.ticket h2 {
    margin: 0;
}

.module-card p,
.panel p,
.ticket p {
    color: var(--muted);
    line-height: 1.55;
}

.split-grid,
.dashboard-grid,
.pos-layout,
.pos-workspace,
.owner-grid {
    grid-template-columns: 1fr;
    margin-top: 12px;
}

.panel {
    min-width: 0;
}

.visual-panel {
    display: grid;
    gap: 8px;
}

.row-item {
    display: grid;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.row-item:last-child { border-bottom: 0; }

.order-row {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.order-row span {
    grid-column: 1 / -1;
}

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

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.pos-check-panel {
    align-content: start;
}

.check-items {
    display: grid;
    gap: 8px;
}

.check-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.check-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.check-item.is-void {
    opacity: 0.58;
}

.qty-controls,
.payment-actions,
.active-check-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.qty-controls {
    align-items: center;
}

.qty-controls span {
    display: grid;
    place-items: center;
    min-width: 28px;
    color: var(--text);
    font-weight: 900;
}

.total-stack {
    display: grid;
    gap: 6px;
    margin: 12px 0;
}

.total-stack div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}

.total-stack dt,
.total-stack dd {
    margin: 0;
}

.total-stack dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.total-stack dd,
.grand-total {
    font-weight: 900;
}

.grand-total {
    color: var(--accent);
}

.inline-action-form,
.payment-actions form {
    display: flex;
    align-items: end;
    gap: 8px;
    margin: 8px 0 0;
}

.inline-action-form label,
.payment-actions label {
    display: grid;
    gap: 5px;
    flex: 1 1 120px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.inline-action-form input,
.payment-actions input {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    padding: 7px 9px;
}

.danger-btn {
    border-color: rgba(220, 38, 38, 0.48);
    color: #ffd1d1;
}

.active-check-grid .order-row {
    flex: 1 1 220px;
    min-width: 220px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.table-map {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.table-card {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.table-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 177, 131, 0.14);
}

.table-main {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: start;
    cursor: pointer;
}

.table-main strong {
    font-size: 20px;
}

.table-main span,
.table-main small {
    color: var(--muted);
}

.table-main small {
    font-size: 12px;
}

.action-panel {
    background: var(--surface-strong);
    color: #fff;
}

.action-panel h2 {
    color: #fff;
}

.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.action-row:last-child {
    border-bottom: 0;
}

.action-row span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
}

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

.product-card {
    display: grid;
    gap: 10px;
    min-height: 210px;
    padding: 10px;
    text-align: start;
    cursor: pointer;
    border: 1px solid var(--line);
}

.product-card.is-working {
    opacity: 0.72;
    pointer-events: none;
}

.product-card.just-created {
    border-color: var(--accent);
}

.media-frame {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 118px;
    overflow: hidden;
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--card-accent, var(--accent)) 18%, #fff), #fff 68%),
        var(--surface-soft);
}

body.theme-dark .media-frame {
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--card-accent, var(--accent)) 24%, #111c17), #111c17 68%),
        var(--surface-soft);
}

.media-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 180ms ease;
}

.media-frame.image-loaded img {
    opacity: 1;
}

.media-fallback {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--card-accent, var(--accent));
    color: #fff;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
}

.media-frame.image-loaded .media-fallback {
    opacity: 0;
}

.product-info {
    display: grid;
    gap: 3px;
}

.product-info strong {
    line-height: 1.25;
}

.price-pill {
    justify-self: start;
    border: 1px solid color-mix(in srgb, var(--card-accent, var(--accent)) 24%, #fff);
    border-radius: 999px;
    padding: 5px 8px;
    color: var(--card-accent, var(--accent));
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 9%, #fff);
    font-weight: 900;
}

.ticket {
    border-inline-start: 5px solid var(--accent-2);
}

.ticket-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.compact-filter-panel {
    margin-bottom: 12px;
    padding-block: 12px;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.filter-form label {
    display: grid;
    gap: 5px;
    flex: 1 1 170px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.filter-form select {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    padding: 7px 9px;
}

.filter-form input {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    padding: 7px 9px;
}

.catalog-workspace {
    align-items: start;
}

.catalog-list {
    display: grid;
    gap: 10px;
}

.catalog-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.catalog-thumb {
    min-height: 70px;
    aspect-ratio: 1;
}

.catalog-thumb .media-fallback {
    width: 42px;
    height: 42px;
    font-size: 13px;
}

.catalog-row strong,
.catalog-row span,
.catalog-row small {
    display: block;
}

.catalog-row span,
.catalog-row small {
    color: var(--muted);
    font-size: 12px;
}

.catalog-state-stack,
.catalog-row-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    gap: 8px;
}

.catalog-row-actions form {
    margin: 0;
}

.compact-row {
    padding-block: 9px;
}

.compact-total-stack {
    margin-top: 0;
}

.stacked-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.ticket-meta,
.kds-item-list {
    display: grid;
    gap: 6px;
    margin: 10px 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.ticket-meta {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.ticket-meta span,
.kds-item-list span {
    color: var(--muted);
    font-size: 12px;
}

.secondary-actions button {
    background: transparent;
}

.ticket-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ticket-actions button[data-status="ready"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.bottom-nav {
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

body.theme-dark .data-table,
body.theme-dark .data-table th {
    background: var(--surface);
}

.bottom-nav a {
    min-height: 66px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
}

.bottom-nav span {
    width: 28px;
    height: 24px;
    background: var(--surface-soft);
    color: var(--accent);
    font-size: 10px;
}

.bottom-nav a:hover,
.bottom-nav a:focus {
    color: var(--accent);
}

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

.table-scroll {
    overflow: auto;
    max-height: 520px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    background: var(--surface);
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    white-space: nowrap;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
}

.inline-form,
.control-form {
    display: grid;
    gap: 12px;
}

.inline-form label,
.control-form label {
    display: grid;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.control-form input,
.control-form select,
.control-form textarea,
.inline-form select {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    padding: 8px 10px;
    outline: 0;
}

.control-form textarea {
    min-height: 84px;
    resize: vertical;
}

.control-form input:focus,
.control-form select:focus,
.control-form textarea:focus,
.inline-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52, 177, 131, 0.16);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}

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

.check-field {
    align-content: center;
    grid-template-columns: auto 1fr;
    min-height: 42px;
}

.check-field span {
    grid-column: 2;
    grid-row: 1;
}

.check-field input[type="checkbox"] {
    grid-column: 1;
    grid-row: 1;
    width: 20px;
    min-height: 20px;
    accent-color: var(--accent);
}

.wide-field {
    grid-column: 1 / -1;
}

.control-form ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.control-form ul label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
}

.message-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.message {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 800;
}

.message.success {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

.message.error {
    border-color: color-mix(in srgb, var(--red) 45%, var(--line));
}

.owner-metrics {
    margin-bottom: 14px;
}

.app-toggle-grid .module-card {
    min-height: 230px;
}

.status-btn {
    width: 100%;
    margin-top: auto;
}

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

.status-btn.is-off {
    background: rgba(220, 38, 38, 0.16);
    border-color: rgba(220, 38, 38, 0.5);
    color: #ffd1d1;
}

.status-btn:disabled {
    cursor: not-allowed;
    opacity: 0.82;
}

.state-on,
.state-off {
    justify-self: end;
    padding: 5px 8px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 900;
}

.state-on {
    background: rgba(52, 177, 131, 0.16);
    color: #9ff0cf;
}

.state-off {
    background: rgba(220, 38, 38, 0.16);
    color: #ffd1d1;
}

.owner-users {
    margin-top: 14px;
}

.login-shell {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(420px, 100%);
}

@media (max-width: 440px) {
    .product-grid {
        grid-template-columns: 1fr;
    }

    .section-head {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .topbar {
        min-height: 60px;
    }

    .topbar-page {
        flex-basis: calc(100% - 96px);
        order: 3;
    }

    .topbar-controls {
        flex: 1 1 auto;
    }

    .topbar-page h1,
    .topbar-page strong {
        font-size: 18px;
    }

    .header-action-form {
        max-width: none;
    }

    .header-action-form .action-button span {
        display: none;
    }

    .topbar-actions a span,
    .topbar-actions button span {
        display: none;
    }

    .tenant-context-pill {
        max-width: 118px;
        min-height: 34px;
        padding-inline: 8px;
    }

    .tenant-switcher label > span {
        display: none;
    }

    .tenant-switcher select {
        width: 150px;
    }

    .compact-brand > span:not(.brand-mark) {
        display: none;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .top-actions a {
        min-height: 36px;
        padding: 7px 10px;
    }

    .metric {
        min-height: 92px;
    }
}

@media (min-width: 760px) {
    body { padding-bottom: 0; }

    .visual-hero {
        grid-template-columns: minmax(0, 1.35fr) 340px;
        align-items: stretch;
    }

    .metric-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .split-grid,
    .pos-layout,
    .pos-workspace,
    .owner-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
    }

    .dashboard-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 300px;
    }

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

    .catalog-row {
        grid-template-columns: 82px minmax(0, 1fr) auto;
        align-items: center;
    }

    .catalog-state-stack {
        grid-column: auto;
        justify-content: flex-end;
    }

    .catalog-row-actions {
        grid-column: 2 / -1;
        justify-content: flex-end;
    }

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

    .bottom-nav {
        display: none;
    }
}

@media (min-width: 1040px) {
    .side-nav {
        position: fixed;
        inset-block: 0;
        left: 0;
        right: auto;
        z-index: 40;
        display: flex;
        flex-direction: column;
        width: var(--sidebar-width);
        padding: 16px;
        background: rgba(255, 255, 255, 0.88);
        border-inline-end: 1px solid var(--line);
        backdrop-filter: blur(18px);
    }

    body.theme-dark .side-links a.active,
    body.theme-dark .side-links a:hover {
        background: var(--surface-soft);
    }

    html[dir="rtl"] .side-nav {
        left: auto;
        right: 0;
        border-inline-end: 0;
        border-inline-start: 1px solid var(--line);
    }

    .brand-stacked {
        padding-bottom: 16px;
        border-bottom: 1px solid var(--line);
    }

    .side-toggle {
        display: inline-flex;
        margin-top: 12px;
        width: 100%;
    }

    .side-links {
        display: grid;
        gap: 6px;
        margin-top: 16px;
        overflow: auto;
        padding-bottom: 12px;
    }

    .side-links a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 42px;
        padding: 8px;
        border-radius: var(--radius);
        color: var(--muted);
        font-weight: 900;
    }

    .side-links span {
        width: 32px;
        height: 28px;
        background: var(--surface-soft);
        color: var(--accent);
        font-size: 10px;
    }

    .side-links .svg-icon,
    .bottom-nav .svg-icon {
        width: 16px;
        height: 16px;
    }

    .side-links a.active,
    .side-links a:hover {
        color: var(--text);
        background: var(--surface-soft);
    }

    .side-links a.active span {
        background: var(--accent);
        color: #fff;
    }

    .app-shell {
        width: auto;
        margin: 0 0 0 var(--sidebar-width);
    }

    html[dir="rtl"] .app-shell {
        margin: 0 var(--sidebar-width) 0 0;
    }

    .page {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 20px 24px;
    }

    .compact-brand {
        display: none;
    }

    .topbar {
        justify-content: space-between;
        min-height: 70px;
    }

    body.rtl .side-nav {
        left: auto;
        right: 0;
        border-left: 1px solid var(--line);
        border-right: 0;
    }

    body.rtl .app-shell {
        margin: 0 var(--sidebar-width) 0 0;
        width: auto;
    }

    body.rtl .page {
        margin: 0;
    }

    body.ltr .side-nav {
        left: 0;
        right: auto;
        border-left: 0;
        border-right: 1px solid var(--line);
    }

    body.ltr .app-shell {
        margin: 0 0 0 var(--sidebar-width);
        width: auto;
    }

    body.ltr .page {
        margin: 0;
    }

    body.sidebar-collapsed .side-nav {
        width: var(--sidebar-collapsed-width);
        padding: 12px;
    }

    body.sidebar-collapsed .brand-stacked {
        justify-content: center;
    }

    body.sidebar-collapsed .brand-stacked > span:not(.brand-mark) {
        display: none;
    }

    body.sidebar-collapsed .side-links a {
        justify-content: center;
        gap: 0;
        font-size: 0;
        padding-inline: 6px;
    }

    body.sidebar-collapsed .side-links span {
        font-size: 10px;
    }

    body.sidebar-collapsed .side-toggle {
        padding-inline: 6px;
    }

    body.sidebar-collapsed .app-shell {
        width: auto;
    }

    body.sidebar-collapsed.rtl .app-shell {
        margin: 0 var(--sidebar-collapsed-width) 0 0;
    }

    body.sidebar-collapsed.ltr .app-shell {
        margin: 0 0 0 var(--sidebar-collapsed-width);
    }
}

.workflow-grid,
.quick-link-grid {
    display: grid;
    gap: 10px;
}

.action-step {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.action-step span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 30px;
    border-radius: var(--radius);
    background: rgba(52, 177, 131, 0.16);
    color: var(--accent);
    font-weight: 900;
    font-size: 12px;
}

.action-step p {
    margin: 0;
}

.title-with-icon {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title-icon {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--card-accent, var(--accent)) 18%, var(--surface-soft));
    color: var(--card-accent, var(--accent));
    border: 1px solid color-mix(in srgb, var(--card-accent, var(--accent)) 32%, var(--line));
}

.page-title-icon .svg-icon {
    width: 26px;
    height: 26px;
}

.module-action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.module-head-actions {
    justify-content: flex-end;
}

.action-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, var(--surface-soft)), var(--surface-soft));
    color: var(--text);
    cursor: pointer;
    font-weight: 900;
    box-shadow: var(--shadow-soft);
}

.action-button .svg-icon {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.action-button:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

@media (min-width: 760px) {
    .workflow-grid,
    .quick-link-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
