/* ------------------------------------------------------------------
   Online menu — dashboard styles (administrator and restaurant owner)
------------------------------------------------------------------- */

:root {
    color-scheme: dark;
    --bg: #11131d;
    --panel: rgba(255, 255, 255, .045);
    --panel-hover: rgba(255, 255, 255, .075);
    --border: rgba(255, 255, 255, .085);
    --line: rgba(255, 255, 255, .065);
    --inner-bg: rgba(255, 255, 255, .03);
    --text: #f5f5fa;
    --muted: #9297ad;
    --accent: #b8a0ff;
    --accent-text: #241a38;
    --accent-soft: rgba(167, 139, 250, .12);
    --green: #75dfb0;
    --orange: #ffc77d;
    --red: #ff8394;
    --blue: #82caff;
    --topbar-bg: rgba(17, 19, 29, .9);
    --dialog-bg: #171925;
    --overlay-bg: rgba(5, 6, 13, .72);
    --shadow: 0 25px 90px rgba(0, 0, 0, .3);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f5fa;
    --panel: rgba(255, 255, 255, .85);
    --panel-hover: #fff;
    --border: rgba(39, 43, 65, .11);
    --line: rgba(39, 43, 65, .08);
    --inner-bg: rgba(39, 43, 65, .03);
    --text: #25283a;
    --muted: #747b91;
    --accent: #7956cf;
    --accent-text: #fff;
    --accent-soft: rgba(121, 86, 207, .1);
    --green: #17885e;
    --orange: #ad6813;
    --red: #d94d62;
    --blue: #287bb9;
    --topbar-bg: rgba(244, 245, 250, .92);
    --dialog-bg: #fff;
    --overlay-bg: rgba(35, 38, 55, .38);
    --shadow: 0 25px 75px rgba(36, 41, 64, .17);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
    min-height: 100vh;
    font-family: "Vazirmatn", Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text);
    background:
        radial-gradient(ellipse at 0% 0%, rgba(137, 101, 231, .12), transparent 35%),
        radial-gradient(ellipse at 100% 55%, rgba(83, 173, 221, .055), transparent 30%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }

/* ---------- layout ---------- */

.app { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px 48px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(22px);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 24px;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-icon {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    font-size: 22px;
    color: #261d36;
    background: linear-gradient(135deg, #d2c2ff, #a78bfa);
    overflow: hidden;
}
.brand-icon img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 15px; font-weight: 800; }
.brand-caption { color: var(--muted); font-size: 11px; }

.nav {
    display: flex;
    gap: 4px;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
    flex-shrink: 0;
    padding: 5px 13px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 13px;
    transition: .2s;
}
.nav a:hover { color: var(--text); background: var(--panel-hover); }
.nav a.active { color: var(--accent-text); background: var(--accent); font-weight: 700; }

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 28px 0 20px;
}
.page-header h1 { font-size: 22px; font-weight: 800; }
.page-header p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.section { margin-top: 30px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2 { font-size: 17px; font-weight: 800; }
.section-heading p { margin-top: 2px; color: var(--muted); font-size: 12px; }

.footer {
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ---------- controls ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: .2s;
}
.btn:hover { border-color: var(--accent); background: var(--panel-hover); }
.btn-primary { color: var(--accent-text); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { min-height: 32px; padding: 0 11px; border-radius: 10px; font-size: 12px; }
.btn-block { width: 100%; }

.theme-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    font-size: 17px;
}

.card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
    backdrop-filter: blur(18px);
}
.card + .card { margin-top: 16px; }
.card-title { margin-bottom: 14px; font-size: 15px; font-weight: 800; }

.alert { margin-bottom: 18px; padding: 11px 15px; border: 1px solid var(--border); border-radius: 13px; font-size: 13px; }
.alert-success { color: var(--green); background: rgba(117, 223, 176, .1); border-color: rgba(117, 223, 176, .25); }
.alert-error { color: var(--red); background: rgba(255, 131, 148, .1); border-color: rgba(255, 131, 148, .25); }

.empty-state { padding: 38px 16px; color: var(--muted); text-align: center; border: 1px dashed var(--border); border-radius: 18px; }

.muted { color: var(--muted); }
.ltr { direction: ltr; text-align: left; }
.inline-form { display: inline; }

/* ---------- pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 9px;
    font-size: 11px;
    white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.occupied { color: var(--red); background: rgba(255, 131, 148, .11); }
.pill.free, .pill.completed, .pill.ready { color: var(--green); background: rgba(117, 223, 176, .12); }
.pill.reserved, .pill.new { color: var(--orange); background: rgba(255, 199, 125, .12); }
.pill.preparing { color: var(--blue); background: rgba(130, 202, 255, .12); }
.pill.cancelled { color: var(--muted); background: var(--inner-bg); }

/* ---------- stats ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 13px; }
.stat { display: flex; align-items: center; gap: 14px; padding: 17px; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.stat-icon { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; font-size: 20px; background: var(--accent-soft); }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.5; }
.stat-caption { color: var(--muted); font-size: 11px; }

/* ---------- tables of data ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 12px 14px; color: var(--muted); font-size: 12px; font-weight: 600; text-align: right; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tr:hover td { background: var(--inner-bg); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .field-label { color: var(--muted); font-size: 12px; }
.input, .select, .textarea {
    width: 100%;
    min-width: 0;
    padding: 9px 12px;
    color: var(--text);
    background: var(--inner-bg);
    border: 1px solid var(--border);
    border-radius: 11px;
    outline: none;
    font-size: 13px;
}
.input, .select { min-height: 42px; }
.textarea { min-height: 84px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.select option { color: var(--text); background: var(--dialog-bg); }
.field-hint { color: var(--muted); font-size: 11px; }
.field-error { color: var(--red); font-size: 12px; }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--red); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }

.file-preview { display: flex; align-items: center; gap: 12px; }
.file-preview img { width: 58px; height: 58px; object-fit: cover; border: 1px solid var(--border); border-radius: 12px; }

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--inner-bg);
    cursor: pointer;
}
.switch-row strong { display: block; font-size: 13px; }
.switch-row span.muted { display: block; font-size: 12px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex-shrink: 0; width: 40px; height: 23px; border-radius: 99px; background: #666b7c; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .25s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(-17px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 11px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); color: var(--muted); font-size: 12px; }
.chip:hover, .chip.active { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }

/* ---------- dashboard ---------- */

.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 13px; }
.table-card { position: relative; padding: 15px; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); transition: .2s; }
.table-card::before { content: ""; position: absolute; inset: 0 0 0 auto; width: 3px; background: var(--table-color); }
.table-card[data-state="occupied"] { --table-color: var(--red); }
.table-card[data-state="free"] { --table-color: var(--green); }
.table-card[data-state="reserved"] { --table-color: var(--orange); }
.table-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.table-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.table-name { font-size: 15px; font-weight: 800; }
.table-meta { margin-top: 10px; color: var(--muted); font-size: 12px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.table-actions .input { min-height: 32px; padding: 3px 9px; font-size: 12px; }
.table-edit { display: grid; grid-template-columns: 1fr 70px auto; gap: 6px; margin-top: 12px; }

.orders-list { display: grid; gap: 12px; }
.order-card { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 17px; background: var(--panel); transition: .2s; }
.order-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.order-card-icon { display: grid; place-items: center; flex-shrink: 0; width: 46px; height: 46px; border: 1px solid var(--border); border-radius: 14px; background: var(--inner-bg); font-size: 21px; }
.order-card-main { flex: 1; min-width: 0; }
.order-card-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.order-card-heading h3 { font-size: 14px; font-weight: 800; }
.order-card-info { color: var(--muted); font-size: 12px; }
.order-card-total { font-size: 14px; font-weight: 800; white-space: nowrap; }

.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pagination a, .pagination span { min-width: 36px; padding: 4px 10px; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 13px; }
.pagination .current { color: var(--accent-text); background: var(--accent); border-color: var(--accent); }
.pagination .disabled { opacity: .4; }

/* ---------- inventory & menu management ---------- */

.inventory-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 13px; }
.inventory-item { display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 16px; background: var(--panel); }
.inventory-icon { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; background: var(--inner-bg); font-size: 20px; }
.inventory-info { flex: 1; min-width: 0; }
.inventory-name { font-size: 14px; font-weight: 700; }
.inventory-amount { color: var(--muted); font-size: 12px; }
.warning { padding: 2px 9px; border-radius: 8px; color: var(--orange); background: rgba(255, 199, 125, .12); font-size: 11px; white-space: nowrap; }
.warning.critical { color: var(--red); background: rgba(255, 131, 148, .12); }

.menu-category { margin-top: 26px; }
.menu-category-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.menu-category-head h2 { font-size: 16px; font-weight: 800; }
.menu-item { display: flex; align-items: center; gap: 13px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 15px; background: var(--panel); }
.menu-item + .menu-item { margin-top: 9px; }
.menu-item.unavailable { opacity: .55; }
.menu-thumb { display: grid; place-items: center; flex-shrink: 0; width: 52px; height: 52px; border-radius: 13px; background: var(--inner-bg); font-size: 22px; overflow: hidden; }
.menu-thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-item-info { flex: 1; min-width: 0; }
.menu-item-name { font-size: 14px; font-weight: 700; }
.menu-item-desc { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.menu-item-price { font-size: 13px; font-weight: 800; white-space: nowrap; }

/* ---------- order builder & detail ---------- */

.picker-category { margin-top: 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.picker-item { display: flex; align-items: center; gap: 11px; margin-top: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--inner-bg); }
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-name { font-size: 13px; font-weight: 700; }
.picker-item-price { color: var(--muted); font-size: 12px; }
.qty { display: flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--inner-bg); }
.qty button { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; color: var(--accent-text); background: var(--accent); font-size: 17px; line-height: 1; }
.qty input { width: 34px; border: 0; background: transparent; text-align: center; font-weight: 700; }
.order-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 15px; border-top: 1px dashed var(--border); }
.order-summary strong { color: var(--accent); font-size: 18px; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.meta-card { padding: 11px 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--inner-bg); }
.meta-label { color: var(--muted); font-size: 11px; }
.meta-value { margin-top: 2px; font-size: 13px; font-weight: 700; }
.line-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.order-total { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--border); }
.order-total strong { color: var(--accent); font-size: 18px; }

/* ---------- finance ---------- */

.tabs { display: flex; gap: 6px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 13px; background: var(--inner-bg); }
.tabs a { flex: 1; padding: 6px; border-radius: 9px; color: var(--muted); font-size: 13px; text-align: center; }
.tabs a.active { color: var(--accent-text); background: var(--accent); font-weight: 700; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.filter-bar .field { flex: 1; min-width: 150px; }

/* ---------- templates ---------- */

.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.template-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--panel); }
.template-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.template-preview { position: relative; height: 230px; overflow: hidden; background: #fff; }
.template-preview iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 1000px;
    height: 1150px;
    border: 0;
    transform: scale(.23);
    transform-origin: top left;
    pointer-events: none;
}
.template-card-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 13px; }
.template-card-name { font-size: 14px; font-weight: 700; }

.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.editor-preview { position: sticky; top: 130px; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; background: #fff; }
.editor-preview iframe { display: block; width: 100%; height: 640px; border: 0; }
.field-group + .field-group { margin-top: 24px; }
.field-group h3 { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.field-group .field + .field { margin-top: 14px; }
.icon-field { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }

/* ---------- QR ---------- */

.qr-card { display: grid; place-items: center; gap: 14px; max-width: 460px; margin: 0 auto; padding: 28px; text-align: center; }
.qr-card svg, .qr-card img { width: 100%; max-width: 340px; height: auto; border-radius: 14px; background: #fff; }
.qr-name { font-size: 18px; font-weight: 800; }
.qr-url { color: var(--muted); font-size: 12px; word-break: break-all; }

dialog { margin: auto; padding: 24px; width: min(420px, calc(100% - 32px)); color: var(--text); border: 1px solid var(--border); border-radius: 22px; background: var(--dialog-bg); box-shadow: var(--shadow); }
dialog::backdrop { background: var(--overlay-bg); backdrop-filter: blur(6px); }
dialog .qr-card { padding: 0; }

/* ---------- auth & suspended ---------- */

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 30px; border: 1px solid var(--border); border-radius: 24px; background: var(--panel); backdrop-filter: blur(18px); }
.auth-card .brand { justify-content: center; margin-bottom: 22px; }
.auth-card .field + .field { margin-top: 14px; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .editor-layout { grid-template-columns: minmax(0, 1fr); }
    .editor-preview { position: static; }
}

@media (max-width: 640px) {
    .app { padding: 0 14px 40px; }
    .topbar-inner, .nav { padding-inline: 14px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .brand-caption { display: none; }
    .page-header h1 { font-size: 19px; }
}

@media print {
    .topbar, .nav, .page-header, .footer, .no-print, .alert { display: none !important; }
    body { background: #fff; color: #000; }
    .app { padding: 0; }
    .card { border: 0; background: none; }
}
