/* FMX Classic's tokens; the appearance picker's Classic preview declares them again over the page's skin. */
:root, [data-interface-theme="classic"] {
    color-scheme: light;
    --epos-primary: #0369a1;
    --epos-primary-ink: #ffffff;
    --epos-primary-strong: #075985;
    --epos-cyan: #0ea5e9;
    --epos-cyan-soft: #dff3fb;
    --epos-navy: #102a37;
    --epos-bg: #eaf4f8;
    --epos-surface: #ffffff;
    --epos-muted: #5b7280;
    --epos-border: #c7dce5;
    --epos-success: #15803d;
    --epos-warning: #b45309;
    --epos-danger: #b91c1c;
    --epos-payment-cash: #16713a;
    --epos-payment-cash-hover: #125d31;
    --epos-payment-card: #0b7294;
    --epos-payment-card-hover: #085c79;
    --epos-payment-refund: #8a4b00;
    --epos-payment-refund-bg: #fff8e8;
    --epos-shadow: 0 12px 30px rgba(16, 42, 55, 0.12);
    --epos-ease-out: cubic-bezier(0.23, 1, 0.32, 1);

    /* Role tokens. These name the shade families that used to be written as
       near-identical hex literals in every stylesheet; see MASTER.md. Use the
       role token rather than adding a new literal. */
    --epos-surface-tint: #f7fafb;
    --epos-surface-sunken: #eef4f7;
    --epos-cyan-wash: #ecf7fc;
    --epos-border-soft: #d7e3e8;
    --epos-border-strong: #87bfd6;
    --epos-text: #173f52;
    --epos-ink-soft: #365766;
    --epos-ink-muted: #49636f;
    --epos-success-bg: #effbf3;
    --epos-success-text: #166534;
    --epos-danger-bg: #fff5f5;
    --epos-danger-text: #b42318;
    --epos-warning-bg: #fff8e8;
    --epos-warning-text: #92400e;
    --epos-focus: #1683ad;
    --epos-shadow-soft: 0 2px 8px rgba(16, 42, 55, .055);
    --epos-navy-deep: #1b3542;
    --epos-ink-deep: #294d5d;
    --epos-ink-slate: #526c78;
    --epos-ink-faint: #607985;
    --epos-border-accent: #a8d5e7;
    --epos-border-accent-soft: #b8d9e6;
    --epos-border-success: #9fd6b1;
    --epos-border-danger: #e7a6a6;
    --epos-border-warning: #e8c884;
    --epos-scrollbar-thumb: #adc8d3;
    --epos-success-strong: #11643a;
    --epos-success-bg-strong: #dcf7e6;
    --epos-danger-strong: #9c1c1c;
    --epos-danger-bg-strong: #fde3e2;
    --epos-warning-strong: #7b4a07;
    --epos-warning-bg-strong: #fff5d6;
    --epos-warning-wash: #fff1c9;
    --epos-amber: #d79216;
    --epos-heading-accent: #0b6f9b;

    /* Corner radii actually in use across the till and administration shells. */
    --epos-radius-control: 4px;
    --epos-radius-card: 5px;
    --epos-radius-panel: 6px;

    /* The two design-system/epos/MASTER.md palette roles with no --epos-*
       equivalent. The other --color-* aliases were removed: every stylesheet
       now uses the canonical --epos-* name. */
    --color-muted: #e2edf2;
    --color-destructive: #dc2626;
    font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
    font-synthesis: none;

    /* Till shell widths. Only the media blocks in pos-orders.css (1366) and
       pos-1024.css re-point them; the brand preview in admin-settings.css reads
       --pos-nav-width too. */
    --pos-nav-width: 6.5rem;
    --pos-basket-width: clamp(28rem, 29vw, 32rem);

    /* Height of the open till keyboard; TouchKeyboard.razor.js sets it on <html>
       so open dialogs keep their action row above the keys. */
    --touch-keyboard-inset: 0px;
}

* {
    box-sizing: border-box;
}

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

html {
    background: var(--epos-surface-tint);
}

body {
    background: var(--epos-bg);
    color: var(--epos-text);
    font-weight: 400;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
    font: inherit;
}

.epos-icon {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    display: block;
    pointer-events: none;
}

.with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.42rem;
}

button,
a,
select,
input[type="checkbox"],
input[type="radio"] {
    touch-action: manipulation;
}

button:not(:disabled), a[href], select, label[for] {
    cursor: pointer;
}

a {
    color: var(--epos-primary-strong);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.75rem, 2.2vw, 2.45rem);
    line-height: 1.12;
    letter-spacing: -0.025em;
}

h2 {
    font-size: 1.35rem;
}

.skip-link {
    position: fixed;
    z-index: 2000;
    top: -5rem;
    left: 0.75rem;
    border-radius: 0 0 var(--epos-radius-panel) var(--epos-radius-panel);
    background: var(--epos-navy);
    padding: 0.75rem 1rem;
    color: var(--epos-surface);
    font-weight: 800;
    text-decoration: none;
}

::selection {
    background: #cbeaf6;
    color: #102f3d;
}

:focus { outline: none; }

.button {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    border-radius: var(--epos-radius-control);
    padding: 0.72rem 1rem;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
    box-shadow: 0 1px 2px rgba(16, 42, 55, .08);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.button:hover:not(:disabled) {
    box-shadow: 0 3px 8px rgba(16, 42, 55, .12);
}

.button:active:not(:disabled) {
    box-shadow: inset 0 1px 2px rgba(16, 42, 55, .16);
    transition-duration: 0s;
}

.button-primary {
    background: var(--epos-primary);
    color: var(--epos-surface);
}

.button-primary:hover:not(:disabled) {
    background: var(--epos-primary-strong);
}

.button-secondary {
    border-color: var(--epos-primary);
    background: var(--epos-surface);
    color: var(--epos-primary-strong);
}

.button-secondary:hover:not(:disabled) {
    background: var(--epos-cyan-soft);
}

.button-success {
    background: var(--epos-success);
    color: var(--epos-surface);
}

.button-success:hover:not(:disabled) {
    background: var(--epos-success-text);
}

.button-danger {
    background: var(--epos-danger);
    color: var(--epos-surface);
}

.button-quiet {
    border-color: var(--epos-border);
    background: var(--epos-surface);
    color: var(--epos-navy);
}

.button-large {
    min-height: 56px;
    padding-inline: 1.4rem;
    font-size: 1.05rem;
}

.button-block {
    width: 100%;
}

/* Entry shell shared with the not-found and access-denied pages; the sign-in and
   setup pages themselves are styled in styles/entry.css. */
.entry-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: var(--epos-bg);
}

/* The same plain card as the sign-in pages, so each skin's surface, border and corners carry over. */
.entry-card {
    width: min(100%, 31rem);
    border: 1px solid var(--epos-border);
    border-radius: var(--epos-radius-panel);
    background: var(--epos-surface);
    box-shadow: var(--epos-shadow-soft);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: center;
}

.brand-mark {
    width: 4.4rem;
    height: 4.4rem;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--epos-cyan), var(--epos-primary));
    color: var(--epos-surface);
    font-size: 2.15rem;
    font-weight: 800;
    box-shadow: 0 7px 18px rgba(3, 105, 161, 0.28);
}

.brand-mark-small {
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.15rem;
    box-shadow: none;
}

/* Image logos include their own artwork; do not frame their transparent edges. */
.brand-mark:has(img) {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.brand-mark .epos-icon {
    width: 52%;
    height: 52%;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: inherit;
    object-fit: cover;
}

.eyebrow {
    margin: 0;
    color: var(--epos-heading-accent);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.2;
    text-transform: uppercase;
}

.muted-copy {
    color: var(--epos-muted);
    line-height: 1.45;
}

/* One line of text, cut with an ellipsis where its row gives it no more room. */
.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Read by assistive technology, not shown: a table's actions heading, say. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    border: 0;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.notice-spinner {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border: 2px solid var(--epos-border-accent);
    border-top-color: var(--epos-primary);
    border-radius: 50%;
    animation: epos-spin 750ms linear infinite;
}

@keyframes epos-spin {
    to { transform: rotate(360deg); }
}

.entry-card h1,
.login-brand h1 {
    margin: 0;
    color: var(--epos-text);
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 650;
    line-height: 1.18;
    letter-spacing: -.015em;
}

.entry-card > .eyebrow {
    margin: 1rem 0 .35rem;
}

.entry-card > .muted-copy {
    margin: .45rem 0 0;
    color: var(--epos-muted);
    font-size: .84rem;
    line-height: 1.45;
}

.entry-card > .button {
    margin-top: 1.2rem;
}

/* Fields. */
.field {
    display: grid;
    gap: 0.38rem;
}

.field label,
.pin-form label {
    font-size: 0.88rem;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--epos-border);
    border-radius: var(--epos-radius-control);
    background: var(--epos-surface);
    color: var(--epos-navy);
    padding: 0.68rem 0.78rem;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

/* File pickers share the theme's controls, including the browser-rendered filename. */
input[type="file"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: calc(44px + .5rem + 2px);
    border: 1px solid var(--epos-border);
    border-radius: var(--epos-radius-control);
    background: var(--epos-surface);
    color: var(--epos-muted);
    padding: .25rem;
    font: inherit;
    font-size: .85rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    min-height: 44px;
    max-width: 100%;
    margin-inline-end: .75rem;
    padding: .5rem .85rem;
    border: 0;
    border-radius: var(--epos-radius-control);
    background: var(--epos-cyan-wash);
    color: var(--epos-primary-strong);
    font: inherit;
    font-weight: 600;
    cursor: inherit;
    transition: background 160ms ease, color 160ms ease;
}

input[type="file"]:hover:not(:disabled)::file-selector-button {
    background: var(--epos-cyan-soft);
}

input[type="file"]:disabled,
input[type="file"]:disabled::file-selector-button {
    background: var(--epos-surface-sunken);
    color: var(--epos-muted);
    cursor: not-allowed;
}

label.button:has(input[type="file"]:disabled) {
    opacity: .48;
    cursor: not-allowed;
}

.alert {
    border: 1px solid;
    border-radius: var(--epos-radius-card);
    padding: 0.8rem 0.9rem;
    margin-bottom: 1rem;
    font-weight: 650;
    line-height: 1.45;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 3px rgba(16, 42, 55, .045);
}

.alert-error {
    border-color: var(--epos-border-danger);
    background: var(--epos-danger-bg);
    color: var(--epos-danger-strong);
}

.alert-success {
    border-color: var(--epos-border-success);
    background: var(--epos-success-bg);
    color: var(--epos-success-text);
}

.alert-info {
    border-color: var(--epos-border-accent);
    background: var(--epos-cyan-wash);
    color: var(--epos-primary-strong);
}

.status-pill {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    border: 1px solid transparent;
    border-radius: var(--epos-radius-control);
    background: var(--color-muted);
    padding: .2rem .42rem;
    color: var(--epos-ink-deep);
    font-size: .7rem;
    font-weight: 650;
    line-height: 1.1;
    white-space: nowrap;
}

.status-pill .epos-icon {
    width: .85rem;
    height: .85rem;
    flex: none;
}

.status-pill.success {
    background: var(--epos-success-bg-strong);
    color: var(--epos-success-text);
}

.status-pill.warning {
    background: var(--epos-warning-bg-strong);
    color: var(--epos-warning-text);
}

.status-pill.danger {
    background: var(--epos-danger-bg-strong);
    color: var(--epos-danger-strong);
}

.empty-state {
    padding: 2rem 1rem;
    color: var(--epos-muted);
    text-align: center;
}

/* The one table (administration lists and the till's tip records): a bordered scroller, tinted uppercase header,
   one row rule, no row hover, numeric cells right-aligned. */
.table-wrap {
    position: relative;
    overflow-x: auto;
    border: 1px solid var(--epos-border-soft);
    border-radius: var(--epos-radius-control);
    background: var(--epos-surface);
    box-shadow: var(--pos-scroll-shadow, 0 0 transparent), inset 0 0 0 1px rgba(255, 255, 255, .5);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    font-variant-numeric: tabular-nums;
}

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

.data-table th, .data-table td {
    padding: .52rem .65rem;
    border-bottom: 1px solid var(--color-muted);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: var(--epos-surface-sunken);
    color: var(--epos-ink-soft);
    font-size: .73rem;
    letter-spacing: .035em;
    text-transform: uppercase;
    font-weight: 650;
}

.data-table :is(th, td).numeric {
    text-align: right;
    white-space: nowrap;
}

.data-table .table-actions {
    text-align: right;
    white-space: nowrap;
}

/* A cell's second line (an id, a provider, "This terminal"), under its main value. */
.data-table .table-secondary {
    display: block;
    margin-top: .12rem;
    color: var(--epos-muted);
}

.button-compact {
    padding: 0.45rem 0.7rem;
    font-size: 0.84rem;
}

.field small {
    color: var(--epos-muted);
    line-height: 1.35;
}

.input-suffix {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
}

.input-suffix input {
    border-radius: var(--epos-radius-control) 0 0 var(--epos-radius-control);
}

.input-suffix span {
    display: grid;
    place-items: center;
    border: 1px solid var(--epos-border);
    border-left: 0;
    border-radius: 0 var(--epos-radius-control) var(--epos-radius-control) 0;
    background: var(--epos-surface-sunken);
    padding: 0 0.75rem;
    color: var(--epos-muted);
    font-weight: 700;
}

.monospace-input,
code {
    font-family: Consolas, "Courier New", monospace;
}

/* Modal primitives: overlay, dialog shell, header, close and actions. */
.modal-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow-y: auto;
    background: rgba(9, 31, 42, 0.68);
    padding: 1rem 1rem calc(1rem + var(--touch-keyboard-inset));
}

.modal-overlay.refund-modal-overlay {
    --touch-keyboard-inset: 0px;
}

.pos-modal {
    width: min(100%, 48rem);
    max-height: calc(100vh - 2rem - var(--touch-keyboard-inset));
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--epos-radius-card);
    background: var(--epos-surface);
    box-shadow: var(--pos-scroll-shadow, 0 0 transparent), 0 24px 54px rgba(4, 24, 34, 0.35);
    padding: 1rem;
    font-weight: 400;
}

.compact-modal {
    width: min(100%, 31rem);
}

.pos-confirmation-overlay {
    z-index: 1300;
}

.pos-confirmation-dialog {
    overflow: hidden;
    border-color: var(--epos-border-warning);
    padding: 0;
}

.pos-confirmation-dialog > .modal-header {
    align-items: center;
    border-bottom-color: var(--epos-border-warning);
    background: var(--epos-warning-bg);
    margin: 0;
    padding: .9rem 1rem;
}

.pos-confirmation-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: .7rem;
}

.pos-confirmation-icon {
    width: 2.65rem;
    height: 2.65rem;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--epos-border-warning);
    border-radius: 50%;
    background: var(--epos-warning-bg-strong);
    color: var(--epos-warning-text);
}

.pos-confirmation-icon .epos-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* A declined or failed card operation: the same dialog in the danger tones. */
.pos-confirmation-dialog.danger { border-color: var(--epos-border-danger); }

.pos-confirmation-dialog.danger > .modal-header {
    border-bottom-color: var(--epos-border-danger);
    background: var(--epos-danger-bg);
}

.pos-confirmation-dialog.danger .pos-confirmation-icon {
    border-color: var(--epos-border-danger);
    background: var(--epos-danger-bg-strong);
    color: var(--epos-danger);
}

.pos-confirmation-message {
    margin: 0;
    padding: 1rem;
    color: var(--epos-text);
    font-size: 1rem;
    line-height: 1.55;
}

.pos-confirmation-content {
    padding: 0 1rem 1rem;
}

.pos-confirmation-amounts {
    display: grid;
    gap: .6rem;
    margin: 0;
}

.pos-confirmation-amounts > div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.pos-confirmation-amounts dd {
    margin: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pos-confirmation-amounts > .pos-confirmation-total {
    border-top: 1px solid var(--epos-border-soft);
    padding-top: .75rem;
    font-size: 1.2rem;
    font-weight: 650;
}

.pos-confirmation-dialog > .modal-actions {
    margin: 0;
    background: var(--epos-surface-tint);
    padding: .8rem 1rem;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--epos-border-soft);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    color: var(--epos-text);
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    min-height: 44px;
    border: 1px solid var(--epos-border);
    border-radius: var(--epos-radius-card);
    background: var(--epos-surface);
    padding: 0.5rem 0.7rem;
    color: var(--epos-navy);
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    border-top: 1px solid var(--epos-border);
    margin-top: 1rem;
    padding-top: 0.85rem;
}

.modal-header > div:first-child:not(.pos-confirmation-heading) {
    display: grid;
    min-width: 0;
    gap: .14rem;
}

.modal-header small {
    margin: 0;
    color: var(--epos-muted);
    font-size: .78rem;
    font-weight: 400;
    line-height: 1.4;
}

.pos-modal h3 {
    color: var(--epos-text);
    font-family: inherit;
    font-size: .95rem;
    font-weight: 650;
    line-height: 1.25;
}

.pos-modal h4 {
    color: var(--epos-text);
    font-family: inherit;
    font-size: .86rem;
    font-weight: 650;
    line-height: 1.25;
}

.pos-modal > .modal-header h2 {
    margin: 0;
    color: var(--epos-text);
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 650;
    line-height: 1.2;
    letter-spacing: -.01em;
}

/* List pagination footer (CataloguePagination: catalogue, reports and the till refund picker). */
.catalogue-pagination {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .85rem;
    border-top: 1px solid var(--epos-border);
    background: var(--epos-surface-tint);
    color: var(--epos-ink-slate);
    font-size: .78rem;
}

.catalogue-pagination > div {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.catalogue-pagination strong {
    color: var(--epos-navy);
    font-variant-numeric: tabular-nums;
}

/* The product name's wordmark (Shared/BrandWordmark): "FMX" heavy, "EPOS" light, the marketing site's weights. */
.brand-wordmark { font-weight: 450; }
.brand-wordmark-heavy { font-weight: 750; }
