/* Sufra 平台总看板 —— 黑金主题（字体与图标复用 sufra_brand） */
@font-face { font-family: "Sufra Display"; src: url("fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 300 500; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Sufra Display"; src: url("fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Sufra Display"; src: url("fonts/amiri-arabic-700-normal.woff2") format("woff2"); font-weight: 300 900; font-display: swap; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Sufra Sans"; src: url("fonts/manrope-latin-400-normal.woff2") format("woff2"); font-weight: 100 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Sufra Sans"; src: url("fonts/manrope-latin-600-normal.woff2") format("woff2"); font-weight: 500 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "Sufra Sans"; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); font-weight: 100 400; font-display: swap; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Sufra Sans"; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); font-weight: 500 900; font-display: swap; unicode-range: U+0600-06FF, U+FB50-FDFF, U+FE70-FEFC; }

:root {
    --ink: #0E1311;
    --ink-2: #141B18;
    --ink-3: #1B2420;
    --line: rgba(201, 169, 110, .16);
    --line-strong: rgba(201, 169, 110, .34);
    --gold: #C9A96E;
    --gold-light: #E2CB98;
    --cream: #F3EDE1;
    --text: #DCD7CB;
    --muted: #8E9993;
    --live: #7FCB98;
    --warn: #E3B266;
    --danger: #E37C6B;
    --display: "Sufra Display", "Songti SC", "Noto Serif SC", serif;
    --sans: "Sufra Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    --sidebar: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(90% 50% at 15% -10%, rgba(201, 169, 110, .08), transparent 60%), var(--ink); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
h1, h2 { font-family: var(--display); font-weight: 600; color: var(--cream); margin: 0; font-feature-settings: "lnum" 1; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.eyebrow { margin: 0 0 .5rem; color: var(--gold); font-size: .72rem; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; }
.error { color: var(--danger); margin: .75rem 0 0; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- 框架：侧边栏 + 顶栏 */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    padding: 1.6rem 1rem 1.2rem;
    border-inline-end: 1px solid var(--line);
    background: rgba(10, 14, 12, .6);
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 0 .6rem; }
.brand img { height: 2rem; }
.brand-word { font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: .32em; color: var(--gold); }
.brand-sub { margin: .5rem .6rem 1.8rem; color: var(--muted); font-size: .78rem; letter-spacing: .08em; }
.nav { display: flex; flex-direction: column; gap: .25rem; }
.nav a, .nav-btn {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .8rem; border-radius: .7rem;
    color: var(--text); font: inherit; font-size: .95rem;
    border: 1px solid transparent; background: none; cursor: pointer; width: 100%; text-align: start;
    transition: background .15s, color .15s, border-color .15s;
}
.nav svg, .nav-btn svg { width: 1.15rem; height: 1.15rem; color: var(--muted); }
.nav a:hover, .nav-btn:hover { background: rgba(201, 169, 110, .06); color: var(--cream); }
.nav a.is-active { background: rgba(201, 169, 110, .1); border-color: var(--line-strong); color: var(--gold-light); }
.nav a.is-active svg { color: var(--gold); }
.sidebar-foot { margin-top: auto; }

.main { min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 2rem; background: rgba(14, 19, 17, .86); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title a:hover { color: var(--gold-light); }
.topbar-title span:last-child { color: var(--cream); }
.topbar-title .sep { opacity: .5; }
.topbar-actions { display: flex; align-items: center; gap: .6rem; }
.stamp { color: var(--muted); font-size: .8rem; }

.btn-ghost {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .45rem .95rem; border: 1px solid var(--line-strong); border-radius: 999px;
    background: transparent; color: var(--text); font: inherit; font-size: .85rem; cursor: pointer;
    transition: border-color .2s, color .2s; white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-light); }
.btn-sm { padding: .3rem .75rem; font-size: .8rem; }
.btn-gold {
    display: inline-flex; justify-content: center; align-items: center; gap: .5rem;
    padding: .8rem 1.6rem; border: 0; border-radius: 999px;
    background: var(--gold); color: var(--ink); font: inherit; font-weight: 700; letter-spacing: .06em; cursor: pointer;
    transition: background .2s, opacity .2s;
}
.btn-gold:hover { background: var(--gold-light); }
.btn-gold:disabled { opacity: .4; cursor: not-allowed; }
.btn-gold.is-busy { opacity: .7; pointer-events: none; }
.link-gold { color: var(--gold); font-weight: 600; }
.link-gold:hover { color: var(--gold-light); }

/* 语言切换 */
.lang-switch { position: relative; }
.lang-switch summary {
    list-style: none; display: inline-flex; align-items: center; gap: .45rem;
    padding: .42rem .85rem; border: 1px solid var(--line-strong); border-radius: 999px;
    cursor: pointer; font-size: .85rem; color: var(--cream); user-select: none;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary svg { width: 1rem; height: 1rem; color: var(--gold); }
.lang-switch summary .caret { width: .85rem; color: var(--muted); }
.lang-switch[open] summary { border-color: var(--gold); }
.lang-menu {
    position: absolute; top: calc(100% + .4rem); inset-inline-end: 0; z-index: 30;
    min-width: 9.5rem; padding: .35rem; border-radius: .8rem;
    background: var(--ink-3); border: 1px solid var(--line-strong); box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
}
.lang-menu a { display: block; padding: .55rem .8rem; border-radius: .55rem; font-size: .9rem; }
.lang-menu a:hover { background: rgba(201, 169, 110, .08); color: var(--cream); }
.lang-menu a.is-current { color: var(--gold-light); font-weight: 700; }
.lang-menu a.is-current::after { content: "✓"; float: inline-end; color: var(--gold); }

/* ---------------------------------------------------------------- 页面 */
.page { max-width: 1320px; margin: 0 auto; padding: 2rem 2rem 4rem; }
.hero { margin-bottom: 1.6rem; }
.hero h1 { font-size: 2.5rem; line-height: 1.1; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.hero .count { font-family: var(--sans); font-size: 1rem; color: var(--gold); vertical-align: middle; margin-inline-start: .4rem; padding: .1rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .35rem; padding: 1.2rem 1.3rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 1rem; }
.kpi-link { transition: border-color .2s; }
.kpi-link:hover { border-color: var(--line-strong); }
.kpi-label { color: var(--muted); font-size: .8rem; letter-spacing: .04em; }
.kpi-value { font-family: var(--display); font-size: 2.6rem; font-weight: 600; line-height: 1; color: var(--cream); font-feature-settings: "lnum" 1, "tnum" 1; }
.kpi-value.small { font-size: 1.8rem; }
.kpi-foot { color: var(--gold); font-size: .78rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; }
.card { padding: 1.3rem 1.4rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 1rem; margin-bottom: 1rem; }
.grid-2 .card { margin-bottom: 0; }
.card.empty { text-align: center; padding: 3rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-head h2 { font-size: 1.45rem; }
.card-head .muted { font-size: .8rem; }

/* 图表 */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { fill: rgba(201, 169, 110, .38); stroke: none; }
.chart .bar:hover, .chart .bar-now { fill: var(--gold); }
.chart .tick { fill: var(--muted); stroke: none; font-size: 11px; font-family: var(--sans); }

/* 预警 */
.alerts { list-style: none; margin: 0; padding: 0; }
.alerts li { display: flex; flex-direction: column; gap: .2rem; padding: .7rem 0; padding-inline-start: .9rem; border-inline-start: 2px solid var(--warn); margin-bottom: .6rem; }
.alerts li a { color: var(--cream); font-weight: 600; }
.alerts li span { color: var(--muted); font-size: .82rem; }
.alerts li.alert-danger { border-color: var(--danger); }
.alerts li.alert-ok { border-color: var(--live); color: var(--live); }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-weight: 600; color: var(--muted); font-size: .74rem; letter-spacing: .06em; padding: .6rem .7rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: .85rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.row-link { cursor: pointer; }
.row-link:hover td { background: rgba(201, 169, 110, .04); }
.r-name { display: block; color: var(--cream); font-weight: 600; }
.r-slug { color: var(--muted); font-size: .76rem; }
.pill { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .74rem; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill-live { color: var(--live); border-color: rgba(127, 203, 152, .45); }
.pill-live::before { content: "●"; margin-inline-end: .35rem; font-size: .6rem; vertical-align: 1px; }
.pill-warn { color: var(--warn); border-color: rgba(227, 178, 102, .45); }
.pill-danger { color: var(--danger); border-color: rgba(227, 124, 107, .45); }

/* ---------------------------------------------------------------- 餐厅列表 */
.search { display: flex; align-items: center; gap: .55rem; min-width: min(100%, 360px); padding: .65rem 1rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--ink-2); }
.search svg { width: 1.05rem; height: 1.05rem; color: var(--gold); }
.search input { flex: 1; border: 0; outline: 0; background: none; color: var(--cream); font: inherit; font-size: .92rem; }
.search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 169, 110, .1); }
.r-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.r-card { display: flex; flex-direction: column; gap: .9rem; padding: 1.3rem; background: var(--ink-2); border: 1px solid var(--line); border-radius: 1.1rem; transition: border-color .2s, transform .2s, background .2s; }
.r-card:hover { border-color: var(--line-strong); background: #161E1A; transform: translateY(-2px); }
.r-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.r-card-head h2 { font-size: 1.45rem; }
.r-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: .8rem 0; border-block: 1px solid var(--line); }
.r-card-stats span { display: block; color: var(--muted); font-size: .72rem; }
.r-card-stats strong { font-family: var(--display); font-size: 1.5rem; color: var(--cream); font-feature-settings: "lnum" 1; }
.r-card-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; font-size: .86rem; }
.r-card-k { color: var(--muted); font-size: .78rem; }
.r-card-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .78rem; margin-top: auto; }
.app-chips { display: flex; gap: .3rem; }
.app-chip { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: .5rem; border: 1px solid var(--line-strong); color: var(--gold); }
.app-chip .app-icon { width: 1rem; height: 1rem; }
.empty-search { text-align: center; padding: 2rem; }

/* ---------------------------------------------------------------- 餐厅详情：标签页 */
.tabs { display: flex; gap: .3rem; margin: 0 0 1.4rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .7rem 1.1rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: .95rem; }
.tabs a:hover { color: var(--cream); }
.tabs a.is-active { color: var(--gold-light); border-color: var(--gold); }

.rank { margin: 0; padding: 0; list-style: none; counter-reset: rank; }
.rank li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--line); counter-increment: rank; }
.rank li::before { content: counter(rank); width: 1.6rem; color: var(--gold); font-family: var(--display); font-size: 1.05rem; font-feature-settings: "lnum" 1; }
.rank-name { flex: 1; color: var(--cream); }
.rank-qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.facts div { padding: 1rem 1.3rem; border: 1px solid var(--line); border-radius: 1rem; display: flex; justify-content: space-between; align-items: baseline; }
.facts span { color: var(--muted); font-size: .85rem; }
.facts strong { font-family: var(--display); font-size: 1.8rem; color: var(--cream); font-feature-settings: "lnum" 1; }

/* ---------------------------------------------------------------- 负责人与权限 */
.access-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.4fr); gap: 1rem; align-items: start; }
.access-grid .card { margin-bottom: 0; }
.manager { display: flex; align-items: flex-start; gap: 1rem; padding: .4rem 0 1rem; }
.manager + .manager { border-top: 1px solid var(--line); padding-top: 1rem; }
.avatar { flex-shrink: 0; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%; background: rgba(201, 169, 110, .12); border: 1px solid var(--line-strong); color: var(--gold-light); font-family: var(--display); font-size: 1.4rem; text-transform: uppercase; }
.manager-info { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.manager-info strong { color: var(--cream); font-size: 1.05rem; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .7rem 0 0; font-size: .82rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; color: var(--text); }

.form { display: flex; flex-direction: column; gap: .9rem; margin-top: 1rem; }
.form label { display: flex; flex-direction: column; gap: .4rem; color: var(--muted); font-size: .8rem; letter-spacing: .04em; }
.form input, .form select { padding: .75rem .9rem; border-radius: .7rem; border: 1px solid var(--line-strong); background: var(--ink); color: var(--cream); font: inherit; font-size: .95rem; outline: none; }
.form input:focus, .form select:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 169, 110, .12); }

.apps { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.app { display: flex; align-items: center; gap: 1rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--ink); transition: border-color .2s, background .2s; }
.app.is-on { border-color: var(--line-strong); background: rgba(201, 169, 110, .05); }
.app-badge { flex-shrink: 0; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: .7rem; border: 1px solid var(--line-strong); color: var(--muted); transition: color .2s, border-color .2s; }
.app.is-on .app-badge { color: var(--gold); border-color: var(--gold); }
.app-badge .app-icon { width: 1.3rem; height: 1.3rem; }
.app-text { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.app-text strong { color: var(--cream); font-weight: 600; }
.app-text small { color: var(--muted); font-size: .8rem; }
.app-text small.warn { color: var(--warn); }
.tag { font-size: .68rem; font-weight: 600; color: var(--gold); border: 1px solid var(--line-strong); border-radius: 999px; padding: .05rem .5rem; margin-inline-start: .3rem; vertical-align: 2px; }

.switch { position: relative; flex-shrink: 0; width: 3rem; height: 1.7rem; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch input:disabled { cursor: not-allowed; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: #2A3530; border: 1px solid var(--line-strong); transition: background .2s; }
.slider::after { content: ""; position: absolute; top: .17rem; inset-inline-start: .2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + .slider { background: rgba(201, 169, 110, .35); border-color: var(--gold); }
.switch input:checked + .slider::after { background: var(--gold-light); transform: translateX(1.28rem); }
[dir="rtl"] .switch input:checked + .slider::after { transform: translateX(-1.28rem); }
.switch input:disabled + .slider { opacity: .6; }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(201, 169, 110, .3); }

.save-bar { position: static; display: flex; align-items: center; justify-content: flex-end; gap: 1rem; margin-top: 1.2rem; padding: .8rem; border-radius: 999px; transition: background .2s, box-shadow .2s; }
.save-bar.is-dirty { position: sticky; bottom: 1rem; background: rgba(20, 27, 24, .95); box-shadow: 0 0 0 1px var(--line-strong), 0 16px 32px rgba(0, 0, 0, .4); }

.notice { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; margin-bottom: 1rem; border-radius: .9rem; border: 1px solid; }
.notice-ok { border-color: rgba(127, 203, 152, .45); background: rgba(127, 203, 152, .08); color: var(--live); }
.notice-error { border-color: rgba(227, 124, 107, .45); background: rgba(227, 124, 107, .08); color: var(--danger); }
.notice span { color: var(--text); font-size: .85rem; }
.credentials { margin-bottom: 1rem; padding: 1.1rem 1.3rem; border-radius: 1rem; border: 1px dashed var(--gold); background: rgba(201, 169, 110, .06); }
.credentials p { margin: 0 0 .7rem; color: var(--gold-light); font-size: .9rem; }
.credentials dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; align-items: center; }
.credentials dt { color: var(--muted); font-size: .82rem; }
.credentials dd { margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.credentials code { font-family: ui-monospace, Menlo, monospace; color: var(--cream); font-size: .95rem; }
.credentials .secret { color: var(--gold-light); font-size: 1.1rem; letter-spacing: .04em; }

/* ---------------------------------------------------------------- 登录 */
.login-lang { position: fixed; top: 1.2rem; inset-inline-end: 1.4rem; z-index: 5; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: 100%; max-width: 380px; padding: 2.6rem 2.2rem; background: var(--ink-2); border: 1px solid var(--line-strong); border-radius: 1.4rem; text-align: center; box-shadow: 0 40px 80px rgba(0, 0, 0, .45); }
.login-emblem { height: 3.6rem; margin-bottom: 1.2rem; }
.login-card h1 { font-size: 2.2rem; margin-bottom: .3rem; }
.login-card .muted { margin: 0 0 1.8rem; font-size: .88rem; }
.login-card label { display: block; text-align: start; color: var(--muted); font-size: .76rem; letter-spacing: .1em; margin-bottom: .45rem; }
.login-card input { width: 100%; padding: .85rem 1rem; border-radius: .7rem; border: 1px solid var(--line-strong); background: var(--ink); color: var(--cream); font: inherit; font-size: 1rem; outline: none; }
.login-card input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 169, 110, .14); }
.login-card .btn-gold { width: 100%; margin-top: 1.4rem; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .access-grid { grid-template-columns: 1fr; }
    .grid-2 .card, .access-grid .card { margin-bottom: 1rem; }
}
@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: .5rem; padding: .7rem 1rem; border-inline-end: 0; border-bottom: 1px solid var(--line); }
    .brand-sub, .brand-word { display: none; }
    .nav { flex-direction: row; }
    .nav a, .nav-btn { padding: .5rem .7rem; }
    .sidebar-foot { margin-top: 0; margin-inline-start: auto; }
    .topbar { padding: .7rem 1rem; }
    .stamp { display: none; }
    .page { padding: 1.4rem 1rem 3rem; }
    .hero h1 { font-size: 2rem; }
    .facts { grid-template-columns: 1fr; }
}
