:root {
    color-scheme: light;
    font-family: Arial, sans-serif;
    color: #1f2937;
    background: #f5f7fa;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 24px;
    color: #1f2937;
    background: #f5f7fa;
}

a { color: #1d4ed8; }
h1, h2, h3 { color: #111827; }

.global-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}
.global-nav__spacer { flex: 1; }
.global-nav form { margin: 0; }
.global-nav__user { font-weight: 700; }
.global-nav__session { display: flex; min-width: 0; align-items: center; gap: 12px; }

.restaurant-context {
    margin-bottom: 24px;
    padding: 18px 20px 0;
    overflow: hidden;
    border: 1px solid #1e3a5f;
    border-radius: 8px;
    background: #17324f;
    color: #fff;
}

.restaurant-context__eyebrow {
    margin-bottom: 4px;
    color: #bfdbfe;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.restaurant-context h1 {
    display: inline;
    margin: 0;
    color: #fff;
    font-size: 1.65rem;
}

.restaurant-context__id {
    margin-left: 10px;
    color: #bfdbfe;
}

.restaurant-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 16px -20px 0;
    padding: 0 16px;
    background: #10263d;
}

.restaurant-nav a {
    padding: 11px 12px;
    color: #dbeafe;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.restaurant-nav a:hover,
.restaurant-nav a:focus,
.restaurant-nav a[aria-current="page"] {
    color: #fff;
    border-bottom-color: #60a5fa;
}

.notice, .error {
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.notice { background: #eef7ee; border: 1px solid #b8d8b8; }
.error { background: #fee; border: 1px solid #d99; }
.muted { color: #6b7280; font-size: 0.9rem; }

.tv-health-group { margin: 28px 0; }
.tv-health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr)); gap: 16px; }
.tv-health-card { padding: 18px; border: 1px solid #d1d5db; border-left: 6px solid #6b7280; border-radius: 8px; background: #fff; }
.tv-health-card--online { border-left-color: #15803d; }
.tv-health-card--stale { border-left-color: #ca8a04; }
.tv-health-card--offline { border-left-color: #b91c1c; }
.tv-health-card--revoked { border-left-color: #6b7280; opacity: 0.82; }
.tv-health-card__summary { display: grid; gap: 8px; cursor: pointer; list-style: none; }
.tv-health-card__summary::-webkit-details-marker { display: none; }
.tv-health-card__summary-main { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tv-health-card__title { min-width: 0; color: #111827; font-size: 1.17rem; font-weight: 700; overflow-wrap: anywhere; }
.tv-health-card__heartbeat { color: #4b5563; font-size: 0.9rem; }
.tv-health-card__heartbeat strong { color: #1f2937; }
.tv-health-card__summary::after { content: "Show details"; color: #1d4ed8; font-size: 0.8rem; font-weight: 700; }
.tv-health-card[open] > .tv-health-card__summary::after { content: "Hide details"; }
.tv-health-card__body { padding-top: 4px; }
.tv-health-card__url-id { margin-top: 8px; }
.status-badge { padding: 5px 9px; border-radius: 999px; background: #e5e7eb; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.status-badge--online { color: #166534; background: #dcfce7; }
.status-badge--stale { color: #854d0e; background: #fef9c3; }
.status-badge--offline { color: #991b1b; background: #fee2e2; }
.status-badge--revoked { color: #374151; background: #e5e7eb; }
.alert-tv-card { border-left: 6px solid #6b7280; }
.alert-tv-card--online { border-left-color: #15803d; }
.alert-tv-card--stale { border-left-color: #ca8a04; }
.alert-tv-card--offline { border-left-color: #b91c1c; }
.alert-status-detail { display: inline-block; margin-left: 8px; color: #4b5563; font-size: 0.86rem; }
.tv-health-details { display: grid; grid-template-columns: 125px 1fr; gap: 7px 12px; margin: 18px 0; }
.tv-health-details dt { color: #4b5563; font-weight: 700; }
.tv-health-details dd { margin: 0; overflow-wrap: anywhere; }
.tv-health-error { color: #991b1b; }
.tv-health-warning { margin-top: 12px; padding: 7px 9px; border-radius: 4px; color: #854d0e; background: #fef9c3; font-size: 0.86rem; font-weight: 700; }
.tv-device-name-form { margin: 16px 0; }
.tv-device-name-form label { margin-top: 0; }
.tv-device-name-form > div { display: flex; gap: 8px; }
.tv-device-name-form input { min-width: 0; }

.user-assignments { display: grid; gap: 10px; max-width: 950px; }
.user-assignment-row { display: grid; grid-template-columns: minmax(260px, 1.5fr) minmax(190px, 1fr) auto; align-items: end; gap: 12px; padding: 12px; border: 1px solid #d1d5db; border-radius: 6px; background: #f9fafb; }
.user-assignment-row label { margin-top: 0; }
.user-assignment-row input, .user-assignment-row select { max-width: none; }
.user-assignment-remove { margin-bottom: 1px; }

@media (max-width: 720px) {
    .tv-health-group { margin: 20px 0; }
    .tv-health-group h2 { margin-bottom: 10px; font-size: 1.2rem; }
    .tv-health-grid { gap: 10px; }
    .tv-health-card { padding: 12px 14px; }
    .tv-health-card__summary { gap: 5px; }
    .tv-health-card__summary::after { justify-self: start; }
    .tv-health-details { grid-template-columns: 105px 1fr; gap: 7px 9px; margin: 14px 0; font-size: 0.9rem; }
    .user-assignment-row { grid-template-columns: 1fr; }
    .user-assignment-remove { justify-self: start; }
}

table {
    width: 100%;
    margin-bottom: 24px;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 9px;
    border: 1px solid #d1d5db;
    text-align: left;
    vertical-align: top;
}

th { background: #eef2f7; }

label {
    display: block;
    margin: 12px 0 4px;
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    max-width: 700px;
    padding: 8px;
    border: 1px solid #9ca3af;
    border-radius: 3px;
    font: inherit;
}

textarea { min-height: 100px; font-family: Consolas, monospace; }
input[type="checkbox"] { width: auto; }

button, .button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    margin: 0;
    border: 1px solid #1f2937;
    border-radius: 4px;
    background: #1f2937;
    color: #fff;
    font: 600 0.95rem/1.2 Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

button:hover, button:focus, .button:hover, .button:focus { background: #374151; }
.button--secondary { border-color: #6b7280; background: #fff; color: #1f2937; }
.button--secondary:hover, .button--secondary:focus { background: #f3f4f6; }
.delete-button { border-color: #b42318; background: #b42318; }
.delete-button:hover, .delete-button:focus { background: #8f1c13; }

.actions, .form-actions, .filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.actions form, .form-actions form { display: inline-flex; margin: 0; }
.form-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid #d1d5db; }

.filters {
    margin-bottom: 24px;
    padding: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}

.filters label { margin-top: 0; }
.filters__field { min-width: 220px; }

.form-panel {
    max-width: 1180px;
    margin: 0 0 24px;
    border: 1px solid #9ca3af;
    border-radius: 6px;
    background: #fff;
}

.form-panel--full-width {
    width: 100%;
    max-width: none;
}

.form-panel summary {
    padding: 13px 16px;
    background: #e8edf4;
    color: #111827;
    font-weight: 700;
    cursor: pointer;
}

.form-panel[open] summary { border-bottom: 1px solid #cbd5e1; }
.form-panel > form, .form-panel__body { padding: 4px 18px 20px; }
.admin-form { max-width: 1180px; }
.form-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 340px));
    gap: 12px;
}

@media (max-width: 720px) {
    .form-field-row { grid-template-columns: 1fr; }
}

.category-config input, .category-config select { min-width: 80px; }
.category-config input[type="checkbox"] { min-width: 0; }

.variant-list {
    display: grid;
    gap: 4px;
    white-space: nowrap;
}

.workspace-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    max-width: 900px;
}

.workspace-card {
    display: block;
    padding: 20px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #111827;
    text-decoration: none;
}

.workspace-card strong { display: block; margin-bottom: 6px; font-size: 1.15rem; }
.workspace-card span { color: #64748b; }
.provider-integration-cards { max-width: 1180px; }
.provider-summary { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 16px 0; }
.provider-summary dt { font-weight: 700; }
.provider-summary dd { margin: 0; overflow-wrap: anywhere; }
.provider-capabilities { margin: 12px 0 20px; padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 6px; background: #eff6ff; }
.provider-review-list { display: grid; gap: 14px; margin-bottom: 26px; }
.provider-review-card { position: relative; display: grid; grid-template-columns: minmax(220px, 0.75fr) minmax(480px, 1.5fr); gap: 18px; padding: 16px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; }
.provider-review-card h4 { margin: 0 0 8px; font-size: 1.1rem; }
.provider-review-card.is-pending { border-color: #2563eb; }
.provider-review-card__pending { position: absolute; z-index: 2; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: inherit; background: rgb(239 246 255 / 92%); color: #1e3a8a; }
.provider-review-card__pending[hidden] { display: none; }
.provider-review-spinner { width: 24px; height: 24px; border: 3px solid #bfdbfe; border-top-color: #2563eb; border-radius: 50%; animation: provider-review-spin 0.75s linear infinite; }
@keyframes provider-review-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .provider-review-spinner { animation-duration: 1.5s; } }
.sync-submit-button--pending { display: inline-flex; align-items: center; gap: 8px; cursor: wait; }
.sync-submit-button--pending::before { width: 0.85em; height: 0.85em; border: 2px solid rgb(255 255 255 / 45%); border-top-color: currentColor; border-radius: 50%; animation: provider-review-spin 0.75s linear infinite; content: ""; }
.sync-submit-status { margin-left: 8px; color: #475569; font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) { .sync-submit-button--pending::before { animation-duration: 1.5s; } }
.provider-price-list { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-bottom: 7px; font-weight: 700; }
.provider-price-comparison .provider-price-list { margin-bottom: 8px; }
.provider-base-price { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; font-size: 0.9rem; }
.provider-variant-mappings { display: grid; gap: 4px; font-size: 0.9rem; }
.provider-variant-mappings > div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.provider-variant-mappings__arrow { color: #64748b; }
.provider-variant-mappings__unmapped { color: #b45309; font-weight: 700; }
.provider-link-settings { display: grid; grid-template-columns: repeat(3, minmax(110px, 1fr)); gap: 8px; min-width: 390px; }
.provider-link-settings label { margin: 0; font-size: 0.82rem; }
.provider-link-settings select { min-width: 0; }
.provider-link-settings button { align-self: end; }
.provider-link-settings__status { align-self: center; grid-column: span 2; }
.provider-link-actions { margin-top: 8px; }
.provider-badge { display: block; width: fit-content; margin-top: 3px; padding: 2px 6px; border: 1px solid #9fc4e7; border-radius: 999px; background: #eaf4ff; color: #174f7c; font-size: 0.72rem; font-weight: 700; line-height: 1.2; text-transform: capitalize; white-space: nowrap; }
.provider-review-actions { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)) auto; align-items: end; gap: 10px; }
.provider-review-actions form { margin: 0; }
.provider-review-actions label { margin-top: 0; }
.provider-review-actions select { max-width: none; }
.provider-ignored-item { justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
.compact-list { margin: 0; padding-left: 18px; }
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(460px, 100%); padding: 32px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgb(15 23 42 / 12%); }
.login-button { margin-top: 12px; }
.login-divider { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; color: #6b7280; font-size: 0.8rem; text-transform: uppercase; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; border-top: 1px solid #d1d5db; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.page-heading h2 { margin-bottom: 0; }
.bulk-pricing-actions { margin-bottom: 16px; }
.bulk-pricing-table input { width: 110px; }
.bulk-variant-list { display: grid; gap: 8px; }
.bulk-variant-list label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.currency-input { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.pair-page { min-height: 100vh; display: grid; place-items: center; background: #111827; }
.pair-card { width: min(620px, calc(100% - 32px)); padding: 36px; border-radius: 12px; background: #fff; box-shadow: 0 18px 45px rgb(0 0 0 / 35%); }
.pair-card h1 { margin-top: 0; font-size: 2.2rem; }
.pair-code { width: 100%; font-size: clamp(2rem, 8vw, 4rem); font-weight: 700; letter-spacing: 0.16em; text-align: center; text-transform: uppercase; }
.pair-submit { width: 100%; min-height: 64px; margin-top: 18px; font-size: 1.35rem; }
.recovery-pairing { margin: 22px 0 14px; padding-top: 16px; border-top: 1px solid #d1d5db; }
.recovery-pairing summary { color: #1d4ed8; font-weight: 700; cursor: pointer; }
.recovery-code { margin-top: 4px; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.08em; text-align: center; text-transform: uppercase; }
.pairing-result { max-width: 860px; padding: 18px; border: 2px solid #2563eb; border-radius: 8px; background: #eff6ff; }
.pairing-result__code { margin: 10px 0; font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 800; letter-spacing: 0.18em; }
.recovery-code-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; padding: 0; list-style: none; }
.recovery-code-list code { display: block; padding: 10px; background: #fff; font-size: 1.15rem; text-align: center; }

@media (max-width: 760px) {
    body { padding: 12px; }
    .restaurant-context { padding-right: 12px; padding-left: 12px; }
    .restaurant-nav { margin-right: -12px; margin-left: -12px; padding: 0 8px; }
    table { display: block; overflow-x: auto; }
    .provider-review-card { grid-template-columns: 1fr; }
    .provider-review-actions { grid-template-columns: 1fr; }
}

.items-table .item-identity-compact { display: none !important; }

@media (max-width: 760px) and (orientation: portrait) {
    .global-nav {
        max-width: 100%;
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .global-nav__spacer { display: none; }
    .global-nav__session {
        flex: 1 0 100%;
        justify-content: space-between;
    }
    .global-nav__user {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .items-table {
        display: table;
        table-layout: auto;
        font-size: 0.85rem;
    }

    .items-table th,
    .items-table td { padding: 6px 5px; }

    .items-table .item-id-column,
    .items-table .item-order-column,
    .items-table .item-category-column,
    .items-table .item-name-column { display: none; }

    .items-table .item-identity-compact { display: table-cell !important; }
    .items-table .item-actions .actions { flex-direction: column; align-items: stretch; }
    .items-table .item-actions .button,
    .items-table .item-actions button { width: 100%; padding-right: 8px; padding-left: 8px; }
}
.sync-event-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.sync-event-summary--large {
    margin: 16px 0;
}

.sync-event-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #1f2937;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.sync-event-badge--success,
.sync-event-badge--added,
.sync-event-badge--restored,
.sync-event-badge--auto-linked {
    background: #dcfce7;
    color: #166534;
}

.sync-event-badge--changed {
    background: #dbeafe;
    color: #1e40af;
}

.sync-event-badge--ignored,
.sync-event-badge--missing,
.sync-event-badge--partial {
    background: #fef3c7;
    color: #92400e;
}

.sync-event-badge--error {
    background: #fee2e2;
    color: #991b1b;
}

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

.sync-event-row {
    padding: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}

.sync-event-row__identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.sync-change-table {
    margin-top: 8px;
}

.sync-change-table pre {
    max-width: 520px;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
}

.admin-section,
.editor-panel {
    margin: 20px 0;
    padding: 18px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
}

.editor-panel > summary { cursor: pointer; font-size: 1.15rem; font-weight: 700; }
.alert-settings-form { display: grid; gap: 18px; margin-top: 18px; }
.alert-settings-form fieldset { display: grid; gap: 12px; min-width: 0; padding: 16px; border: 1px solid #d1d5db; border-radius: 6px; }
.alert-settings-form legend { padding: 0 6px; font-weight: 700; }
.business-hours-row,
.tv-policy-row,
.recipient-card {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) repeat(3, minmax(130px, 1fr));
    gap: 12px;
    align-items: end;
}
.business-hours-row label,
.tv-policy-row label,
.recipient-card label { display: grid; gap: 5px; }
.checkbox-label { display: flex !important; align-items: center !important; gap: 8px !important; }
.checkbox-label input { width: auto; }
.alert-tv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.recipient-card { margin-top: 14px; padding: 14px; border: 1px solid #d1d5db; border-radius: 6px; background: #f9fafb; }
.recipient-card__actions { display: grid; gap: 8px; margin: 8px 0 18px; padding: 0 14px; }
.recipient-card__actions button:disabled { cursor: not-allowed; opacity: 0.55; }
.profile-notification-tests { margin-top: 22px; padding-top: 18px; border-top: 1px solid #d1d5db; }
.profile-notification-tests button:disabled { cursor: not-allowed; opacity: 0.55; }
.alert-control-page { display: grid; min-height: 100vh; place-items: center; }
.alert-control-card { width: min(680px, 100%); padding: clamp(18px, 5vw, 36px); border-radius: 12px; background: #fff; box-shadow: 0 12px 40px rgb(0 0 0 / 12%); }
.alert-incident-summary,
.alert-pause-state { display: grid; gap: 6px; margin: 18px 0; padding: 18px; border-radius: 8px; background: #eff6ff; }
.active-alerts { margin: 22px 0; }
.active-alerts h2 { margin-bottom: 12px; font-size: 1.2rem; }
.active-alert-card { display: grid; gap: 7px; margin-top: 10px; padding: 16px; border: 1px solid #fecaca; border-left: 6px solid #b91c1c; border-radius: 8px; background: #fff7f7; }
.active-alert-card > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.history-heading h3 { margin-top: 0; }
.history-heading p { margin-bottom: 0; }
.alert-control-actions { display: grid; gap: 12px; margin: 24px 0; }
.alert-control-actions button { width: 100%; min-height: 52px; font-size: 1.05rem; }
.button--danger { background: #b91c1c; }

@media (max-width: 760px) {
    .business-hours-row,
    .tv-policy-row,
    .recipient-card { grid-template-columns: 1fr; align-items: stretch; }
    .history-heading { align-items: stretch; flex-direction: column; }
    .alert-control-page { padding: 12px; }
}
