/* RTN MERCHANT LOYALTY PORTAL - Shared Stylesheet */

:root {
  --rtn-mustard: #FFCE1B;
  --rtn-mustard-soft: #FFF4C2;
  --rtn-mustard-tint: #FFF8D6;
  --rtn-ink: #1A1A1A;
  --rtn-surface: #FAF8F4;
  --rtn-warm-100: #F1EEE6;
  --rtn-warm-200: #E8E4DC;
  --rtn-warm-600: #6B6862;
  --rtn-warm-800: #3D3B38;
  --rtn-white: #FFFFFF;
  --rtn-muted: #8A8780;
  --rtn-success: #1F8B4C;
  --rtn-success-bg: #E6F4EA;
  --rtn-warning: #E8A317;
  --rtn-warning-bg: #FFF4C2;
  --rtn-error: #D64545;
  --rtn-error-bg: #FBEAEA;
  --rtn-info: #2B6CB0;
  --rtn-info-bg: #E6F0FB;
  /* Duotone pairs (RTN design system §1): deep title / mid body on every tint.
     Previously ABSENT — chips used the mid-tone as text (~3.8:1, WCAG AA fail) and
     several pages referenced --rtn-*-deep with no fallback, so those pills rendered
     colourless. Defining them here fixes both at the source. */
  --rtn-success-deep: #093419; --rtn-success-mid: #1A5A2E;
  --rtn-warning-deep: #4A3206; --rtn-warning-mid: #6B470D;
  --rtn-error-deep: #4A0F0F;   --rtn-error-mid: #761E1E;
  --rtn-info-deep: #133565;
  --rtn-warm-400: #C9C3B8;
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-hero: 22px;
  --border-card: 1px solid rgba(0,0,0,0.06);
  --border-line: 1px solid rgba(0,0,0,0.05);
  --border-soft: 1px solid rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--rtn-surface); font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--rtn-ink); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; overflow: hidden; }

.sidebar { background: var(--rtn-ink); color: var(--rtn-surface); display: flex; flex-direction: column; overflow-y: auto; }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.brand-mark { width: 38px; height: 38px; background: var(--rtn-mustard); color: var(--rtn-ink); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: 'Inter'; font-weight: 600; font-size: 14px; letter-spacing: -0.4px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: 'Inter'; font-size: 14px; font-weight: 500; color: var(--rtn-surface); }
.brand-tag { font-size: 10px; color: var(--rtn-warm-600); margin-top: 2px; letter-spacing: 0.4px; text-transform: uppercase; }
.nav-group { padding: 14px 12px 4px; }
.nav-label { font-size: 10px; font-weight: 500; color: var(--rtn-warm-600); letter-spacing: 1.2px; text-transform: uppercase; padding: 0 10px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--rtn-muted); font-size: 13px; cursor: pointer; transition: background 140ms, color 140ms; margin-bottom: 2px; user-select: none; text-decoration: none; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--rtn-surface); }
.nav-item.active { background: rgba(255,206,27,0.12); color: var(--rtn-mustard); font-weight: 500; }
.nav-item.active i { color: var(--rtn-mustard); }
.nav-item i { font-size: 18px; width: 20px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--rtn-error); color: var(--rtn-white); font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 20px; line-height: 1.4; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 8px 18px; }
.sidebar-footer { margin-top: auto; padding: 14px 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.user-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background 120ms; text-decoration: none; }
.user-card:hover { background: rgba(255,255,255,0.05); }
.user-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--rtn-ink); border: 1.5px solid var(--rtn-mustard); display: flex; align-items: center; justify-content: center; color: var(--rtn-mustard); font-family: 'Inter'; font-weight: 500; font-size: 13px; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--rtn-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta { font-size: 11px; color: var(--rtn-warm-600); margin-top: 2px; }

.main { display: flex; flex-direction: column; overflow: hidden; background: var(--rtn-surface); }

.topbar { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: var(--rtn-surface); border-bottom: 1px solid rgba(0,0,0,0.05); flex-shrink: 0; }
.topbar-title { font-family: 'Inter'; font-size: 20px; font-weight: 500; letter-spacing: -0.4px; }
.topbar-sub { font-size: 12px; color: var(--rtn-warm-600); margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn { width: 38px; height: 38px; background: var(--rtn-white); border: var(--border-soft); border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 120ms; position: relative; }
.icon-btn:hover { background: var(--rtn-warm-100); }
.icon-btn i { font-size: 18px; }
.notif-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; background: var(--rtn-error); border-radius: 50%; border: 2px solid var(--rtn-surface); }

.btn-primary { display: inline-flex; align-items: center; gap: 7px; background: var(--rtn-mustard); color: var(--rtn-ink); font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 10px; transition: opacity 120ms, transform 80ms; }
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary i { font-size: 16px; }
.btn-secondary { display: inline-flex; align-items: center; gap: 6px; background: var(--rtn-white); color: var(--rtn-ink); font-size: 13px; font-weight: 500; padding: 9px 14px; border-radius: 10px; border: var(--border-soft); transition: background 120ms; }
.btn-secondary:hover { background: var(--rtn-warm-100); }
.btn-secondary i { font-size: 16px; }
.btn-ghost { display: inline-flex; align-items: center; gap: 5px; color: var(--rtn-warm-600); font-size: 12px; font-weight: 500; padding: 6px 10px; border-radius: 8px; transition: background 120ms; }
.btn-ghost:hover { background: var(--rtn-warm-100); color: var(--rtn-ink); }

.content { flex: 1; overflow-y: auto; padding: 24px 28px 40px; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: var(--rtn-warm-200); border-radius: 10px; }

.muted { color: var(--rtn-warm-600); }

.card { background: var(--rtn-white); border: var(--border-card); border-radius: var(--radius-lg); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 12px; border-bottom: var(--border-line); }
.card-head h3 { font-family: 'Inter'; font-size: 15px; font-weight: 500; letter-spacing: -0.2px; }
.card-body { padding: 16px 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--rtn-white); border: var(--border-card); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon { width: 40px; height: 40px; background: var(--rtn-warm-100); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.kpi-icon i { font-size: 20px; }
.kpi-icon.accent { background: var(--rtn-mustard); }
.kpi-delta { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 6px; display: inline-flex; align-items: center; gap: 3px; }
.kpi-delta.up { background: var(--rtn-success-bg); color: var(--rtn-success-deep); }
.kpi-delta.down { background: var(--rtn-error-bg); color: var(--rtn-error-deep); }
.kpi-delta.warn { background: var(--rtn-warning-bg); color: var(--rtn-warning-deep); }
.kpi-value { font-family: 'Inter'; font-size: 28px; font-weight: 500; letter-spacing: -0.7px; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi-label { font-size: 12px; color: var(--rtn-warm-600); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

.table { width: 100%; border-collapse: collapse; }
.table th { font-size: 11px; font-weight: 500; color: var(--rtn-warm-600); letter-spacing: 0.6px; text-transform: uppercase; padding: 10px 20px; text-align: left; background: var(--rtn-surface); border-bottom: var(--border-line); }
.table td { padding: 12px 20px; border-bottom: var(--border-line); font-size: 13px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.row-hover:hover td { background: var(--rtn-surface); cursor: pointer; }
.table .num { font-variant-numeric: tabular-nums; font-family: 'Inter'; font-weight: 500; }
.avatar-mono { width: 32px; height: 32px; border-radius: 50%; background: var(--rtn-ink); color: var(--rtn-mustard); font-family: 'Inter'; font-weight: 500; font-size: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-mono.alt { background: var(--rtn-warm-100); color: var(--rtn-ink); }
.cell-stack { display: flex; align-items: center; gap: 10px; }
.cell-name { font-weight: 500; font-size: 13px; }
.cell-sub { font-size: 11px; color: var(--rtn-warm-600); margin-top: 2px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 4px 9px; border-radius: 7px; white-space: nowrap; }
.chip.success { background: var(--rtn-success-bg); color: var(--rtn-success-deep); }
.chip.warn { background: var(--rtn-warning-bg); color: var(--rtn-warning-deep); }
.chip.error { background: var(--rtn-error-bg); color: var(--rtn-error-deep); }
.chip.muted { background: var(--rtn-warm-100); color: var(--rtn-warm-800); }
.chip.info { background: var(--rtn-info-bg); color: var(--rtn-info-deep); }
.chip.mustard { background: var(--rtn-mustard); color: var(--rtn-ink); }
.chip i { font-size: 12px; }

.plan-hero { background: var(--rtn-ink); border-radius: var(--radius-hero); padding: 22px; color: var(--rtn-surface); position: relative; overflow: hidden; height: 100%; display: flex; flex-direction: column; gap: 18px; }
.plan-hero::before { content: ''; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px; border: 1px solid rgba(255,206,27,0.10); border-radius: 50%; }
.plan-hero::after { content: ''; position: absolute; top: -80px; right: -80px; width: 260px; height: 260px; border: 1px solid rgba(255,206,27,0.06); border-radius: 50%; }
.plan-hero > * { position: relative; z-index: 1; }
.plan-tier-badge { background: var(--rtn-mustard); color: var(--rtn-ink); font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 7px; letter-spacing: 0.5px; text-transform: uppercase; width: fit-content; }
.plan-name-display { font-family: 'Inter'; font-size: 26px; font-weight: 500; color: var(--rtn-surface); margin-top: 6px; }
.plan-price-display { font-family: 'Inter'; font-size: 36px; font-weight: 500; color: var(--rtn-mustard); font-variant-numeric: tabular-nums; letter-spacing: -1.2px; line-height: 1; margin-top: 4px; }
.plan-price-display .unit { font-size: 14px; color: var(--rtn-warm-600); font-weight: 400; }
.plan-features-list { display: flex; flex-direction: column; gap: 9px; }
.plan-feat { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--rtn-muted); }
.plan-feat i { color: var(--rtn-mustard); font-size: 16px; }
.plan-progress-wrap { display: flex; flex-direction: column; gap: 6px; }
.plan-progress-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--rtn-warm-600); }
.plan-progress-bar { height: 5px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.plan-progress-fill { height: 100%; background: var(--rtn-mustard); border-radius: 4px; }
.plan-cta { background: rgba(255,206,27,0.12); border: 1px solid rgba(255,206,27,0.25); color: var(--rtn-mustard); font-size: 12px; font-weight: 500; padding: 10px 14px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background 120ms; }
.plan-cta:hover { background: rgba(255,206,27,0.2); }

.activity-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 20px; border-bottom: var(--border-line); cursor: pointer; transition: background 100ms; text-decoration: none; }
.activity-row:last-child { border-bottom: none; }
.activity-row:hover { background: var(--rtn-surface); }
.act-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--rtn-warm-100); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.act-icon i { font-size: 16px; }
.act-icon.success { background: var(--rtn-success-bg); }
.act-icon.success i { color: var(--rtn-success); }
.act-icon.warn { background: var(--rtn-warning-bg); }
.act-icon.warn i { color: var(--rtn-warning); }
.act-icon.error { background: var(--rtn-error-bg); }
.act-icon.error i { color: var(--rtn-error); }
.act-body { flex: 1; min-width: 0; }
.act-title { font-size: 13px; font-weight: 500; }
.act-sub { font-size: 12px; color: var(--rtn-warm-600); margin-top: 3px; }
.act-time { font-size: 11px; color: var(--rtn-muted); margin-top: 4px; }

.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 18px 20px; }
.qa-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: transform 80ms; text-decoration: none; }
.qa-tile:active { transform: scale(0.96); }
.qa-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--rtn-warm-100); display: flex; align-items: center; justify-content: center; transition: background 140ms; }
.qa-tile:hover .qa-icon { background: var(--rtn-warm-200); }
.qa-icon i { font-size: 22px; }
.qa-label { font-size: 11px; font-weight: 500; color: var(--rtn-warm-800); text-align: center; }

.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 500; color: var(--rtn-warm-800); }
.field-help { font-size: 11px; color: var(--rtn-warm-600); margin-top: 4px; }
.input, .select, .textarea { width: 100%; background: var(--rtn-white); border: 1px solid rgba(0,0,0,0.1); border-radius: var(--radius-md); padding: 11px 14px; font-size: 13px; transition: border-color 120ms, box-shadow 120ms; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--rtn-mustard); box-shadow: 0 0 0 3px rgba(255,206,27,0.15); }
.input::placeholder, .textarea::placeholder { color: var(--rtn-muted); }
.textarea { min-height: 90px; resize: vertical; }
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--rtn-warm-200); border-radius: 20px; transition: 200ms; }
.toggle-slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: var(--rtn-white); border-radius: 50%; transition: 200ms; }
.toggle input:checked + .toggle-slider { background: var(--rtn-ink); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); background: var(--rtn-mustard); }
.toggle input:disabled + .toggle-slider { cursor: not-allowed; opacity: 0.5; }

/* Disabled form controls had no styling at all, so a field switched off in JS
   still looked fully editable. Give the state a visible affordance. */
.input:disabled,
.input[disabled],
select:disabled,
textarea:disabled {
  background: var(--rtn-warm-100);
  color: var(--rtn-warm-600);
  cursor: not-allowed;
  opacity: 0.7;
}
.field-disabled .field-label,
.field-disabled .field-help { opacity: 0.6; }

/* Preview CTA — a primary action whose backend isn't live yet. Still clickable
   (it explains itself via toast), but visibly not a normal primary button. */
.btn-primary.btn-preview {
  background: var(--rtn-warm-100);
  color: var(--rtn-ink);
  border: 1px dashed var(--rtn-warm-400, #c9c3b8);
  box-shadow: none;
}
.btn-primary.btn-preview:hover { background: var(--rtn-warm-200); }
.cta-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  background: var(--rtn-warning-bg);
  color: var(--rtn-warning-deep);
  border-radius: 999px;
  padding: 2px 7px;
  margin-left: 4px;
}

.plans-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.plan-card-c { background: var(--rtn-white); border: var(--border-card); border-radius: var(--radius-lg); padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; position: relative; }
.plan-card-c.featured { border: 2px solid var(--rtn-mustard); background: var(--rtn-mustard-tint); }
.plan-card-c.current { background: var(--rtn-ink); color: var(--rtn-surface); }
.plan-tag { position: absolute; top: -10px; left: 18px; background: var(--rtn-mustard); color: var(--rtn-ink); font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 6px; letter-spacing: 0.5px; text-transform: uppercase; }
.plan-c-name { font-family: 'Inter'; font-size: 18px; font-weight: 500; }
.plan-c-price { font-family: 'Inter'; font-size: 32px; font-weight: 500; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.plan-card-c.current .plan-c-price { color: var(--rtn-mustard); }
.plan-c-price .per { font-size: 13px; color: var(--rtn-warm-600); font-weight: 400; }
.plan-c-feats { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.plan-c-feat { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--rtn-warm-800); line-height: 1.5; }
.plan-card-c.current .plan-c-feat { color: var(--rtn-muted); }
.plan-c-feat i { color: var(--rtn-success); font-size: 14px; flex-shrink: 0; margin-top: 2px; }
.plan-card-c.current .plan-c-feat i { color: var(--rtn-mustard); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid rgba(0,0,0,0.06); margin-bottom: 18px; padding: 0 4px; }
.tab { padding: 10px 14px; font-size: 13px; color: var(--rtn-warm-600); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; transition: color 120ms; }
.tab:hover { color: var(--rtn-ink); }
.tab.active { color: var(--rtn-ink); border-bottom-color: var(--rtn-ink); }

.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.store-card { background: var(--rtn-white); border: var(--border-card); border-radius: var(--radius-lg); padding: 18px; cursor: pointer; transition: transform 140ms, box-shadow 140ms; }
.store-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.04); }
.store-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.store-card-name { font-family: 'Inter'; font-size: 15px; font-weight: 500; }
.store-card-loc { font-size: 12px; color: var(--rtn-warm-600); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.store-card-loc i { font-size: 13px; }
.store-stat-row { display: flex; gap: 18px; padding: 12px 0; border-top: var(--border-line); border-bottom: var(--border-line); margin-bottom: 14px; }
.store-stat { flex: 1; }
.store-stat-val { font-family: 'Inter'; font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; }
.store-stat-lbl { font-size: 11px; color: var(--rtn-warm-600); margin-top: 2px; }
.store-card-foot { display: flex; align-items: center; justify-content: space-between; }

.invoice-row { display: grid; grid-template-columns: 1fr 130px 130px 130px 100px; gap: 12px; padding: 14px 20px; border-bottom: var(--border-line); align-items: center; }
.invoice-row:last-child { border-bottom: none; }
.invoice-id { font-family: 'Inter'; font-weight: 500; font-size: 13px; }
.invoice-amt { font-family: 'Inter'; font-weight: 500; font-variant-numeric: tabular-nums; }

.mfr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mfr-card { background: var(--rtn-white); border: var(--border-card); border-radius: var(--radius-lg); padding: 20px; }
.mfr-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.mfr-logo { width: 52px; height: 52px; background: var(--rtn-ink); color: var(--rtn-mustard); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-family: 'Inter'; font-weight: 600; font-size: 13px; }
.mfr-name { font-family: 'Inter'; font-size: 16px; font-weight: 500; }
.mfr-sub { font-size: 12px; color: var(--rtn-warm-600); margin-top: 2px; }
.mfr-desc { font-size: 12px; color: var(--rtn-warm-600); margin-bottom: 14px; line-height: 1.5; }

.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast { background: var(--rtn-ink); color: var(--rtn-surface); padding: 12px 16px; border-radius: 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; box-shadow: 0 12px 30px rgba(0,0,0,0.15); animation: toastIn 240ms ease-out; min-width: 240px; }
.toast i { color: var(--rtn-mustard); font-size: 18px; }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-bg { position: fixed; inset: 0; background: rgba(26,26,26,0.5); display: none; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); }
.modal-bg.show { display: flex; }
.modal { background: var(--rtn-white); border-radius: var(--radius-lg); width: 480px; max-width: 90vw; max-height: 86vh; overflow-y: auto; animation: modalIn 200ms ease-out; }
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head { padding: 20px 24px 14px; border-bottom: var(--border-line); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-family: 'Inter'; font-size: 17px; font-weight: 500; }
.modal-body { padding: 20px 24px; }
.modal-foot { padding: 16px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: var(--border-line); }

.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: var(--border-line); }
.setting-row:last-child { border-bottom: none; }
.setting-info h4 { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.setting-info p { font-size: 12px; color: var(--rtn-warm-600); }

.upload-zone { border: 1.5px dashed rgba(0,0,0,0.15); border-radius: var(--radius-lg); padding: 32px; text-align: center; background: var(--rtn-surface); transition: border-color 120ms, background 120ms; cursor: pointer; }
.upload-zone:hover { border-color: var(--rtn-mustard); background: var(--rtn-mustard-tint); }
.upload-icon { width: 56px; height: 56px; background: var(--rtn-warm-100); border-radius: 50%; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.upload-icon i { font-size: 24px; color: var(--rtn-warm-600); }

.doc-list { display: flex; flex-direction: column; }
.doc-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: var(--border-line); cursor: pointer; transition: background 100ms; }
.doc-item:last-child { border-bottom: none; }
.doc-item:hover { background: var(--rtn-surface); }
.doc-icon { width: 40px; height: 40px; background: var(--rtn-warm-100); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.doc-icon i { font-size: 18px; }
.doc-info { flex: 1; }
.doc-name { font-size: 13px; font-weight: 500; }
.doc-meta { font-size: 11px; color: var(--rtn-warm-600); margin-top: 2px; }

.ticket-row { padding: 16px 20px; border-bottom: var(--border-line); cursor: pointer; transition: background 100ms; }
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--rtn-surface); }
.ticket-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ticket-id { font-family: 'Inter'; font-size: 11px; color: var(--rtn-warm-600); letter-spacing: 0.4px; }
.ticket-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.ticket-foot { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--rtn-warm-600); }

.page { animation: pageIn 280ms ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.row-flex { display: flex; align-items: center; gap: 8px; }
.gap-md { gap: 12px; }
.mb-md { margin-bottom: 16px; }
.hidden { display: none !important; }

.search-bar { background: var(--rtn-white); border: var(--border-soft); border-radius: var(--radius-md); padding: 9px 14px; display: flex; align-items: center; gap: 10px; width: 320px; }
.search-bar i { color: var(--rtn-warm-600); font-size: 16px; }
.search-bar input { border: none; outline: none; background: transparent; flex: 1; font-size: 13px; }
.search-bar input::placeholder { color: var(--rtn-muted); }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip { padding: 6px 12px; border-radius: 20px; background: var(--rtn-white); border: var(--border-soft); font-size: 12px; color: var(--rtn-warm-800); cursor: pointer; transition: all 120ms; }
.filter-chip:hover { background: var(--rtn-warm-100); }
.filter-chip.active { background: var(--rtn-ink); color: var(--rtn-surface); border-color: var(--rtn-ink); }

.auth-screen { display: flex; height: 100vh; background: var(--rtn-surface); }
.auth-side { flex: 1; background: var(--rtn-ink); color: var(--rtn-surface); padding: 60px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px; border: 1px solid rgba(255,206,27,0.08); border-radius: 50%; }
.auth-side::after { content: ''; position: absolute; bottom: -150px; right: -50px; width: 300px; height: 300px; border: 1px solid rgba(255,206,27,0.05); border-radius: 50%; }
.auth-form-side { width: 480px; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.auth-headline { font-family: 'Inter'; font-size: 38px; font-weight: 500; letter-spacing: -1px; line-height: 1.15; position: relative; z-index: 1; }
.auth-quote { font-size: 14px; color: var(--rtn-muted); line-height: 1.7; max-width: 440px; position: relative; z-index: 1; margin-top: 24px; }
.auth-form-title { font-family: 'Inter'; font-size: 26px; font-weight: 500; letter-spacing: -0.6px; margin-bottom: 8px; }
.auth-form-sub { font-size: 13px; color: var(--rtn-warm-600); margin-bottom: 28px; }
.auth-stats { display: flex; gap: 24px; position: relative; z-index: 1; }
.auth-stat-num { font-family: 'Inter'; font-size: 22px; font-weight: 500; color: var(--rtn-mustard); }
.auth-stat-lbl { font-size: 11px; color: var(--rtn-warm-600); margin-top: 2px; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .plans-grid, .mfr-grid { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-form-side { width: 100%; }
}

/* ── Empty + loading state — RTN.empty()/RTN.loading() emit .empty > .empty-icon.
   These selectors did not exist, so every empty + loading state on all 25 pages
   rendered unstyled. This is the single highest-leverage UI repair. ── */
.empty { text-align: center; max-width: 340px; margin: 40px auto; padding: 24px 16px; }
.empty-icon { width: 80px; height: 80px; border-radius: 50%; background: var(--rtn-warm-100); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.empty-icon i { font-size: 34px; color: var(--rtn-warm-800); }
.empty h4 { font-size: 18px; font-weight: 600; letter-spacing: -0.2px; color: var(--rtn-ink); margin-bottom: 6px; }
.empty p { font-size: 13px; color: var(--rtn-warm-600); line-height: 1.5; margin-bottom: 16px; }
.empty .btn-primary, .empty .btn-secondary { display: inline-flex; }

/* wrap wide tables so the page body never scrolls sideways */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* mobile drawer toggle — hidden on desktop */
.topbar-menu { display: none; margin-right: 6px; }

/* ── Mobile shell (< 900px): the fixed 248px sidebar becomes an off-canvas drawer,
   so content is no longer crushed on phones/tablets. ── */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: var(--sidebar-w); z-index: 200; transform: translateX(-100%); transition: transform 220ms ease; box-shadow: 0 0 44px rgba(0,0,0,0.35); }
  .app.nav-open .sidebar { transform: translateX(0); }
  .topbar-menu { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-1-1, .plans-grid, .mfr-grid, .store-grid { grid-template-columns: 1fr; }
  .search-bar { display: none; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

/* Bell unread counter */
.bell-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rtn-error);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--rtn-white);
  pointer-events: none;
}
/* The alert check failed: amber "!" — unknown, not all-clear. */
.bell-badge.warn { background: var(--rtn-warning); color: var(--rtn-ink, #1a1a1a); }

/* KPI cards that act as filters / shortcuts (RTN.kpiClickable) */
.kpi.kpi-click { cursor: pointer; transition: border-color 140ms, box-shadow 140ms, transform 140ms, background 140ms; }
.kpi.kpi-click:hover { border-color: var(--rtn-mustard); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06); transform: translateY(-1px); }
.kpi.kpi-click:focus-visible { outline: 2px solid var(--rtn-mustard); outline-offset: 2px; }
.kpi.kpi-click.active { border-color: var(--rtn-ink); box-shadow: inset 0 0 0 1px var(--rtn-ink); background: var(--rtn-warm-100); }

/* Section flash after a KPI shortcut scrolls to it */
@keyframes rtn-flash { 0% { box-shadow: 0 0 0 0 rgba(232, 163, 23, 0.55); } 100% { box-shadow: 0 0 0 14px rgba(232, 163, 23, 0); } }
.flash { animation: rtn-flash 1.2s ease-out; border-radius: var(--radius-lg); }

.link-btn { background: none; border: none; padding: 0; font: inherit; color: var(--rtn-ink); text-decoration: underline; cursor: pointer; }
.btn-secondary[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Copy-to-clipboard button sitting inside a read-only field */
.input-with-action { position: relative; display: flex; align-items: center; }
.input-with-action .input { padding-right: 42px; }
.copy-btn {
  position: absolute;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--rtn-warm-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font: inherit;
}
.copy-btn:hover { background: var(--rtn-warm-100); color: var(--rtn-ink); }
.copy-btn:focus-visible { outline: 2px solid var(--rtn-mustard); outline-offset: 1px; }

/* Filter toolbar above a table */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: var(--border-line); }
.toolbar .select { width: auto; min-width: 150px; padding: 8px 12px; }
.toolbar .search-bar { width: 260px; padding: 7px 12px; }

/* Settings sub-navigation tabs */
.tab-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  font: inherit;
  font-size: 13px;
  color: var(--rtn-warm-800);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tab-btn:hover { background: var(--rtn-warm-100); }
.tab-btn:focus-visible { outline: 2px solid var(--rtn-mustard); outline-offset: -2px; }
.tab-btn[aria-selected="true"] { background: var(--rtn-mustard-tint); color: var(--rtn-ink); font-weight: 500; }
.tab-btn.danger { color: var(--rtn-error); }

/* Document preview */
.doc-frame { width: 100%; height: 60vh; border: var(--border-line); border-radius: 8px; background: var(--rtn-surface); }
.doc-img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 8px; }
#modal.wide-modal { max-width: min(900px, 94vw); width: 100%; }

/* Disabled "coming soon" CTAs */
.cta-disabled-wrap { display: inline-flex; cursor: not-allowed; }
.btn-primary[disabled], .btn-secondary[disabled] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

/* Negative / unsettled balances */
.neg { color: var(--rtn-error); }
.chip.unsettled { background: var(--rtn-warning-bg); color: var(--rtn-warning-deep); }

/* [hidden] must win over a component's own display rule. .default-hint is
   display:inline-flex, which kept the "Tiers are off" banner on screen while
   the toggle read ON. */
[hidden] { display: none !important; }

/* Colour swatch + hex field */
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type="color"] { width: 42px; height: 38px; padding: 2px; border: 1px solid rgba(0,0,0,0.1); border-radius: var(--radius-md); background: var(--rtn-white); cursor: pointer; flex-shrink: 0; }
.color-field .input { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Client error banner (js/app.js). Fixed to the bottom so it never displaces
   the content the merchant is reading. */
.rtn-error-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 9999;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-md, 10px);
  background: var(--rtn-error-bg, #fdeceb); color: var(--rtn-error-deep, #922);
  border: 1px solid var(--rtn-error, #c0392b);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
  font-size: 13px; line-height: 1.5;
}
.rtn-error-banner i.ti { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.rtn-error-banner div { flex: 1; min-width: 0; }
.rtn-error-banner code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; word-break: break-word;
}
.rtn-error-banner .btn-secondary { flex-shrink: 0; }
.rtn-error-close {
  background: none; border: none; color: inherit; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 2px; flex-shrink: 0;
}

/* Promotional free period (js/app.js RTN.promoBanner). Warm, not alarming —
   this is good news, so it must not borrow the error/warning palette. */
.promo-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; margin-bottom: 18px;
  background: var(--rtn-mustard-tint, #fff8dd);
  border: 1px solid var(--rtn-mustard, #FFCE1B);
  border-radius: var(--radius-md, 10px);
}
.promo-icon { font-size: 22px; color: var(--rtn-ink); flex-shrink: 0; line-height: 1.2; }
.promo-title { font-weight: 600; font-size: 15px; color: var(--rtn-ink); }
.promo-sub { font-size: 13px; color: var(--rtn-warm-800); line-height: 1.5; margin-top: 2px; }
.promo-line {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; font-weight: 500; color: var(--rtn-ink);
  background: var(--rtn-mustard-tint, #fff8dd);
  border: 1px solid var(--rtn-mustard, #FFCE1B);
  border-radius: 999px; padding: 4px 12px; margin-top: 8px;
}
.promo-dot { color: var(--rtn-warm-600); }

/* Member transaction history (RTN.memberTxnsHtml) — Members 360 + Customers. */
.mtx { border: var(--border-line, 1px solid #eee); border-radius: 8px; padding: 2px 14px; font-size: 13px; max-height: 280px; overflow-y: auto; }
.mtx-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.mtx-row + .mtx-row { border-top: var(--border-line, 1px solid #eee); }
