/* ============================================================
   SPENDIAL — spendial.css
   Shared stylesheet. Every page links this.
   Page-specific CSS stays in that page's <style> block.
   ============================================================ */

/* ------------------------------------------------------------
   VARIABLES
   ------------------------------------------------------------ */
:root {
  --snow: #FFFFFF;
  --off-white: #FDFCF9;
  --powder: #F9F9F3;
  --navy: #1E314F;
  --plum: #6D597A;
  --gold: #9A803A;
  --line: #1E314F;
  --line-soft: #E2DCD1;
  --radius: 14px;
  --radius-sm: 10px;
  --danger: #DE1B3E;
  --danger-soft: #FFF0F3;

  --shadow-soft: 0 1px 2px rgba(30,49,79,0.04),
                 0 2px 6px rgba(30,49,79,0.04),
                 0 8px 24px rgba(30,49,79,0.06);
  --shadow-lift: 0 4px 8px rgba(30,49,79,0.06),
                 0 8px 20px rgba(30,49,79,0.08),
                 0 16px 40px rgba(30,49,79,0.10);
  --shadow-card: 0 1px 3px rgba(30,49,79,0.04);

  --lift-distance: -2px;
  --lift-shadow: 0 6px 16px rgba(30,49,79,0.10),
                 0 2px 6px rgba(30,49,79,0.06);
  --lift-transition: transform 0.2s ease,
                     box-shadow 0.2s ease,
                     border-color 0.2s ease,
                     background 0.2s ease,
                     color 0.2s ease;
  --lift-border: var(--gold);

  --sidebar-w: 200px;
  --content-max: 1600px;
}

/* ------------------------------------------------------------
   RESET + BASE
   ------------------------------------------------------------ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  background: var(--snow);
  color: var(--navy);
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-family: 'DM Serif Display', serif; font-weight: 400; }

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ------------------------------------------------------------
   LAYOUT SHELL
   ------------------------------------------------------------ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--snow);
  border-right: 1px solid var(--line-soft);
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  background: var(--snow);
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
}

.page-body {
  background: var(--off-white);
  min-height: 100vh;
  padding: 12px 32px 48px;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ------------------------------------------------------------
   WORDMARK
   ------------------------------------------------------------ */
.wordmark-wrap { padding-bottom: 18px; }

.wordmark {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  color: var(--navy);
  letter-spacing: 0.5px;
  display: inline-block;
  line-height: 1;
  padding-bottom: 4px;
  border-bottom: 3px solid var(--gold);
  margin: 0 20px;
}
.wordmark .wm-flow { color: var(--navy); }
.wordmark .wm-trak { color: var(--navy); }

/* ------------------------------------------------------------
   NAV
   ------------------------------------------------------------ */
.nav-section { padding: 24px 12px 0; }

.nav-link {
  display: block;
  padding: 10px 12px;
  color: var(--navy);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: var(--lift-transition);
  margin-bottom: 6px;
  position: relative;
}
.nav-link:hover {
  background: var(--powder);
  transform: translateY(var(--lift-distance));
  box-shadow: var(--lift-shadow);
}
.nav-link.active { background: var(--powder); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--gold);
}

/* ------------------------------------------------------------
   TOP BAR
   ------------------------------------------------------------ */
.top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy);
  background: var(--snow);
  color: var(--navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--lift-transition);
}
.icon-btn:hover {
  transform: translateY(var(--lift-distance));
  border-color: var(--lift-border);
  box-shadow: var(--lift-shadow);
}
.icon-btn svg { width: 16px; height: 16px; stroke: var(--navy); fill: none; stroke-width: 1.8; }

.menu-wrap { position: relative; }

.menu-dropdown {
  display: none;
  position: absolute;
  top: 42px;
  right: 0;
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 180px;
  z-index: 50;
  box-shadow: var(--shadow-lift);
}
.menu-dropdown.open { display: block; }

.menu-item {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--navy);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  transition: background 0.15s ease;
}
.menu-item:hover { background: var(--powder); }

/* ------------------------------------------------------------
   PAGE HEADER
   ------------------------------------------------------------ */
.page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}
.page-title { font-size: 32px; color: var(--navy); line-height: 1.1; }
.page-sub { font-size: 13px; font-weight: 600; color: var(--plum); margin-top: 4px; opacity: 0.9; }

.page-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   BUTTONS
   ------------------------------------------------------------ */
.btn {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy);
  background: var(--snow);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--lift-transition);
}
.btn:hover {
  transform: translateY(var(--lift-distance));
  border-color: var(--lift-border);
  box-shadow: var(--lift-shadow);
}
.btn-primary { background: var(--navy); color: var(--snow); border-color: var(--navy); }
.btn-primary:hover {
  border-color: var(--navy);
  box-shadow: 0 8px 20px rgba(30,49,79,0.22),
              0 3px 8px rgba(30,49,79,0.10);
}
.btn svg { width: 16px; height: 16px; }

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--snow);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

/* ------------------------------------------------------------
   TOOLBAR / SEARCH
   ------------------------------------------------------------ */
.toolbar-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 280px;
  max-width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(154,128,58,0.08);
}
.search svg { width: 16px; height: 16px; color: var(--navy); opacity: 0.6; flex-shrink: 0; }
.search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  width: 100%;
}
.search input::placeholder { color: var(--navy); opacity: 0.5; }

/* ------------------------------------------------------------
   SECTIONS / CARDS
   ------------------------------------------------------------ */
.section {
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  transition: var(--lift-transition);
}
.section:hover {
  transform: translateY(var(--lift-distance));
  box-shadow: var(--lift-shadow);
}
.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--navy);
  margin-bottom: 4px;
}
.section-sub {
  font-size: 12px;
  color: var(--plum);
  margin-bottom: 18px;
  opacity: 0.9;
}

/* ------------------------------------------------------------
   ROWS
   ------------------------------------------------------------ */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--navy);
  gap: 16px;
  flex-wrap: wrap;
}
.row:last-child { border-bottom: none; }
.row-label {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--navy);
  font-weight: 600;
}
.row-help {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  color: var(--plum);
  margin-top: 2px;
  font-weight: 500;
}

/* ------------------------------------------------------------
   FORM FIELDS
   ------------------------------------------------------------ */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(154,128,58,0.08);
}
.field textarea { resize: vertical; min-height: 70px; }
.field input[type="date"] { cursor: pointer; }
.field select:disabled { opacity: 0.5; cursor: not-allowed; background: var(--powder); }

/* ------------------------------------------------------------
   FORM GRID
   ------------------------------------------------------------ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid .half { grid-column: span 2; }
.form-grid .triple {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}

.form-grid .section-title {
  grid-column: 1 / -1;
  font-size: 15px;
  margin: 6px 0 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

/* ------------------------------------------------------------
   TABLES
   ------------------------------------------------------------ */
.table-wrap {
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow-x: auto;
  transition: var(--lift-transition);
}
.table-wrap:hover {
  transform: translateY(var(--lift-distance));
  box-shadow: var(--lift-shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 11px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  border-bottom: 1px solid var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--snow);
}

tbody td {
  padding: 11px 14px;
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 14px;
  border-bottom: 1px solid var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background 0.15s ease; }
tbody tr:hover { background: var(--off-white); }

tbody .empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--plum);
  font-size: 14px;
  font-weight: 600;
  white-space: normal;
  cursor: default;
}
tbody .empty:hover { background: transparent; }

/* ------------------------------------------------------------
   MODAL
   ------------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30,49,79,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 70;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-lift);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.modal-head h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--navy);
  margin: 0;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--navy);
  background: var(--snow);
  color: var(--navy);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--lift-transition);
}
.modal-close:hover {
  background: var(--powder);
  border-color: var(--lift-border);
  transform: translateY(var(--lift-distance));
  box-shadow: var(--lift-shadow);
}

.modal-sub {
  font-size: 12px;
  font-weight: 600;
  color: var(--plum);
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  flex-wrap: wrap;
}
.modal-actions .btn-danger { margin-right: auto; }
.modal-actions .btn { padding: 8px 14px; font-size: 14px; }

/* ------------------------------------------------------------
   PHOTO GRID
   ------------------------------------------------------------ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 100%;
}

.photo-slot {
  aspect-ratio: 1 / 1;
  border: 1.5px dashed var(--navy);
  border-radius: var(--radius-sm);
  background: var(--off-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  color: var(--navy);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}
.photo-slot:hover {
  background: var(--snow);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30,49,79,0.10), 0 2px 6px rgba(30,49,79,0.06);
}
.photo-slot svg { width: 16px; height: 16px; opacity: 0.6; }
.photo-slot.filled {
  border-style: solid;
  border-color: var(--navy);
  padding: 0;
  cursor: default;
}
.photo-slot.filled:hover {
  transform: none;
  box-shadow: none;
  background: transparent;
}
.photo-slot img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.photo-slot .photo-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(30,49,79,0.85);
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
}
.photo-slot .photo-remove:hover { background: var(--danger); }
.photo-slot.dragover {
  background: var(--powder);
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(30,49,79,0.10), 0 2px 6px rgba(30,49,79,0.06);
}
.photo-slot input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

.photo-hint { font-size: 12px; color: var(--plum); margin-top: 8px; font-weight: 500; }

/* ------------------------------------------------------------
   MULTISELECT
   ------------------------------------------------------------ */
.multiselect { position: relative; }
.ms-button {
  width: 100%;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ms-button:hover { background: var(--off-white); }
.ms-button .val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-button .val.placeholder { opacity: 1; color: var(--navy); }
.ms-button .caret { flex-shrink: 0; transition: transform 0.15s; font-size: 11px; }
.multiselect.open .ms-button .caret { transform: rotate(180deg); }
.ms-panel {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 4px;
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lift);
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  z-index: 100;
}
.multiselect.open .ms-panel { display: block; }
.ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  cursor: pointer;
  user-select: none;
}
.ms-item:hover { background: var(--powder); }
.ms-item input[type="checkbox"] { accent-color: var(--navy); width: 16px; height: 16px; cursor: pointer; }
.ms-add-row { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 6px; }
.ms-add-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: none;
  background: none;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
  border-radius: 6px;
}
.ms-add-btn:hover { background: var(--powder); }

/* ------------------------------------------------------------
   ADDABLE SELECT HELPERS
   ------------------------------------------------------------ */
.addable-input-wrap { align-items: stretch; }
.addable-input {
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--snow);
  color: var(--navy);
  outline: none;
  min-width: 0;
}
.addable-save-btn, .addable-cancel-btn {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--snow);
  color: var(--navy);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.addable-save-btn:hover { background: var(--navy); color: var(--snow); }
.addable-cancel-btn { padding: 8px 10px; border-color: var(--line-soft); color: var(--plum); }
.addable-cancel-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* ------------------------------------------------------------
   TOGGLE ROW / SWITCH
   ------------------------------------------------------------ */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--off-white);
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  transition: var(--lift-transition);
}
.toggle-row:hover {
  border-color: var(--lift-border);
  box-shadow: var(--lift-shadow);
}
.toggle-row .txt .t { font-size: 14px; font-weight: 600; }
.toggle-row .txt .d { font-size: 12px; font-weight: 500; color: var(--plum); margin-top: 2px; }

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: 24px;
  transition: 0.2s;
  cursor: pointer;
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--navy);
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(30,49,79,0.15);
}
.switch input:checked + .slider { background: var(--navy); }
.switch input:checked + .slider::before {
  transform: translate(18px, -50%);
  background: var(--snow);
}

/* ------------------------------------------------------------
   LOCKED / TIER BADGE
   ------------------------------------------------------------ */
.locked { opacity: 0.55; pointer-events: none; user-select: none; }

.lock-badge {
  display: inline-block;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  background: var(--powder);
  color: var(--gold);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}

/* ------------------------------------------------------------
   PILLS
   ------------------------------------------------------------ */
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 7px 11px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: var(--snow);
  color: var(--navy);
  transition: var(--lift-transition);
}
.pill:hover {
  transform: translateY(var(--lift-distance));
  box-shadow: var(--lift-shadow);
  border-color: var(--lift-border);
}
.pill button {
  background: none;
  border: none;
  color: var(--plum);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
}
.pill button:hover { color: var(--danger); }

/* ------------------------------------------------------------
   ADD ROW
   ------------------------------------------------------------ */
.add-row { display: flex; gap: 8px; max-width: 360px; }
.add-row input {
  flex: 1;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--snow);
  color: var(--navy);
  transition: border-color 0.15s ease;
}
.add-row input:focus { outline: none; border-color: var(--gold); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (min-width: 1601px) {
  .page-body { padding: 12px 48px 48px; }
}

@media (max-width: 1400px) {
  .page-body { padding: 12px 32px 44px; }
}

@media (max-width: 1200px) {
  .page-body { padding: 12px 24px 40px; }
  .page-title { font-size: 30px; }
}

/* Tablet: 2-column form-grid */
@media (max-width: 1100px) and (min-width: 901px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .half { grid-column: 1 / -1; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Mobile / small: 1-column */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    position: static;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--navy);
    padding: 16px 0;
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .app { flex-direction: column; }
  .page-body { padding: 12px 20px 36px; max-width: 100%; }
  .page-title { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .triple { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
  .search { width: 100%; }
  .toolbar-row { justify-content: stretch; }
  .nav-link.active::before { display: none; }

  /* --- RESPONSIVE TABLES (Cards on mobile) --- */
  .table-wrap {
    border: none;
    box-shadow: none;
    background: transparent;
    overflow-x: visible;
  }
  .table-wrap table {
    display: block;
    width: 100%;
  }
  .table-wrap thead {
    display: none; /* Hide headers */
  }
  .table-wrap tbody {
    display: block;
    width: 100%;
  }
  .table-wrap tbody tr {
    display: block;
    margin-bottom: 16px;
    background: var(--snow);
    border: 1px solid var(--navy);
    border-radius: var(--radius);
    padding: 4px 16px;
    box-shadow: var(--shadow-card);
  }
  .table-wrap tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
    text-align: right;
    white-space: normal;
    font-size: 14px;
  }
  .table-wrap tbody td:last-child {
    border-bottom: none;
  }
  /* If the user adds data-label="Header" to <td>, it will show here */
  .table-wrap tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--plum);
    text-align: left;
    margin-right: 16px;
    flex-shrink: 0;
  }
  .table-wrap tbody td.empty {
    display: block;
    text-align: center;
    padding: 40px 20px;
    color: var(--plum);
    font-weight: 600;
  }
  .table-wrap tbody td.empty::before {
    display: none;
  }
}

@media (max-width: 600px) {
  body { font-size: 14px; }
  .page-body { padding: 10px 14px 32px; }
  .page-title { font-size: 24px; }
  .section { padding: 16px 14px; }
  .section-title { font-size: 18px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 20px 18px 18px; max-height: 95vh; }
  .modal-head h2 { font-size: 22px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .modal-actions .btn-danger { flex: 0 0 auto; margin-right: 0; }
  .wordmark { font-size: 28px; }
  .nav-link { font-size: 14px; padding: 9px 10px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  @page { size: letter; margin: 0.5in; }

  html, body { background: white !important; color: #000 !important; }

  .sidebar,
  .top-bar,
  .page-actions,
  .toolbar-row,
  .menu-wrap,
  .menu-dropdown,
  #bellBtn,
  #menuBtn { display: none !important; }

  .app { display: block !important; }
  .main { margin-left: 0 !important; width: 100% !important; min-height: 0 !important; }
  .page-body { padding: 0 !important; max-width: none !important; background: white !important; min-height: 0 !important; }

  .page-header { display: none !important; }

  .section,
  .table-wrap,
  .info-card,
  .sched-block,
  .chart-card,
  .report-table-card,
  .qcard,
  .tax-strip .tcard,
  .tier-mini {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #666 !important;
    border-radius: 0 !important;
    transform: none !important;
  }

  table { page-break-inside: auto; font-size: 10px !important; }
  table thead th {
    background: #f0f0f0 !important;
    color: #000 !important;
    border-bottom: 1px solid #000 !important;
    font-size: 10px !important;
    padding: 6px 8px !important;
  }
  table tbody td {
    color: #000 !important;
    border-bottom: 1px solid #ccc !important;
    font-size: 10px !important;
    padding: 6px 8px !important;
  }
  table tbody tr { page-break-inside: avoid; }
  table tbody tr:last-child td { border-bottom: 1px solid #000 !important; }

  .section-title,
  .sched-block h2,
  .info-card h2,
  .report-table-card h2,
  .chart-title { color: #000 !important; }

  .page-sub,
  .section-sub,
  .sched-block .sub,
  .info-card .sub { color: #444 !important; }

  tfoot td {
    background: #f0f0f0 !important;
    border-top: 2px solid #000 !important;
    color: #000 !important;
  }
}

/* ------------------------------------------------------------
   CONFIRM MODAL
   ------------------------------------------------------------ */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30,49,79,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
}
.confirm-backdrop.open { display: flex; }

.confirm-modal {
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-lift);
  animation: confirmIn 0.15s ease-out;
}

@keyframes confirmIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.confirm-modal h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  font-weight: 400;
  color: var(--navy);
  margin: 0 0 6px;
}

.confirm-modal p {
  font-size: 14px;
  color: var(--navy);
  line-height: 1.5;
  margin: 0 0 16px;
  opacity: 0.85;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.confirm-actions .btn { min-width: 80px; justify-content: center; }

@media (max-width: 600px) {
  .confirm-modal { padding: 18px 16px 14px; }
  .confirm-actions .btn { flex: 1; }
}

/* ============================================================
   BELL — gold dot + notification dropdown
   ============================================================ */

.icon-btn { position: relative; }

.bell-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  display: none;
  pointer-events: none;
}
.bell-dot.active { display: block; }

.bell-panel {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  width: 320px;
  max-height: 480px;
  overflow-y: auto;
  background: var(--snow);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 8px;
  z-index: 60;
}
.bell-panel.open { display: block; }

.bell-empty {
  padding: 32px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--plum);
}

.bell-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  transition: background 0.15s ease;
}
.bell-item:hover { background: var(--off-white); }
.bell-item.read { opacity: 0.55; }

.bell-item-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: 6px;
}
.bell-item.read .bell-item-dot { background: var(--line-soft); }

.bell-item-txt { flex: 1; min-width: 0; }
.bell-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}
.bell-item-body {
  font-size: 12px;
  font-weight: 500;
  color: var(--plum);
  line-height: 1.4;
}