/* =============================================================================
 * Shemify - Tracker #22 - Recurring Transactions Page CSS (phase22_a)
 *
 * Lessons applied from #10/#20/#26:
 *   - 24px 32px page padding (no max-width squeeze)
 *   - .ui-dropdown scoped to #recurring-host with width:auto to override
 *     the global :466 width:100% rule
 *   - .rec-input :hover/:focus/.is-saving/.is-error use !important to win
 *     cascade vs shell-override-v2.css :540-547
 *   - 13px uppercase KPI labels, SVG help icon, 44x44 modal close
 *   - All glass surfaces: gradient + inset box-shadow + backdrop-filter
 *   - No raw hex outside tokens
 * =============================================================================
 */

/* ----- Page shell ------------------------------------------------------- */
.rec-page {
  padding: 24px 32px;
  width: 100%;
  box-sizing: border-box;
  color: var(--ink);
  font-family: var(--font);
}

.rec-page-header { margin-bottom: 24px; }
.rec-page-title-row {
  display: flex; align-items: center; gap: 12px;
}
.rec-page-title {
  font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  margin: 0; color: var(--ink);
  text-shadow: 0 0 30px rgba(200, 160, 76, .06);
}
.rec-page-tagline {
  margin: 8px 0 0 0;
  color: var(--ink-3); font-size: 13px; max-width: 720px; line-height: 1.5;
}
.rec-page-actions {
  margin-top: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

/* Help icon (SVG, lesson from #26) */
.rec-help-icon {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .04);
  color: var(--ink-3);
  border: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  border-radius: 50%;
  cursor: pointer;
  transition: all .2s var(--spring);
}
.rec-help-icon:hover {
  color: var(--gold);
  background: rgba(200, 160, 76, .08);
  box-shadow: inset 0 0 0 1px rgba(200, 160, 76, .2);
}

/* ----- KPI strip -------------------------------------------------------- */
.rec-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.rec-kpi-card {
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03) 0%, rgba(255, 255, 255, .015) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 2px 8px rgba(0, 0, 0, .2);
  border-radius: var(--r-lg);
  backdrop-filter: blur(8px);
}
.rec-kpi-label {
  font-size: 13px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4);
}
.rec-kpi-value {
  font-size: 44px; font-weight: 200;
  letter-spacing: -.05em; color: var(--ink);
  margin: 8px 0 4px 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .5), 0 0 40px rgba(200, 160, 76, .04);
}
.rec-kpi-sub {
  font-size: 11px; color: var(--ink-3);
}

@media (max-width: 1100px) {
  .rec-kpi-strip { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .rec-kpi-strip { grid-template-columns: 1fr; }
}

/* ----- Schedule grid + cards ------------------------------------------- */
.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.rec-card {
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03) 0%, rgba(255, 255, 255, .015) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), 0 2px 8px rgba(0, 0, 0, .2);
  border-radius: var(--r-lg);
  backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform .2s var(--spring), box-shadow .2s var(--spring);
  position: relative;
}
.rec-card:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08),
              0 8px 32px rgba(0, 0, 0, .3),
              0 0 40px rgba(200, 160, 76, .04);
}
.rec-card.is-paused { opacity: .65; }
.rec-card.is-active::before {
  content: ''; position: absolute; left: 0; top: 24px; bottom: 24px;
  width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  box-shadow: 0 0 12px rgba(200, 160, 76, .5);
}
.rec-card.is-paused::before {
  content: ''; position: absolute; left: 0; top: 24px; bottom: 24px;
  width: 3px; border-radius: 2px;
  background: var(--amber);
  opacity: .6;
}
.rec-card-head {
  display: flex; justify-content: space-between; align-items: center;
}
.rec-card-type-pill {
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(200, 160, 76, .12), rgba(200, 160, 76, .06));
  color: var(--gold);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(200, 160, 76, .15);
}
.rec-card-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  letter-spacing: .04em;
}
.rec-status-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4);
}
.rec-card.is-active .rec-status-dot {
  background: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, .5);
}
.rec-card.is-paused .rec-status-dot {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, .35);
}
.rec-card-name {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink);
  margin-top: 4px;
}
.rec-card-counterparty {
  font-size: 12px; color: var(--ink-3);
}
.rec-card-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-3);
  margin-top: 4px;
}
.rec-card-runs {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .04);
  display: flex; flex-direction: column; gap: 4px;
}
.rec-card-runs-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px;
}
.rec-card-runs-label {
  color: var(--ink-4);
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.rec-card-runs-val { color: var(--ink-2); font-weight: 500; }
.rec-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .04);
}
.rec-card-action {
  flex: 1; min-width: 80px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  font-size: 12px; font-weight: 600;
  border: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all .2s var(--spring);
  min-height: 36px;
}
.rec-card-action:hover {
  background: rgba(255, 255, 255, .08);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.rec-card-action-danger {
  color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .15);
}
.rec-card-action-danger:hover {
  background: rgba(248, 113, 113, .08);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25);
}

/* ----- Empty / loading -------------------------------------------------- */
.rec-loading,
.rec-empty {
  padding: 48px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02) 0%, rgba(255, 255, 255, .005) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
  border-radius: var(--r-lg);
  text-align: center;
  color: var(--ink-3);
}
.rec-empty-title {
  font-size: 16px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
.rec-empty p { margin: 4px auto; max-width: 480px; line-height: 1.5; font-size: 13px; }
.rec-empty button { margin-top: 16px; }

/* ----- Buttons ---------------------------------------------------------- */
.rec-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  min-height: 36px;
  transition: all .22s var(--spring);
}
.rec-btn-primary {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 100%);
  color: var(--void);
  font-weight: 700;
  box-shadow: 0 2px 12px rgba(200, 160, 76, .25), 0 0 30px rgba(200, 160, 76, .1), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.rec-btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 28px rgba(200, 160, 76, .4), 0 0 60px rgba(200, 160, 76, .15), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.rec-btn-primary[disabled] {
  opacity: .55; cursor: not-allowed; transform: none;
  box-shadow: none; background: rgba(255, 255, 255, .06); color: var(--ink-3);
  filter: grayscale(1);
}
.rec-btn-ghost {
  background: rgba(255, 255, 255, .05); color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 2px 8px rgba(0, 0, 0, .2);
}
.rec-btn-ghost:hover { background: rgba(255, 255, 255, .09); transform: translateY(-1px) scale(1.01); }
.rec-btn-danger {
  background: rgba(248, 113, 113, .12); color: var(--red); font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .15);
}
.rec-btn-danger:hover { background: rgba(248, 113, 113, .18); }

/* ----- Forms (inside modals) -------------------------------------------- */
.rec-form { display: flex; flex-direction: column; gap: 16px; }
.rec-form-row { display: flex; flex-direction: column; gap: 6px; }
.rec-form-row label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.rec-form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .rec-form-grid-2 { grid-template-columns: 1fr; }
}
.rec-hint {
  font-size: 11px; color: var(--ink-4);
  margin: 4px 0 0 0; line-height: 1.5;
}
.rec-hint strong { color: var(--ink-2); }

/* Lesson from #20: state CSS uses !important to win shell-override-v2.css cascade */
.rec-input {
  width: 100%; box-sizing: border-box;
  padding: 10px 14px; font-size: 14px;
  background: rgba(255, 255, 255, .03);
  color: var(--ink);
  border: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  border-radius: var(--r-sm);
  font-family: inherit;
  transition: all .2s var(--spring);
  color-scheme: dark;
}
.rec-input:hover {
  background: rgba(255, 255, 255, .05) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12) !important;
}
.rec-input:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(200, 160, 76, .12), inset 0 0 0 1px rgba(200, 160, 76, .2) !important;
}
.rec-input.is-saving {
  background: rgba(96, 165, 250, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .2) !important;
}
.rec-input.is-saved {
  background: rgba(74, 222, 128, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, .2) !important;
}
.rec-input.is-error {
  background: rgba(248, 113, 113, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25) !important;
}
.rec-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7); opacity: .6; cursor: pointer;
}
textarea.rec-input { min-height: 80px; resize: vertical; }
.rec-input.rec-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Wizard cards */
.rec-wizard-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 700px) {
  .rec-wizard-row { grid-template-columns: 1fr; }
}
.rec-wizard-card {
  padding: 20px 16px;
  background: rgba(255, 255, 255, .04);
  border: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  border-radius: var(--r);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: all .22s var(--spring);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.rec-wizard-card:hover {
  transform: translateY(-2px) scale(1.01);
  background: rgba(200, 160, 76, .04);
  box-shadow: inset 0 0 0 1px rgba(200, 160, 76, .25), 0 4px 16px rgba(200, 160, 76, .08);
}
.rec-wizard-card-icon { color: var(--gold); margin-bottom: 4px; }
.rec-wizard-card-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.rec-wizard-card-sub { font-size: 11px; color: var(--ink-3); line-height: 1.4; }

/* JE table */
.rec-je-table {
  width: 100%; border-collapse: collapse;
}
.rec-je-table th {
  font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  text-align: left; padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.rec-je-table th.rec-num,
.rec-je-table td.rec-num { text-align: right; }
.rec-je-table td { padding: 6px; }

/* Council Round 1 Order 5 — live debit/credit/difference totals row.
 * Sits directly under the JE lines table so Tiffany can see whether the
 * entry balances at a glance. Difference is red (--red) until it equals
 * exactly $0.00, then green (--green). */
.rec-je-totals {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
  border-radius: var(--r-sm);
}
.rec-je-totals-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.rec-je-totals-cell { text-align: right; }
.rec-je-totals-label {
  font-size: 9px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 2px;
}
.rec-je-totals-val {
  font-size: 16px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -.01em;
}
.rec-je-totals-diff.is-imbalanced {
  color: var(--red) !important;
  text-shadow: 0 0 12px rgba(248, 113, 113, .25);
}
.rec-je-totals-diff.is-balanced {
  color: var(--green) !important;
  text-shadow: 0 0 12px rgba(74, 222, 128, .25);
}
@media (max-width: 600px) {
  .rec-je-totals-row { grid-template-columns: 1fr; gap: 6px; }
  .rec-je-totals-cell { display: flex; justify-content: space-between; align-items: baseline; text-align: left; }
}

/* ----- .ui-dropdown scoped width:auto (lesson from #10) ---------------- */
/* The .ui-dropdown system relies on per-page CSS for trigger + menu styling
 * (the global ui-components.css :466 only defines width:100% — every
 * consumer scopes its own visual rules). Mirrors the banking.js pattern. */
#recurring-host .ui-dropdown,
.modal-overlay.rec-modal .ui-dropdown {
  position: relative;
  display: inline-block;
  width: auto;
}
#recurring-host .ui-dropdown-trigger,
.modal-overlay.rec-modal .ui-dropdown-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02));
  color: var(--ink);
  font: 500 13px var(--font);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  min-height: 36px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  transition: all .22s var(--spring);
}
#recurring-host .ui-dropdown-trigger:hover,
.modal-overlay.rec-modal .ui-dropdown-trigger:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
}
#recurring-host .ui-dropdown-chevron,
.modal-overlay.rec-modal .ui-dropdown-chevron {
  transition: transform .2s ease; opacity: .6;
}
#recurring-host .ui-dropdown.open .ui-dropdown-chevron,
.modal-overlay.rec-modal .ui-dropdown.open .ui-dropdown-chevron {
  transform: rotate(180deg);
}
#recurring-host .ui-dropdown-menu,
.modal-overlay.rec-modal .ui-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px); left: 0;
  min-width: 100%;
  background: var(--elevated);
  backdrop-filter: blur(20px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 32px rgba(0, 0, 0, .5);
  border-radius: var(--r);
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-8px) scale(.98);
  pointer-events: none;
  transition: all .22s var(--spring);
  z-index: 1100;
}
#recurring-host .ui-dropdown.open .ui-dropdown-menu,
.modal-overlay.rec-modal .ui-dropdown.open .ui-dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#recurring-host .ui-dropdown-item,
.modal-overlay.rec-modal .ui-dropdown-item {
  padding: 8px 12px 8px 28px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease;
  position: relative;
}
#recurring-host .ui-dropdown-item:hover,
.modal-overlay.rec-modal .ui-dropdown-item:hover {
  background: rgba(255, 255, 255, .05);
}
#recurring-host .ui-dropdown-item.selected::before,
.modal-overlay.rec-modal .ui-dropdown-item.selected::before {
  content: ''; position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(200, 160, 76, .5);
}
html.light #recurring-host .ui-dropdown-trigger,
html.light .modal-overlay.rec-modal .ui-dropdown-trigger {
  background: linear-gradient(180deg, #FFFFFF, #FAFAF8);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light #recurring-host .ui-dropdown-menu,
html.light .modal-overlay.rec-modal .ui-dropdown-menu {
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 8px 32px rgba(0, 0, 0, .10);
}

/* ----- Modal local size variants (the global .modal-overlay system
 *       handles spring entrance, RGB orb, backdrop blur, shell parallax) -- */
.modal-overlay.rec-modal .modal-panel.rec-modal-sm { max-width: 420px; }
.modal-overlay.rec-modal .modal-panel.rec-modal-md { max-width: 640px; }
.modal-overlay.rec-modal .modal-close {
  width: 44px; height: 44px;  /* lesson from #10: 44x44 touch target */
}

/* ----- Light mode parity ------------------------------------------------ */
html.light .rec-page-title-row { color: var(--ink); }
html.light .rec-help-icon {
  background: rgba(0, 0, 0, .04);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light .rec-kpi-card,
html.light .rec-card,
html.light .rec-loading,
html.light .rec-empty {
  background: rgba(255, 255, 255, .85);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}
html.light .rec-input {
  background: rgba(255, 255, 255, .9);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light .rec-input:hover {
  background: rgba(255, 255, 255, 1) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12) !important;
}
