/* RayneCore design system: deep navy, indigo and violet, Discord-style layout. */
:root {
    --bg-rail: #05060F;
    --bg-side: #0B0E1E;
    --bg-main: #111428;
    --bg-card: #181C38;
    --bg-hover: #1A1F3D;
    --bg-active: #1E2448;
    --bg-input: #05060F;
    --line: #1E2340;
    --line-strong: #262B4D;
    --line-btn: #3A4170;
    --text: #E2E8F0;
    --text-2: #C3C9DD;
    --muted: #9AA3C0;
    --accent: #4F46E5;
    --accent-hover: #4338CA;
    --accent-text: #A5B4FC;
    --violet: #C4B5FD;
    --ok: #5EEAD4; --ok-bg: rgba(45, 212, 191, .12);
    --low: #FCD34D; --low-bg: rgba(251, 191, 36, .12);
    --crit: #FDA4AF; --crit-bg: rgba(251, 113, 133, .14);
    --crit-strong: #F43F5E;
    --radius: 10px;
    --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Sora', var(--font);
    --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg-rail); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: #C7D2FE; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); margin: 0; }
h1:focus { outline: none; }
.rc-icon { flex-shrink: 0; }
.rc-grow { flex-grow: 1; }
.rc-muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.rc-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-error { color: var(--crit); font-size: 14px; margin: 0; }
.rc-row { display: flex; align-items: center; gap: 10px; }
.rc-stack { display: flex; flex-direction: column; gap: 12px; }
.rc-wrap { flex-wrap: wrap; }
.rc-hidden { display: none !important; }

/* ---------- App frame ---------- */
.rc-app { display: flex; height: 100vh; height: 100dvh; background: var(--bg-main); overflow: hidden; }
.rc-rail { width: 72px; flex-shrink: 0; background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0; overflow-y: auto; }
.rc-rail form { margin: 0; }
.rc-rail-btn { position: relative; width: 48px; height: 48px; border-radius: 24px; border: 0; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 15px; color: #fff; background: var(--bg-side); transition: border-radius .15s, background .15s; }
.rc-rail-btn:hover, .rc-rail-btn.active { border-radius: 16px; color: #fff; }
.rc-rail-btn.brand { background: transparent; border-radius: 12px; padding: 0; }
.rc-rail-btn.brand img { width: 48px; height: 48px; display: block; border-radius: 12px; }
.rc-rail-btn.venue { background: var(--venue, #7C3AED); }
.rc-rail-btn.org { background: var(--bg-side); color: var(--accent-text); }
.rc-rail-btn.subtle { color: var(--muted); }
.rc-rail-btn.active::before { content: ""; position: absolute; left: -12px; width: 4px; height: 36px; border-radius: 0 4px 4px 0; background: var(--text); }
.rc-rail-sep { width: 32px; height: 2px; border-radius: 1px; background: var(--line); }

.rc-sidebar { width: 248px; flex-shrink: 0; background: var(--bg-side); display: flex; flex-direction: column; }
.rc-side-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.rc-side-head strong { font-family: var(--display); font-size: 15px; display: block; }
.rc-side-body { flex-grow: 1; overflow-y: auto; padding: 16px 8px; display: flex; flex-direction: column; gap: 18px; }
.rc-side-group { display: flex; flex-direction: column; gap: 2px; }
.rc-side-label { padding: 0 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); }
.rc-chan { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 6px; color: var(--text-2); font-weight: 500; border: 0; background: transparent; text-align: left; width: 100%; }
.rc-chan:hover { background: var(--bg-hover); color: var(--text); }
.rc-chan.active { background: var(--bg-active); color: #fff; }
.rc-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit-strong); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.rc-badge.soft { background: var(--low-bg); color: var(--low); }
.rc-tag { height: 20px; padding: 0 7px; border-radius: 6px; background: #7C3AED; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em; display: inline-flex; align-items: center; }
.rc-usercard { height: 60px; flex-shrink: 0; background: #080A18; display: flex; align-items: center; gap: 10px; padding: 0 10px; }
.rc-usercard strong { display: block; font-size: 14px; }
.rc-avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--accent); color: #fff; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.rc-main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-topbar { min-height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 12px; padding: 8px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rc-title { font-size: 17px; }
.rc-divider { width: 1px; height: 20px; background: var(--line-strong); }
/* Tables react to the content width (side panel open or not), not the window width. */
.rc-content { flex-grow: 1; overflow-y: auto; padding: 16px 20px 32px; container-type: inline-size; }
.rc-panel { width: 340px; flex-shrink: 0; background: var(--bg-side); border-left: 1px solid var(--line); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; position: relative; }
.rc-panel h2 { font-size: 20px; }
.rc-panel-close { position: absolute; top: 12px; right: 12px; }
.rc-tabbar { display: none; }
.rc-drawer-scrim { display: none; }
.rc-only-mobile { display: none !important; }

/* ---------- Controls ---------- */
.rc-btn { height: 40px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-card); color: var(--text); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.rc-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.rc-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.rc-btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.rc-btn.danger { background: transparent; border-color: rgba(251, 113, 133, .45); color: var(--crit); }
.rc-btn.ghost { background: transparent; border-color: transparent; color: var(--accent-text); }
.rc-btn.outline { background: transparent; border-color: var(--line-btn); }
.rc-btn.big { height: 52px; font-size: 16px; border-radius: 12px; }
.rc-btn.wide { width: 100%; }
.rc-btn.sm { height: 32px; padding: 0 10px; font-size: 13px; }
.rc-icon-btn { width: 40px; height: 40px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rc-icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.rc-input, .rc-select, .rc-textarea { height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg-input); color: var(--text); font-size: 15px; width: 100%; }
.rc-textarea { height: auto; padding: 10px 12px; }
.rc-input.mono { font-family: var(--mono); }
.rc-input::placeholder { color: #7C84A3; }
.rc-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.rc-field .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.rc-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rc-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rc-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.rc-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.rc-search { height: 38px; width: 240px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 8px; background: var(--bg-input); color: var(--muted); }
.rc-search input { border: 0; background: transparent; outline: none; flex-grow: 1; min-width: 0; color: var(--text); }

.rc-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg-input); }
.rc-seg button { height: 32px; padding: 0 12px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.rc-seg button.on { background: var(--bg-active); color: #fff; }
.rc-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.rc-tabs button, .rc-tabs a { height: 40px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.rc-tabs .on { color: #fff; border-bottom-color: #818CF8; }

.rc-pill { height: 28px; padding: 0 10px; border-radius: 14px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rc-pill-ok { background: var(--ok-bg); color: var(--ok); }
.rc-pill-low { background: var(--low-bg); color: var(--low); }
.rc-pill-crit { background: var(--crit-bg); color: var(--crit); }
.rc-pill-none { background: var(--bg-card); color: var(--text-2); }
.rc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
/* All-items sheet: a wide spreadsheet that scrolls inside its box, header and item name pinned. */
.rc-sheet-wrap { overflow: auto; max-height: calc(100dvh - 190px); border: 1px solid var(--line); border-radius: 12px; }
.rc-xl { border-collapse: separate; border-spacing: 0; font-size: 14px; }
.rc-xl th { position: sticky; top: 0; z-index: 2; background: var(--bg-side); text-align: left; padding: 10px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
.rc-xl td { padding: 4px 6px; border-bottom: 1px solid var(--line); background: var(--bg-main); height: 49px; }
.rc-xl .pin { position: sticky; left: 0; z-index: 1; }
.rc-xl th.pin { z-index: 3; }
.rc-xl td.c { text-align: center; }
.rc-xl input:not([type=checkbox]), .rc-xl select { height: 36px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: var(--text); font-size: 14px; }
.rc-xl input:not([type=checkbox]):hover, .rc-xl select:hover { border-color: var(--line-strong); }
.rc-xl input:not([type=checkbox]):focus, .rc-xl select:focus { border-color: var(--accent-text); background: var(--bg-input); outline: none; }
.rc-xl select { max-width: 160px; }
.rc-xl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.rc-xl tr.ok td.pin { box-shadow: inset 3px 0 0 var(--ok); }
.rc-xl tr.err td { background: var(--crit-bg); }
.rc-xl .w-xs { width: 64px; }
.rc-xl .w-s { width: 96px; }
.rc-xl .w-m { width: 140px; }
.rc-xl .w-l { width: 240px; font-weight: 500; }
.rc-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.45; color: var(--text-2); }
.rc-unknown summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.rc-unknown-row { padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.rc-count-name { display: block; max-width: 100%; border: 0; background: transparent; padding: 0; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.rc-count-name:hover { color: var(--accent-text); text-decoration: underline; }
.rc-link-edit { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); }
.rc-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rc-tag { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.rc-tag:hover { background: var(--bg-hover); color: var(--text); }
.rc-tag.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rc-variance-toggle { margin-left: auto; padding: 4px 10px; border-radius: 999px; background: var(--bg-card); }

.rc-card { background: var(--bg-card); border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px; }
.rc-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.rc-kpi { padding: 14px; border-radius: 12px; background: var(--bg-card); display: flex; flex-direction: column; gap: 4px; }
.rc-kpi .label { font-size: 12px; color: var(--muted); }
.rc-kpi .value { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.rc-kpi .sub { font-size: 12px; color: var(--muted); }
.rc-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 14px; background: rgba(99, 102, 241, .12); border: 1px solid rgba(129, 140, 248, .4); }
.rc-banner.warn { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .35); color: #FDE68A; }
.rc-banner.support { background: rgba(124, 58, 237, .14); border-color: rgba(167, 139, 250, .4); color: var(--violet); }
.rc-empty { text-align: center; padding: 48px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.rc-empty h2 { color: var(--text); font-size: 20px; }
.rc-section-title { font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; }

/* ---------- Tables / lists ---------- */
.rc-table { width: 100%; }
.rc-thead, .rc-tr { display: grid; gap: 12px; align-items: center; padding: 0 12px; }
.rc-thead { padding-top: 10px; padding-bottom: 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.rc-tr { min-height: 56px; border-radius: 8px; border-left: 3px solid transparent; }
.rc-tr:hover { background: var(--bg-hover); }
.rc-tr.sel { background: var(--bg-active); }
/* A row's "more" menu (Settings > People). */
.rc-menu-anchor { position: relative; }
.rc-menu { position: absolute; z-index: 30; top: calc(100% + 4px); right: 0; min-width: 230px; padding: 6px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); display: flex; flex-direction: column; }
.rc-menu button { text-align: left; padding: 9px 10px; border-radius: 6px; border: 0; background: transparent; color: var(--text); font-size: 14px; }
.rc-menu button:hover, .rc-menu button:focus-visible { background: var(--bg-hover); }
.rc-menu button.danger { color: var(--crit); }
.rc-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 16px; }
.rc-perms .rc-check { align-items: flex-start; }
.rc-perms .rc-check input { margin-top: 1px; flex-shrink: 0; }
.rc-perms .rc-check input:disabled + span { opacity: .55; }
.rc-tr.edge-low { border-left-color: #FBBF24; }
.rc-tr.edge-crit { border-left-color: #FB7185; }
.rc-tr .name { border: 0; background: transparent; padding: 0; text-align: left; color: var(--text); font-weight: 500; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-inv { grid-template-columns: 90px minmax(160px, 1fr) 110px 160px 60px 60px 128px; }
.rc-num { font-family: var(--mono); font-size: 15px; }
.rc-stepper { display: flex; align-items: center; gap: 6px; }
.rc-step { width: 40px; height: 40px; border-radius: 10px; border: 0; background: #1E2340; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.rc-step:hover:not(:disabled) { background: #2A3160; }
.rc-step.plus { background: var(--accent); color: #fff; }
.rc-step.plus:hover:not(:disabled) { background: var(--accent-hover); }
.rc-qty { min-width: 46px; text-align: center; font-family: var(--mono); font-size: 17px; font-weight: 600; border: 0; background: transparent; color: var(--text); padding: 6px 2px; border-radius: 6px; }
button.rc-qty:hover { background: var(--bg-hover); }
.rc-qty-input { width: 64px; height: 40px; text-align: center; font-family: var(--mono); font-size: 16px; border-radius: 8px; border: 1px solid var(--accent-text); background: var(--bg-input); color: var(--text); }

.rc-feed { display: flex; flex-direction: column; gap: 12px; }
.rc-feed-item { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.rc-feed-dot { width: 6px; height: 6px; margin-top: 8px; flex-shrink: 0; border-radius: 3px; background: #818CF8; }

/* ---------- Overlays ---------- */
.rc-overlay { position: fixed; inset: 0; background: rgba(3, 4, 12, .72); z-index: 40; }
.rc-modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--line-strong); display: flex; flex-direction: column; }
.rc-modal.wide { width: min(820px, calc(100vw - 32px)); }
.rc-modal-head { padding: 22px 56px 0 24px; position: relative; display: flex; flex-direction: column; gap: 6px; }
.rc-modal-head h2 { font-size: 20px; }
.rc-modal-head p { margin: 0; }
.rc-modal-x { position: absolute; top: 14px; right: 14px; }
.rc-modal-body { container-type: inline-size; padding: 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.rc-modal-foot { padding: 0 24px 22px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.rc-secret { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: .06em; text-align: center; padding: 14px; border-radius: 12px; background: var(--bg-input); border: 1px dashed var(--line-btn); user-select: all; }
.rc-sheet { position: fixed; z-index: 42; left: 50%; bottom: 0; transform: translateX(-50%); width: min(420px, 100vw); border-radius: 24px 24px 0 0; background: var(--bg-card); border-top: 1px solid var(--line-strong); padding: 22px 20px 26px; display: flex; flex-direction: column; gap: 14px; }
.rc-sheet h2 { font-size: 19px; }
.rc-sheet p { margin: 0; }
.rc-toasts { position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.rc-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: #0B0E1E; font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); max-width: min(560px, calc(100vw - 32px)); cursor: pointer; }
.rc-toast-error { background: #FECDD3; color: #4C0519; }

/* ---------- PIN pad ---------- */
.rc-pinpad { display: flex; flex-direction: column; gap: 18px; }
.rc-pin-dots { display: flex; justify-content: center; gap: 18px; }
.rc-pin-dot { width: 18px; height: 18px; border-radius: 9px; border: 2px solid #818CF8; }
.rc-pin-dot.on { background: #818CF8; }
.rc-pin-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rc-pin-key { height: 64px; border-radius: 18px; border: 0; background: #262B4D; color: var(--text); font-family: var(--mono); font-size: 26px; font-weight: 600; }
.rc-pin-key:hover { background: #2E3462; }
.rc-pin-key.ghost { background: transparent; }

/* ---------- Sign-in pages ---------- */
.rc-auth { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 50% -10%, #111635 0%, #050816 60%); }
.rc-auth-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 20px; }
.rc-auth-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.rc-auth-logo .mark { width: 72px; height: 72px; display: block; filter: drop-shadow(0 8px 24px rgba(37, 99, 235, .35)); }
.rc-auth-logo h1 { font-size: 24px; }
.rc-auth-logo p { margin: 0; color: var(--muted); }
.rc-auth form { display: flex; flex-direction: column; gap: 14px; }
.rc-auth .rc-input { height: 48px; border-radius: 12px; font-size: 16px; }
.rc-pin-input { font-family: var(--mono); font-size: 32px; letter-spacing: .5em; text-align: center; height: 64px !important; }
.validation-message { color: var(--crit); font-size: 13px; }

/* ---------- Count ---------- */
.rc-count-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--bg-card); margin-bottom: 8px; border: 1px solid transparent; }
.rc-count-line.done { border-color: rgba(45, 212, 191, .35); }
.rc-count-line .meta { font-size: 13px; color: var(--muted); }
.rc-area-progress { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-area-chip { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--bg-card); color: var(--text-2); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); }
.rc-area-chip.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.rc-area-chip.current { border-color: #818CF8; color: #fff; }

/* ---------- Findings ---------- */
.rc-finding { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px; background: var(--bg-card); margin-bottom: 8px; }
.rc-kind { height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; }
.rc-kind-CountingMistake { background: rgba(129, 140, 248, .18); color: #C7D2FE; }
.rc-kind-MissingPaperwork { background: var(--ok-bg); color: var(--ok); }
.rc-kind-SetupProblem { background: var(--low-bg); color: var(--low); }
.rc-kind-RealLoss { background: var(--crit-bg); color: var(--crit); }
.rc-sheet-grid { border-radius: 10px; background: var(--bg-input); border: 1px solid var(--line); font-family: var(--mono); font-size: 13px; max-height: 300px; overflow: auto; }
.rc-sheet-grid .r { display: grid; grid-template-columns: 36px 1fr 1fr; border-top: 1px solid var(--line); }
.rc-sheet-grid .r > span { padding: 6px 10px; border-right: 1px solid var(--line-strong); }
.rc-sheet-grid .r > span:first-child { background: var(--bg-card); color: var(--muted); text-align: right; }
.rc-sheet-grid .h { background: var(--bg-card); color: var(--muted); font-weight: 600; position: sticky; top: 0; border-top: 0; }

/* Import: one card per sheet or block. */
.rc-import-group { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-main); }
.rc-import-group.skipped { opacity: .55; }
.rc-import-group summary { cursor: pointer; }

/* Spreadsheet preview of a supplier's order file: lettered columns, numbered rows. */
.rc-sheet-wrap { flex-shrink: 0; border-radius: 10px; background: var(--bg-input); border: 1px solid var(--line); max-height: 320px; overflow: auto; }
.rc-xls { border-collapse: collapse; font-family: var(--mono); font-size: 13px; min-width: 100%; }
.rc-xls th, .rc-xls td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; white-space: nowrap; }
.rc-xls thead th { position: sticky; top: 0; background: var(--bg-card); color: var(--muted); font-weight: 600; text-align: center; z-index: 1; }
.rc-xls tbody th { background: var(--bg-card); color: var(--muted); font-weight: 500; text-align: right; width: 36px; }
.rc-xls tr.top td { color: var(--violet); }
.rc-xls tr.head td { color: var(--text); font-weight: 600; background: rgba(99, 102, 241, .1); }
.rc-xls td { height: 31px; }

/* Order file maker: one line per column. */
.rc-colrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.2fr) auto; grid-template-areas: "l h f m" ". t t t"; gap: 8px; align-items: center; }
.rc-colrow .letter { grid-area: l; }
.rc-colrow .hdr { grid-area: h; }
.rc-colrow .field { grid-area: f; }
.rc-colrow .letter { height: 34px; border-radius: 8px; background: var(--bg-active); color: var(--accent-text); font-family: var(--mono); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.rc-colrow .fixed { grid-area: t; }
.rc-colrow .moves { grid-area: m; display: flex; gap: 2px; }
.rc-colrow .moves .rc-icon-btn { width: 34px; height: 34px; }

/* Barcode scanning: full-screen camera with an aiming frame. */
.rc-scan { position: fixed; inset: 0; z-index: 60; background: #000; display: flex; flex-direction: column; }
.rc-scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rc-scan-frame { position: absolute; left: 50%; top: 42%; width: min(78vw, 420px); height: min(34vw, 190px); transform: translate(-50%, -50%); border: 3px solid rgba(165, 180, 252, .95); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(3, 4, 12, .45); pointer-events: none; }
.rc-scan-top { position: relative; display: flex; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 14px 12px; background: linear-gradient(rgba(3, 4, 12, .8), transparent); color: #fff; }
.rc-scan-top .rc-icon-btn { color: #fff; }
.rc-scan-bottom { position: relative; margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 14px max(18px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(3, 4, 12, .9) 30%); }
.rc-scan-status { margin: 0; text-align: center; color: #fff; font-weight: 500; }
.rc-scan-bottom .rc-btn.on { background: #FCD34D; color: #111; border-color: #FCD34D; }
.rc-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-input); color: var(--text); width: 100%; }
.rc-pick:hover:not(:disabled) { border-color: var(--accent-text); }
@keyframes rc-flash { 0%, 100% { background: transparent; } 20% { background: rgba(99, 102, 241, .35); } }
.rc-flash { animation: rc-flash 1.6s ease; }

/* Bottle counting: full bottles + the open bottle's level, tapped on a picture. */
.rc-bottle-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.rc-bottle { position: relative; width: 120px; height: 300px; flex-shrink: 0; margin: 0 auto; }
.rc-bottle svg { display: block; }
.rc-bottle .glass { fill: rgba(165, 180, 252, .08); }
.rc-bottle .outline { fill: none; stroke: var(--accent-text); stroke-width: 2.5; }
.rc-bottle .liquor { fill: #D97706; opacity: .85; transition: y .15s, height .15s; }
.rc-bottle .tick { stroke: rgba(226, 232, 240, .25); stroke-width: 1; stroke-dasharray: 3 3; }
.rc-bottle .tick.on { stroke: #fff; stroke-width: 2; stroke-dasharray: none; }
.rc-bottle .tick-label { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.rc-bottle-hit { position: absolute; inset: 0; cursor: pointer; }
.rc-bottle-label { position: absolute; left: 0; right: 0; bottom: -22px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); pointer-events: none; }
.rc-open-list { display: flex; flex-direction: column; gap: 6px; }
.rc-open-row { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 0; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg-input); }
.rc-open-row.on { border-color: var(--accent-text); background: var(--bg-active); }
.rc-open-pick { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 40px; padding: 0 12px; border: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; text-align: left; }
.rc-open-thumb { width: 30px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-strong); display: block; }
.rc-stepper-big .rc-step { width: 52px; height: 52px; }
.rc-stepper-big .rc-qty-input { width: 80px; height: 52px; font-size: 22px; }
.rc-total { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--bg-input); }
.rc-total strong { font-family: var(--mono); font-size: 26px; }
.rc-photo-thumb { width: 72px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-strong); }
.rc-step-bottle { position: relative; background: rgba(217, 119, 6, .18); color: #FCD34D; }
.rc-step-pack { background: rgba(45, 212, 191, .14); color: var(--ok); }
.rc-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 4px; background: var(--ok); }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 900px) {
    .rc-only-mobile { display: inline-flex !important; }
    .rc-only-desktop { display: none !important; }
    .rc-rail, .rc-sidebar { position: fixed; top: 0; bottom: 0; z-index: 30; transform: translateX(-120%); transition: transform .2s ease, visibility .2s; visibility: hidden; }
    .rc-rail { left: 0; }
    .rc-sidebar { left: 72px; width: min(280px, calc(100vw - 72px)); transform: translateX(calc(-100% - 96px)); }
    .drawer-open .rc-rail, .drawer-open .rc-sidebar { transform: none; visibility: visible; }
    .drawer-open .rc-drawer-scrim { display: block; position: fixed; inset: 0; background: rgba(3, 4, 12, .6); z-index: 29; }
    .rc-topbar { padding: 8px 12px; }
    .rc-content { padding: 12px 12px 96px; }
    .rc-panel { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; width: auto; max-height: 85dvh; border-left: 0; border-top: 1px solid var(--line-strong); border-radius: 20px 20px 0 0; transform: translateY(110%); transition: transform .2s ease; padding-top: 28px; }
    .panel-open .rc-panel { transform: none; }
    .rc-tabbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; height: 68px; background: var(--bg-side); border-top: 1px solid var(--line); z-index: 20; padding-bottom: env(safe-area-inset-bottom); }
    .rc-tabbar a, .rc-tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: transparent; }
    .rc-tabbar .active { color: #fff; }
    .rc-search { width: 100%; order: 10; }
    .rc-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rc-grid3 { grid-template-columns: 1fr; }
    .rc-step { width: 44px; height: 44px; border-radius: 12px; }
    .rc-finding { flex-direction: column; align-items: stretch; }
    .rc-colrow { grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "l h m" ". f f" ". t t"; row-gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
    .rc-modal-foot .rc-btn { flex-grow: 1; }
    .rc-scan-btn span { display: none; }
    .rc-scan-btn { padding: 0 10px; }
}

/* ---------- Tables in narrow content (phone, or desktop with the side panel open) ---------- */
/* Inventory: drop the least important columns first so the item name always has room. */
@container (max-width: 879px) {
    .rc-inv { grid-template-columns: 90px minmax(160px, 1fr) 160px 60px 60px 128px; }
    .rc-inv .c-code { display: none; }
}
@container (max-width: 759px) {
    .rc-inv { grid-template-columns: 90px minmax(160px, 1fr) 160px 128px; }
    .rc-inv .c-par, .rc-inv .c-need { display: none; }
}
@container (max-width: 619px) {
    .rc-thead.rc-inv { display: none; }
    .rc-tr.rc-inv { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name step" "meta step"; row-gap: 2px; padding: 10px 12px; background: var(--bg-card); margin-bottom: 8px; border-radius: 14px; border-left-width: 4px; }
    .rc-inv .c-loc { display: none; }
    .rc-inv .c-name { grid-area: name; }
    .rc-inv .c-step { grid-area: step; }
    .rc-inv .c-status { grid-area: meta; }
    .rc-inv .c-status .rc-pill { height: 22px; font-size: 12px; background: transparent; padding: 0; }
}
/* Other tables (.rc-cards) become cards: main cell on top, labelled values below, actions last.
   840px fits the widest one (Variance) with room left for the name. */
@container (max-width: 839px) {
    .rc-thead.rc-cards { display: none; }
    .rc-tr.rc-cards { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 12px; min-height: 0 !important; background: var(--bg-card); margin-bottom: 8px; border-radius: 14px; }
    .rc-tr.rc-cards > * { min-width: 0; }
    .rc-tr.rc-cards > .c-main { order: -1; flex: 1 1 100%; white-space: normal; overflow: visible; overflow-wrap: break-word; }
    .rc-tr.rc-cards > .c-main .small { display: block; margin-top: 2px; }
    .rc-tr.rc-cards > .c-act { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start !important; text-align: left !important; }
    .rc-tr.rc-cards > .c-act > .rc-btn { flex: 1 1 auto; }
    .rc-tr.rc-cards > .c-end { margin-left: auto; }
    .rc-tr.rc-cards > .rc-select { flex: 1 1 100%; }
    .rc-tr.rc-cards [data-l]::before { content: attr(data-l); margin-right: 6px; font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted); }
}

/* Scan log on the count page: green = counted, violet = unknown barcode, red = nothing added. */
.rc-scanlog { display: flex; flex-direction: column; gap: 6px; max-height: min(60dvh, 520px); overflow-y: auto; }
.rc-scanlog-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-input); min-width: 0; }
.rc-scanlog-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
.rc-scanlog-row.new .rc-scanlog-dot { background: var(--violet); }
.rc-scanlog-row.fail .rc-scanlog-dot { background: var(--crit); }
.rc-scanlog-row.undone { opacity: .55; }
.rc-scanlog-row.undone strong { text-decoration: line-through; }
.rc-scanlog-qty { color: var(--text); font-weight: 600; }
.rc-scanlog-row.undone .rc-scanlog-qty { text-decoration: none; color: var(--muted); }
