*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f0f0eb;
  --surface: #ffffff;
  --surface2: #f5f5f0;
  --border: #c8c8be;
  --border-strong: #a0a096;
  --text: #1a1a18;
  --text-muted: #6b6b64;
  --text-light: #9a9a92;
  --green: #2d7a3a;
  --green-bg: #e8f5ea;
  --amber: #b85c00;
  --amber-bg: #fef3e2;
  --red: #c0392b;
  --red-bg: #fdecea;
  --accent: #1a3a6b;
  --accent-bg: #e8eef7;
  --radius-sm: 3px;
  --radius: 4px;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --row-h: 36px;
}

body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; font-size: 13px; line-height: 1.4; }
button, input { font: inherit; }
button:disabled { opacity: 0.55; cursor: wait; }
.hidden { display: none !important; }

.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-shell { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, 400px); gap: 28px; align-items: center; }
.auth-shell-compact { width: min(880px, 100%); }
.auth-intro { padding: 12px 0; }
.auth-intro h1 { font-size: 40px; line-height: 1.03; margin-bottom: 12px; color: var(--text); text-transform: uppercase; letter-spacing: 0; max-width: 620px; }
.auth-tagline { font-size: 16px; color: var(--text-muted); max-width: 520px; margin-bottom: 14px; }
.auth-status-strip { display: flex; flex-wrap: wrap; gap: 1px; width: fit-content; max-width: 100%; margin-bottom: 20px; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; background: var(--border); }
.auth-status-strip span { background: var(--surface); padding: 6px 10px; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.auth-benefits { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.auth-benefits li { position: relative; padding-left: 18px; font-size: 14px; font-weight: 600; color: var(--text); }
.auth-benefits li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 7px; height: 7px; border: 1px solid var(--accent); background: var(--accent-bg); }
.auth-proof-list { max-width: 620px; display: grid; gap: 1px; border: 1px solid var(--border-strong); background: var(--border); border-radius: var(--radius); overflow: hidden; }
.auth-proof-list p { margin: 0; padding: 10px 12px; background: var(--surface); color: var(--text-muted); font-size: 12px; }

.auth-product-preview { max-width: 640px; margin-bottom: 16px; background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; box-shadow: 0 10px 30px rgba(26,26,24,0.08); }
.preview-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px; background: linear-gradient(90deg, rgba(26,58,107,0.05) 1px, transparent 1px), linear-gradient(0deg, rgba(26,58,107,0.05) 1px, transparent 1px), var(--surface2); background-size: 18px 18px; border-bottom: 1px solid var(--border-strong); }
.preview-top strong { display: block; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; }
.preview-kicker { display: block; margin-bottom: 3px; color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.preview-live { background: var(--green-bg); color: var(--green); border: 1px solid #9dd4a4; border-radius: 2px; padding: 2px 7px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border-bottom: 1px solid var(--border-strong); }
.preview-stats div { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.preview-stats span { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.preview-stats strong { color: var(--text); font-family: var(--font-mono); font-size: 24px; line-height: 1; }
.preview-stats .preview-warn { color: var(--amber); }
.preview-table { display: grid; gap: 1px; background: var(--border); border-bottom: 1px solid var(--border-strong); }
.preview-row { display: grid; grid-template-columns: minmax(0,1.5fr) 88px 82px; gap: 10px; align-items: center; min-height: 34px; padding: 0 14px; background: var(--surface); color: var(--text); font-size: 12px; }
.preview-head { background: var(--surface2); color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.preview-badge { justify-self: start; border-radius: 2px; padding: 2px 7px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.preview-badge.low { color: var(--amber); background: var(--amber-bg); border: 1px solid #f0b87a; }
.preview-badge.order { color: var(--accent); background: var(--accent-bg); border: 1px solid #b8c8e0; }
.preview-badge.ok { color: var(--green); background: var(--green-bg); border: 1px solid #9dd4a4; }
.preview-audit { display: grid; gap: 1px; background: var(--border); }
.preview-audit div { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 14px; background: var(--surface); border-left: 3px solid var(--accent); }
.preview-audit span { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; }
.preview-audit strong { color: var(--text); font-size: 12px; }
.preview-audit em { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; font-style: normal; }

.auth-box { background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); padding: 40px 36px; width: 100%; max-width: 400px; }
.auth-logo { display: inline-flex; align-items: center; justify-content: center; height: 30px; padding: 0 10px; margin-bottom: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); background: var(--accent-bg); }
.auth-box h1 { font-size: 20px; font-weight: 700; line-height: 1.2; margin-bottom: 6px; text-transform: uppercase; color: var(--text); }
.auth-box h2 { font-size: 16px; font-weight: 700; line-height: 1.2; margin-bottom: 6px; text-transform: uppercase; color: var(--text); }
.auth-box p { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; }
.auth-tabs { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); margin-bottom: 20px; overflow: hidden; }
.tab-btn { flex: 1; padding: 8px; border: 0; background: var(--surface2); color: var(--text-muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s, color 0.15s; text-transform: uppercase; letter-spacing: 0.04em; }
.tab-btn:first-child { border-right: 1px solid var(--border-strong); }
.tab-btn.active { background: var(--accent); color: #fff; }

.field-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field-group input, .field-group select { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); font-size: 13px; width: 100%; text-transform: none; letter-spacing: 0; }
.field-group input:focus, .field-group select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.top-space { margin-top: 20px; }
.invite-input { text-transform: uppercase !important; letter-spacing: 0.1em !important; font-family: var(--font-mono) !important; }
.auth-error { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 12px; margin-bottom: 12px; }
.auth-btn { width: 100%; padding: 10px; background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer; margin-top: 4px; transition: opacity 0.15s; text-transform: uppercase; letter-spacing: 0.04em; }
.auth-btn:hover { opacity: 0.88; }
.auth-btn-muted { background: var(--surface2); color: var(--text); border-color: var(--border-strong); }
.divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.divider span { font-size: 11px; color: var(--text-light); text-transform: uppercase; }

/* ── PENDING SCREEN ── */
.pending-status-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--amber-bg);
  border: 1px solid #f0b87a;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.pending-icon { font-size: 24px; flex-shrink: 0; }
.pending-status-box > div { flex: 1; min-width: 0; }
.pending-status-box strong { display: block; font-size: 14px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.pending-email { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; margin-bottom: 0; }
.pending-badge { background: var(--amber-bg); border: 1px solid #f0b87a; color: var(--amber); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 2px; white-space: nowrap; }
.pending-note { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.pending-note a { color: var(--accent); text-decoration: none; }
.pending-note a:hover { text-decoration: underline; }

/* ── APP HEADER / NAV ── */
.app-header { display: flex; justify-content: space-between; align-items: center; padding: 0 24px; height: 48px; background: var(--accent); color: #fff; border-bottom: 2px solid #0f2448; position: sticky; top: 0; z-index: 100; }
.header-left, .header-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-left { gap: 16px; }
.header-logo { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; border: 1px solid rgba(255,255,255,0.35); border-radius: var(--radius-sm); padding: 3px 6px; }
.app-header h1 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #fff; white-space: nowrap; }
.workspace-label { font-size: 11px; color: rgba(255,255,255,0.66); font-family: var(--font-mono); border-left: 1px solid rgba(255,255,255,0.22); padding-left: 16px; margin-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.user-email { font-size: 11px; color: rgba(255,255,255,0.72); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.role-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 2px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.role-owner { background: rgba(255,255,255,0.2); color: #fff; }
.role-member { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.74); }
.member-row .role-owner { background: var(--accent-bg); color: var(--accent); border: 1px solid #b8c8e0; }
.member-row .role-member { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.sign-out-btn { padding: 5px 12px; background: transparent; border: 1px solid rgba(255,255,255,0.32); border-radius: var(--radius-sm); color: rgba(255,255,255,0.86); font-size: 11px; font-weight: 700; cursor: pointer; transition: background 0.15s, color 0.15s; text-transform: uppercase; letter-spacing: 0.04em; }
.sign-out-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.app-nav { display: flex; background: var(--surface); border-bottom: 2px solid var(--border-strong); padding: 0 24px; }
.nav-tab { padding: 0 16px; height: 38px; background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--text-muted); font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s, color 0.15s; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-tab:hover { color: var(--text); background: var(--surface2); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: transparent; }
.nav-spacer { flex: 1; }
.tools-dropdown-wrap { position: relative; display: flex; align-items: center; }
.tools-menu { position: absolute; top: calc(100% + 2px); right: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); min-width: 190px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); z-index: 200; overflow: hidden; }
.tools-menu-section { padding: 6px 0; }
.tools-menu-label { padding: 4px 14px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-light); }
.tools-menu-item { display: block; width: 100%; padding: 8px 14px; background: transparent; border: 0; text-align: left; font-size: 13px; color: var(--text); cursor: pointer; }
.tools-menu-item:hover { background: var(--surface2); }
.tools-menu-divider { height: 1px; background: var(--border); }

.app-main { max-width: 1400px; margin: 0 auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.card, .onboarding-card, .result-panel { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px 20px; }
.card-label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.card-hint { font-size: 11px; color: var(--text-light); margin-bottom: 12px; }
.controls-row, .history-header, .team-header, .dash-section-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-input { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--text); font-size: 13px; width: 260px; }
.search-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.controls-right { display: flex; gap: 6px; flex-wrap: wrap; }

.btn-secondary, .btn-primary, .check-btn, .copy-btn, .danger-btn, .danger-btn-sm { border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; transition: opacity 0.15s, background 0.15s, border-color 0.15s, color 0.15s; text-transform: uppercase; letter-spacing: 0.04em; }
.btn-secondary { padding: 6px 14px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface2); border-color: var(--accent); color: var(--accent); }
.btn-primary, .check-btn, .copy-btn { padding: 6px 14px; background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.btn-primary:hover, .check-btn:hover, .copy-btn:hover { opacity: 0.88; }
.check-btn { padding: 9px 24px; align-self: flex-start; }

.table-wrap { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
thead { background: var(--surface2); position: sticky; top: 0; z-index: 10; }
th { padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); white-space: nowrap; border-bottom: 2px solid var(--border-strong); }
td { padding: 0 10px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background 0.1s; }
tbody tr:hover { background: #f8f8f4; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.low-stock { background: var(--amber-bg); }
tbody tr.low-stock:hover { background: #fdefd0; }
tbody tr.row-focus { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-bg); }
.cell-input { background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 4px 6px; color: var(--text); font-size: 12px; width: 100%; height: 26px; }
.cell-input:focus { outline: 0; border-color: var(--accent); background: #fff; }
.cell-input:disabled { opacity: 0.48; cursor: not-allowed; }
.qty-input, .cost-input { width: 64px; min-width: unset; font-family: var(--font-mono); text-align: right; }
.qty-checkout-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.checkout-toggle { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-family: var(--font-mono); font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1; }
.checkout-toggle:hover { background: var(--amber-bg); border-color: #f0b87a; color: var(--amber); }
.checkout-popover { position: absolute; top: calc(100% + 6px); left: 0; width: 220px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 26px rgba(0,0,0,0.16); padding: 10px; z-index: 300; }
.checkout-popover::before { content: ""; position: absolute; top: -6px; left: 72px; width: 10px; height: 10px; background: var(--surface); border-left: 1px solid var(--border-strong); border-top: 1px solid var(--border-strong); transform: rotate(45deg); }
.checkout-popover-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.checkout-popover-head span { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.checkout-popover-head strong { color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.checkout-quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin-bottom: 8px; }
.checkout-quick-grid button, .checkout-custom button { background: var(--surface2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; height: 30px; }
.checkout-quick-grid button:hover, .checkout-custom button:hover { background: var(--amber-bg); border-color: #f0b87a; color: var(--amber); }
.checkout-custom { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; }
.checkout-custom input { min-width: 0; height: 30px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 5px 7px; font-family: var(--font-mono); font-size: 12px; }
.checkout-custom input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.checkout-custom button { padding: 0 9px; }
.cost-wrap { display: flex; align-items: center; gap: 2px; }
.dollar { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }

.status-badge, .order-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 2px; white-space: nowrap; text-transform: uppercase; }
.status-ok { background: var(--green-bg); color: var(--green); border: 1px solid #9dd4a4; }
.status-low { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0b87a; }
.order-pending { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0b87a; }
.order-received { background: var(--green-bg); color: var(--green); border: 1px solid #9dd4a4; }
.order-none { background: var(--surface2); color: var(--text-light); border: 1px solid var(--border); }
.order-status-cell { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.mark-received-btn { padding: 3px 8px; background: var(--green-bg); border: 1px solid #9dd4a4; border-radius: var(--radius-sm); color: var(--green); font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; }
.mark-received-btn:hover { background: #d0edcf; }
.actions-cell { display: flex; align-items: center; gap: 4px; }
.action-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.03em; }
.action-btn:hover { background: var(--surface); border-color: var(--accent); color: var(--accent); }
.action-btn.buylist-btn:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-bg); }
.action-btn.delete-action:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

.empty-state { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); }
.empty-state.bordered { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); }

.result-message { font-size: 16px; font-weight: 700; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.02em; }
.result-ok { color: var(--green); }
.result-low { color: var(--amber); }
.result-details { color: var(--text-muted); font-size: 12px; margin-bottom: 16px; }
#low-stock-list ul { list-style: none; display: flex; flex-direction: column; gap: 1px; }
#low-stock-list li { background: var(--amber-bg); border: 1px solid #f0b87a; border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.item-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.item-need { font-size: 11px; color: var(--amber); font-family: var(--font-mono); font-weight: 700; }
.item-meta { font-size: 11px; color: var(--text-muted); }
.item-cost { font-size: 11px; color: var(--green); font-family: var(--font-mono); font-weight: 700; }
.total-cost-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 12px 14px; background: var(--accent-bg); border: 1px solid #b8c8e0; border-radius: var(--radius-sm); font-size: 13px; }
.total-cost-row span { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.total-cost-row strong { color: var(--accent); font-family: var(--font-mono); font-size: 16px; }
.email-status { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; }
.email-status.success { background: var(--green-bg); color: var(--green); border: 1px solid #9dd4a4; }
.email-status.error { background: var(--red-bg); color: var(--red); border: 1px solid #e8a09a; }
.email-status.warn { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0b87a; }
.email-status.sending { background: var(--accent-bg); color: var(--accent); border: 1px solid #b8c8e0; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1px; background: var(--border-strong); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.stat-card { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-card-warn .stat-value { color: var(--amber); }
.stat-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.stat-value { font-size: 24px; font-weight: 700; font-family: var(--font-mono); color: var(--text); line-height: 1; }
.dash-section { display: flex; flex-direction: column; gap: 10px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); }
.section-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dash-low-list, .history-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.dash-low-item { background: var(--surface); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.dash-low-item:hover { background: var(--surface2); }
.dash-item-left { display: flex; flex-direction: column; gap: 2px; }
.dash-item-left strong { font-size: 13px; font-weight: 600; }
.dash-item-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.dash-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dash-item-need { font-size: 11px; color: var(--amber); font-family: var(--font-mono); font-weight: 700; }
.dash-item-cost { font-size: 11px; color: var(--green); font-family: var(--font-mono); font-weight: 700; }
.dash-all-ok { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px; color: var(--green); background: var(--green-bg); border: 1px solid #9dd4a4; border-radius: var(--radius); }
.dash-ok-icon { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }
.dash-all-ok p { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

.history-card { background: var(--surface); padding: 14px 18px; }
.history-card:hover { background: var(--surface2); }
.history-card-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.history-card-left { display: flex; flex-direction: column; gap: 2px; }
.history-part-name { font-size: 14px; font-weight: 700; }
.history-date { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.history-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.history-stat { display: flex; flex-direction: column; gap: 2px; }
.history-stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.history-stat-value { font-size: 12px; color: var(--text); font-family: var(--font-mono); overflow-wrap: anywhere; }
.history-stat-value.highlight { color: var(--accent); font-weight: 700; }

.activity-header, .activity-panel-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.activity-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; }
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.activity-panel { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.activity-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.activity-group { background: var(--surface2); color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; padding: 7px 12px; }
.activity-item { background: var(--surface); display: grid; grid-template-columns: 74px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 11px 12px; border-left: 3px solid var(--border-strong); }
.activity-item:hover { background: var(--surface2); }
.activity-order { border-left-color: var(--accent); }
.activity-alert { border-left-color: var(--amber); }
.activity-team { border-left-color: var(--green); }
.activity-edit { border-left-color: var(--border-strong); }
.activity-time { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.activity-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.activity-summary { font-size: 13px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.activity-meta { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); overflow-wrap: anywhere; }
.activity-jump { padding: 4px 9px; background: var(--surface2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; }
.activity-jump:hover { color: var(--accent); border-color: var(--accent); background: #fff; }
.audit-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.audit-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.audit-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.audit-action { display: block; font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; }
.audit-target { display: block; font-size: 13px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.audit-stamp, .audit-user { color: var(--text-muted); font-family: var(--font-mono); font-size: 10px; }
.audit-user { margin-bottom: 10px; overflow-wrap: anywhere; }
.audit-changes { display: flex; flex-direction: column; gap: 4px; }
.audit-change { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--border); padding-top: 4px; font-size: 11px; }
.audit-change span { color: var(--text-muted); }
.audit-change strong { color: var(--text); font-family: var(--font-mono); font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-box { background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); padding: 24px; max-width: 420px; width: 100%; box-shadow: 0 8px 32px rgba(0,0,0,0.16); }
.modal-box h2 { font-size: 14px; font-weight: 700; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.04em; }
.modal-content { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.modal-meta { font-size: 12px; color: var(--text-muted); }
.modal-meta strong { color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.order-helper { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--border); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.order-helper div { background: var(--surface); padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.order-helper span { color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.order-helper strong { color: var(--text); font-family: var(--font-mono); font-size: 18px; }
.order-helper .order-helper-warn { color: var(--amber); }
.order-suggestions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.suggestion-btn { background: var(--surface2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; gap: 8px; cursor: pointer; color: var(--text); text-align: left; }
.suggestion-btn:hover { border-color: var(--accent); background: var(--accent-bg); }
.suggestion-btn:disabled { cursor: not-allowed; opacity: 0.5; }
.suggestion-btn span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.suggestion-btn strong { color: var(--accent); font-family: var(--font-mono); font-size: 18px; }

.invite-code-box { display: flex; align-items: center; gap: 12px; background: var(--surface2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 12px 16px; }
.invite-code-text { font-family: var(--font-mono); font-size: 20px; font-weight: 700; letter-spacing: 0.2em; color: var(--accent); flex: 1; }
.members-list { display: flex; flex-direction: column; }
.member-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.member-row:last-child { border-bottom: 0; padding-bottom: 0; }
.member-info { display: flex; flex-direction: column; gap: 2px; }
.member-email { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.member-joined { font-size: 11px; color: var(--text-muted); }
.member-right { display: flex; align-items: center; gap: 8px; }
.danger-card { border-color: #e8a09a; }
.danger-label { color: var(--red); }
.danger-btn { padding: 8px 16px; background: var(--red-bg); border: 1px solid #e8a09a; color: var(--red); }
.danger-btn:hover { background: #f8d8d4; }
.danger-btn-sm { padding: 4px 10px; background: var(--red-bg); border: 1px solid #e8a09a; color: var(--red); font-size: 11px; }
.danger-btn-sm:hover { background: #f8d8d4; }

.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 700; font-size: 12px; opacity: 0; transform: translateY(8px); transition: all 0.25s; pointer-events: none; z-index: 9999; text-transform: uppercase; letter-spacing: 0.04em; }
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.toast-undo-btn { margin-left: 12px; padding: 3px 10px; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); border-radius: var(--radius-sm); color: #fff; font-size: 11px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle; }
.toast-undo-btn:hover { background: rgba(255,255,255,0.35); }
.toast.toast-ok { background: var(--green); }
.toast.toast-warn { background: var(--amber); }
.toast.toast-err { background: var(--red); }
.sync-indicator { font-size: 11px; color: rgba(255,255,255,0.66); font-family: var(--font-mono); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

.onboarding-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.onboarding-progress { font-family: var(--font-mono); font-size: 13px; font-weight: 700; color: var(--accent); background: var(--accent-bg); border: 1px solid #b8c8e0; border-radius: var(--radius-sm); padding: 4px 12px; }
.onboarding-steps { display: flex; flex-direction: column; gap: 1px; }
.onboarding-step { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); transition: opacity 0.3s; }
.onboarding-step:last-child { border-bottom: 0; }
.step-check { font-size: 13px; flex-shrink: 0; margin-top: 1px; color: var(--text-muted); transition: color 0.2s; font-family: var(--font-mono); font-weight: 700; }
.step-body { display: flex; flex-direction: column; gap: 2px; }
.step-title { font-size: 13px; font-weight: 600; color: var(--text); }
.step-hint { font-size: 11px; color: var(--text-muted); }
.onboarding-complete { display: flex; align-items: center; gap: 14px; color: var(--green); font-size: 13px; }
.onboarding-complete span { font-family: var(--font-mono); font-weight: 700; border: 1px solid #9dd4a4; border-radius: var(--radius-sm); padding: 4px 6px; background: var(--green-bg); }
.onboarding-complete strong { display: block; font-size: 14px; margin-bottom: 2px; }
.onboarding-complete p { color: var(--text-muted); font-size: 12px; }

/* ── ADMIN PANEL ── */
.admin-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.admin-stats { display: flex; gap: 1px; background: var(--border-strong); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.admin-stat { background: var(--surface); padding: 10px 18px; display: flex; flex-direction: column; gap: 3px; min-width: 70px; text-align: center; }
.admin-stat span { font-size: 22px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.admin-stat label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.admin-stat-warn span { color: var(--amber); }
.admin-stat-ok span { color: var(--green); }

.admin-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.admin-workspace-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }

.admin-workspace-card { background: var(--surface); padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-workspace-card:hover { background: var(--surface2); }
.admin-card-pending { border-left: 3px solid var(--amber); }
.admin-card-granted { border-left: 3px solid var(--green); }

.admin-card-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.admin-card-name { font-size: 15px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.admin-card-meta { display: flex; flex-wrap: wrap; gap: 12px; }
.admin-card-meta span { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); overflow-wrap: anywhere; }

.admin-card-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }

.admin-access-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 10px; border-radius: 2px; white-space: nowrap; }
.admin-badge-pending { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0b87a; }
.admin-badge-granted { background: var(--green-bg); color: var(--green); border: 1px solid #9dd4a4; }

.admin-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; cursor: pointer; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--border-strong); background: var(--surface2); color: var(--text); transition: all 0.15s; white-space: nowrap; }
.admin-btn-grant-free { background: var(--green-bg); border-color: #9dd4a4; color: var(--green); }
.admin-btn-grant-free:hover { background: #d0edcf; }
.admin-btn-grant-paid { background: var(--accent-bg); border-color: #b8c8e0; color: var(--accent); }
.admin-btn-grant-paid:hover { background: #d4dff0; }
.admin-btn-revoke { background: var(--red-bg); border-color: #e8a09a; color: var(--red); }
.admin-btn-revoke:hover { background: #f8d8d4; }
.admin-btn-toggle-type:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ── CART ── */
.cart-fab { position: fixed; bottom: 28px; left: 28px; width: 56px; height: 56px; background: var(--accent); border: none; border-radius: 50%; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(26,58,107,0.35); z-index: 800; transition: opacity 0.2s, transform 0.2s; flex-direction: column; gap: 0; }
.cart-fab:hover { opacity: 0.88; transform: scale(1.06); }
.cart-fab-icon { font-size: 22px; line-height: 1; }
.cart-fab-count { font-family: var(--font-mono); font-size: 10px; font-weight: 700; line-height: 1; }
.cart-panel { position: fixed; bottom: 0; left: 0; width: 340px; max-height: 70vh; background: var(--surface); border: 2px solid var(--border-strong); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,0.14); z-index: 900; display: flex; flex-direction: column; overflow: hidden; }
.cart-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 18px 10px; border-bottom: 1px solid var(--border); }
.cart-close-btn { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); }
.cart-close-btn:hover { background: var(--surface2); color: var(--text); }
.cart-list { flex: 1; overflow-y: auto; padding: 8px 0; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--border); }
.cart-item:last-child { border-bottom: none; }
.cart-item-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-qty { display: flex; align-items: center; gap: 6px; }
.cart-qty-btn { width: 24px; height: 24px; background: var(--surface2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-family: var(--font-mono); }
.cart-qty-btn:hover { background: var(--amber-bg); border-color: #f0b87a; color: var(--amber); }
.cart-qty-num { font-family: var(--font-mono); font-size: 13px; font-weight: 700; width: 28px; text-align: center; color: var(--text); }
.cart-remove-btn { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 13px; padding: 2px 4px; border-radius: var(--radius-sm); }
.cart-remove-btn:hover { color: var(--red); background: var(--red-bg); }
.cart-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
.cart-footer .btn-primary { flex: 1; }

/* ── SCANNER ── */
.scanner-modal-box { max-width: 480px; padding: 20px; }
.scanner-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.scanner-header h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.scanner-viewport { position: relative; width: 100%; aspect-ratio: 4/3; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-strong); }
.scanner-viewport video, .scanner-viewport canvas { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; object-fit: cover; }
.scanner-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; pointer-events: none; }
.scanner-crosshair { width: 72%; height: 28%; border: 2px solid rgba(255,255,255,0.7); border-radius: 4px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.38); position: relative; }
.scanner-crosshair::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: rgba(26,58,107,0.7); transform: translateY(-50%); }
.scanner-status { margin-top: 10px; font-size: 12px; color: var(--text-muted); text-align: center; font-family: var(--font-mono); min-height: 18px; }
.scanner-result { margin-top: 8px; padding: 10px 14px; background: var(--green-bg); border: 1px solid #9dd4a4; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; color: var(--green); text-align: center; font-family: var(--font-mono); }

/* ── MOBILE CARD VIEW ── */
.card-view { display: none; flex-direction: column; gap: 8px; }
.card-empty { padding: 40px; text-align: center; color: var(--text-muted); font-size: 13px; }
.part-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.part-card-low { border-left: 3px solid var(--amber); }
.part-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.part-card-name-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.part-card-name { font-size: 15px; font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.part-card-supplier { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.part-card-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.part-card-stat { background: var(--surface2); padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.part-card-stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.part-card-stat-value { font-size: 18px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.part-card-stat-warn { color: var(--amber); }
.part-card-order-badge { display: flex; }
.part-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.part-card-btn { flex: 1; padding: 10px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; cursor: pointer; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--border-strong); background: var(--surface2); color: var(--text); min-width: 80px; }
.part-card-checkout { background: var(--accent); border-color: var(--accent); color: #fff; }
.part-card-checkout:hover { opacity: 0.88; }
.part-card-buylist { background: var(--amber-bg); border-color: #f0b87a; color: var(--amber); }
.part-card-buylist:hover { background: #fdefd0; }
.part-card-edit:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.part-card-save { background: var(--accent); border-color: var(--accent); color: #fff; }
.part-card-save:hover { opacity: 0.88; }
.part-card-delete { background: var(--red-bg); border-color: #e8a09a; color: var(--red); }
.part-card-delete:hover { background: #f8d8d4; }
.part-card-edit-panel { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.part-card-edit-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.part-card-edit-label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.part-card-input { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 8px; color: var(--text); font-size: 13px; width: 100%; }
.part-card-input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.part-card-edit-actions { display: flex; gap: 6px; }

/* ── RESPONSIVE ── */
@media (max-width: 760px) {
  .auth-shell { grid-template-columns: 1fr; gap: 18px; }
  .auth-intro h1 { font-size: 32px; }
  .auth-tagline { font-size: 14px; }
  .auth-product-preview { max-width: 100%; }
  .preview-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .preview-row { grid-template-columns: minmax(0,1fr) 68px 70px; padding: 0 10px; }
  .preview-audit div { grid-template-columns: 1fr; gap: 3px; }
  .app-main { padding: 12px; gap: 12px; }
  .app-header { height: auto; min-height: 48px; padding: 8px 12px; align-items: flex-start; gap: 8px; }
  .header-left, .header-right { gap: 8px; flex-wrap: wrap; }
  .app-header h1 { font-size: 12px; }
  .workspace-label, .user-email { display: none; }
  .app-nav { padding: 0 12px; overflow-x: auto; }
  .nav-tab { padding: 0 12px; font-size: 11px; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  .controls-right { justify-content: flex-start; }
  .check-btn { width: 100%; text-align: center; }
  .auth-box { padding: 24px 18px; }
  .item-top, .dash-low-item { flex-direction: column; align-items: flex-start; }
  .dash-item-right { align-items: flex-start; }
  .total-cost-row { flex-direction: column; gap: 4px; align-items: flex-start; }
  .dash-grid { grid-template-columns: repeat(2,1fr); }
  .history-card-grid { grid-template-columns: repeat(2,1fr); }
  .activity-item { grid-template-columns: 1fr; gap: 5px; }
  .activity-jump { justify-self: flex-start; }
  .audit-list { grid-template-columns: 1fr; }
  .modal-box { padding: 20px 16px; }
  .order-helper, .order-suggestions { grid-template-columns: 1fr; }
  .invite-code-text { font-size: 16px; }
  .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
  .cart-panel { width: 100%; border-radius: 0; border-left: none; border-right: none; }
  .cart-fab { bottom: 80px; left: 16px; width: 50px; height: 50px; }
  .card-view { display: flex; }
  .table-wrap { display: none; }
  .check-btn { display: none; }
  .result-panel { display: none; }
  .admin-workspace-card { flex-direction: column; align-items: flex-start; }
  .admin-card-right { width: 100%; justify-content: space-between; }
}

@media (max-width: 420px) {
  .dash-grid, .history-card-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .invite-code-box { flex-direction: column; align-items: stretch; }
  .copy-btn { width: 100%; }
  .admin-stats { flex-direction: column; }
}
/* â”€â”€ MOBILE TOOLS SHEET â”€â”€ */
.mobile-tools-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1100;
}
.mobile-tools-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  z-index: 1200;
  padding: 0 0 32px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
}
.mobile-tools-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 12px auto 0;
}
.mobile-tools-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  margin: 0;
}
.mobile-tool-btn {
  background: var(--surface);
  border: none;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}
.mobile-tool-btn:active { background: var(--surface2); }
.mobile-tool-icon {
  font-size: 24px;
  line-height: 1;
}
.mobile-tools-close {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px 0;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mobile-tools-close:active { background: var(--border); }

/* hide mobile sheet on desktop, show on mobile */
.mobile-tools-overlay,
.mobile-tools-sheet { display: none; }

@media (max-width: 760px) {
  .mobile-tools-overlay.visible { display: block; }
  .mobile-tools-sheet.visible { display: block; }
  /* hide desktop tools menu on mobile */
  .tools-menu { display: none !important; }
}
/* ── MOBILE TOOLS SHEET ── */
.mobile-tools-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 12px auto 0;
}
.mobile-tools-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  margin: 0;
}
.mobile-tool-btn {
  background: var(--surface);
  border: none;
  padding: 18px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}
.mobile-tool-btn:active { background: var(--surface2); }
.mobile-tool-icon { font-size: 24px; line-height: 1; }
.mobile-tools-close {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px 0;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mobile-tools-close:active { background: var(--border); }

/* overlay — invisible by default, no pointer events */
#mobile-tools-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
  background: transparent;
  transition: background 0.2s;
  display: block;
}
#mobile-tools-overlay.visible {
  pointer-events: all;
  background: rgba(0,0,0,0.5);
}

/* sheet — hidden off screen by default */
#mobile-tools-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  top: auto;
  z-index: 1200;
  background: var(--surface);
  border-radius: 12px 12px 0 0;
  padding: 0 0 32px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  display: block;
}
#mobile-tools-sheet.visible {
  transform: translateY(0);
}
@media (min-width: 761px) {
  #mobile-tools-overlay,
  #mobile-tools-sheet { display: none !important; }
}
@media (max-width: 760px) {
  .tools-menu { display: none !important; }
}
