/* =============================================================================
 * Shemify - Tracker #21 - Expenses Page CSS (phase21_a)
 *
 * Lessons applied UPFRONT from #20 + #26 + #22:
 *   - 24px 32px page padding (no max-width squeeze)
 *   - .ui-dropdown scoped to #expenses-host with width:auto + per-page menu CSS
 *     (banking.js pattern; global ui-components.css only declares width:100%)
 *   - .exp-input :hover/:focus/.is-saving/.is-saved/.is-error use !important
 *     to defeat shell-override-v2.css :540-547 cascade
 *   - 13px uppercase KPI labels, SVG help icon, 44x44 modal close
 *   - All glass surfaces: gradient + inset box-shadow + backdrop-filter
 * =============================================================================
 */

/* ----- Page shell ------------------------------------------------------- */
.exp-page {
  padding: 24px 32px;
  width: 100%;
  box-sizing: border-box;
  color: var(--ink);
  font-family: var(--font);
}

.exp-page-header { margin-bottom: 24px; }
.exp-page-title-row {
  display: flex; align-items: center; gap: 12px;
}
.exp-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);
}
.exp-page-tagline {
  margin: 8px 0 0 0;
  color: var(--ink-3); font-size: 13px; max-width: 720px; line-height: 1.5;
}
.exp-page-actions {
  margin-top: 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}

.exp-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);
}
.exp-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 -------------------------------------------------------- */
.exp-kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.exp-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);
}
.exp-kpi-label {
  font-size: 13px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4);
}
.exp-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);
}
.exp-kpi-sub { font-size: 11px; color: var(--ink-3); }
@media (max-width: 1100px) { .exp-kpi-strip { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px)  { .exp-kpi-strip { grid-template-columns: 1fr; } }

/* ----- Expense grid + cards -------------------------------------------- */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.exp-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;
}
.exp-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);
}

/* status side-bars */
.exp-card::before {
  content: ''; position: absolute; left: 0; top: 24px; bottom: 24px;
  width: 3px; border-radius: 2px;
  background: var(--ink-4);
}
.exp-card.is-draft::before    { background: var(--ink-3); }
.exp-card.is-pending::before  { background: var(--amber); box-shadow: 0 0 12px rgba(251,191,36,.5); }
.exp-card.is-approved::before { background: var(--blue);  box-shadow: 0 0 12px rgba(96,165,250,.5); }
.exp-card.is-posted::before   { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); box-shadow: 0 0 12px rgba(200,160,76,.5); }
.exp-card.is-rejected::before { background: var(--red);   box-shadow: 0 0 12px rgba(248,113,113,.5); }
.exp-card.is-rejected         { opacity: .65; }
.exp-card.is-posted           { opacity: .92; }

.exp-card-head {
  display: flex; justify-content: space-between; align-items: center;
}
.exp-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);
}
.exp-card-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-3);
  letter-spacing: .04em;
}
.exp-status-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-4);
}
.exp-card.is-pending  .exp-status-dot { background: var(--amber); box-shadow: 0 0 8px rgba(251,191,36,.5); }
.exp-card.is-approved .exp-status-dot { background: var(--blue);  box-shadow: 0 0 8px rgba(96,165,250,.5); }
.exp-card.is-posted   .exp-status-dot { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,.5); }
.exp-card.is-rejected .exp-status-dot { background: var(--red);   box-shadow: 0 0 8px rgba(248,113,113,.5); }

.exp-card-merchant {
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--ink);
  margin-top: 4px;
  word-break: break-word;
}
.exp-card-amount {
  font-size: 24px; font-weight: 200; letter-spacing: -.03em; color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(200,160,76,.15);
}
.exp-card-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-3);
}
.exp-card-account {
  font-size: 11px; color: var(--ink-4);
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .04);
}
.exp-card-rejection {
  font-size: 11px; color: var(--red);
  padding: 8px 10px;
  background: rgba(248, 113, 113, .06);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .15);
  border-radius: var(--r-sm);
}
.exp-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .04);
}
.exp-card-action {
  flex: 1; min-width: 70px;
  padding: 12px 14px;
  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);
  /* Council Round 1 Order 7 — 44px minimum touch target (CLAUDE.md). */
  min-height: 44px;
}
.exp-card-action:hover {
  background: rgba(255, 255, 255, .08);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.exp-card-action-primary {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: var(--void); font-weight: 700;
  box-shadow: 0 2px 12px rgba(200, 160, 76, .25), inset 0 1px 0 rgba(255,255,255,.2);
}
.exp-card-action-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 28px rgba(200, 160, 76, .4), inset 0 1px 0 rgba(255,255,255,.25);
}
.exp-card-action-danger {
  color: var(--red);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .15);
}
.exp-card-action-danger:hover {
  background: rgba(248, 113, 113, .08);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25);
}

/* ----- Empty / loading -------------------------------------------------- */
.exp-loading,
.exp-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);
}
.exp-empty-title {
  font-size: 16px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
.exp-empty p { margin: 4px auto; max-width: 480px; line-height: 1.5; font-size: 13px; }
.exp-empty button { margin-top: 16px; }

/* ----- Buttons ---------------------------------------------------------- */
.exp-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--r-sm);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  /* Council Round 1 Order 7 — 44px minimum touch target (CLAUDE.md). */
  min-height: 44px;
  transition: all .22s var(--spring);
}
.exp-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);
}
.exp-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);
}
.exp-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);
}
.exp-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);
}
.exp-btn-ghost:hover { background: rgba(255, 255, 255, .09); transform: translateY(-1px) scale(1.01); }
.exp-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);
}
.exp-btn-danger:hover { background: rgba(248, 113, 113, .18); }

/* ----- Forms (inside modals) -------------------------------------------- */
.exp-form { display: flex; flex-direction: column; gap: 16px; }
.exp-form-row { display: flex; flex-direction: column; gap: 6px; }
.exp-form-row label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-3);
}
.exp-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.exp-form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 600px) {
  .exp-form-grid-2, .exp-form-grid-3 { grid-template-columns: 1fr; }
}
.exp-hint {
  font-size: 11px; color: var(--ink-4);
  margin: 4px 0 0 0; line-height: 1.5;
}
.exp-hint strong { color: var(--ink-2); }
.exp-hint-error {
  color: var(--red);
}
.exp-hint-error strong { color: var(--red); }
.exp-card-attachment-icon {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink-3);
}
.exp-card-submitter,
.exp-card-approver {
  font-size: 11px; color: var(--ink-3);
}
.exp-card-submitter strong,
.exp-card-approver strong { color: var(--ink-2); font-weight: 600; }
.exp-card-notes-snippet {
  font-size: 11px; color: var(--ink-3);
  font-style: italic;
  padding: 4px 0;
  line-height: 1.4;
}
.exp-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2);
  text-transform: none; letter-spacing: 0; font-weight: 500;
  cursor: pointer;
}
.exp-checkbox input { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }

/* Lesson from #20: state CSS uses !important to win shell-override-v2.css cascade.
 * Council Round 1 Order 7 — bump padding to give 44px min-height
 * (12px top + 12px bottom + 14px font-size with 1.4 line-height ≈ 44.8px). */
.exp-input {
  width: 100%; box-sizing: border-box;
  padding: 12px 16px; font-size: 14px;
  min-height: 44px;
  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;
}
.exp-input:hover {
  background: rgba(255, 255, 255, .05) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12) !important;
}
.exp-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;
}
.exp-input.is-saving {
  background: rgba(96, 165, 250, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .2) !important;
}
.exp-input.is-saved {
  background: rgba(74, 222, 128, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(74, 222, 128, .2) !important;
}
.exp-input.is-error {
  background: rgba(248, 113, 113, .04) !important;
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .25) !important;
}
.exp-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7); opacity: .6; cursor: pointer;
}
textarea.exp-input { min-height: 80px; resize: vertical; }
select.exp-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%239898A8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.exp-mileage-preview {
  padding: 10px 14px;
  background: rgba(200, 160, 76, .06);
  box-shadow: inset 0 0 0 1px rgba(200, 160, 76, .15);
  border-radius: var(--r-sm);
  font-size: 14px; color: var(--ink-2);
}
.exp-mileage-preview strong {
  color: var(--gold);
  font-size: 18px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(200,160,76,.25);
  margin-left: 6px;
}

/* Wizard cards */
.exp-wizard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 700px) { .exp-wizard-row { grid-template-columns: 1fr; } }
.exp-wizard-card {
  padding: 24px 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;
}
.exp-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);
}
.exp-wizard-card-icon { color: var(--gold); margin-bottom: 4px; }
.exp-wizard-card-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.exp-wizard-card-sub { font-size: 11px; color: var(--ink-3); line-height: 1.4; }

/* ----- .ui-dropdown scoped (lesson from #22 R1: per-page menu CSS) ----- */
#expenses-host .ui-dropdown,
.modal-overlay.exp-modal .ui-dropdown {
  position: relative;
  display: inline-block;
  width: auto;
}
#expenses-host .ui-dropdown-trigger,
.modal-overlay.exp-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);
}
#expenses-host .ui-dropdown-trigger:hover,
.modal-overlay.exp-modal .ui-dropdown-trigger:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
}
#expenses-host .ui-dropdown-chevron,
.modal-overlay.exp-modal .ui-dropdown-chevron { transition: transform .2s ease; opacity: .6; }
#expenses-host .ui-dropdown.open .ui-dropdown-chevron,
.modal-overlay.exp-modal .ui-dropdown.open .ui-dropdown-chevron { transform: rotate(180deg); }
#expenses-host .ui-dropdown-menu,
.modal-overlay.exp-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;
}
#expenses-host .ui-dropdown.open .ui-dropdown-menu,
.modal-overlay.exp-modal .ui-dropdown.open .ui-dropdown-menu {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#expenses-host .ui-dropdown-item,
.modal-overlay.exp-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;
}
#expenses-host .ui-dropdown-item:hover,
.modal-overlay.exp-modal .ui-dropdown-item:hover {
  background: rgba(255, 255, 255, .05);
}
#expenses-host .ui-dropdown-item.selected::before,
.modal-overlay.exp-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 #expenses-host .ui-dropdown-trigger,
html.light .modal-overlay.exp-modal .ui-dropdown-trigger {
  background: linear-gradient(180deg, #FFFFFF, #FAFAF8);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light #expenses-host .ui-dropdown-menu,
html.light .modal-overlay.exp-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 ---------------------------------------- */
.modal-overlay.exp-modal .modal-panel.exp-modal-sm { max-width: 420px; }
.modal-overlay.exp-modal .modal-panel.exp-modal-md { max-width: 640px; }
.modal-overlay.exp-modal .modal-close {
  width: 44px; height: 44px;  /* lesson from #10: 44x44 touch target */
}

/* ----- Light mode parity ------------------------------------------------ */
html.light .exp-page-title-row { color: var(--ink); }
html.light .exp-help-icon {
  background: rgba(0, 0, 0, .04);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light .exp-kpi-card,
html.light .exp-card,
html.light .exp-loading,
html.light .exp-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 .exp-input {
  background: rgba(255, 255, 255, .9);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
}
html.light .exp-input:hover {
  background: rgba(255, 255, 255, 1) !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12) !important;
}
