/* ============================================================
   style.css — FinanceApprovals v2
   Global styles. No framework dependencies.
   Palette: Concept 02 "Precision Badge"
   ============================================================ */

/* ── Reset / base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Color tokens — light mode ──────────────────────────────── */
:root {
  --color-brand:        #1a3a5c;   /* navy */
  --color-brand-dark:   #122840;   /* navy darkened */
  --color-accent:       #c8860a;   /* amber */
  --color-accent-hover: #a86e08;
  --color-danger:       #c4262e;
  --color-success:      #107c10;
  --color-warning:      #ca5010;
  --color-bg:           #f0f2f5;   /* off-white */
  --color-surface:      #ffffff;
  --color-surface-2:    #f7f8fa;
  --color-border:       #d8dde6;
  --color-text:         #1a1a2e;
  --color-text-muted:   #5a6478;
  --color-nav-bg:       #1a3a5c;
  --color-nav-text:     #ffffff;
  --color-link:         #1a3a5c;
  --radius:             8px;
  --radius-sm:          6px;
  --radius-xs:          4px;
  --shadow-sm:          0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:             0 4px 12px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  --shadow-lg:          0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08);
  --nav-height:         56px;
  --transition:         .18s ease;
  color-scheme:         light;
}

/* ── Color tokens — dark mode ───────────────────────────────── */
[data-theme="dark"] {
  --color-brand:        #4a9fd4;   /* steel blue */
  --color-brand-dark:   #3a8bbf;
  --color-accent:       #f0a830;   /* bright amber */
  --color-accent-hover: #d4921e;
  --color-bg:           #13131f;
  --color-surface:      #1e1e30;
  --color-surface-2:    #252538;
  --color-border:       #2e2e48;
  --color-text:         #e8eaf0;
  --color-text-muted:   #8890a8;
  --color-nav-bg:       #1a1a2e;
  --color-nav-text:     #e8eaf0;
  --color-link:         #4a9fd4;
  color-scheme:         dark;
}

/* ── System preference fallback (when no data-theme is set) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-brand:        #4a9fd4;
    --color-brand-dark:   #3a8bbf;
    --color-accent:       #f0a830;
    --color-accent-hover: #d4921e;
    --color-bg:           #13131f;
    --color-surface:      #1e1e30;
    --color-surface-2:    #252538;
    --color-border:       #2e2e48;
    --color-text:         #e8eaf0;
    --color-text-muted:   #8890a8;
    --color-nav-bg:       #1a1a2e;
    --color-nav-text:     #e8eaf0;
    --color-link:         #4a9fd4;
    color-scheme:         dark;
  }
}

/* ── Base typography ────────────────────────────────────────── */
html, body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  /* Fluid base: 13px on 320px screens, 15px on 1280px+ screens */
  font-size: clamp(13px, 0.8125rem + 0.26vw, 15px);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height for mobile browsers */
  transition: background var(--transition), color var(--transition);
  /* Prevent horizontal overflow on mobile */
  overflow-x: hidden;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--color-nav-bg);
  color: var(--color-nav-text);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  transition: background var(--transition);
}

.nav-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

/* Logo variants — CSS controls which is visible */
.nav-logo-light { display: block; }
.nav-logo-dark  { display: none; }

[data-theme="dark"] .nav-logo-light { display: none; }
[data-theme="dark"] .nav-logo-dark  { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-logo-light { display: none; }
  :root:not([data-theme="light"]) .nav-logo-dark  { display: block; }
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.125rem;
  flex: 1;
}

.nav-item {
  color: rgba(255,255,255,.78);
  text-decoration: none;
  padding: 0.45rem 0.875rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  font-size: 0.875rem;
}
.nav-item:hover  { background: rgba(255,255,255,.12); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }

.badge-soon {
  font-size: 10px;
  background: rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 4px;
  font-weight: 500;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  font-size: 0.85rem;
  color: rgba(255,255,255,.85);
  margin-left: auto;
}

/* Theme toggle button */
.btn-theme-toggle {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.btn-theme-toggle:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.35);
}

/* ── Page states ────────────────────────────────────────────── */
.page-state {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - var(--nav-height));
}

#page-loading {
  flex-direction: column;
  gap: 1rem;
  color: var(--color-text-muted);
}

/* ── Sign-in card ───────────────────────────────────────────── */
.sign-in-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  /* Fluid padding: compact on phones, generous on desktop */
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.5rem);
  max-width: 440px;
  width: 100%;
  text-align: center;
  border: 1px solid var(--color-border);
  transition: background var(--transition), border-color var(--transition);
}

.sign-in-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.75rem;
}

/* Sign-in card logo variants */
.signin-logo-light { display: block; }
.signin-logo-dark  { display: none; }

[data-theme="dark"] .signin-logo-light { display: none; }
[data-theme="dark"] .signin-logo-dark  { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .signin-logo-light { display: none; }
  :root:not([data-theme="light"]) .signin-logo-dark  { display: block; }
}

.sign-in-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}
.sign-in-card p {
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.sign-in-divider {
  height: 1px;
  background: var(--color-border);
  margin: 1.5rem 0;
}

/* ── Info bar ───────────────────────────────────────────────── */
.info-bar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 1.5rem;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  transition: background var(--transition), border-color var(--transition);
}
.info-sep { color: var(--color-border); }

/* ── Module container ───────────────────────────────────────── */
#module-container {
  /* Fluid padding: 0.75rem on small screens, 1.5rem on wide */
  padding: clamp(0.75rem, 2vw, 1.5rem);
  max-width: 1280px;
  margin: 0 auto;
  /* Ensure module fills available vertical space */
  min-height: calc(100dvh - var(--nav-height));
}

.coming-soon {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--color-text-muted);
}
.coming-soon h2 { text-transform: capitalize; margin-bottom: 0.5rem; font-size: 1.25rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}
.btn-primary:hover {
  background: var(--color-brand-dark);
  border-color: var(--color-brand-dark);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover {
  background: var(--color-surface-2);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

.btn-danger    { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { filter: brightness(0.9); box-shadow: var(--shadow-sm); }

.btn-success   { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-success:hover { filter: brightness(0.9); box-shadow: var(--shadow-sm); }

.btn-sm  { padding: 0.35rem 0.7rem; font-size: 0.78rem; border-radius: var(--radius-xs); }
.btn-lg  { padding: 0.7rem 1.75rem; font-size: 1rem; border-radius: var(--radius-sm); }
.btn-xs  { padding: 0.18rem 0.45rem; font-size: 0.72rem; border-radius: var(--radius-xs); }
.btn-link {
  background: none;
  border: none;
  color: var(--color-link);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}
.btn-link:hover { color: var(--color-brand-dark); }

/* ── Form controls ──────────────────────────────────────────── */
.form-control {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(26, 58, 92, .15);
}
[data-theme="dark"] .form-control:focus {
  box-shadow: 0 0 0 3px rgba(74, 159, 212, .2);
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--color-text);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-group { margin-bottom: 1.1rem; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}
.card-header {
  padding: 0.875rem 1.125rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--color-surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 1.125rem; }
.card-footer {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--color-border); }
table { width: 100%; border-collapse: collapse; font-size: clamp(0.75rem, 1.5vw, 0.83rem); }
th, td {
  /* Fluid cell padding: tighter on small screens */
  padding: clamp(0.4rem, 1.2vw, 0.6rem) clamp(0.5rem, 1.8vw, 0.875rem);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
th {
  background: var(--color-surface-2);
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--color-surface-2); }

/* ── Status badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-draft      { background: rgba(90, 100, 120, .12); color: var(--color-text-muted); }
.badge-submitted  { background: rgba(26, 58, 92, .12);   color: #1a3a5c; }
.badge-approved   { background: rgba(16, 124, 16, .12);  color: #0a5e0a; }
.badge-rejected   { background: rgba(196, 38, 46, .12);  color: #9b1c22; }
.badge-processed  { background: rgba(200, 134, 10, .12); color: #7a5200; }

[data-theme="dark"] .badge-submitted  { background: rgba(74, 159, 212, .2);  color: #7ec8ef; }
[data-theme="dark"] .badge-approved   { background: rgba(16, 124, 16, .2);   color: #4ec94e; }
[data-theme="dark"] .badge-rejected   { background: rgba(196, 38, 46, .2);   color: #f07078; }
[data-theme="dark"] .badge-processed  { background: rgba(200, 134, 10, .2);  color: #f0a830; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.125rem;
}
.tab-btn {
  padding: 0.625rem 1.125rem;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}
.tab-btn:hover   { color: var(--color-brand); }
.tab-btn.active  { color: var(--color-brand); border-bottom-color: var(--color-accent); font-weight: 600; }

/* ── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.toolbar-spacer { flex: 1; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6vh;
  overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  width: 100%;
  max-width: 540px;
  margin: 0 1rem 2rem;
  transition: background var(--transition);
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text-muted);
  line-height: 1;
  border-radius: var(--radius-xs);
  padding: 0.125rem 0.375rem;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--color-border); color: var(--color-text); }
.modal-body   { padding: 1.25rem; }
.modal-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Search results (people picker) ────────────────────────── */
.search-results {
  list-style: none;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  background: var(--color-surface);
}
.search-results li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.83rem;
  transition: background var(--transition);
}
.search-results li:hover,
.search-results li.selected {
  background: var(--color-surface-2);
  color: var(--color-brand);
}

/* ── Alerts / banners ───────────────────────────────────────── */
.error-banner {
  background: rgba(196, 38, 46, .08);
  color: #9b1c22;
  border-left: 4px solid var(--color-danger);
  padding: 0.875rem 1.25rem;
  font-size: 0.85rem;
}
[data-theme="dark"] .error-banner { color: #f07078; background: rgba(196, 38, 46, .15); }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.alert-info    { background: rgba(26, 58, 92, .08);  color: #1a3a5c; border-color: rgba(26, 58, 92, .2); }
.alert-success { background: rgba(16, 124, 16, .08); color: #0a5e0a; border-color: rgba(16, 124, 16, .2); }
.alert-warning { background: rgba(202, 80, 16, .08); color: #6b3300; border-color: rgba(202, 80, 16, .2); }
.alert-danger  { background: rgba(196, 38, 46, .08); color: #9b1c22; border-color: rgba(196, 38, 46, .2); }

[data-theme="dark"] .alert-info    { color: #7ec8ef; }
[data-theme="dark"] .alert-success { color: #4ec94e; }
[data-theme="dark"] .alert-warning { color: #f0a830; }
[data-theme="dark"] .alert-danger  { color: #f07078; }

/* ── Toast notification ─────────────────────────────────────── */
.er-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--color-text);
  color: var(--color-surface);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
}
.er-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Receipt attachments ─────────────────────────────────────── */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
}
.attachment-link {
  color: var(--color-link);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}
.attachment-link:hover { text-decoration: underline; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0 0.875rem; gap: 0.75rem; }
  .nav-links { display: none; }
  /* Sign-in card: fluid padding handled via clamp() above; ensure it fills narrow screens */
  .sign-in-card { width: calc(100% - 2rem); }
}

/* ── Walkthrough / Tour (CR-021) ────────────────────────────── */

/* Dark semi-transparent overlay covering the entire page */
.wt-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  pointer-events: auto;
}

/* Transparent spotlight cutout — positioned absolutely over the target element */
.wt-spotlight {
  position: absolute;
  z-index: 10000;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}

/* Tooltip card */
.wt-tooltip {
  position: absolute;
  z-index: 10002;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.125rem 1.25rem 1rem;
  width: min(340px, calc(100vw - 2rem));
  outline: none;
  transition: top 0.25s ease, left 0.25s ease;
}

.wt-tooltip-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-brand);
  margin-bottom: 0.5rem;
}

.wt-tooltip-text {
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}

.wt-tooltip-counter {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.875rem;
}

.wt-tooltip-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Skip button: ghost/muted on the left */
.wt-btn {
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
}

.wt-btn-skip {
  background: none;
  color: var(--color-text-muted);
  margin-right: auto;
  padding-left: 0;
}
.wt-btn-skip:hover { color: var(--color-text); }

.wt-btn-back {
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.wt-btn-back:hover:not(:disabled) { background: var(--color-border); }
.wt-btn-back:disabled { opacity: 0.38; cursor: default; }

.wt-btn-next {
  background: var(--color-brand);
  color: #fff;
}
.wt-btn-next:hover { background: var(--color-brand-dark); }

/* ── Navbar dropdown menu ───────────────────────────────────── */
.nav-menu-wrap {
  position: relative;
}

.btn-nav-menu {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  border-radius: var(--radius-sm);
  height: 36px;
  min-width: 36px;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.btn-nav-menu:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.35);
}
.btn-nav-menu:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.nav-menu-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.nav-menu-hamburger {
  font-size: 1rem;
  line-height: 1;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  z-index: 300;
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}

.nav-dropdown-user {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-dropdown-sep {
  height: 1px;
  background: var(--color-border);
  margin: 0.125rem 0;
}

.nav-dropdown-manager {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.nav-dropdown-label { font-weight: 600; }
.nav-dropdown-manager strong { color: var(--color-text); }

.nav-dropdown-item.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--color-text);
  text-align: left;
  transition: background var(--transition);
}
.nav-dropdown-item.nav-dropdown-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-brand);
}
.nav-dropdown-item.nav-dropdown-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

.nav-dropdown-icon {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.nav-dropdown-signout {
  color: var(--color-danger);
}
.nav-dropdown-signout:hover {
  background: rgba(196,38,46,.06);
  color: var(--color-danger);
}

/* ── Inline row expand (My Team) ────────────────────────────── */
.er-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  transition: color var(--transition), background var(--transition);
  line-height: 1;
}
.er-expand-btn:hover { color: var(--color-brand); background: var(--color-surface-2); }
.er-expand-btn[aria-expanded="true"] { color: var(--color-brand); }

.er-expand-row td {
  padding: 0 !important;
  border-bottom: 2px solid var(--color-accent) !important;
}

.er-inline-expand {
  padding: 1rem 1.125rem;
  background: var(--color-surface-2);
  border-top: 1px solid var(--color-border);
}

.er-inline-expand .table-wrap {
  margin-bottom: 0.875rem;
  border-radius: var(--radius-sm);
}

.er-inline-expand-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}

/* ── Accounting summary panel (CR-017) ──────────────────────── */
.accounting-summary-panel {
  /* inherits .card styles */
}

.accounting-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.accounting-stat-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  min-width: 140px;
  flex: 1;
  transition: background var(--transition), border-color var(--transition);
}

/* Accounting table checkbox column */
.accounting-table th:nth-child(2),
.accounting-table td:nth-child(2) {
  width: 36px;
  text-align: center;
  padding: 0.4rem 0.5rem;
}

/* ── Process button (CR-018) ─────────────────────────────────── */
.acct-process-btn {
  min-width: 90px;
  transition: opacity var(--transition), background var(--transition);
}
.acct-process-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.acct-process-btn--loading {
  opacity: 0.75;
  cursor: wait;
  pointer-events: none;
}
/* Animated ellipsis while processing */
@keyframes acct-ellipsis {
  0%   { content: '\2026'; }
  33%  { content: '.'; }
  66%  { content: '..'; }
  100% { content: '\2026'; }
}
.acct-process-btn--loading::after {
  display: none; /* text already contains ellipsis via JS */
}

/* ── Mobile tab bar — base (hidden on desktop) ─────────────── */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(0,0,0,.1);
  z-index: 150;
  align-items: stretch;
  transition: background var(--transition), border-color var(--transition);
}

/* ── Mobile: bottom tab bar ──────────────────────────────────── */
@media (max-width: 768px) {
  /* Push content above the tab bar */
  #app-shell {
    padding-bottom: 62px;
  }

  .tabs {
    display: none;
  }

  .mobile-tab-bar {
    display: flex;
  }
}

.mobile-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 0.35rem 0.25rem;
  min-height: 44px;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab-btn:active { background: var(--color-surface-2); }
.mobile-tab-btn.active {
  color: var(--color-brand);
  font-weight: 700;
}
[data-theme="dark"] .mobile-tab-btn.active { color: var(--color-brand); }

.mobile-tab-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* ── Mobile: FAB for New Report ─────────────────────────────── */
.fab-new-report {
  display: none;
}

@media (max-width: 768px) {
  .fab-new-report {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 74px;
    right: 1.25rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-lg);
    font-size: 1.6rem;
    cursor: pointer;
    z-index: 160;
    transition: background var(--transition), box-shadow var(--transition), transform .12s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .fab-new-report:active { transform: scale(0.93); }
  .fab-new-report:hover  { background: var(--color-brand-dark); box-shadow: 0 6px 20px rgba(0,0,0,.2); }

  /* Hide the toolbar New Report button on mobile */
  .toolbar-new-report { display: none !important; }
}

/* ── Card list — never shown (table-only approach on all viewports) ── */
.report-card-list { display: none !important; }

/* ── Mobile: table-based layout ─────────────────────────────── */
@media (max-width: 768px) {
  /* Restore module container padding so the table has breathing room */
  #module-container {
    padding: clamp(0.5rem, 2vw, 0.75rem);
  }

  /* Toolbar: compact but still padded */
  .toolbar {
    padding: 0;
    margin-bottom: 0.625rem;
  }

  /* Table wrapper: no horizontal scroll — let the table reflow */
  .table-wrap {
    overflow-x: hidden;
  }

  /* Larger, readable table text on mobile */
  .my-reports-table,
  .my-team-table {
    width: 100%;
    table-layout: auto;
    font-size: 0.95rem;
  }

  /* Touch-friendly rows — no word wrap */
  .my-reports-table td,
  .my-team-table td {
    padding: 0.625rem 0.5rem;
    min-height: 44px;
    vertical-align: middle;
    white-space: nowrap;
  }

  /* Title column: only column that can truncate if needed */
  .my-reports-table td:nth-child(1),
  .my-team-table td:nth-child(3) {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .my-reports-table th,
  .my-team-table th {
    padding: 0.5rem 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* Status column: always show full badge — no shrink */
  .my-reports-table td:nth-child(2),
  .my-reports-table th:nth-child(2) {
    white-space: nowrap;
    width: 1%;
  }

  /* Amount column: right-align, always show full value.
     My Reports col 3 = Total Amount (DOM position 3).
     My Team col 5 = Total Amount (DOM position 5; cols 1,4,6 are hidden). */
  .my-reports-table td:nth-child(3),
  .my-reports-table th:nth-child(3),
  .my-team-table td:nth-child(5),
  .my-team-table th:nth-child(5) {
    text-align: right;
    white-space: nowrap;
    width: 1%;
  }
}

/* ── Mobile: hide extra columns so 3-column layouts fit ─────── */
/*
  My Reports columns: 1=Title, 2=Status, 3=Total Amount, 4=Submitted Date
  Mobile: show Title, Status, Total Amount — hide Submitted Date (col 4)

  My Team columns: 1=Chevron, 2=Employee, 3=Report Title, 4=Status, 5=Total Amount, 6=Submitted Date
  Mobile: show Employee, Report Title, Total Amount — hide Chevron (col 1), Status (col 4), Submitted Date (col 6)
  After hiding cols 1, 4, 6 the visible order becomes: Employee(2), Report Title(3), Total Amount(5)
  The amount right-align rule above targets nth-child(3) of the *visible* layout via the table-layout rules.
*/
@media (max-width: 768px) {
  /* My Reports: show only Title (1), Status (2), Total Amount (3) — hide Submitted Date (4) */
  .my-reports-table th:nth-child(4),
  .my-reports-table td:nth-child(4) { display: none; }

  /* My Team: show only Employee (2), Report Title (3), Total Amount (5)
     Hide: Chevron (1), Status (4), Submitted Date (6) */
  .my-team-table th:nth-child(1),
  .my-team-table td:nth-child(1),
  .my-team-table th:nth-child(4),
  .my-team-table td:nth-child(4),
  .my-team-table th:nth-child(6),
  .my-team-table td:nth-child(6) { display: none; }

  /* Hide All Reports and Accounting tabs on mobile — they are role-gated on desktop
     and not appropriate for the mobile workflow. */
  .tab-btn[data-tab="all-reports"],
  .tab-btn[data-tab="accounting"] { display: none; }
}

/* ── Safe-area insets for notched devices (iPhone X+, Android) ── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-tab-bar {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(62px + env(safe-area-inset-bottom));
  }

  @media (max-width: 768px) {
    #app-shell {
      padding-bottom: calc(62px + env(safe-area-inset-bottom));
    }
  }
}

/* ── Receipt Preview Modal ────────────────────────────────── */
.receipt-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.receipt-preview-modal {
  background: var(--color-surface, #fff);
  border-radius: 8px;
  max-width: 90vw;
  max-height: 90vh;
  width: 800px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.receipt-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.9rem;
  gap: 0.5rem;
}

.receipt-preview-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 0.25rem;
  flex-shrink: 0;
}
.receipt-preview-close:hover {
  color: var(--color-text);
}

.receipt-preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 300px;
}

.receipt-preview-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}

.receipt-preview-iframe {
  width: 100%;
  height: 80vh;
  border: none;
  border-radius: 4px;
}

/* ── Admin navbar button (CR-020) ────────────────────────── */
.nav-admin-wrap {
  position: relative;
}

.btn-nav-admin {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.9);
  border-radius: var(--radius-sm);
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.05rem;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
  padding: 0;
}
.btn-nav-admin:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.35);
}
.btn-nav-admin:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.nav-admin-icon {
  line-height: 1;
  font-style: normal;
}

/* The admin dropdown reuses .nav-dropdown positioning/style.
   Override right-alignment relative to its own wrap. */
.nav-admin-dropdown {
  right: 0;
  min-width: 210px;
}

/* ── Expense Types admin view (CR-020) ───────────────────── */
.expense-types-admin {
  padding: clamp(1rem, 3vw, 1.75rem);
  max-width: 900px;
  margin: 0 auto;
}

.et-admin-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.et-admin-title {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.et-admin-back-btn {
  flex-shrink: 0;
}

.et-admin-add-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.et-admin-table-wrap {
  overflow-x: auto;
}

.et-admin-table {
  width: 100%;
}

.et-admin-table th,
.et-admin-table td {
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

.et-action-cell {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

/* Smaller inputs in edit rows */
.form-control-sm {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  height: auto;
}

/* Highlight the in-progress add row */
.et-add-row td {
  background: var(--color-surface-2);
}

.et-admin-status {
  padding: 0.75rem 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}
