:root {
  --blue: #2563eb;
  --blue-lt: #dbeafe;
  --blue-mid: #93c5fd;
  --teal: #0d9488;
  --teal-lt: #ccfbf1;
  --amber: #d97706;
  --amber-lt: #fef3c7;
  --rose: #e11d48;
  --rose-lt: #ffe4e6;
  --green: #16a34a;
  --green-lt: #dcfce7;
  --sky: #0ea5e9;
  --sky-lt: #e0f2fe;
  --indigo: #4f46e5;
  --bg: #f0f7ff;
  --surface: #ffffff;
  --border: #dbeafe;
  --border2: #bfdbfe;
  --text: #1e3a5f;
  --text-2: #4b6b8a;
  --text-3: #7b9ab5;
  --sidebar-bg: #1e3a5f;
  --sidebar-w: 250px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(37, 99, 235, 0.1);
  --shadow-lg: 0 8px 40px rgba(37, 99, 235, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 28px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-logo h1 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 900;
  color: #60a5fa;
  letter-spacing: -0.5px;
}
.sidebar-logo p {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.38);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 14px 0;
  flex: 1;
}
.nav-section {
  font-size: 0.62rem;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 14px 22px 5px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.nav-item.active {
  color: #93c5fd;
  border-left-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}
.nav-item i {
  width: 18px;
  text-align: center;
  font-size: 0.85rem;
}

.sync-indicator {
  padding: 14px 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  flex-shrink: 0;
}
.sync-dot.syncing {
  background: #fbbf24;
  animation: pulse 1s infinite;
}
.sync-dot.error {
  background: #f87171;
}
.sync-dot.dirty {
  background: #fbbf24;
}
/* v1.17: shown until the first successful cloud pull; app is read-only while visible */
#load-banner {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--amber-lt);
  border-bottom: 1.5px solid var(--amber);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 22px;
}
#load-banner.show {
  display: flex;
}
#load-banner.error {
  background: var(--rose-lt);
  border-bottom-color: var(--rose);
}
#load-banner .btn {
  margin-left: auto;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ── MAIN ── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.07);
}
.topbar-title {
  font-family: 'Fraunces', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
}
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  letter-spacing: 0.2px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}
.btn-teal {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
}
.btn-teal:hover {
  background: #0f766e;
}
.btn-secondary {
  background: var(--blue-lt);
  color: var(--blue);
  border: 1px solid var(--border2);
}
.btn-secondary:hover {
  background: var(--border2);
}
.btn-danger {
  background: var(--rose);
  color: #fff;
}
.btn-danger:hover {
  background: #be123c;
}
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--blue-lt);
  color: var(--blue);
}
.btn-sm {
  padding: 6px 13px;
  font-size: 0.78rem;
}
.btn-xs {
  padding: 4px 10px;
  font-size: 0.73rem;
}

/* ── PAGE ── */
.page-content {
  padding: 32px;
}
.view {
  display: none;
  animation: fadeIn 0.2s ease;
}
.view.active {
  display: block;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── STATS ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card .sc-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.stat-card .sc-label {
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
}
.stat-card .sc-value {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
  line-height: 1;
}
.stat-card .sc-sub {
  font-size: 0.77rem;
  color: var(--text-3);
  margin-top: 4px;
}
.stat-card.clickable {
  cursor: pointer;
  transition: all 0.2s;
}
.stat-card.clickable:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--blue-mid);
}
.stat-card.clickable:hover .sc-value {
  color: var(--blue);
}
.stat-card.clickable:hover .sc-label {
  color: var(--blue);
}

/* ── CALENDAR ── */
.calendar-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--blue-lt), #fff);
}
.cal-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  color: var(--blue);
}
.cal-nav {
  display: flex;
  gap: 6px;
}
.cal-nav button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  transition: all 0.15s;
}
.cal-nav button:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-day-label {
  text-align: center;
  padding: 10px 0;
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.cal-cell {
  min-height: 88px;
  padding: 6px 7px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.cal-cell:nth-child(7n) {
  border-right: none;
}
.cal-cell.other-month {
  background: rgba(240, 247, 255, 0.6);
  opacity: 0.5;
}
.cal-cell.today {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(14, 165, 233, 0.04));
}
.day-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 3px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-cell.today .day-num {
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
}
.cal-trip-bar {
  display: block;
  transition: opacity 0.15s;
  user-select: none;
}
.cal-trip-bar:hover {
  opacity: 0.82;
}

/* ── TRIPS GRID ── */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.trip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.trip-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.trip-card-banner {
  height: 6px;
}
.trip-card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.trip-card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.trip-card-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.trip-status {
  font-size: 0.67rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  text-transform: uppercase;
}
.status-planning {
  background: var(--sky-lt);
  color: var(--sky);
}
.status-confirmed {
  background: var(--amber-lt);
  color: var(--amber);
}
.status-completed {
  background: var(--green-lt);
  color: var(--green);
}
.status-cancelled {
  background: var(--rose-lt);
  color: var(--rose);
}
.trip-card-body {
  padding: 12px 18px;
}
.trip-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.81rem;
  color: var(--text-2);
  margin-bottom: 5px;
}
.trip-meta-row i {
  width: 14px;
  text-align: center;
  color: var(--blue);
  font-size: 0.78rem;
}
.trip-card-footer {
  padding: 10px 18px;
  background: var(--blue-lt);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.77rem;
  color: var(--text-2);
  font-weight: 600;
}

/* ── DETAIL ── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-3);
  cursor: pointer;
  margin-bottom: 18px;
  font-weight: 700;
  transition: color 0.15s;
}
.back-btn:hover {
  color: var(--blue);
}
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 20px;
}
.detail-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.1;
}
.detail-header-meta {
  color: var(--text-3);
  font-size: 0.86rem;
  margin-top: 6px;
  font-weight: 600;
}
.detail-header-right {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.info-card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
}
.info-card-header i {
  font-size: 0.9rem;
}
.info-card-header h4 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.info-card-body {
  padding: 16px 18px;
}

/* ── FIELDS ── */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.field-row.single {
  grid-template-columns: 1fr;
}
.field-row.triple {
  grid-template-columns: 1fr 1fr 1fr;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-group label {
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 800;
}
input[type='text'],
input[type='date'],
input[type='url'],
input[type='number'],
input[type='time'],
select,
textarea {
  font-family: 'Nunito', sans-serif;
  font-size: 0.87rem;
  color: var(--text);
  background: #f8fbff;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
  font-weight: 600;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* ── RECEIPTS ── */
.receipt-drop-zone {
  border: 2px dashed var(--border2);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--blue-lt);
  margin-bottom: 14px;
}
.receipt-drop-zone:hover,
.receipt-drop-zone.dragover {
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.06);
}
.receipt-drop-zone i {
  font-size: 1.8rem;
  color: var(--blue);
  margin-bottom: 8px;
  display: block;
}
.receipt-drop-zone p {
  font-size: 0.83rem;
  color: var(--text-2);
  font-weight: 600;
}
.receipts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.receipt-item {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.receipt-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--blue-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}
.receipt-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.receipt-info {
  flex: 1;
  min-width: 0;
}
.receipt-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.receipt-desc {
  font-size: 0.76rem;
  color: var(--text-3);
  font-weight: 600;
}
.receipt-amount {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--green);
  white-space: nowrap;
  font-family: 'Fraunces', serif;
}
.icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  color: var(--text-3);
  transition: all 0.15s;
}
.icon-btn:hover {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}
.icon-btn.dl:hover {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

/* ── PER DIEM CARD ── */
.perdiem-card {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  border-radius: var(--radius);
  padding: 20px;
  color: #fff;
  margin-bottom: 18px;
}
.perdiem-card h4 {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  margin-bottom: 14px;
  opacity: 0.9;
}
.perdiem-quarters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pq {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
}
.pq.active {
  background: rgba(96, 165, 250, 0.3);
  border-color: #60a5fa;
}
.pq .pq-time {
  font-size: 0.62rem;
  opacity: 0.7;
  margin-bottom: 4px;
  font-weight: 700;
}
.pq .pq-val {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 700;
}
.pq .pq-label {
  font-size: 0.58rem;
  opacity: 0.6;
  margin-top: 2px;
  font-weight: 600;
}
.perdiem-meals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pm {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.pm.active {
  background: rgba(52, 211, 153, 0.25);
  border: 1px solid rgba(52, 211, 153, 0.5);
}
.pm .pm-icon {
  font-size: 1.1rem;
  margin-bottom: 3px;
}
.pm .pm-label {
  font-size: 0.65rem;
  opacity: 0.7;
  font-weight: 700;
}
.pm .pm-val {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  font-weight: 700;
}
.perdiem-total {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.perdiem-total .pt-label {
  font-size: 0.78rem;
  opacity: 0.8;
  font-weight: 700;
}
.perdiem-total .pt-val {
  font-family: 'Fraunces', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #93c5fd;
}

/* ── TOTAL BAR ── */
.total-bar {
  background: linear-gradient(135deg, #1e3a5f, var(--blue));
  color: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}
.total-bar .tb-label {
  font-size: 0.78rem;
  opacity: 0.7;
  font-weight: 700;
}
.total-bar .tb-val {
  font-family: 'Fraunces', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: #93c5fd;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 60, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  backdrop-filter: blur(2px);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 580px;
  max-width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(14px) scale(0.98);
  transition: transform 0.2s;
  box-shadow: 0 24px 80px rgba(10, 30, 60, 0.3);
}
.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, var(--blue-lt), #fff);
}
.modal-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  color: var(--blue);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-3);
  transition: all 0.15s;
}
.modal-close:hover {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}
.modal-body {
  padding: 22px 24px;
}
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--bg);
}

/* ── SETUP SCREEN ── */

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  z-index: 999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.22s;
  pointer-events: none;
  max-width: 320px;
  box-shadow: var(--shadow-lg);
}
#toast.show {
  opacity: 1;
  transform: translateY(0);
}
#toast.success {
  border-left: 4px solid #34d399;
}
#toast.error {
  border-left: 4px solid #f87171;
}
#toast.info {
  border-left: 4px solid #60a5fa;
}
#undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1e3a5f;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(10, 30, 60, 0.35);
  white-space: nowrap;
}
#undo-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}
.undo-btn {
  background: #60a5fa;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: background 0.15s;
}
.undo-btn:hover {
  background: #3b82f6;
}
.del-confirm-input-wrap {
  margin: 16px 0;
}
.del-confirm-input-wrap input {
  border-color: var(--rose);
}
.del-confirm-input-wrap input:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
}

/* ── EMPTY ── */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-3);
}
.empty-state i {
  font-size: 3rem;
  margin-bottom: 14px;
  display: block;
  opacity: 0.35;
}
.empty-state h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  margin-bottom: 6px;
  color: var(--text);
}
.empty-state p {
  font-size: 0.84rem;
  font-weight: 600;
}

hr {
  border: none;
  border-top: 1.5px solid var(--border);
  margin: 16px 0;
}
.section-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--blue-lt);
  border: 1px solid var(--border2);
  color: var(--blue);
  font-weight: 800;
}

.category-pill {
  display: inline-block;
  font-size: 0.66rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  text-transform: uppercase;
}
.cat-meal {
  background: #fef3c7;
  color: #d97706;
}
.cat-transport {
  background: #dbeafe;
  color: #2563eb;
}
.cat-accommodation {
  background: #ede9fe;
  color: #7c3aed;
}
.cat-entertainment {
  background: #fce7f3;
  color: #db2777;
}
.cat-supplies {
  background: #dcfce7;
  color: #16a34a;
}
.cat-other {
  background: #f1f5f9;
  color: #64748b;
}
.cat-registration {
  background: #f3e8ff;
  color: #7c3aed;
}

/* ── COUNTDOWN BANNER ── */
.countdown-banner {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  border-radius: var(--radius);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(37, 99, 235, 0.22);
  transition: all 0.2s;
}
.countdown-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(37, 99, 235, 0.32);
}
.countdown-banner.active-trip {
  background: linear-gradient(135deg, #0d6b5e, #0d9488);
}
.cd-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 700;
  margin-bottom: 5px;
}
.cd-title {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 5px;
}
.cd-detail {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}
.cd-number {
  font-family: 'Fraunces', serif;
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.cd-number span {
  font-family: 'Nunito', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 3px;
}
@media (max-width: 700px) {
  .countdown-banner {
    padding: 16px 18px;
  }
  .cd-title {
    font-size: 1.1rem;
  }
  .cd-number {
    font-size: 2.2rem;
  }
}

/* STATUS BANNERS */
.banner-planning {
  background: linear-gradient(90deg, var(--sky), var(--blue));
}
.banner-confirmed {
  background: linear-gradient(90deg, var(--amber), #f59e0b);
}
.banner-completed {
  background: linear-gradient(90deg, var(--teal), var(--green));
}
.banner-cancelled {
  background: linear-gradient(90deg, var(--rose), #f43f5e);
}

/* IMPORT */
.import-area {
  border: 2px dashed var(--border2);
  border-radius: 12px;
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--blue-lt);
}
.import-area:hover {
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.06);
}
.import-area i {
  font-size: 2.4rem;
  color: var(--blue);
  margin-bottom: 12px;
  display: block;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ── MOBILE DETAIL SECTION ORDER ── */
.detail-sections-wrap {
  display: flex;
  flex-direction: column;
}
@media (max-width: 700px) {
  .detail-sec-info {
    order: 1;
  }
  .detail-sec-receipts {
    order: 2;
  }
  .detail-sec-docs {
    order: 3;
  }
}

/* ── MOBILE NAV OVERLAY ── */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 30, 60, 0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
#sidebar-overlay.open {
  display: block;
}

/* ── BOTTOM TAB BAR (mobile only) ── */
#bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  z-index: 90;
  height: 62px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-inner {
  display: flex;
  height: 62px;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.15s;
  border: none;
  background: none;
  padding: 0;
}
.bnav-item i {
  font-size: 1.1rem;
}
.bnav-item.active {
  color: #60a5fa;
}
.bnav-item:active {
  color: #fff;
}

/* ── HAMBURGER BUTTON (mobile topbar) ── */
#hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--blue-lt);
  border: 1px solid var(--border2);
  color: var(--blue);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
    width: var(--sidebar-w);
  }
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  #main {
    margin-left: 0;
  }
  #hamburger {
    display: flex;
  }
  #bottom-nav {
    display: block;
  }
  .page-content {
    padding: 14px;
    padding-bottom: 80px;
  }
  .stats-row {
    grid-template-columns: 1fr 1fr;
  }
  .topbar-actions .btn:not(.btn-sm) {
    display: none;
  }
  .detail-header {
    flex-direction: column;
    gap: 12px;
  }
  .detail-header-right {
    justify-content: flex-start;
    width: 100%;
  }
  .detail-header h2 {
    font-size: 1.4rem;
  }
  .cal-cell {
    min-height: 60px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .field-row.triple {
    grid-template-columns: 1fr;
  }
  .trips-grid {
    grid-template-columns: 1fr;
  }
}

/* ── LOGIN SCREEN ── */
#login-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1e40af 0%, #0891b2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: 'Nunito', sans-serif;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 36px 32px 32px;
  width: 340px;
  max-width: 92vw;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.login-logo {
  font-size: 2.2rem;
  margin-bottom: 4px;
}
.login-title {
  font-family: 'Fraunces', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 2px;
}
.login-sub {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 24px;
}
/* Solo tile — used only if the roster has an odd count */
/* ── MICROSOFT SSO BUTTON ── */
.login-blurb {
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 20px;
}
.ms-signin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 13px 18px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e3a5f;
}
.ms-signin-btn:hover {
  background: #f8fafc;
  border-color: #2563eb;
  box-shadow: 0 3px 14px rgba(37, 99, 235, 0.16);
}
.ms-signin-btn:active {
  transform: scale(0.985);
}
.ms-signin-btn:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}
.ms-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.login-foot {
  font-size: 0.73rem;
  color: #94a3b8;
  font-weight: 600;
  margin-top: 18px;
  line-height: 1.5;
}
.login-spinner {
  width: 30px;
  height: 30px;
  margin: 12px auto 14px;
  border-radius: 50%;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  animation: login-spin 0.7s linear infinite;
}
@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}
.login-checking-text {
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 8px;
}
.login-err {
  font-size: 0.78rem;
  color: #e11d48;
  font-weight: 700;
  min-height: 1.1em;
  margin-top: 4px;
}

/* ── USER BADGE in receipt list ── */
.receipt-user-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}
.user-pill.uploader {
  background: #dbeafe;
  color: #1e40af;
}
.user-pill.assignee {
  background: #ccfbf1;
  color: #065f46;
}

/* ── Current user chip in topbar ── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #dbeafe;
  border: 1.5px solid #93c5fd;
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1e40af;
}
.user-chip:hover {
  background: #bfdbfe;
}
.user-chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  color: #fff;
}

/* ── TRAVEL DOCS ── */
.doc-item {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.doc-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: #fff;
}
.doc-info {
  flex: 1;
  min-width: 0;
}
.doc-name {
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-meta {
  font-size: 0.73rem;
  color: var(--text-3);
  font-weight: 600;
}
.doc-cat-pill {
  display: inline-block;
  font-size: 0.64rem;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}
.dcat-flight {
  background: #dbeafe;
  color: #2563eb;
}
.dcat-hotel {
  background: #ede9fe;
  color: #7c3aed;
}
.dcat-agenda {
  background: #fef3c7;
  color: #d97706;
}
.dcat-ground {
  background: #dcfce7;
  color: #16a34a;
}
.dcat-meeting {
  background: #fce7f3;
  color: #db2777;
}
.dcat-visa {
  background: #fff7ed;
  color: #ea580c;
}
.dcat-other {
  background: #f1f5f9;
  color: #64748b;
}

/* ── OPEN ITEMS ── */
.open-item-row {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.open-item-row.resolved {
  opacity: 0.5;
}
.open-item-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--teal);
}
.open-item-body {
  flex: 1;
  min-width: 0;
}
.open-item-desc {
  font-weight: 700;
  font-size: 0.88rem;
}
.open-item-desc.resolved-text {
  text-decoration: line-through;
  color: var(--text-3);
}
.open-item-meta {
  font-size: 0.73rem;
  color: var(--text-3);
  font-weight: 600;
  margin-top: 3px;
}
.oi-trip-group {
  margin-bottom: 22px;
}
.oi-trip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.oi-trip-title {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

/* ── SIGNATURE ── */
.sign-canvas-wrap {
  border: 2px solid var(--border2);
  border-radius: 10px;
  background: #fafafa;
  overflow: hidden;
  margin-bottom: 10px;
  position: relative;
}
#sign-canvas {
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.sign-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-3);
  font-size: 0.8rem;
  font-weight: 600;
  pointer-events: none;
}

/* ── EMAILJS SETUP NOTICE ── */
.emailjs-setup {
  background: var(--amber-lt);
  border: 1.5px solid var(--amber);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text);
}
.emailjs-setup code {
  background: rgba(0, 0, 0, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.78rem;
}

/* ── FILE VIEWER ── */
#file-viewer-modal .modal {
  max-width: 90vw;
  width: 860px;
}
.file-viewer-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
.file-viewer-pdf {
  width: 100%;
  height: 72vh;
  border: none;
  border-radius: 8px;
}
/* ── RECEIPT ITEM clickable ── */
.receipt-item {
  cursor: pointer;
  transition:
    box-shadow 0.15s,
    border-color 0.15s;
}
.receipt-item:hover {
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.13);
  border-color: var(--blue-mid);
}
.receipt-thumb-clickable {
  cursor: zoom-in !important;
}
