:root {
    --bg: #fbf9ff;
    --panel: #ffffff;
    --panel-soft: #fbf9ff;
    --panel-strong: #7b63b7;
    --text: #272139;
    --muted: #766d88;
    --line: #e9e1f6;
    --accent: #9179cf;
    --accent-2: #d5b7e8;
    --accent-3: #6d559f;
    --success: #3f8265;
    --success-soft: #effaf5;
    --danger-soft: #fff8fb;
    --shadow: 0 18px 46px rgba(95, 73, 132, .10);
    --shadow-soft: 0 8px 24px rgba(95, 73, 132, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.app-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
}

.app-content {
    min-width: 0;
    width: min(1440px, 100%);
    padding: 28px 28px 44px;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 2px 0;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
}

.app-footer strong {
    color: var(--accent-3);
}

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 18px;
    background: #ffffff;
    border-right: 1px solid var(--line);
    box-shadow: 12px 0 34px rgba(95, 73, 132, .07);
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 18px;
    border-bottom: 1px solid var(--line);
}

.brand-logo {
    display: block;
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #efe8fb;
}

.brand-block div {
    display: grid;
    gap: 3px;
}

.brand-block strong {
    font-size: 15px;
}

.brand-block small,
.sidebar-note {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.app-nav {
    display: grid;
    gap: 8px;
}

.sidebar-note {
    margin-top: auto;
    padding: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.app-nav a,
.button-primary,
.button-secondary,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
}

.app-nav a {
    color: var(--muted);
    background: #fff;
    border: 1px solid var(--line);
    justify-content: flex-start;
    width: 100%;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.app-nav a.active,
.button-primary {
    color: #fff;
    background: var(--panel-strong);
    border: 1px solid var(--panel-strong);
}

.app-nav a:hover {
    color: var(--accent-3);
    background: #f8f4ff;
    border-color: #d9ccf1;
}

.app-nav-children {
    display: grid;
    gap: 5px;
    margin: -4px 0 4px 10px;
    padding-left: 10px;
    border-left: 1px solid var(--line);
}

.app-nav-children a {
    min-height: 30px;
    padding: 7px 9px;
    color: var(--muted);
    background: transparent;
    border-color: transparent;
    font-size: 12px;
    font-weight: 500;
}

.app-nav-children a:hover {
    color: var(--accent-3);
    background: var(--panel-soft);
    border-color: var(--line);
}

.app-nav-children a.active {
    color: var(--accent-3);
    background: var(--panel-soft);
    border-color: var(--line);
}

.button-secondary {
    color: var(--text);
    background: #f3eefb;
    border: 1px solid var(--line);
}

.icon-button {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    height: 34px;
    padding: 0;
    color: var(--accent-3);
    background: #f3eefb;
    border: 1px solid var(--line);
    font-size: 16px;
    line-height: 1;
}

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

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

h1 {
    font-size: 34px;
    line-height: 1.08;
}

h2 {
    font-size: 18px;
}

.filters {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, .92);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.filters label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sidebar-user {
    display: grid;
    gap: 4px;
    margin-top: auto;
    padding: 12px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.sidebar-user strong {
    font-size: 13px;
}

.sidebar-user small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.sidebar-user a {
    color: var(--accent-3);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

input,
button,
select,
textarea {
    border-radius: 7px;
    font: inherit;
}

input,
button,
select {
    height: 38px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    padding: 0 10px;
    color: var(--text);
    background: #fff;
}

textarea {
    width: 100%;
    min-height: 82px;
    padding-top: 10px;
    resize: vertical;
}

button {
    border: 0;
    padding: 0 16px;
    background: var(--panel-strong);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

button:hover {
    background: var(--accent-3);
    box-shadow: var(--shadow-soft);
}

.alert {
    background: #fff8fb;
    border: 1px solid #e9c3dd;
    border-radius: 8px;
    padding: 16px;
    display: grid;
    gap: 8px;
}

.notice {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f0e9fb;
    color: #5e478f;
    border: 1px solid #dacaf2;
    border-radius: 8px;
    font-weight: 700;
}

.alert code {
    background: rgba(0, 0, 0, .07);
    padding: 2px 5px;
    border-radius: 4px;
}

.login-page {
    min-height: 100vh;
    background: var(--bg);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    margin-bottom: 14px;
}

.login-card h1 {
    margin-bottom: 8px;
    font-size: 28px;
}

.login-card p {
    margin: 0 0 18px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.login-error {
    margin-bottom: 14px;
    padding: 11px 12px;
    color: #8d2d45;
    background: #fff8fb;
    border: 1px solid #e9c3dd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 800;
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: min(420px, 100%);
    margin-top: 14px;
    padding-top: 12px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 12px;
    font-weight: 800;
}

.login-footer strong {
    color: var(--accent-3);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.metric-card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.metric-card {
    padding: 18px;
    display: grid;
    gap: 8px;
    min-width: 0;
}

.metric-card span,
.metric-card small,
.panel-head span,
.rank-item span {
    color: var(--muted);
}

.metric-card span {
    font-size: 13px;
    font-weight: 700;
}

.metric-card strong {
    font-size: 27px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.metric-primary {
    background: #f7f2ff;
    border-color: #d9ccf1;
}

.metric-card.warn {
    background: var(--danger-soft);
    border-color: #e9c3dd;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.span-5 {
    grid-column: span 5;
}

.span-6 {
    grid-column: span 6;
}

.span-7 {
    grid-column: span 7;
}

.span-12 {
    grid-column: 1 / -1;
}

.panel {
    padding: 18px;
    min-width: 0;
}

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

.panel-head > div {
    display: grid;
    gap: 4px;
}

.panel-total {
    color: var(--accent-3);
    font-size: 14px;
    text-align: right;
}

.panel-link {
    color: var(--accent-3);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.button-refresh {
    min-height: 34px;
    height: 34px;
    padding: 0 13px;
    border-radius: 7px;
    font-size: 13px;
}

.panel-toolbar {
    margin-bottom: 12px;
}

.crud-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.crud-tabs a {
    min-height: 34px;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-weight: 700;
    font-size: 13px;
}

.crud-tabs a.active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.report-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    color: var(--accent-3);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 7px;
    box-shadow: var(--shadow-soft);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.report-tabs a.active {
    color: #fff;
    background: var(--panel-strong);
    border-color: var(--panel-strong);
}

.report-filters {
    margin-bottom: 14px;
}

.report-filters .wide-filter {
    min-width: min(340px, 100%);
}

.report-filters .wide-filter input {
    min-width: min(320px, 100%);
}

.compact-month-select {
    width: 96px;
    padding: 0 8px;
    font-size: 13px;
}

.compact-year-input {
    width: 76px;
    padding: 0 8px;
    font-weight: 800;
}

.period-inline {
    display: flex;
    gap: 6px;
}

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

.check-dropdown {
    position: relative;
    align-self: flex-end;
}

.check-dropdown-toggle {
    min-width: 132px;
}

.check-dropdown-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    display: none;
    width: 240px;
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.check-dropdown.open .check-dropdown-menu {
    display: grid;
    gap: 4px;
}

.check-dropdown-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 5px 6px;
    color: var(--text);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.check-dropdown-menu label:hover {
    background: #f7f2ff;
}

.check-dropdown-menu input {
    width: 16px;
    height: 16px;
    padding: 0;
}

.report-panel-head {
    align-items: flex-start;
}

.report-panel-head > div:first-child {
    min-width: 0;
}

.report-panel-head .export-actions {
    margin-left: auto;
}

.export-actions {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
    white-space: nowrap;
}

.export-actions a {
    width: auto !important;
    min-width: 68px;
    flex: 0 0 auto;
}

.report-table th,
.report-table td {
    white-space: nowrap;
}

.report-table th.right,
.report-number-cell {
    text-align: right;
}

.report-number-cell {
    font-variant-numeric: tabular-nums;
}

.report-col-Quantity,
.report-col-Price,
.report-col-line_amount,
.report-col-subtotal_amount,
.report-col-tax_amount,
.report-col-service_amount,
.report-col-quantity,
.report-col-ticket_count,
.report-col-total_amount {
    min-width: 96px;
    text-align: right;
}

.report-col-Price,
.report-col-line_amount,
.report-col-subtotal_amount,
.report-col-tax_amount,
.report-col-service_amount,
.report-col-total_amount {
    min-width: 128px;
}

.report-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.restaurant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.restaurant-card {
    display: grid;
    gap: 10px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    box-shadow: var(--shadow);
}

.restaurant-card span,
.restaurant-card small {
    color: var(--muted);
    font-weight: 800;
}

.restaurant-card strong {
    color: var(--ink);
    font-size: 24px;
}

.restaurant-card button {
    width: fit-content;
}

.local-login-card {
    max-width: 460px;
    margin: 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.admin-panel-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-config-nav {
    position: sticky;
    top: 18px;
    display: grid;
    gap: 8px;
    padding: 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.admin-config-nav strong {
    color: var(--ink);
    font-size: 13px;
    letter-spacing: .02em;
    font-weight: 600;
}

.admin-config-nav a,
.admin-subtabs a {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 9px 12px;
    color: var(--text);
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.admin-config-nav a.active,
.admin-subtabs a.active {
    color: #fff;
    background: var(--panel-strong);
    border-color: var(--panel-strong);
}

.admin-panel-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.master-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.master-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 8px 14px;
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.master-tabs a.active {
    color: #fff;
    background: var(--panel-strong);
    border-color: var(--panel-strong);
}

.master-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.master-section-head h2 {
    margin: 0;
    color: var(--ink);
    font-size: 28px;
    font-weight: 700;
}

.master-section-head p,
.topbar p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.master-section-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.master-filter-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(160px, 260px) minmax(130px, 220px);
    gap: 8px;
    align-items: end;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.master-filter-card label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}

.master-filter-card input,
.master-filter-card select {
    width: 100%;
}

.admin-search-panel {
    padding: 18px;
}

.license-split-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.admin-data-panel {
    padding: 18px;
}

.admin-data-panel .admin-table-space {
    margin-top: 0;
}

.admin-hidden-edit-form {
    display: none;
}

.admin-modal[hidden] {
    display: none;
}

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 32, .36);
}

.admin-modal-card {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: min(720px, calc(100vh - 48px));
    overflow: auto;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 70px rgba(28, 20, 45, .22);
}

.admin-modal-wide {
    width: min(920px, 100%);
}

.admin-modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.admin-modal-card h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--muted);
    background: var(--panel-soft);
    border: 1px solid var(--line);
}

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

.admin-modal-form footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.admin-modal-form select:disabled {
    color: #8a829b;
    background: #f1eef7;
    border-color: #ddd4ed;
    cursor: not-allowed;
}

.admin-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

.admin-form-compact {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    align-items: end;
    padding: 14px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.admin-form-spaced {
    margin-top: 14px;
}

.admin-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.admin-form input,
.admin-form select {
    width: 100%;
    min-width: 0;
}

.admin-form button {
    align-self: end;
    width: fit-content;
}

.admin-form-actions {
    display: flex;
    align-items: end;
}

.admin-form-actions button {
    width: 100%;
    white-space: nowrap;
}

.admin-table-space {
    margin-top: 16px;
}

.admin-master-table {
    min-width: 860px;
}

.admin-master-table th,
.admin-master-table td {
    vertical-align: middle;
}

.detail-row > td {
    background: #fbf9ff;
    border-top: 0;
}

.detail-edit-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 8px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.detail-edit-grid label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.detail-edit-grid input,
.detail-edit-grid select {
    width: 100%;
    min-width: 0;
}

.detail-edit-grid input:disabled,
.detail-edit-grid select:disabled {
    color: var(--text);
    opacity: 1;
    background: #fff;
    border-color: transparent;
    padding-left: 0;
}

.detail-edit-grid.is-editing input,
.detail-edit-grid.is-editing select {
    border-color: var(--line);
    padding-left: 12px;
}

.detail-section-title {
    margin: 12px 0 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.nested-list {
    display: grid;
    gap: 8px;
}

.restaurant-name-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.restaurant-name-list span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
}

.restaurant-master-table {
    min-width: 860px;
}

.admin-restaurant-edit-row > td {
    padding: 0;
    border-bottom: 0;
}

.restaurant-info-row > td {
    background: #fbf9ff;
}

.restaurant-detail-grid {
    display: grid;
    grid-template-columns: 1fr .8fr minmax(240px, 1.5fr) .6fr;
    gap: 10px;
}

.restaurant-detail-grid span {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.restaurant-detail-grid small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
}

.nested-edit-grid {
    grid-template-columns: 1fr .7fr minmax(180px, 1.2fr) minmax(180px, 1.2fr) .65fr auto;
    align-items: end;
}

.inline-delete-form {
    justify-self: end;
    margin-top: -48px;
    margin-right: 12px;
}

.access-detail-row {
    display: grid;
    grid-template-columns: 110px minmax(140px, 1fr) minmax(180px, 1.4fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

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

.icon-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.icon-actions form {
    margin: 0;
}

.icon-action {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--accent-3);
    background: #f6f2ff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.icon-action svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sticky-action-cell {
    position: sticky;
    right: 0;
    z-index: 2;
    background: #fff;
    box-shadow: -8px 0 12px rgba(255, 255, 255, .86);
    white-space: nowrap;
}

.sticky-action-cell-last {
    right: 0;
}

th.sticky-action-cell {
    z-index: 3;
}

tbody tr:hover .sticky-action-cell {
    background: #fbf9ff;
}

.icon-action.danger {
    color: #9d174d;
    background: #fff3f7;
    border-color: #f1b6c8;
}

.icon-action.copied,
.icon-copy-token.copied {
    color: #12633b;
    background: #f1fff8;
    border-color: #c8eddc;
}

.role-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-chip-row span {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 7px 12px;
    color: var(--accent-3);
    background: #f3eefb;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.admin-panel-layout .panel,
.admin-panel-content .panel {
    margin-bottom: 0;
}

.admin-panel-layout h2,
.admin-panel-content h2 {
    font-weight: 600;
}

.admin-panel-layout .panel-head span,
.admin-panel-content .panel-head span {
    font-weight: 500;
}

.admin-panel-layout table th,
.admin-panel-content table th {
    color: var(--muted);
    font-weight: 600;
    text-transform: none;
}

.admin-panel-layout table td,
.admin-panel-content table td {
    color: var(--text);
    font-weight: 400;
}

.admin-panel-layout input,
.admin-panel-layout select,
.admin-panel-content input,
.admin-panel-content select {
    font-weight: 400;
}

.admin-panel-layout button,
.admin-panel-layout .button-secondary,
.admin-panel-content button,
.admin-panel-content .button-secondary {
    font-weight: 500;
}

.notice {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid #c8eddc;
    border-radius: 8px;
    background: #f1fff8;
    color: #12633b;
    font-weight: 600;
}

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

.inline-form select {
    min-width: 120px;
}

.inline-form button {
    padding: 9px 12px;
}

.saas-admin-table input,
.saas-admin-table select,
.admin-edit-table input,
.admin-edit-table select {
    width: 100%;
    min-width: 120px;
}

.admin-edit-table {
    min-width: 1120px;
}

.admin-edit-table th:nth-child(4),
.admin-edit-table td:nth-child(4),
.admin-edit-table th:nth-child(5),
.admin-edit-table td:nth-child(5) {
    min-width: 220px;
}

.saas-admin-table th:nth-child(5),
.saas-admin-table td:nth-child(5) {
    text-align: right;
    width: 90px;
}

.table-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
}

.table-actions-inline form {
    margin: 0;
}

.button-danger {
    background: #fff3f7;
    border-color: #f1b6c8;
    color: #9d174d;
}

.token-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 122px 38px;
    gap: 8px;
    align-items: center;
}

.token-input-row button {
    width: 100%;
}

.icon-copy-token {
    width: 38px;
    min-width: 38px;
    padding: 0;
}

.icon-copy-token svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.token-input-row .button-secondary {
    white-space: nowrap;
}

.dashboard-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-settings-link {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
    color: var(--panel-strong);
    font-size: 18px;
    line-height: 1;
    text-decoration: none;
}

.dashboard-settings-link:hover {
    background: #efe9ff;
}

.report-pagination div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.report-pagination strong {
    color: var(--text);
}

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

.crud-form label {
    display: grid;
    gap: 6px;
}

.crud-form label span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.crud-form .check-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
}

.crud-form .check-field input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.table-actions {
    white-space: nowrap;
}

.table-actions a,
.link-danger {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    border: 0;
    background: transparent;
    color: var(--accent-3);
    text-decoration: none;
    font-weight: 700;
    padding: 0 5px;
}

.table-actions form {
    display: inline;
}

.link-danger {
    color: #b33b36;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.pagination a {
    color: var(--accent-3);
    text-decoration: none;
}

.panel-head span {
    font-size: 12px;
    font-weight: 700;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 18px;
    margin-bottom: 16px;
    padding: 22px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.dashboard-hero-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px;
}

.dashboard-hero-compact h1 {
    font-size: 26px;
    line-height: 1.1;
}

.dashboard-hero-compact .filters {
    flex: 0 0 auto;
}

.hero-copy {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.hero-subtitle {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.dashboard-version {
    color: #9a8caf;
    font-size: 11px;
    font-weight: 800;
}

.hero-filter {
    box-shadow: none;
    background: #fbf9ff;
}

.dashboard-filter {
    align-items: end;
}

.dashboard-filter input[type="number"],
.dashboard-filter select {
    min-width: 150px;
}

.sales-chart {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(54px, 1fr);
    align-items: end;
    gap: 10px;
    min-height: 210px;
    overflow-x: auto;
    padding: 8px 4px 2px;
}

.chart-column {
    display: grid;
    grid-template-rows: 1fr auto auto;
    gap: 7px;
    min-width: 54px;
    height: 200px;
    text-align: center;
}

.chart-bar-wrap {
    display: flex;
    align-items: end;
    justify-content: center;
    height: 125px;
    padding: 0 8px;
    background: #fbf9ff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.chart-column i {
    display: block;
    width: 100%;
    min-height: 8px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, #c7a6e5, var(--accent-3));
}

.chart-column strong {
    color: var(--text);
    font-size: 12px;
}

.chart-column span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.chart-info {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.top-item-list {
    display: grid;
    gap: 12px;
}

.top-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.top-item b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--accent-3);
    background: #f3edfb;
    font-size: 13px;
}

.top-item div {
    position: relative;
    display: grid;
    gap: 5px;
    min-width: 0;
    padding-bottom: 9px;
}

.top-item strong {
    overflow-wrap: anywhere;
}

.top-item span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.top-item i {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    height: 3px;
    border-radius: 999px;
    background: var(--accent-2);
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.quick-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 13px;
    color: var(--accent-3);
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 7px;
    box-shadow: var(--shadow-soft);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.quick-actions a:hover {
    background: #f7f2ff;
    border-color: #d9ccf1;
}

.dashboard-metrics {
    margin-bottom: 16px;
}

.dashboard-grid {
    align-items: start;
}

.dashboard-panel-equal {
    min-height: 366px;
}

.trend-list {
    display: grid;
    gap: 14px;
}

.trend-row {
    display: grid;
    grid-template-columns: minmax(104px, .75fr) minmax(160px, 1.5fr) minmax(128px, auto);
    align-items: center;
    gap: 14px;
}

.trend-row div:first-child {
    display: grid;
    gap: 2px;
}

.trend-row div:first-child span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.trend-row em {
    color: var(--text);
    font-style: normal;
    font-weight: 800;
    text-align: right;
}

.payment-list {
    gap: 14px;
}

.payment-method-list {
    display: grid;
    gap: 13px;
}

.payment-method {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 0 0 13px;
    border-bottom: 1px solid var(--line);
}

.payment-method b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: var(--accent-3);
    background: #f3edfb;
    font-size: 13px;
}

.payment-method div {
    position: relative;
    display: grid;
    gap: 4px;
    min-width: 0;
    padding-bottom: 10px;
}

.payment-method strong {
    overflow-wrap: anywhere;
}

.payment-method span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.payment-method em {
    color: var(--text);
    font-style: normal;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.payment-method i {
    position: absolute;
    left: 0;
    bottom: 0;
    display: block;
    height: 3px;
    border-radius: 999px;
    background: var(--accent-2);
}

.compact-table table,
.payment-method-table,
.top-item-table {
    min-width: 0;
}

.compact-table th,
.compact-table td {
    padding: 9px 8px;
}

.payment-method-table td:first-child {
    font-weight: 800;
}

.top-item-table td:first-child {
    color: var(--accent-3);
    font-weight: 800;
}

.top-item-table td:nth-child(2) {
    font-weight: 800;
}

.latest-payment-table {
    min-width: 680px;
}

.bar-list,
.rank-list {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 96px minmax(120px, 1fr) 150px;
    align-items: center;
    gap: 12px;
    font-size: 13px;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #eee8f8;
}

.bar-fill,
.rank-item i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

.bar-row strong {
    text-align: right;
}

.rank-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.rank-link {
    color: inherit;
    text-decoration: none;
}

.rank-link:hover strong {
    color: var(--accent);
}

.rank-item div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.rank-item strong {
    overflow-wrap: anywhere;
}

.rank-item em {
    flex: 0 0 auto;
    font-style: normal;
    font-weight: 700;
    text-align: right;
}

.rank-item i {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 2px;
    background: var(--accent-2);
}

.compact .rank-item {
    gap: 10px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tbody tr:hover td {
    background: #fbf9ff;
}

.right {
    text-align: right;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status.paid {
    background: var(--success-soft);
    color: var(--success);
}

.status.open {
    background: #f0e9fb;
    color: #5e478f;
}

.empty,
.empty-cell {
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    padding: 22px;
}

.receipt-report {
    width: min(420px, 100%);
    margin: 0 auto;
    padding: 22px 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: #1d1a24;
    font-family: "Courier New", Courier, monospace;
}

.receipt-title,
.receipt-subtitle,
.receipt-period,
.receipt-powered {
    text-align: center;
}

.receipt-title {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.receipt-subtitle {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 10px;
}

.receipt-period {
    font-size: 12px;
    line-height: 1.55;
    margin-bottom: 18px;
}

.receipt-report h2 {
    font-size: 14px;
    margin: 16px 0 8px;
    padding-top: 8px;
    border-top: 1px dashed #cfc5e6;
}

.receipt-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    min-height: 24px;
    align-items: baseline;
    font-size: 12px;
}

.receipt-row.three {
    grid-template-columns: minmax(0, 1fr) 64px auto;
}

.receipt-row span {
    overflow-wrap: anywhere;
}

.receipt-row em {
    color: #5f5473;
    font-style: normal;
    text-align: right;
}

.receipt-row strong {
    font-weight: 700;
    text-align: right;
}

.item-sales-receipt {
    width: min(460px, 100%);
}

.receipt-detail-row span {
    padding-left: 12px;
}

.receipt-table-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 64px auto;
    gap: 10px;
}

.receipt-table-head em,
.receipt-table-head strong {
    font-style: normal;
    text-align: right;
}

.receipt-void-row {
    margin-top: 3px;
}

.receipt-powered {
    margin-top: 22px;
    padding-top: 12px;
    border-top: 1px dashed #cfc5e6;
    font-size: 11px;
}

@media (max-width: 1180px) {
    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .trend-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .trend-row em {
        text-align: left;
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-content {
        padding: 18px 16px 32px;
    }

    .sidebar {
        position: static;
        height: auto;
        gap: 12px;
        padding: 14px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: 0 10px 24px rgba(95, 73, 132, .08);
    }

    .brand-block {
        padding: 0 0 12px;
    }

    .app-nav {
        display: flex;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .app-nav a {
        width: auto;
        flex: 0 0 auto;
    }

    .app-nav-children {
        display: flex;
        margin: 0;
        padding-left: 0;
        border-left: 0;
        overflow-x: auto;
    }

    .sidebar-note {
        display: none;
    }

    .topbar,
    .filters,
    .dashboard-hero {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .dashboard-hero-compact {
        justify-content: stretch;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

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

    .master-section-actions {
        justify-content: flex-start;
    }

    .master-filter-card {
        grid-template-columns: 1fr;
    }

    .license-split-grid {
        grid-template-columns: 1fr;
    }

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

    .admin-panel-layout {
        grid-template-columns: 1fr;
    }

    .admin-config-nav {
        position: static;
    }

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

    .detail-edit-grid,
    .nested-edit-grid,
    .access-detail-row,
    .restaurant-detail-grid {
        grid-template-columns: 1fr;
    }

    .inline-delete-form {
        justify-self: start;
        margin: 0;
    }

    .span-5,
    .span-6,
    .span-7,
    .span-12 {
        grid-column: auto;
    }

    .dashboard-panel-equal {
        min-height: 0;
    }

    .bar-row {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .bar-row strong {
        text-align: left;
    }

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

@media (max-width: 620px) {
    .app-content {
        padding: 14px 12px 28px;
    }

    h1 {
        font-size: 26px;
    }

    .dashboard-hero,
    .panel,
    .metric-card {
        padding: 14px;
    }

    .metric-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions a {
        justify-content: center;
        text-align: center;
    }

    .panel-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .filters label,
    .filters input,
    .filters select,
    .filters button {
        width: 100%;
    }

    .report-tabs,
    .report-pagination,
    .report-pagination div {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .export-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start;
        width: 100%;
    }

    .export-actions a {
        min-width: 64px;
    }

    .report-tabs a,
    .report-pagination a {
        justify-content: center;
    }

    .report-pagination {
        text-align: center;
    }

    .admin-form,
    .admin-form-compact {
        grid-template-columns: 1fr;
    }

    .admin-form-actions button {
        width: fit-content;
    }

    .admin-subtabs,
    .admin-config-nav {
        width: 100%;
    }

    .admin-subtabs a,
    .admin-config-nav a {
        justify-content: center;
    }

    .app-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .report-filters .wide-filter,
    .report-filters .wide-filter input {
        min-width: 0;
    }

    .compact-month-select,
    .compact-year-input {
        width: 100%;
    }

    .period-inline {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-filter input[type="number"],
    .dashboard-filter select {
        min-width: 0;
    }

    .sales-chart {
        grid-auto-columns: minmax(46px, 64px);
        min-height: 230px;
    }

    .chart-column {
        height: 220px;
    }

    .chart-bar-wrap {
        height: 145px;
        padding: 0 6px;
    }

    .payment-method {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .payment-method em {
        grid-column: 2;
        text-align: left;
    }
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .no-print {
        display: none !important;
    }

    .app-shell {
        display: block;
        min-height: auto;
    }

    .app-content {
        width: auto;
        padding: 0;
    }

    .receipt-report {
        width: 80mm;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    @page {
        size: 80mm auto;
        margin: 6mm;
    }
}
