:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #13231e;
  --ink-soft: #52625d;
  --muted: #7e8c87;
  --line: #e1e7e2;
  --line-strong: #ced8d1;
  --brand: #0c9a66;
  --brand-strong: #087a50;
  --brand-soft: #e4f6ed;
  --nav: #0c211b;
  --nav-soft: #15342b;
  --amber: #d98926;
  --amber-soft: #fff2dd;
  --red: #d94a4a;
  --red-soft: #ffebeb;
  --blue: #3b79d8;
  --blue-soft: #eaf1ff;
  --shadow: 0 12px 36px rgba(21, 47, 38, 0.08);
  --shadow-sm: 0 4px 14px rgba(21, 47, 38, 0.06);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar: 246px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.hidden { display: none !important; }

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--ink-soft);
}
.boot-mark, .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #20c486, #087a50);
  box-shadow: 0 8px 20px rgba(12, 154, 102, 0.24);
  font-weight: 900;
}
.boot-mark { animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.92); opacity: 0.7; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(480px, 1.1fr) minmax(420px, 0.9fr);
  background: #f7f8f5;
}
.login-showcase {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 56px;
  color: #edf8f3;
  background:
    radial-gradient(circle at 82% 22%, rgba(50, 212, 150, 0.24), transparent 30%),
    radial-gradient(circle at 12% 78%, rgba(102, 180, 255, 0.12), transparent 30%),
    linear-gradient(145deg, #0b211b 0%, #0f362a 62%, #0d4a35 100%);
}
.login-showcase::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -180px;
  bottom: -210px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 60px rgba(255,255,255,0.025), 0 0 0 130px rgba(255,255,255,0.02);
}
.login-brand { display: flex; align-items: center; gap: 13px; font-size: 19px; font-weight: 700; letter-spacing: 0.02em; }
.login-hero { position: relative; z-index: 1; max-width: 620px; padding: 40px 0; }
.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 24px;
  border: 1px solid rgba(129, 241, 191, 0.24);
  border-radius: 999px;
  color: #9be7c3;
  background: rgba(35, 182, 119, 0.09);
  font-size: 13px;
}
.login-kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #40d996; box-shadow: 0 0 0 4px rgba(64,217,150,0.12); }
.login-hero h1 { margin: 0; max-width: 560px; font-size: clamp(36px, 4.2vw, 62px); line-height: 1.12; letter-spacing: -0.04em; }
.login-hero h1 span { color: #63dfa9; }
.login-hero p { max-width: 540px; margin: 24px 0 0; color: #a8c6ba; font-size: 16px; line-height: 1.85; }
.login-features { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.login-feature {
  display: flex; align-items: center; gap: 10px; padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 12px;
  background: rgba(255, 255, 255, 0.035); color: #cbe0d8; font-size: 13px;
}
.login-feature svg { width: 17px; height: 17px; color: #67dea9; }
.login-footer { position: relative; z-index: 1; color: #76998b; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 42px; background: #f8f9f7; }
.login-card { width: min(100%, 400px); animation: fadeUp 0.45s ease both; }
.login-card h2 { margin: 0 0 9px; font-size: 29px; letter-spacing: -0.03em; }
.login-sub { margin: 0 0 32px; color: var(--muted); font-size: 14px; }
.login-card form { display: grid; gap: 18px; }
.login-card .btn-primary { width: 100%; height: 48px; margin-top: 4px; }
.login-hint { margin-top: 24px; padding: 14px 16px; border-radius: 12px; color: #64736d; background: #eef2ee; font-size: 12px; line-height: 1.7; }
.login-hint strong { color: #33463f; font-weight: 700; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 24px 16px 18px; color: #d9e8e1; background: var(--nav); z-index: 30;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.16) transparent;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 26px; font-weight: 700; letter-spacing: 0.01em; }
.sidebar-brand small { display: block; margin-top: 3px; color: #729587; font-size: 10px; font-weight: 500; letter-spacing: 0.12em; }
.nav-section-label { padding: 6px 11px 9px; color: #66877a; font-size: 10px; font-weight: 700; letter-spacing: 0.13em; }
.nav-list { display: grid; gap: 5px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 13px;
  border: 0; border-radius: 11px; color: #9cb7ad; background: transparent; font-size: 14px; text-align: left;
  transition: 0.18s ease;
}
.nav-item:hover { color: #eef9f4; background: rgba(255,255,255,0.055); }
.nav-item.active { color: white; background: #174638; box-shadow: inset 3px 0 0 #46d69b; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item .nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 99px; color: #77c9a7; background: rgba(56,195,137,0.12); font-size: 10px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.07); }
.profile-card { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; background: rgba(255,255,255,0.035); }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #062b1f; background: #79e0b4; font-weight: 800; }
.profile-info { min-width: 0; flex: 1; }
.profile-info strong { display: block; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.profile-info span { display: block; overflow: hidden; margin-top: 3px; color: #719184; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.icon-button {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink-soft); background: var(--surface); transition: 0.18s ease;
}
.icon-button:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface-soft); }
.icon-button svg { width: 17px; height: 17px; }
.sidebar .icon-button { border: 0; color: #86a99a; background: transparent; }
.sidebar .icon-button:hover { color: white; background: rgba(255,255,255,0.07); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 82px; display: flex; align-items: center; gap: 18px;
  padding: 16px 34px; border-bottom: 1px solid rgba(217, 225, 219, 0.82);
  background: rgba(243, 245, 242, 0.9); backdrop-filter: blur(18px);
}
.mobile-menu { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font-size: 22px; letter-spacing: -0.025em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.store-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: var(--surface); font-size: 12px;
}
.store-link:hover { border-color: #b8cbc1; color: var(--brand-strong); }
.store-link svg { width: 15px; height: 15px; }
.page-content { padding: 28px 34px 48px; animation: fadeUp 0.28s ease both; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink-soft); background: white; font-size: 13px; font-weight: 600;
  transition: 0.18s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { border-color: var(--brand); color: white; background: var(--brand); box-shadow: 0 6px 16px rgba(12,154,102,0.16); }
.btn-primary:hover { border-color: var(--brand-strong); background: var(--brand-strong); }
.btn-danger { border-color: #efc4c4; color: var(--red); background: #fff8f8; }
.btn-danger:hover { border-color: #e5abab; background: var(--red-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 31px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.btn-icon { width: 32px; min-height: 32px; padding: 0; }
.btn .spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }

.field { display: grid; gap: 7px; }
.field label { color: #3b4d46; font-size: 12px; font-weight: 650; }
.field label em { color: var(--red); font-style: normal; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  color: var(--ink); outline: none; background: white; transition: 0.16s ease;
}
.field textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,154,102,0.1); }
.field input::placeholder, .field textarea::placeholder { color: #a6b0ac; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.form-grid .span-2 { grid-column: span 2; }
.input-with-icon { position: relative; }
.input-with-icon svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: #8a9893; }
.input-with-icon input { padding-left: 37px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; gap: 14px; padding: 20px 22px 16px; }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-header .right { margin-left: auto; }
.card-body { padding: 0 22px 22px; }
.panel-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-strong); font-size: 12px; font-weight: 600; }
.panel-link svg { width: 14px; height: 14px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card { position: relative; overflow: hidden; min-height: 138px; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -40px; bottom: -55px; border-radius: 50%; background: var(--metric-halo, #ebf8f2); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: 12px; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--metric-color, var(--brand)); background: var(--metric-bg, var(--brand-soft)); }
.metric-icon svg { width: 17px; height: 17px; }
.metric-value { position: relative; z-index: 1; margin-top: 18px; font-size: 28px; font-weight: 750; letter-spacing: -0.04em; }
.metric-value small { margin-left: 3px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.metric-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.trend-up { color: var(--brand); }
.trend-down { color: var(--red); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr); gap: 18px; margin-top: 18px; }
.chart-wrap { height: 258px; padding: 2px 0 0; }
.chart-wrap svg { width: 100%; height: 100%; overflow: visible; }
.chart-label { fill: #8c9994; font-size: 10px; }
.chart-grid { stroke: #edf1ee; stroke-width: 1; }
.chart-line { fill: none; stroke: url(#lineGradient); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGradient); }
.chart-dot { fill: white; stroke: var(--brand); stroke-width: 2; }
.chart-summary { display: flex; align-items: flex-end; gap: 8px; margin-right: 22px; }
.chart-summary strong { font-size: 22px; letter-spacing: -0.03em; }
.chart-summary span { padding-bottom: 3px; color: var(--muted); font-size: 11px; }
.low-stock-list { display: grid; gap: 4px; }
.low-stock-item { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid #eef2ef; }
.low-stock-item:last-child { border-bottom: 0; }
.stock-emoji { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #f3f7f4; font-size: 19px; }
.stock-info { min-width: 0; flex: 1; }
.stock-info strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stock-info span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.stock-count { text-align: right; }
.stock-count strong { color: var(--red); font-size: 14px; }
.stock-count span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.empty-compact { padding: 42px 8px; color: var(--muted); text-align: center; font-size: 12px; }

.section-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.toolbar-search { position: relative; width: min(330px, 100%); }
.toolbar-search svg { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; color: #8c9994; transform: translateY(-50%); }
.toolbar-search input { width: 100%; height: 40px; padding: 0 13px 0 38px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: white; font-size: 12px; }
.toolbar-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(12,154,102,0.08); }
.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filter-tabs { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.filter-tab { min-height: 30px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { color: var(--brand-strong); background: var(--brand-soft); }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 13px 17px; border-bottom: 1px solid var(--line); color: #75837e; background: #fafbf9; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-align: left; white-space: nowrap; }
.data-table td { padding: 15px 17px; border-bottom: 1px solid #edf1ee; color: #3d4d47; font-size: 12px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.15s ease; }
.data-table tbody tr:hover { background: #fbfcfa; }
.product-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.product-thumb { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border-radius: 11px; background: linear-gradient(145deg, #f3f8f4, #eaf3ed); font-size: 23px; }
.product-cell strong { display: block; max-width: 240px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.product-cell span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.money { color: var(--ink); font-weight: 650; }
.money-muted { color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.text-link { border: 0; color: var(--brand-strong); background: none; font-size: 11px; font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.text-danger { color: var(--red); }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { color: #07835a; background: #e7f8f0; }
.badge-warning { color: #ac690f; background: var(--amber-soft); }
.badge-danger { color: #bb3f3f; background: var(--red-soft); }
.badge-info { color: #326ac0; background: var(--blue-soft); }
.badge-muted { color: #687671; background: #eff2f0; }
.device-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.device-card { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); transition: 0.2s ease; }
.device-card:hover { transform: translateY(-2px); border-color: #c7d8cf; box-shadow: var(--shadow); }
.device-top { display: flex; align-items: flex-start; gap: 12px; }
.device-visual { width: 48px; height: 54px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px; flex: none; border: 1px solid #d7e5dd; border-radius: 12px; background: linear-gradient(160deg, #edf8f2, #dff1e8); }
.device-visual svg { width: 26px; height: 36px; color: #16865d; }
.device-title { min-width: 0; flex: 1; }
.device-title h3 { margin: 1px 0 4px; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.device-title p { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-menu { position: relative; }
.device-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; padding: 13px; border-radius: 11px; background: #f7f9f6; }
.device-meta > div span { display: block; color: var(--muted); font-size: 9px; }
.device-meta > div strong { display: block; margin-top: 4px; font-size: 12px; }
.device-actions { display: flex; gap: 7px; margin-top: 15px; }
.device-actions .btn { flex: 1; }
.device-code-pill { display: inline-flex; padding: 3px 7px; border-radius: 6px; color: #658077; background: #eef4f0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 9px; }
.low-stock-label { color: var(--red); }

.payment-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 28px; padding: 30px; border: 1px solid #cde6d9; border-radius: var(--radius); background: linear-gradient(130deg, #eaf9f1, #f8fcf9 68%, #eef9f3); }
.payment-hero::after { content: ""; position: absolute; right: -50px; bottom: -90px; width: 260px; height: 260px; border: 1px solid rgba(12,154,102,0.13); border-radius: 50%; box-shadow: 0 0 0 45px rgba(12,154,102,0.035); }
.payment-copy { position: relative; z-index: 1; }
.payment-copy h2 { margin: 16px 0 10px; font-size: 25px; letter-spacing: -0.035em; }
.payment-copy p { max-width: 600px; margin: 0; color: #5f726a; font-size: 13px; line-height: 1.8; }
.payment-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.payment-symbol { position: relative; z-index: 1; align-self: center; justify-self: center; width: 128px; height: 128px; display: grid; place-items: center; border-radius: 34px; color: white; background: linear-gradient(145deg, #24d287, #079c64); box-shadow: 0 18px 34px rgba(8,154,102,0.25); }
.payment-symbol svg { width: 60px; height: 60px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.setting-list { display: grid; gap: 0; }
.setting-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid #eef2ef; }
.setting-item:last-child { border-bottom: 0; }
.setting-index { width: 24px; height: 24px; display: grid; place-items: center; flex: none; border-radius: 8px; color: var(--brand-strong); background: var(--brand-soft); font-size: 10px; font-weight: 700; }
.setting-item strong { display: block; font-size: 12px; }
.setting-item p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.note-box { padding: 14px 15px; border: 1px solid #e5e9e6; border-radius: 11px; color: #687671; background: #f8faf8; font-size: 11px; line-height: 1.75; }
.note-box strong { color: #374942; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(4, 20, 15, 0.46); backdrop-filter: blur(5px); animation: fadeIn 0.18s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: min(680px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.55); border-radius: 20px; background: #fff; box-shadow: 0 28px 80px rgba(4, 26, 18, 0.24);
  animation: modalIn 0.22s ease both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.modal.modal-wide { width: min(980px, 100%); }
.modal.modal-narrow { width: min(460px, 100%); }
.modal-header { display: flex; align-items: flex-start; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid #edf1ee; }
.modal-header h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.modal-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-header .icon-button { margin-left: auto; flex: none; }
.modal-body { overflow: auto; padding: 22px 24px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding: 16px 24px; border-top: 1px solid #edf1ee; background: #fbfcfa; }
.modal-footer .left { margin-right: auto; color: var(--muted); font-size: 11px; }
.form-error { color: var(--red); font-size: 11px; line-height: 1.5; }
.modal-icon { width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.modal-icon svg { width: 19px; height: 19px; }

.slot-editor { width: 100%; border-collapse: collapse; }
.slot-editor th { padding: 9px 8px; color: var(--muted); font-size: 10px; text-align: left; }
.slot-editor td { padding: 6px 8px; vertical-align: middle; }
.slot-editor input, .slot-editor select { width: 100%; min-width: 70px; height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; }
.slot-editor .slot-code-input { width: 84px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.slot-editor .stock-input { width: 72px; }
.slot-editor .capacity-input { width: 72px; }
.slot-editor .product-select { min-width: 160px; }
.slot-editor .btn { min-height: 30px; width: 30px; padding: 0; }
.slot-toolbar { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }

.scan-box { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: center; }
.qr-preview { width: 220px; height: 220px; display: grid; place-items: center; padding: 16px; border: 1px dashed #b7cec2; border-radius: 18px; background: #f7fbf8; text-align: center; }
.qr-preview-inner { display: grid; justify-items: center; gap: 10px; color: #6a8379; font-size: 11px; line-height: 1.6; }
.qr-preview-inner svg { width: 48px; height: 48px; color: var(--brand); }
.scan-url { display: flex; gap: 7px; margin-top: 12px; }
.scan-url input { flex: 1; min-width: 0; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #f9faf8; color: #53645d; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.scan-note { margin-top: 18px; }

.order-detail-head { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 13px; background: #f7f9f6; }
.order-detail-head .modal-icon { width: 42px; height: 42px; }
.order-detail-head h3 { margin: 0; font-size: 14px; }
.order-detail-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.order-detail-head .badge { margin-left: auto; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.detail-item { padding: 12px 14px; border: 1px solid #edf1ee; border-radius: 10px; }
.detail-item span { display: block; color: var(--muted); font-size: 9px; }
.detail-item strong { display: block; margin-top: 5px; font-size: 12px; font-weight: 600; }
.order-items { width: 100%; border: 1px solid #edf1ee; border-radius: 12px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.order-items th { padding: 10px 12px; background: #fafbf9; color: var(--muted); font-size: 9px; text-align: left; }
.order-items td { padding: 12px; border-top: 1px solid #edf1ee; font-size: 11px; }
.order-total { display: flex; justify-content: flex-end; gap: 20px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.order-total strong { color: var(--ink); font-size: 18px; }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: grid; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 13px 15px; border: 1px solid #d8e3dc; border-radius: 12px; color: #30443c; background: #fff; box-shadow: 0 16px 38px rgba(15,44,32,0.16); font-size: 12px; animation: toastIn 0.24s ease both; }
.toast::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--brand); }
.toast.error::before { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.empty-state { display: grid; justify-items: center; padding: 60px 24px; text-align: center; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 14px; border-radius: 18px; color: #7fa495; background: #edf5f0; }
.empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { margin: 0; font-size: 14px; }
.empty-state p { margin: 7px 0 17px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.loading-block { display: grid; gap: 12px; padding: 18px 0; }
.skeleton { height: 54px; border-radius: 10px; background: linear-gradient(90deg, #f1f4f1, #f8faf8, #f1f4f1); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.error-banner { padding: 14px 16px; border: 1px solid #f0caca; border-radius: 12px; color: #a64141; background: #fff6f6; font-size: 12px; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-showcase { min-height: 290px; padding: 32px; }
  .login-hero { padding: 30px 0 0; }
  .login-hero h1 { font-size: 38px; }
  .login-hero p, .login-features, .login-footer { display: none; }
  .login-panel { padding: 36px 24px 54px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; width: 250px; transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: 18px 0 45px rgba(0,0,0,0.18); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; }
  .topbar { padding: 14px 20px; }
  .page-content { padding: 22px 20px 40px; }
  .settings-grid { grid-template-columns: 1fr; }
  .payment-hero { grid-template-columns: 1fr; }
  .payment-symbol { display: none; }
}
@media (max-width: 680px) {
  .metrics-grid, .device-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 124px; }
  .section-toolbar { flex-wrap: wrap; }
  .toolbar-search { width: 100%; }
  .toolbar-right { width: 100%; margin-left: 0; }
  .toolbar-right .btn-primary { margin-left: auto; }
  .data-table { min-width: 720px; }
  .table-card { overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .scan-box { grid-template-columns: 1fr; }
  .qr-preview { width: 100%; height: 160px; }
  .modal-backdrop { padding: 8px; align-items: end; }
  .modal { max-height: calc(100vh - 16px); border-radius: 18px 18px 12px 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-actions .store-link span { display: none; }
  .filter-tabs { overflow-x: auto; max-width: 100%; }
  .filter-tab { white-space: nowrap; }
}.qr-code { width: 164px; height: 164px; display: grid; place-items: center; padding: 7px; border-radius: 12px; background: white; box-shadow: 0 5px 18px rgba(22, 50, 37, 0.08); }
.qr-code svg { width: 100%; height: 100%; }
.scope-switcher { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 10px; }
.scope-switcher select { max-width: 150px; border: 0; outline: none; color: var(--ink); background: transparent; font-size: 11px; font-weight: 600; }
.tenant-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 11px; border: 1px solid #dce8e1; border-radius: 10px; color: #436158; background: #f3f9f5; font-size: 11px; font-weight: 600; }
.tenant-chip svg { width: 15px; height: 15px; color: var(--brand); }
.org-head { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.org-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.org-head p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.org-tabs { display: flex; gap: 5px; margin-left: auto; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.org-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 33px; padding: 0 13px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; }
.org-tab svg { width: 14px; height: 14px; }
.org-tab.active { color: var(--brand-strong); background: var(--brand-soft); }
.role-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.role-card { display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow-sm); }
.role-card-head { display: flex; align-items: flex-start; gap: 11px; }
.role-card-head > div:nth-child(2) { min-width: 0; flex: 1; }
.role-card-head h3 { margin: 1px 0 4px; font-size: 14px; }
.role-card-head p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.55; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.role-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; color: var(--muted); font-size: 9px; }
.permission-preview { display: flex; flex-wrap: wrap; gap: 5px; min-height: 52px; margin-top: 13px; align-content: flex-start; }
.permission-preview span { padding: 3px 7px; border-radius: 6px; color: #557168; background: #f1f6f3; font-size: 8px; }
.role-card .device-actions { margin-top: auto; padding-top: 14px; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.permission-group { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.permission-group-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f6f9f6; }
.permission-group-head label { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.permission-group-head span { color: var(--muted); font-size: 9px; }
.permission-items { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; padding: 12px; }
.permission-items label { display: flex; align-items: flex-start; gap: 6px; color: #53665f; font-size: 10px; line-height: 1.45; }
.permission-items input, .permission-group-head input { accent-color: var(--brand); }
.tenant-card .device-visual svg { color: #3b79d8; }
@media (max-width: 1180px) { .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .org-head { align-items: flex-start; flex-direction: column; } .org-tabs { margin-left: 0; max-width: 100%; overflow-x: auto; } }
@media (max-width: 680px) { .role-grid, .permission-groups { grid-template-columns: 1fr; } .permission-items { grid-template-columns: 1fr; } .scope-switcher { max-width: 170px; } .scope-switcher span { display: none; } }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.analytics-rank-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.breakdown-list { display: grid; gap: 15px; padding: 8px 0; }
.breakdown-row { display: grid; gap: 7px; }
.breakdown-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #52625d; font-size: 11px; }
.breakdown-label strong { color: var(--ink); }
.breakdown-track { height: 7px; overflow: hidden; border-radius: 99px; background: #edf2ee; }
.breakdown-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #5cd7a6); }
.breakdown-row small { color: var(--muted); font-size: 9px; text-align: right; }
.rank-number { width: 23px; height: 23px; display: inline-grid; place-items: center; border-radius: 7px; color: var(--brand-strong); background: var(--brand-soft); font-size: 9px; font-weight: 700; }
.order-filter-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.order-filter-form label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.order-filter-form select, .order-filter-form input { min-height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-size: 10px; outline: none; }
@media (max-width: 900px) { .analytics-rank-grid { grid-template-columns: 1fr; } }
/* Fanmaiji-style operations console enhancements */
.dashboard-metric { border-top: 3px solid transparent; }
.dashboard-metric-blue { border-top-color: #3b82f6; }
.dashboard-metric-orange { border-top-color: #ef9a2e; }
.dashboard-metric-green { border-top-color: #17a673; }
.dashboard-metric-slate { border-top-color: #60756d; }
.yesterday-sales-card { margin-top: 18px; }
.payment-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.payment-summary-block { min-height: 118px; display: grid; align-content: center; gap: 8px; padding: 18px; border-radius: 12px; color: white; }
.payment-summary-block span { font-size: 11px; opacity: .92; }
.payment-summary-block strong { font-size: 23px; letter-spacing: -.03em; }
.payment-summary-block small { font-size: 9px; opacity: .85; }
.summary-blue { background: linear-gradient(135deg, #1976e9, #3295ff); }
.summary-orange { background: linear-gradient(135deg, #e98917, #f2ad43); }
.summary-green { background: linear-gradient(135deg, #0f9f71, #52c997); }
.summary-red { background: linear-gradient(135deg, #ef626f, #fa8d97); }
.payment-breakdown-list { display: grid; gap: 16px; padding: 4px 0; }
.payment-breakdown-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: center; }
.payment-breakdown-row > div:first-child { display: flex; justify-content: space-between; gap: 12px; color: #52625d; font-size: 11px; }
.payment-breakdown-row strong { color: var(--ink); }
.payment-breakdown-row small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; text-align: right; }
.compact-table { min-width: 540px; }
.compact-table th, .compact-table td { padding: 9px 8px; }
.device-filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; margin: 20px 0 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow-sm); }
.device-filter-bar .toolbar-search { width: min(360px, 100%); }
.device-filter-bar label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.device-filter-bar select { height: 40px; min-width: 120px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font-size: 11px; outline: none; }
.device-filter-bar .toolbar-create { margin-left: auto; }
.device-table { min-width: 1120px; }
.device-code-link { padding: 0; font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
.device-detail-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.device-detail-summary > div { display: grid; gap: 6px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbf9; }
.device-detail-summary span { color: var(--muted); font-size: 9px; }
.device-detail-summary strong { font-size: 12px; }
.device-detail-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.device-detail-tabs button { flex: none; padding: 11px 15px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; }
.device-detail-tabs button.active { border-bottom-color: var(--brand); color: var(--brand-strong); }
.device-detail-panel { display: none; padding-top: 16px; }
.device-detail-panel.active { display: block; }
.device-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.panel-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-toolbar h3 { margin: 0; font-size: 14px; }
.panel-toolbar p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.panel-toolbar > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; }
.product-form { display: grid; gap: 18px; }
.form-section { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.form-section-title { margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid #edf1ee; }
.form-section-title strong { display: block; font-size: 13px; }
.form-section-title span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
@media (max-width: 1100px) {
  .payment-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .device-detail-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .payment-summary-grid { grid-template-columns: 1fr; }
  .device-filter-bar { align-items: stretch; }
  .device-filter-bar .toolbar-search, .device-filter-bar label, .device-filter-bar select { width: 100%; }
  .device-filter-bar .toolbar-create { margin-left: 0; }
  .device-detail-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-toolbar { flex-direction: column; }
}
.switch-inline { display: inline-flex; align-items: center; gap: 7px; color: #52625d; font-size: 11px; }
.switch-inline input { width: 16px; height: 16px; accent-color: var(--brand); }
.generated-code-list { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.generated-code-list span { padding: 8px 12px; border-radius: 8px; color: var(--brand-strong); background: var(--brand-soft); font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: .1em; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid #edf1ee; }
.settings-row > div { display: grid; gap: 4px; }
.settings-row strong { font-size: 12px; }
.settings-row span { color: var(--muted); font-size: 10px; }
.settings-divider { height: 1px; margin: 16px 0; background: #edf1ee; }
.settings-notice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
@media (max-width: 680px) { .settings-row { align-items: flex-start; flex-direction: column; } .settings-notice-grid { grid-template-columns: 1fr; } }

.product-filter-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto auto; gap: 10px; align-items: end; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow-sm); }
.product-filter-bar label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; }
.product-filter-bar input, .product-filter-bar select { width: 100%; min-height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; font-size: 10px; outline: none; }
.product-table { min-width: 1260px; }
@media (max-width: 1100px) { .product-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px) { .product-filter-bar { grid-template-columns: 1fr; } }

.product-image-editor { display: flex; gap: 14px; align-items: flex-start; }
.product-image-preview { width: 118px; height: 118px; flex: none; display: grid; place-items: center; overflow: hidden; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: #fafcfa; font-size: 10px; }
.product-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.product-image-controls { flex: 1; display: grid; gap: 8px; }
.product-image-controls input[type="file"] { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 10px; }
@media (max-width: 680px) { .product-image-editor { flex-direction: column; } .product-image-preview { width: 100%; height: 150px; } }

.detail-image-gallery { display: flex; flex-wrap: wrap; gap: 9px; min-height: 74px; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #fafcfa; }
.detail-image-item { position: relative; width: 72px; height: 72px; overflow: hidden; border-radius: 8px; background: white; }
.detail-image-item img { width: 100%; height: 100%; object-fit: cover; }
.detail-image-item button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0; border-radius: 50%; color: white; background: rgba(0,0,0,.65); line-height: 1; }
