/* ==================================================================
   GSM DASHBOARD — STYLES v0.2
   Modern sans everywhere. Bolder weights. No serifs.
   Dark navy / wood / chrome palette.
   ================================================================== */

:root {
  --bg:         #0b0b0b;
  --bg-2:       #141311;
  --bg-3:       #1c1a17;
  --bg-elev:    #24211d;
  --line:       #2e2a24;
  --line-2:     #403a31;
  --text:       #f5f0e6;
  --text-2:     #d9d0bf;
  --text-3:     #948b7a;
  --chrome:     #f5f0e6;
  --chrome-dark:#b8ad99;
  --wood:       #c9a46e;
  --wood-light: #e6cfa4;
  --wood-dark:  #8f7246;
  --walnut:     #4a3826;
  --gold:       #d9b97c;
  --green:      #8fbc7a;
  --red:        #d47474;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

/* Texture overlay */
body::before {
  content: ''; position: fixed; inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(212, 163, 104, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(64, 58, 49, 0.35) 0%, transparent 60%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: ''; position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.12 0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 1; opacity: 0.5; mix-blend-mode: overlay;
}

[hidden] { display: none !important; }

/* ==================================================================
   LOGIN SCREEN
   ================================================================== */
.login-screen {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 48px 40px 40px;
  box-shadow: var(--shadow);
  position: relative;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--wood), transparent);
  border-radius: 16px 16px 0 0;
}

.login-brand {
  text-align: center;
  margin-bottom: 36px;
}

.login-brand-mark {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 46px;
  letter-spacing: -0.02em;
  color: var(--chrome);
  line-height: 1;
  margin-bottom: 12px;
  background: linear-gradient(180deg, var(--chrome) 0%, var(--chrome-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.login-brand-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--wood-light);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
}

.field input {
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 500;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--wood);
  background: var(--bg-2);
  box-shadow: 0 0 0 3px rgba(212, 163, 104, 0.15);
}

.btn-primary {
  margin-top: 10px;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 50%, var(--wood-dark) 100%);
  color: #1a1208;
  border: 1px solid var(--wood-dark);
  border-radius: var(--radius-sm);
  padding: 15px 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 2px 10px rgba(212, 163, 104, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 163, 104, 0.4);
  filter: brightness(1.06);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

.login-error {
  background: rgba(212, 116, 116, 0.15);
  border: 1px solid rgba(212, 116, 116, 0.45);
  color: #f4c4c4;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}

/* ==================================================================
   APP SHELL
   ================================================================== */
.app {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.control-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 11, 10, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-2);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.control-bar-left,
.control-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  height: 55px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.user-chip {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-2);
  padding: 5px 12px;
  border-radius: 0;
  white-space: nowrap;
}

.app-version {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: lowercase;
  color: var(--text-3);
  padding: 3px 8px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost:hover {
  color: var(--wood-light);
  border-color: var(--wood);
  background: rgba(212, 163, 104, 0.08);
}

/* ==================================================================
   TAB NAV
   ================================================================== */
.tab-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line-2);
  padding: 0 14px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  position: sticky;
  top: 57px;
  z-index: 99;
}

.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 16px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: color 0.15s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--wood-light);
  border-bottom-color: var(--wood);
}

/* ==================================================================
   TAB PANELS
   ================================================================== */
.tab-container {
  flex: 1;
  padding: 36px 28px 80px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-2);
}

/* ---------- View-toggle row (Summary/Detail on left, Admin on right) ---------- */
.view-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 16px 0;
  flex-wrap: wrap;
}
.view-toggle-row .view-toggle { margin: 0; }

/* ---------- Admin button (gold gradient, matches active view-btn) ---------- */
.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 0;
  border-radius: 8px;
  font: 900 13px/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #1a1410;
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 50%, var(--wood-light) 100%);
  box-shadow:
    0 2px 10px rgba(212, 163, 104, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 140ms ease, filter 140ms ease;
  min-width: 108px;
  justify-content: center;
}
.admin-btn:hover {
  filter: brightness(1.06);
  box-shadow:
    0 4px 14px rgba(212, 163, 104, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.admin-btn:active { transform: scale(0.96); }
.admin-btn[hidden] { display: none !important; }

/* ---------- Upload dropzone (used inside the Admin panel) ---------- */
.upload-dropzone {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  min-width: 240px;
  max-width: 320px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
  font-family: 'Inter', sans-serif;
}
.upload-dropzone:hover,
.upload-dropzone:focus-visible {
  outline: none;
  border-color: var(--wood-dark);
  color: var(--text-2);
  background: rgba(212, 163, 104, 0.06);
}
.upload-dropzone.is-dragging {
  border-style: solid;
  border-color: var(--wood);
  color: var(--wood-light);
  background: rgba(212, 163, 104, 0.10);
}
.upload-dropzone.is-busy { opacity: 0.7; cursor: wait; }
.upload-dropzone-icon {
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: var(--wood);
  opacity: 0.8;
  flex-shrink: 0;
}
.upload-dropzone-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.upload-dropzone-primary {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: inherit;
}
.upload-dropzone-secondary {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-3);
  margin-top: 2px;
}
/* Larger variant inside the Admin panel */
.upload-dropzone-large {
  display: flex;
  width: 100%;
  max-width: none;
  padding: 28px 24px;
  gap: 20px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius);
}
.upload-dropzone-large .upload-dropzone-icon {
  font-size: 34px;
  opacity: 0.9;
}
.upload-dropzone-large .upload-dropzone-primary { font-size: 14px; }
.upload-dropzone-large .upload-dropzone-secondary { font-size: 12px; letter-spacing: 0.02em; }

/* ---------- Admin panel (full-screen overlay) ---------- */
.admin-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  overflow: hidden;
  animation: admin-fade 200ms ease-out;
}
.admin-panel[hidden] { display: none; }
@keyframes admin-fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  padding-top: max(22px, env(safe-area-inset-top));
}
.admin-panel-title {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--wood-light);
  line-height: 1.1;
}
.admin-panel-sub {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-top: 6px;
}
.admin-panel-close {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 8px;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.admin-panel-close:hover {
  color: var(--text);
  border-color: var(--wood-dark);
  background: rgba(212, 163, 104, 0.06);
}
.admin-panel-body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.admin-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  flex-wrap: wrap;
}
.admin-panel-note {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.admin-panel-actions { display: flex; gap: 10px; }
.admin-confirm-btn {
  padding: 10px 22px;
  border: 0;
  border-radius: 8px;
  font: 900 13px/1 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #1a1410;
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 50%, var(--wood-light) 100%);
  cursor: pointer;
  transition: filter 140ms ease;
}
.admin-confirm-btn:hover { filter: brightness(1.06); }
.admin-confirm-btn:disabled {
  background: var(--bg-3);
  color: var(--text-3);
  cursor: not-allowed;
  filter: none;
}

/* Sections inside admin panel */
.admin-section {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.admin-section-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin-bottom: 12px;
}
.admin-dropzone-note {
  margin-top: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
}
.admin-section-placeholder { opacity: 0.6; }
.admin-placeholder-note {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-3);
  font-style: italic;
}
.admin-status-msg {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-2);
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* Preview section layout (reused from old modal) */
.upload-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.upload-summary-tile {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.upload-summary-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}
.upload-summary-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--wood-light);
  letter-spacing: -0.01em;
  word-break: break-word;
}
.upload-months-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.upload-month-chip {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.upload-month-chip.is-new {
  color: #9fd08a;
  border-color: rgba(143, 188, 122, 0.4);
  background: rgba(143, 188, 122, 0.08);
}
.upload-month-chip.is-overwrite {
  color: var(--wood-light);
  border-color: var(--wood-dark);
  background: rgba(212, 163, 104, 0.08);
}
.upload-diff-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.upload-diff-legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.upload-diff-legend .dot.new { background: #9fd08a; }
.upload-diff-legend .dot.overwrite { background: var(--wood); }

/* ---- Remove data (admin danger zone) ---- */
.admin-danger-section { border-color: rgba(212, 116, 116, 0.35); }
.admin-danger-section .admin-section-label { color: var(--red); }
.admin-delete-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-delete-kind {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px/1.4 Inter, sans-serif;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
}
.admin-delete-months {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}
.admin-delete-chip {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 5px 12px;
  font: 700 11px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: var(--text-2);
  cursor: pointer;
  transition: all 120ms ease;
}
.admin-delete-chip.is-selected {
  color: var(--red);
  border-color: rgba(212, 116, 116, 0.6);
  background: rgba(212, 116, 116, 0.10);
}
.admin-delete-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.admin-delete-note {
  font: 12px/1.5 Inter, sans-serif;
  color: var(--text-3);
}
.admin-delete-btn {
  padding: 9px 18px;
  border: 1px solid rgba(212, 116, 116, 0.6);
  border-radius: var(--radius-sm);
  background: rgba(212, 116, 116, 0.12);
  color: var(--red);
  font: 900 12px/1 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
}
.admin-delete-btn:hover { background: rgba(212, 116, 116, 0.2); }
.admin-delete-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.upload-preview-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 480px;
  background: var(--bg);
}
.upload-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
}
.upload-preview-table th,
.upload-preview-table td {
  padding: 6px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.upload-preview-table th {
  position: sticky; top: 0;
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  color: var(--wood-light);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10.5px;
  z-index: 1;
}
.upload-preview-table th:first-child,
.upload-preview-table td:first-child {
  text-align: left;
  position: sticky; left: 0;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-2);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 2;
}
.upload-preview-table th:first-child {
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  z-index: 3;
}
.upload-preview-table td.neg { color: var(--red); }
.upload-preview-table tr.is-subtotal td {
  font-weight: 700;
  color: var(--wood-light);
  border-top: 1px solid var(--wood-dark);
}

.upload-error {
  padding: 14px 16px;
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  background: rgba(212, 116, 116, 0.08);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

/* Narrow phones: Admin button goes full-width under the toggle */
@media (max-width: 600px) {
  .view-toggle-row { flex-direction: column; align-items: stretch; }
  .admin-btn { width: 100%; }
  .admin-panel-body { padding: 16px 16px 32px; }
  .admin-panel-head { padding: 18px 16px 14px; }
  .admin-panel-foot { padding: 14px 16px; }
}

.panel-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.1;
}

.panel-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wood-light);
}

.placeholder-card {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
}

.placeholder-icon {
  font-size: 44px;
  margin-bottom: 16px;
  opacity: 0.85;
}

.placeholder-card h2 {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
}

.placeholder-card p {
  color: var(--text);
  max-width: 520px;
  margin: 0 auto;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
}

.user-info-card {
  margin-top: 24px;
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 22px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.9;
}

.user-info-card strong {
  color: var(--wood-light);
  font-weight: 700;
  display: inline-block;
  min-width: 110px;
}

/* ==================================================================
   FOOTER
   ================================================================== */
.app-footer {
  margin-top: auto;
  padding: 18px 28px;
  border-top: 1px solid var(--line-2);
  background: var(--bg-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}

.connection-status {
  color: var(--green);
  font-weight: 700;
}

.connection-status.offline {
  color: var(--red);
}

/* ==================================================================
   RESPONSIVE
   ================================================================== */
@media (max-width: 640px) {
  .control-bar { padding: 12px 18px; }
  .brand-logo { height: 45px; }
  .user-chip { display: none; }
  .tab-container { padding: 24px 18px 60px; }
  .panel-title { font-size: 28px; }
  .tab-btn { padding: 13px 15px; font-size: 11px; }
  .login-card { padding: 40px 28px 32px; }
  .login-brand-mark { font-size: 40px; }
}

/* Safe area for iOS notch / home indicator */
@supports (padding: max(0px)) {
  .control-bar { padding-top: max(14px, env(safe-area-inset-top)); }
  .app-footer { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}

/* ==================================================================
   DASHBOARD TAB — charts, pills, smoothing toggle
   ================================================================== */

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 40px;
}
.kpi {
  background: var(--bg-2);
  border: 1px solid rgba(212, 163, 104, 0.65);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  text-align: center;
}
.kpi-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.kpi-value {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin-top: 2px;
}
.kpi-value.negative { color: var(--red); }
.kpi-delta {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  margin-top: 2px;
}
.kpi-delta.up   { color: var(--green); }
.kpi-delta.down { color: var(--red); }
.kpi-context {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Responsive KPI grid: 2×2 on phones */
@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .kpi { padding: 14px 14px; }
  .kpi-value { font-size: 20px; }
}

/* Margins & cost-ratio strip: secondary band of .kpi cards beneath the headline KPIs */
.ratio-strip {
  margin-top: -20px;   /* tuck under the kpi-grid's 40px bottom margin */
  margin-bottom: 40px;
}
.ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
/* "% of net revenue" subtitle directly under each metric name */
.ratio-sub {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  margin-top: -2px;
}
/* Labor-only "excl. benefits" line; reserved height keeps all 4 cards aligned */
.ratio-note {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-3);
  min-height: 13px;
}

@media (max-width: 640px) {
  .ratio-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

.dash-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.year-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.year-pill {
  position: relative;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: 0;
  padding: 8px 16px;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}
.year-pill:hover {
  background: var(--bg-elev);
  border-color: var(--wood-dark, #8f6a3e);
}
.year-pill.active {
  background: linear-gradient(135deg, var(--wood-dark, #8f6a3e) 0%, var(--wood) 100%);
  color: #1a1410;
  border-color: var(--wood);
  box-shadow: 0 2px 8px rgba(212, 163, 104, 0.25);
}

.partial-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 9px;
  background: rgba(0,0,0,0.25);
  border-radius: 4px;
  vertical-align: middle;
}

.smoothing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  border: 1px solid var(--wood);
  border-radius: 0;
  padding: 6px 14px;
  box-shadow: 0 2px 10px rgba(212, 163, 104, 0.3);
  transition: box-shadow 0.2s ease;
}
.smoothing-toggle.active {
  box-shadow: 0 3px 14px rgba(212, 163, 104, 0.5);
}
.smooth-lbl {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(26, 20, 16, 0.4);
  transition: color 0.15s ease, font-weight 0.15s ease, font-size 0.15s ease;
}
.smooth-lbl.active {
  font-weight: 900;
  font-size: 12.5px;
  color: #1a1410;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: rgba(26, 20, 16, 0.35);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.2s ease;
}
.slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; top: 3px;
  background: var(--chrome);
  border-radius: 0;
  transition: transform 0.2s ease;
}
.switch input:checked + .slider { background: rgba(26, 20, 16, 0.55); }
.switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }

.smoothing-note {
  display: none;
  background: rgba(212, 163, 104, 0.08);
  border-left: 3px solid var(--wood);
  padding: 10px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: 4px;
}
.smoothing-note.show { display: block; }

.chart-card {
  background: var(--bg-2);
  border: 1px solid rgba(212, 163, 104, 0.65);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
}
.chart-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}
.chart-card-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.chart-card-sub {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--wood);
  text-transform: uppercase;
}
.chart-canvas-wrap {
  position: relative;
  height: 340px;
}

/* Net Income total band: per-year total(s) shown above the chart */
.ni-total {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: -4px;
  margin-bottom: 16px;
}
.ni-total-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ni-total-seg {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.ni-total-yr {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.ni-total-val {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.ni-total-val.pos { color: var(--green); }
.ni-total-val.neg { color: var(--red); }

.dash-error {
  color: #c86464;
  padding: 20px;
  text-align: center;
  font-weight: 500;
}

@media (max-width: 640px) {
  .chart-canvas-wrap { height: 280px; }
  .chart-card-title  { font-size: 15px; }
  .year-pill         { padding: 7px 12px; font-size: 11px; }
  .dash-controls     { gap: 12px; }
}

/* ---------- Anomaly card ---------- */
.anomaly-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.anomaly-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: rgba(26, 20, 16, 0.35);
  border: 1px solid var(--wood);
  border-radius: 0;
  padding: 3px;
  box-shadow: 0 2px 10px rgba(212, 163, 104, 0.25);
}
.mode-btn {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: rgba(236, 199, 149, 0.6);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.mode-btn:hover { color: var(--wood-light); }
.mode-btn.active {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  color: #1a1410;
  font-weight: 900;
}
.threshold-stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  border: 1px solid var(--wood);
  border-radius: 0;
  padding: 5px 8px 5px 14px;
  box-shadow: 0 2px 10px rgba(212, 163, 104, 0.3);
}
.threshold-label {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #1a1410;
  text-transform: uppercase;
}
.threshold-val {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 13px;
  color: #1a1410;
  min-width: 38px;
  text-align: center;
  letter-spacing: 0.02em;
}
.threshold-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(26, 20, 16, 0.35);
  color: #1a1410;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.threshold-btn:hover   { background: rgba(26, 20, 16, 0.5); color: #fff; }
.threshold-btn:active  { transform: scale(0.9); }
.threshold-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.threshold-btn:disabled:hover {
  background: rgba(26, 20, 16, 0.35);
  color: #1a1410;
}

.anomaly-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.anomaly-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.anomaly-label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--fg);
}
.anomaly-label .smooth-tag {
  color: var(--wood);
  font-weight: 700;
  font-size: 12px;
  margin-left: 6px;
  letter-spacing: 0.02em;
}
.anomaly-period {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-2);
  white-space: nowrap;
}
.anomaly-delta {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  text-align: right;
}
.anomaly-delta.up   { color: var(--green); }
.anomaly-delta.down { color: var(--red); }
.anomaly-delta .dollars {
  font-weight: 600;
  font-size: 12px;
  opacity: 0.85;
  margin-left: 4px;
}
.anomaly-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-2);
  font-style: italic;
}

@media (max-width: 640px) {
  .anomaly-row {
    grid-template-columns: 1fr auto;
    row-gap: 4px;
  }
  .anomaly-period {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* ============================================================
   DETAIL VIEW — Summary/Detail toggle, statement tables, tiles
   Added in Session 3b. Purely additive; no existing rules changed.
   ============================================================ */

.view-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 3px;
  margin: 0 0 16px 0;
  gap: 2px;
}
.view-btn {
  background: transparent;
  border: 0;
  color: var(--text-2);
  padding: 8px 20px;
  font: 700 13px/1 Inter, sans-serif;
  letter-spacing: 0.03em;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 80ms ease;
  min-width: 108px;
  text-align: center;
}
.view-btn:hover { color: var(--wood-light); }
.view-btn:active { transform: scale(0.96); }
.view-btn.active {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  color: #1a1410;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(212, 163, 104, 0.25);
}

/* Top row: statement tabs on left (~25% width), Export CSV on right above Net Margin KPI */
.detail-top-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.detail-top-row .detail-stmt-toggle {
  margin: 0;
  grid-column: 1 / 2;
  width: 100%;
}
.detail-top-row .export-btn-wrap {
  grid-column: 4 / 5;
  display: flex;
  align-items: stretch;
}

.detail-stmt-toggle {
  display: flex;
  background: linear-gradient(180deg, #070707 0%, var(--bg-2) 60%, var(--bg-3) 100%);
  border: 1px solid #000000;
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
  width: calc((100% - 42px) / 4); /* one KPI box width — matches .detail-strip grid */
  max-width: 280px;
  box-sizing: border-box;
  margin: 0 0 14px 0;
  box-shadow:
    0 0 0 1px rgba(224, 182, 108, 0.35),
    0 0 10px rgba(224, 182, 108, 0.30),
    0 3px 10px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.detail-stmt-btn {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--wood-light);
  padding: 10px 4px;
  font: 700 12px/1.2 Inter, sans-serif;
  letter-spacing: 0.03em;
  border-radius: 7px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 80ms ease;
  text-align: center;
  white-space: normal;
}
.detail-stmt-btn:hover { color: var(--gold); }
.detail-stmt-btn:active { transform: scale(0.96); }
.detail-stmt-btn.active {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  color: #1a1410;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(212, 163, 104, 0.25);
}

/* Export CSV button — matches toggle container (flipped gradient: black top, blue bottom).
   Half the width of a KPI box, text stacks as "CSV" / "EXPORT" centered. */
.export-btn {
  width: 50%;
  margin-left: auto;
  background: linear-gradient(180deg, #070707 0%, var(--bg-2) 60%, var(--bg-3) 100%);
  border: 1px solid #000000;
  color: var(--wood-light);
  font: 800 11.5px/1.15 Inter, sans-serif;
  letter-spacing: 0.05em;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 8px 6px;
  transition: background 140ms ease, color 140ms ease, transform 80ms ease, box-shadow 140ms ease, border-color 140ms ease;
  box-shadow:
    0 0 0 1px rgba(224, 182, 108, 0.35),
    0 0 10px rgba(224, 182, 108, 0.30),
    0 3px 10px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-transform: uppercase;
  text-align: center;
}
.export-btn .csv-top,
.export-btn .csv-bot-full,
.export-btn .csv-bot-short {
  display: block;
}
.export-btn .csv-bot-short { display: none; }
@media (max-width: 640px) {
  .export-btn .csv-bot-full  { display: none; }
  .export-btn .csv-bot-short { display: block; }
}
.export-btn:hover {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  color: #1a1410;
  border-color: var(--wood-dark);
  box-shadow: 0 4px 14px rgba(212, 163, 104, 0.3);
}
.export-btn:active { transform: scale(0.98); }

/* Header strip (key takeaways per statement) */
.detail-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.detail-tile {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg) 100%);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow:
    0 0 0 1px rgba(224, 182, 108, 0.35),
    0 0 10px rgba(224, 182, 108, 0.30),
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 140ms ease, box-shadow 140ms ease;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.detail-tile:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(224, 182, 108, 0.45),
    0 0 14px rgba(224, 182, 108, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.dt-label {
  color: var(--wood-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  opacity: 0.85;
  text-align: center;
  white-space: pre-line;
  line-height: 1.35;
  min-height: 2em;
}
.dt-value {
  color: var(--text);
  font: 800 22px/1.1 Inter, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  text-align: center;
}
.detail-tile.neg .dt-value { color: var(--red); }

.detail-table-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.detail-chip {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  padding: 5px 10px;
  font: 500 12px/1 Inter, sans-serif;
  border-radius: 7px;
  cursor: pointer;
}
.detail-chip:hover {
  background: var(--bg-3);
  color: var(--text);
}

/* The table scrolls horizontally on narrow screens; first column is sticky */
.detail-scroller {
  background: var(--bg-2);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  max-width: 100%;
}
.detail-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
  font: 400 13px/1.35 Inter, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.detail-table thead th {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 50%, var(--wood-dark) 100%);
  color: #1a1410;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  padding: 11px 12px;
  border-bottom: 2px solid var(--wood-dark);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.detail-table thead th.label-col {
  text-align: left;
  padding-left: 18px;
  min-width: 220px;
}
.detail-table td {
  padding: 5px 12px;
  border-bottom: 1px solid rgba(42, 58, 79, 0.4);
  white-space: nowrap;
}
.detail-table td.amt,
.detail-table th.mcol {
  min-width: 92px;
  text-align: center;
}
.detail-table td.amt {
  cursor: pointer;
}
.detail-table td.amt.neg { color: var(--red); }
.detail-table td.amt.zero { color: var(--text-3); }

/* Tap-to-reveal cents: swap the cell contents inline (no tooltip).
   The tapped cell transforms to a gold gradient with black text showing
   the full-precision value. */
.detail-table td.amt .amt-cents { display: none; }
.detail-table td.amt .amt-whole { display: inline; }
.detail-table td.amt.show-cents {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%) !important;
  color: #1a1410 !important;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px var(--wood-dark), 0 2px 6px rgba(0,0,0,0.4);
}
.detail-table td.amt.neg.show-cents {
  color: #7a1010 !important;   /* deep red, readable against gold */
}
.detail-table td.amt.show-cents .amt-whole { display: none; }
.detail-table td.amt.show-cents .amt-cents { display: inline; }

/* Sticky first column — FULLY opaque so scrolled numbers don't bleed through */
.detail-table .sticky-col {
  position: sticky;
  left: 0;
  background: var(--bg-2);
  background-color: #162230;  /* opaque fallback */
  z-index: 2;
  min-width: 220px;
  max-width: 320px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
  text-overflow: ellipsis;
  overflow: hidden;
  box-shadow: 6px 0 10px -4px rgba(0,0,0,0.55);
}
.detail-table thead .sticky-col {
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 50%, var(--wood-dark) 100%);
  color: #1a1410;
  z-index: 3;
}

/* TTM column — full gold gradient summary column.
   Entire column highlighted so it pops as the aggregated view. */
.detail-table thead th.ttm-col {
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 50%, var(--wood-dark) 100%);
  color: #1a1410;
}
.detail-table td.ttm {
  border-left: 2px solid var(--wood-dark);
  background: linear-gradient(180deg, rgba(236, 199, 149, 0.85) 0%, rgba(212, 163, 104, 0.8) 50%, rgba(155, 117, 66, 0.75) 100%) !important;
  color: #1a1410 !important;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}
.detail-table td.ttm.zero {
  color: #3a2f18 !important;
}
.detail-table td.ttm.neg {
  color: #6a0d0d !important;   /* deep red against gold */
}
/* Keep the tap-reveal cent view even more prominent if the user taps TTM */
.detail-table td.ttm.show-cents {
  background: linear-gradient(135deg, var(--wood-dark) 0%, var(--wood) 100%) !important;
  box-shadow: inset 0 0 0 2px #5a3f1f, 0 2px 8px rgba(0,0,0,0.4);
}
.detail-table td.ttm.neg.show-cents {
  color: #6a0d0d !important;
}

/* Row hierarchy — clean, minimal. No alternating stripes, no wood tint on subtotals. */
.detail-table tr.row.section .sticky-col {
  color: var(--wood-light);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.05em;
}
.detail-table tr.row.subtotal .sticky-col,
.detail-table tr.row.subtotal td.amt {
  font-weight: 700;
  border-top: 1px solid var(--line-2);
}
.detail-table tr.row.subtotal.grand td {
  border-top: 3px double var(--gold);
  border-bottom: 2px solid var(--gold);
  color: var(--gold);
}
.detail-table tr.row.lvl-0 .sticky-col { font-weight: 600; }
.detail-table tr.row.lvl-1 .sticky-col { font-weight: 500; }
.detail-table tr.row.lvl-2 .sticky-col { color: var(--text-2); }
.detail-table tr.row.lvl-3 .sticky-col,
.detail-table tr.row.lvl-4 .sticky-col,
.detail-table tr.row.lvl-5 .sticky-col { color: var(--text-3); }
.detail-table tr.row:hover .sticky-col { background: #24211d; }
.detail-table tr.row:hover td.amt:not(.show-cents) { background: rgba(224, 182, 108, 0.06); }

/* Toggle chevron */
.row-toggle {
  background: transparent;
  border: 0;
  color: var(--wood-light);
  cursor: pointer;
  font-size: 12px;
  width: 18px;
  padding: 0;
  margin-right: 4px;
  line-height: 1;
}
.row-toggle:hover { color: var(--gold); }
.row-toggle-spacer {
  display: inline-block;
  width: 18px;
  margin-right: 4px;
}

.detail-empty, .detail-error {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text-2);
}
.detail-error { border-color: var(--red); color: var(--red); }

.detail-note {
  color: var(--text-3);
  font-size: 12px;
  margin: 10px 2px 0 2px;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 900px) {
  .detail-strip { grid-template-columns: repeat(2, 1fr); }
  .detail-table { font-size: 12px; }
  .detail-table thead th { padding: 6px 8px; font-size: 10.5px; }
  .detail-table td { padding: 4px 8px; }
  .detail-table .sticky-col { min-width: 180px; max-width: 220px; }
}
@media (max-width: 560px) {
  .detail-strip { grid-template-columns: 1fr 1fr; gap: 8px; }
  .dt-value { font-size: 16px; }
  .detail-table { font-size: 11.5px; }
  .detail-table .sticky-col { min-width: 150px; max-width: 180px; }
}

/* Primary Export chip — stand out from Expand/Collapse */
.detail-chip.detail-chip-primary {
  background: linear-gradient(135deg, #8f6a3e 0%, var(--wood) 100%);
  color: #1a1410;
  border-color: var(--wood-dark);
  font-weight: 700;
  margin-left: auto;
}
.detail-chip.detail-chip-primary:hover {
  filter: brightness(1.1);
  color: #1a1410;
}
.detail-table-controls {
  align-items: center;
}

/* Export modal */
.export-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 160ms ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.export-modal {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 22px 22px 18px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(224,182,108,0.2);
  color: var(--text);
}
.export-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.export-modal h3 {
  margin: 0;
  font: 800 18px/1 Inter, sans-serif;
  color: var(--wood-light);
  letter-spacing: 0.01em;
}
.export-close {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.export-close:hover { color: var(--text); }
.export-sub {
  color: var(--text-2);
  font-size: 13px;
  margin: 4px 0 16px 0;
}
.export-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.export-option {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: all 140ms ease;
  font-family: Inter, sans-serif;
}
.export-option:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--bg-3);
  transform: translateX(2px);
}
.export-option:active:not(:disabled) { transform: scale(0.98); }
.export-option:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.eo-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
  color: var(--wood-light);
  letter-spacing: 0.02em;
}
.eo-range {
  font-size: 12.5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ============================================================
   Statement label — decorative title between toggle row and KPI strip.
   "━━━━━ P&L ━━━━━" style with gold lines flanking centered bold text.
   Responsive: lines shrink on smaller screens.
   ============================================================ */
.detail-stmt-label {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 4px 0 16px 0;
  text-align: center;
}
.detail-stmt-label::before,
.detail-stmt-label::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--wood) 40%, var(--wood-light) 100%);
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(224, 182, 108, 0.25);
}
.detail-stmt-label::after {
  background: linear-gradient(90deg, var(--wood-light) 0%, var(--wood) 60%, transparent 100%);
}
.detail-stmt-label span {
  display: inline-block;
  padding: 0 18px;
  font: 900 26px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wood-light);
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
}
@media (max-width: 640px) {
  .detail-stmt-label { gap: 10px; margin: 2px 0 12px 0; }
  .detail-stmt-label span {
    font-size: 18px;
    padding: 0 10px;
  }
  .detail-stmt-label::before,
  .detail-stmt-label::after { height: 1.5px; }
}

/* Connection status dot — lives next to Sign Out button, mirrors footer state */
.connection-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green);
  font-size: 14px;
  line-height: 1;
  margin: 0 4px 0 2px;
  text-shadow: 0 0 8px rgba(143, 188, 122, 0.55);
  transition: color 160ms ease, text-shadow 160ms ease;
}
.connection-dot.offline {
  color: var(--red);
  text-shadow: 0 0 8px rgba(212, 116, 116, 0.55);
}

/* ==================================================================
   SESSION 3d / PHASE 2 — toast, upload history, panel error state
   ================================================================== */

/* ---------- Toast host (fixed, top-center, lives above everything) ---------- */
.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  align-items: flex-end;
}
/* Module-created container (meetings.js, notes.js, pending.js) — same
   visual behavior as toast-host. */
.gsm-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
  align-items: flex-end;       /* keep toasts hugging the right edge */
}
.gsm-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 14px;
  border-radius: 10px;
  background: var(--bg-2, #1a1410);
  border: 1px solid var(--line, #30251b);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font: 500 13px/1.35 Inter, sans-serif;
  color: var(--text-1, #f0e6d8);
  min-width: 240px;
  max-width: 360px;
  animation: gsm-toast-in 220ms cubic-bezier(0.2, 0.7, 0.3, 1.0);
}
.gsm-toast.is-leaving {
  animation: gsm-toast-out 200ms ease-in forwards;
}
@keyframes gsm-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes gsm-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}
.gsm-toast.is-success {
  border-color: #3e6a3e;
  background: linear-gradient(180deg, #1d2a1d 0%, #1a1410 100%);
}
.gsm-toast.is-error {
  border-color: #8a3b3b;
  background: linear-gradient(180deg, #2a1a1a 0%, #1a1410 100%);
}
.gsm-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.gsm-toast.is-success .gsm-toast-icon {
  background: #3e6a3e;
  color: #1a1410;
}
.gsm-toast.is-error .gsm-toast-icon {
  background: #c25454;
  color: #1a1410;
}
.gsm-toast-msg { flex: 1; }
.gsm-toast-close {
  background: transparent;
  border: 0;
  color: var(--text-3, #a89b89);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 120ms ease;
}
.gsm-toast-close:hover { color: var(--text-1, #f0e6d8); }

/* ---------- Admin panel note — error state ---------- */
.admin-panel-note.is-error {
  color: #e78989;
}

/* ---------- Upload history ---------- */
.admin-history-body { margin-top: 4px; }
.admin-history-loading,
.admin-history-empty {
  font: italic 13px/1.5 Inter, sans-serif;
  color: var(--text-3);
  padding: 8px 0;
}
.admin-history-error {
  font: 13px/1.45 Inter, sans-serif;
  color: #e78989;
  padding: 10px 12px;
  background: rgba(194, 84, 84, 0.08);
  border: 1px solid rgba(194, 84, 84, 0.3);
  border-radius: 6px;
}
.admin-history-table {
  width: 100%;
  border-collapse: collapse;
  font: 13px/1.4 Inter, sans-serif;
}
.admin-history-table thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.admin-history-table thead th.num { text-align: right; }
.admin-history-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  vertical-align: middle;
}
.admin-history-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-history-table tbody tr:last-child td { border-bottom: 0; }
.admin-history-table .file-cell {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}
.admin-history-table .hist-new  { color: #8fc48f; font-weight: 600; }
.admin-history-table .hist-over { color: var(--wood-light, #d4a96a); font-weight: 600; }

/* ==================================================================
   SESSION 4 / PHASE 3 — People tab, modals, forgot/forced reset
   ================================================================== */

/* ---------- Login extras ---------- */
.login-info {
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.3);
  color: #c8e6c9;
  font: 13px/1.5 Inter, sans-serif;
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 8px;
}
.login-forgot-link {
  display: inline-block;
  background: transparent;
  border: 0;
  color: var(--text-3, #a89b89);
  font: 500 13px/1.4 Inter, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: 14px;
  padding: 4px 6px;
  cursor: pointer;
  align-self: flex-start;
}
.login-forgot-link:hover { color: var(--text-1, #f0e6d8); }
.login-forgot-link:disabled { opacity: 0.5; cursor: default; }

/* ---------- Modal system (shared) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(8, 6, 4, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--bg-2, #1a1410);
  border: 1px solid var(--line, #30251b);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  padding: 28px 28px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  font: 14px/1.5 Inter, sans-serif;
  color: var(--text-1, #f0e6d8);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.modal-eyebrow {
  font: 700 11px/1.2 Inter, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wood-light, #d4a96a);
  margin-bottom: 6px;
}
.modal-title {
  font: 800 22px/1.2 'Inter', sans-serif;
  margin: 0 0 8px;
  color: var(--text-1, #f0e6d8);
  letter-spacing: -0.01em;
}
.modal-title em { color: var(--wood-light, #d4a96a); font-style: italic; }
.modal-subtitle {
  font: 13px/1.45 Inter, sans-serif;
  color: var(--text-3, #a89b89);
  margin: 0 0 18px;
}
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.modal-form .field { display: flex; flex-direction: column; gap: 6px; }
.modal-form .field-label {
  font: 700 11px/1.2 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3, #a89b89);
}
.modal-form .field-hint {
  font: 12px/1.4 Inter, sans-serif;
  color: var(--text-3, #a89b89);
  margin-top: 4px;
}
.modal-form input,
.modal-form select {
  background: var(--bg-1, #100b08);
  border: 1px solid var(--line, #30251b);
  color: var(--text-1, #f0e6d8);
  font: 14px/1.4 Inter, sans-serif;
  padding: 10px 12px;
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms ease;
}
.modal-form input:focus,
.modal-form select:focus {
  border-color: var(--wood-light, #d4a96a);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.modal-success {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 8px;
  padding: 14px 14px 12px;
  font: 13px/1.45 Inter, sans-serif;
}
.invite-success-head {
  font-weight: 700;
  color: #c8e6c9;
  margin-bottom: 8px;
}
.invite-success-block {
  background: var(--bg-1, #100b08);
  color: var(--text-1, #f0e6d8);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  border: 1px solid var(--line, #30251b);
  border-radius: 6px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 10px;
}
.invite-success-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- People tab ---------- */
.people-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.people-invite-btn { padding: 9px 16px; font-size: 13px; }

.people-list-wrap {
  background: var(--bg-2, #1a1410);
  border: 1px solid var(--line, #30251b);
  border-radius: 10px;
  padding: 6px 6px 4px;
  margin-bottom: 16px;
}
.people-loading,
.people-empty {
  font: italic 13px/1.5 Inter, sans-serif;
  color: var(--text-3);
  padding: 14px 12px;
}
.people-error {
  font: 13px/1.45 Inter, sans-serif;
  color: #e78989;
  padding: 12px;
  background: rgba(194, 84, 84, 0.06);
  border-radius: 6px;
  margin: 4px;
}
.people-table {
  width: 100%;
  border-collapse: collapse;
  font: 13px/1.4 Inter, sans-serif;
}
.people-table thead th {
  text-align: left;
  font: 700 11px/1.2 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.people-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-1);
  vertical-align: middle;
}
.people-table tbody tr:last-child td { border-bottom: 0; }
.people-table .actions-col { text-align: right; white-space: nowrap; }
.actions-disabled { color: var(--text-3); opacity: 0.5; }

/* Role + status pills */
.role-pill,
.status-pill {
  display: inline-block;
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 0;
  border: 1px solid transparent;
}
.role-pill.is-owner   { background: rgba(212, 169, 106, 0.15); color: var(--wood-light, #d4a96a); border-color: rgba(212, 169, 106, 0.4); }
.role-pill.is-admin,
.role-pill.is-manager { background: rgba(143, 196, 143, 0.12); color: #b6dab6; border-color: rgba(143, 196, 143, 0.3); }
.role-pill.is-member  { background: rgba(168, 155, 137, 0.10); color: var(--text-3); border-color: rgba(168, 155, 137, 0.25); }
.role-pill.is-sales   { background: rgba(110, 160, 210, 0.14); color: #9cc4ec; border-color: rgba(110, 160, 210, 0.35); }
.role-pill.is-super   { background: linear-gradient(180deg, rgba(212, 169, 106, 0.32) 0%, rgba(212, 169, 106, 0.18) 100%); color: #f5d8a3; border-color: rgba(212, 169, 106, 0.6); }

.status-pill.is-active     { background: rgba(74, 222, 128, 0.10); color: #b6dab6; border-color: rgba(74, 222, 128, 0.3); }
.status-pill.is-firstlogin { background: rgba(212, 169, 106, 0.10); color: var(--wood-light, #d4a96a); border-color: rgba(212, 169, 106, 0.3); }
.status-pill.is-inactive   { background: rgba(168, 155, 137, 0.08); color: var(--text-3); border-color: rgba(168, 155, 137, 0.25); }

/* In-row link buttons */
.btn-link {
  background: transparent;
  border: 0;
  color: var(--wood-light, #d4a96a);
  font: 600 12px/1.2 Inter, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
  transition: color 120ms ease;
}
.btn-link:hover { color: var(--text-1, #f0e6d8); }
.btn-link:disabled { opacity: 0.5; cursor: default; }
.btn-link.is-danger { color: #e78989; }
.btn-link.is-danger:hover { color: #ff9f9f; }

/* ==================================================================
   SESSION 5 / v10 — EQUIPMENT TAB
   ================================================================== */

/* Toolbar: view toggle + add button */
.eq-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.eq-view-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 3px;
  gap: 2px;
}
.eq-view-btn {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font: 700 12px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 9px 16px;
  border-radius: 0;
  cursor: pointer;
  transition: all 140ms ease;
}
.eq-view-btn:hover { color: var(--text-2); }
.eq-view-btn.active {
  background: linear-gradient(180deg, rgba(212, 169, 106, 0.22) 0%, rgba(212, 169, 106, 0.10) 100%);
  color: var(--wood-light);
  box-shadow: inset 0 0 0 1px rgba(212, 169, 106, 0.4);
}

.eq-add-btn { margin-top: 0; padding: 9px 16px; font-size: 13px; }

.eq-toolbar-actions {
  display: inline-flex;
  align-items: stretch;
  gap: 10px;
}
.eq-toolbar-actions > * {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Body container */
.eq-body { display: flex; flex-direction: column; gap: 28px; }

.eq-loading,
.eq-empty-mini {
  font: italic 13px/1.5 'Inter', sans-serif;
  color: var(--text-3);
  padding: 14px 4px;
}
.eq-error {
  font: 13px/1.45 'Inter', sans-serif;
  color: #e78989;
  padding: 12px;
  background: rgba(194, 84, 84, 0.06);
  border-radius: 8px;
}

.eq-empty {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}
.eq-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--wood-light);
  opacity: 0.9;
}
.eq-empty-icon svg { display: block; height: 56px; width: auto; }
.eq-empty-text {
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  max-width: 420px;
  margin: 0 auto;
}

/* Group (category) */
.eq-group { display: flex; flex-direction: column; gap: 14px; }
.eq-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.eq-group-title {
  font: 800 18px/1.2 'Inter', sans-serif;
  letter-spacing: -0.01em;
  color: var(--text);
}
.eq-group-count {
  font: 700 11px/1 'Inter', sans-serif;
  color: var(--text-3);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 4px 9px;
  border-radius: 0;
  letter-spacing: 0.04em;
}
.eq-group-add {
  margin-left: auto;
  align-self: center;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--wood-light);
  font: 600 16px/1 Inter, sans-serif;
  width: 28px;
  height: 28px;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
}
.eq-group-add:hover {
  background: rgba(212, 169, 106, 0.12);
  border-color: var(--wood-light);
  color: var(--wood-light);
  transform: scale(1.08);
}
.eq-group-add:active { transform: scale(0.95); }

/* ---------- Reorder mode ---------- */
/* The toggle pill — matches the proportions of .eq-add-btn but is a
   secondary (dark + gold-accented) pill until activated, at which point
   it flips to the same gold gradient as .btn-primary. */
.eq-reorder-toggle {
  margin-top: 0;
  background: var(--bg-2);
  color: var(--wood-light);
  border: 1px solid rgba(212, 169, 106, 0.4);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font: 800 13px/1 'Inter', sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
}
.eq-reorder-toggle:hover:not(:disabled) {
  background: rgba(212, 169, 106, 0.12);
  border-color: var(--wood-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(212, 163, 104, 0.22);
}
.eq-reorder-toggle:active:not(:disabled) { transform: translateY(0); }
.eq-reorder-toggle.is-active {
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 50%, var(--wood-dark) 100%);
  color: #1a1208;
  border-color: var(--wood-dark);
  box-shadow: 0 2px 10px rgba(212, 163, 104, 0.35);
}
.eq-reorder-toggle.is-active:hover {
  filter: brightness(1.06);
}

/* The little ▲▼ buttons themselves — refined dark pills with gold accent */
.eq-reorder-btn {
  background: rgba(8, 6, 4, 0.6);
  border: 1px solid rgba(212, 169, 106, 0.32);
  color: var(--wood-light);
  font: 700 11px/1 'Inter', sans-serif;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 6px;
  transition: background 140ms ease, border-color 140ms ease, transform 100ms ease;
  backdrop-filter: blur(2px);
}
.eq-reorder-btn:hover:not(:disabled) {
  background: rgba(212, 169, 106, 0.18);
  border-color: var(--wood-light);
}
.eq-reorder-btn:active:not(:disabled) { transform: scale(0.94); }
.eq-reorder-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

/* Subtle gold tint on category headers when in reorder mode */
.eq-group.is-reorder .eq-group-head {
  background: linear-gradient(180deg, rgba(212, 169, 106, 0.08) 0%, rgba(212, 169, 106, 0.03) 100%);
  border: 1px solid rgba(212, 169, 106, 0.22);
  border-radius: 10px;
  padding: 10px 12px;
}

/* Cards in reorder mode — soft gold dashed outline, no hover-lift */
.eq-card.is-reorder {
  cursor: default;
  outline: 1px dashed rgba(212, 169, 106, 0.32);
  outline-offset: -1px;
}
.eq-card.is-reorder:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
}

/* Card-level reorder controls, top-right corner */
.eq-card-reorder {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.eq-card-reorder .eq-reorder-btn {
  width: 30px;
  height: 30px;
  margin-left: 0;
}

/* ---- Always-on drag-and-drop (categories + cards) ---- */
.eq-groups-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.eq-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: color 140ms ease, background 140ms ease;
}
.eq-drag-handle:hover { color: var(--wood-light); }
.eq-drag-handle:active { cursor: grabbing; }
.eq-drag-handle svg { display: block; }

/* Category-level handle: sits at the start of the section header.
   Uses an explicit color + faint background so it's visible against
   the dark gradient header (var(--text-3) alone disappears). */
.eq-drag-handle-cat {
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 4px;
  color: var(--wood-light);
  background: rgba(212, 169, 106, 0.08);
  border: 1px solid rgba(212, 169, 106, 0.18);
  flex: 0 0 auto;
}
.eq-drag-handle-cat svg { width: 14px; height: 14px; }
.eq-drag-handle-cat:hover {
  background: rgba(212, 169, 106, 0.18);
  border-color: rgba(212, 169, 106, 0.35);
}

/* Card-level handle: top-right corner, doesn't trigger card click */
.eq-drag-handle-card {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(8, 6, 4, 0.45);
  opacity: 0;                       /* fade in on card hover so it's not visual noise */
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease;
  z-index: 3;
}
.eq-card { position: relative; }    /* anchor handle absolutely */
.eq-card:hover .eq-drag-handle-card,
.eq-drag-handle-card:focus-visible {
  opacity: 1;
}
.eq-drag-handle-card:hover {
  background: rgba(212, 169, 106, 0.20);
  color: var(--wood-light);
}

/* On touch devices the :hover state is sticky/unreliable — keep handle visible */
@media (hover: none) {
  .eq-drag-handle-card { opacity: 0.7; }
}

/* SortableJS ghost states — semi-transparent placeholder while dragging */
.eq-card-ghost {
  opacity: 0.35;
  background: rgba(212, 169, 106, 0.08) !important;
  border-style: dashed !important;
}
.eq-group-ghost {
  opacity: 0.45;
}
.eq-group-ghost .eq-group-head {
  background: rgba(212, 169, 106, 0.10);
  border: 1px dashed rgba(212, 169, 106, 0.50);
  border-radius: 8px;
}

/* Card grid */
.eq-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.eq-card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  display: flex;
  flex-direction: column;
}
.eq-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.eq-card:active { transform: translateY(0); }

.eq-card-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.eq-card-cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--wood-light);
  background: linear-gradient(135deg, rgba(212, 163, 104, 0.06), rgba(42, 58, 79, 0.4));
}
.eq-card-cover-empty svg { display: block; height: 44px; width: auto; opacity: 0.55; }

.eq-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }

.eq-card-name {
  font: 700 15px/1.3 'Inter', sans-serif;
  color: var(--text);
  letter-spacing: -0.01em;
}
.eq-card-desc {
  font: 500 12px/1.4 'Inter', sans-serif;
  color: var(--text-3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.eq-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* Pills */
.eq-pill {
  display: inline-block;
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 0;
  border: 1px solid transparent;
}
.eq-pill-status.is-active       { background: rgba(74, 222, 128, 0.10); color: #b6dab6; border-color: rgba(74, 222, 128, 0.3); }
.eq-pill-status.is-under_repair { background: rgba(212, 169, 106, 0.14); color: var(--wood-light); border-color: rgba(212, 169, 106, 0.4); }
.eq-pill-status.is-inactive     { background: rgba(168, 155, 137, 0.10); color: var(--text-3); border-color: rgba(168, 155, 137, 0.25); }
.eq-pill-acq                    { background: rgba(168, 155, 137, 0.08); color: var(--text-2); border-color: rgba(168, 155, 137, 0.22); }
.eq-pill-future                 { background: linear-gradient(180deg, rgba(212, 169, 106, 0.32) 0%, rgba(212, 169, 106, 0.18) 100%); color: #f5d8a3; border-color: rgba(212, 169, 106, 0.6); }

/* Form modal extras */
.eq-toggle-row {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  background: rgba(212, 169, 106, 0.06);
  border: 1px solid rgba(212, 169, 106, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}
.eq-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--wood-light);
  cursor: pointer;
}
.eq-toggle-label {
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--text-2);
}
.eq-toggle-label em {
  color: var(--wood-light);
  font-style: normal;
  font-weight: 700;
}

.eq-form-actions {
  justify-content: space-between !important;
}
.eq-form-actions-right { display: flex; gap: 10px; }

/* ----------------- DETAIL MODAL ----------------- */
.eq-detail-backdrop { padding: 0; }
.eq-detail-card {
  background: var(--bg-2);
  width: 100%;
  max-width: 920px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 14px/1.5 'Inter', sans-serif;
  color: var(--text);
  overflow: hidden;
  border-left: 1px solid var(--line-2);
  border-right: 1px solid var(--line-2);
}
@media (min-width: 720px) {
  .eq-detail-backdrop { padding: 24px; }
  .eq-detail-card {
    border-radius: 16px;
    height: auto;
    max-height: calc(100vh - 48px);
    border: 1px solid var(--line-2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  }
}

.eq-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
}
.eq-detail-head-text { flex: 1; min-width: 0; }
.eq-detail-head-text .modal-eyebrow { color: var(--wood-light); font-size: 11px; }
.eq-detail-head-text .modal-title { font-size: 22px; margin-bottom: 8px; word-wrap: break-word; }
.eq-detail-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.eq-detail-desc {
  margin-top: 10px;
  font: 500 13px/1.5 'Inter', sans-serif;
  color: var(--text-2);
}

.eq-detail-head-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.eq-detail-actions-row { display: flex; gap: 8px; align-items: center; }
.eq-detail-meeting-link {
  background: var(--bg-3);
  border: 1px solid var(--line);
  color: var(--text);
  font: 600 11px/1.2 'Inter', sans-serif;
  padding: 6px 26px 6px 10px;
  border-radius: 0;
  max-width: 240px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2010%206%27%3E%3Cpath%20d%3D%27M0%200l5%206%205-6z%27%20fill%3D%27%238a96a8%27%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px 5px;
}
.eq-detail-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 140ms ease;
}
.eq-detail-close:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line-2);
}

.eq-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.eq-detail-section {
  background: var(--bg-3);
  border: 1px solid var(--wood-dark);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow:
    0 0 0 1px rgba(212, 163, 104, 0.08),
    0 0 16px rgba(212, 163, 104, 0.10);
}
.eq-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.eq-section-title {
  font: 800 13px/1.2 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--wood-light);
}

/* Photo grid */
.eq-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.eq-photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.eq-photo-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 220ms ease;
}
.eq-photo-img.is-loaded { opacity: 1; }
.eq-photo-del,
.eq-photo-cover {
  position: absolute;
  top: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  opacity: 0;
  transition: opacity 140ms ease, transform 120ms ease;
}
.eq-photo-tile:hover .eq-photo-del,
.eq-photo-tile:hover .eq-photo-cover { opacity: 1; }
/* Cover star is always visible (touch-first UX) */
.eq-photo-cover { opacity: 0.92; }
.eq-photo-del { opacity: 0.85; }
.eq-photo-del   { right: 6px; }
.eq-photo-cover { left: 6px; color: var(--wood-light); }
.eq-photo-del:hover   { background: rgba(212, 80, 80, 0.92); transform: scale(1.08); }
.eq-photo-cover:hover { background: rgba(212, 169, 106, 0.92); color: var(--bg); transform: scale(1.08); }
/* Active cover photo: gold filled star, gold ring around tile */
.eq-photo-cover.is-active {
  background: var(--wood-light, #d4a96a);
  color: var(--bg, #1a1410);
  opacity: 1;
}
.eq-photo-tile.is-cover {
  outline: 2px solid var(--wood-light, #d4a96a);
  outline-offset: -2px;
}

/* Doc list */
.eq-doc-list { display: flex; flex-direction: column; gap: 8px; }
.eq-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 140ms ease;
}
.eq-doc-row:hover { border-color: var(--line-2); }
.eq-doc-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.eq-doc-meta { flex: 1; min-width: 0; }
.eq-doc-name {
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  font: 600 13px/1.3 'Inter', sans-serif;
  color: var(--text);
  cursor: pointer;
  transition: color 140ms ease;
  display: block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eq-doc-name:hover { color: var(--wood-light); }
.eq-doc-sub {
  font: 500 11px/1.3 'Inter', sans-serif;
  color: var(--text-3);
  margin-top: 2px;
}
.eq-doc-del {
  background: transparent;
  border: 0;
  color: var(--text-3);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 140ms ease;
}
.eq-doc-del:hover { background: rgba(212, 80, 80, 0.18); color: #e78989; }

/* Notes */
/* ----------------------------------------------------------
   EQUIPMENT NOTES & ISSUES — parchment treatment (v33.24)
   Reskinned to match the Notes tab aesthetic. The form textarea
   and each posted note become mini-parchment surfaces with the
   Architects Daughter handwriting font on the body text.
   ---------------------------------------------------------- */
.eq-note-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
  --p-bg:        #f5edd9;
  --p-bg-2:      #efe4cb;
  --p-bg-3:      #fff8e7;
  --p-line:      #d8c79e;
  --p-line-2:    #c8b27c;
  --p-text:      #2a1f10;
  --p-text-2:    #4a3826;
  --p-text-3:    #7a6747;
  --p-accent:    #8a6a2a;
  --p-danger:    #9a2828;
}
.eq-note-form textarea {
  flex: 1;
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1px solid var(--p-line-2);
  color: var(--p-text);
  font-family: 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
  resize: vertical;
  min-height: 56px;
  letter-spacing: 0.01em;
  box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
  transition: border-color 140ms ease;
}
.eq-note-form textarea::placeholder {
  color: var(--p-text-3);
  font-style: italic;
}
.eq-note-form textarea:focus { border-color: var(--p-accent); }
.eq-note-submit {
  align-self: stretch;
  padding: 0 16px;
  font-size: 13px;
  white-space: nowrap;
}

.eq-note-list { display: flex; flex-direction: column; gap: 10px; }
.eq-note {
  position: relative;
  background: #f5edd9;
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1px solid #c8b27c;
  border-radius: 8px;
  padding: 12px 14px;
  color: #2a1f10;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.30),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
}
.eq-note-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #d8c79e;
}
.eq-note-author {
  font: 700 12px/1.2 'Inter', sans-serif;
  color: #4a3826;
  letter-spacing: 0.02em;
}
.eq-note-date {
  font: 500 11px/1.2 'Inter', sans-serif;
  color: #7a6747;
  flex: 1;
}
.eq-note-del {
  background: transparent;
  border: 0;
  color: #7a6747;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.eq-note-del:hover { background: rgba(154, 40, 40, 0.10); color: #9a2828; }
.eq-note-body {
  font-family: 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #2a1f10;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Editable variant — your own notes are always editable in place.
   Looks like text, gains a soft outline on hover/focus to hint
   interactivity. Auto-saves on blur via equipment.js. */
.eq-note-body-edit {
  width: 100%;
  display: block;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  resize: vertical;
  min-height: 50px;
  padding: 6px 8px;
  margin: -6px -8px;          /* align with read-only siblings visually */
  outline: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.eq-note-body-edit:hover {
  background: rgba(255, 248, 222, 0.55);
  border-color: #d8c79e;
}
.eq-note-body-edit:focus {
  background: #fff8e7;
  border-color: #8a6a2a;
  box-shadow: 0 0 0 1px rgba(138, 106, 42, 0.18);
}

/* ====================================================================
   EQUIPMENT FORM — lease term row (start + end + auto-calc term)
   ==================================================================== */
.eq-lease-fields { display: flex; flex-direction: column; gap: 8px; }
.eq-lease-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 540px) {
  .eq-lease-row { grid-template-columns: 1fr; }
}
.eq-lease-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.eq-lease-sublabel {
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eq-lease-cell input[type="date"] {
  background: var(--bg-1, #0e1620);
  border: 1px solid var(--line);
  color: var(--text);
  font: 14px/1.4 Inter, sans-serif;
  padding: 9px 11px;
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms ease;
}
.eq-lease-cell input[type="date"]:focus {
  border-color: var(--wood-light);
}
.eq-lease-term-cell {
  /* visually distinct as read-only computed value */
}
.eq-lease-term-display {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  background: rgba(212, 169, 106, 0.06);
  border: 1px solid rgba(212, 169, 106, 0.22);
  color: var(--wood-light);
  font: 600 13px/1.3 Inter, sans-serif;
  border-radius: 6px;
}
.eq-lease-term-display.is-error {
  background: rgba(212, 116, 116, 0.08);
  border-color: rgba(212, 116, 116, 0.35);
  color: #e89a9a;
  font-size: 12px;
}

/* ====================================================================
   EQUIPMENT — Lease fields (form) + lease summary (detail view)
   ==================================================================== */

.eq-lease-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: rgba(212, 169, 106, 0.04);
  border: 1px solid rgba(212, 169, 106, 0.18);
  border-radius: 8px;
}
.eq-lease-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 540px) {
  .eq-lease-row { grid-template-columns: 1fr; }
}
.eq-lease-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}
.eq-lease-sublabel {
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eq-lease-cell input[type="date"] {
  background: var(--bg-1, #100b08);
  border: 1px solid var(--line);
  color: var(--text);
  font: 14px/1.4 Inter, sans-serif;
  padding: 9px 10px;
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms ease;
  min-height: 38px;
}
.eq-lease-cell input[type="date"]:focus { border-color: var(--wood-light); }

.eq-lease-term-cell { justify-content: flex-start; }
.eq-lease-term-display {
  background: rgba(212, 169, 106, 0.08);
  border: 1px solid rgba(212, 169, 106, 0.28);
  color: var(--wood-light);
  font: 700 14px/1 Inter, sans-serif;
  letter-spacing: 0.01em;
  padding: 0 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  min-height: 38px;
}
.eq-lease-term-display.is-error {
  background: rgba(212, 116, 116, 0.10);
  border-color: rgba(212, 116, 116, 0.4);
  color: #e89a9a;
  font-size: 12px;
}

/* Detail-view lease summary */
.eq-detail-lease {
  margin: 10px 0 0;
}
.eq-lease-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: rgba(212, 169, 106, 0.05);
  border: 1px solid rgba(212, 169, 106, 0.20);
  border-radius: 8px;
  overflow: hidden;
}
@media (max-width: 540px) {
  .eq-lease-summary { grid-template-columns: 1fr; }
}
.eq-lease-summary-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-right: 1px solid rgba(212, 169, 106, 0.18);
}
.eq-lease-summary-cell:last-child { border-right: 0; }
@media (max-width: 540px) {
  .eq-lease-summary-cell { border-right: 0; border-bottom: 1px solid rgba(212, 169, 106, 0.18); }
  .eq-lease-summary-cell:last-child { border-bottom: 0; }
}
.eq-lease-summary-label {
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eq-lease-summary-val {
  font: 600 14px/1.3 Inter, sans-serif;
  color: var(--text);
}
.eq-lease-summary-cell:last-child .eq-lease-summary-val {
  color: var(--wood-light);
}

/* When the "+ New category…" option reveals the text input, give it a top margin */
#eqFormCategoryNew:not([hidden]) {
  margin-top: 8px;
}

/* ===================================================================
   MEETINGS TAB (v30 / Session 7)
   =================================================================== */

.mtg-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
}
.mtg-new-btn { margin-top: 0; padding: 9px 16px; font-size: 13px; }

.mtg-body { display: flex; flex-direction: column; gap: 28px; }
.mtg-loading,
.mtg-empty-mini {
  font: italic 13px/1.5 'Inter', sans-serif;
  color: var(--text-3);
  padding: 12px 0;
}
.mtg-error {
  color: #f4c4c4;
  background: rgba(212, 116, 116, 0.10);
  border: 1px solid rgba(212, 116, 116, 0.35);
  border-radius: 8px;
  padding: 12px;
  font: 13px/1.5 'Inter', sans-serif;
}
.mtg-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}
.mtg-empty-icon svg {
  width: 56px;
  height: 56px;
  color: var(--wood-light);
  opacity: 0.55;
  margin-bottom: 14px;
}
.mtg-empty-text {
  font: italic 14px/1.5 'Inter', sans-serif;
  max-width: 360px;
  margin: 0 auto;
}

/* Group section */
.mtg-group { display: flex; flex-direction: column; gap: 10px; }
.mtg-group-title {
  font: 700 14px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin: 0 0 6px;
}

/* Meeting row */
.mtg-list { display: flex; flex-direction: column; gap: 8px; }
.mtg-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1.5px solid var(--wood);
  border-radius: 10px;
  cursor: pointer;
  box-shadow:
    0 0 18px rgba(212, 163, 104, 0.22),
    0 0 36px rgba(212, 163, 104, 0.10);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.mtg-row:hover {
  transform: translateY(-1px);
  border-color: var(--wood-light);
  box-shadow:
    0 0 24px rgba(212, 163, 104, 0.42),
    0 0 48px rgba(212, 163, 104, 0.20),
    0 8px 24px rgba(0, 0, 0, 0.35);
}
.mtg-row-date {
  font: 700 13px/1.2 'Inter', sans-serif;
  color: var(--wood-light);
  flex: 0 0 auto;
  min-width: 130px;
}
.mtg-row-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.mtg-row-title {
  font: 600 15px/1.3 'Inter', sans-serif;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtg-pill {
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 0;
  border: 1px solid;
  flex: 0 0 auto;
}
.mtg-pill.is-scheduled    { background: rgba(212, 169, 106, 0.10); color: var(--wood-light); border-color: rgba(212, 169, 106, 0.35); }
.mtg-pill.is-in_progress  { background: rgba(74, 222, 128, 0.10);  color: #b6dab6;             border-color: rgba(74, 222, 128, 0.30); }
.mtg-pill.is-completed    { background: rgba(168, 155, 137, 0.08); color: var(--text-3);       border-color: rgba(168, 155, 137, 0.22); }
.mtg-pill.is-cancelled    { background: rgba(212, 116, 116, 0.08); color: #d8a4a4;             border-color: rgba(212, 116, 116, 0.30); }

/* Detail modal */
.mtg-detail-backdrop { padding: 0; }
.mtg-detail-card {
  max-width: 900px;
  width: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
@media (min-width: 768px) {
  .mtg-detail-backdrop { padding: 24px; }
  .mtg-detail-card {
    max-height: calc(100vh - 48px);
    border-radius: 14px;
  }
}

.mtg-detail-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.mtg-detail-head-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mtg-edit-title {
  font: 800 22px/1.3 'Inter', sans-serif;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  width: 100%;
  margin-left: -8px;
}
.mtg-edit-title:focus, .mtg-edit-title:hover { border-color: var(--line); outline: none; background: var(--bg-2); }
.mtg-edit-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.mtg-edit-date,
.mtg-edit-status {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px/1 'Inter', sans-serif;
  padding: 7px 10px;
  border-radius: 6px;
}
.mtg-detail-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mtg-delete-btn {
  background: transparent;
  border: 1px solid rgba(212, 116, 116, 0.35);
  color: #d8a4a4;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.mtg-delete-btn:hover { background: rgba(212, 116, 116, 0.12); border-color: rgba(212, 116, 116, 0.6); }
.mtg-close-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font: 600 18px/1 'Inter', sans-serif;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mtg-close-btn:hover { background: var(--bg-3); color: var(--text); }

.mtg-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Section block */
.mtg-section { display: flex; flex-direction: column; gap: 10px; }
.mtg-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mtg-section-title {
  font: 700 13px/1 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin: 0;
}
.mtg-add-link {
  background: transparent;
  border: 1px solid rgba(212, 169, 106, 0.32);
  color: var(--wood-light);
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 11px;
  border-radius: 0;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.mtg-add-link:hover { background: rgba(212, 169, 106, 0.14); border-color: var(--wood-light); }

.mtg-list-section { display: flex; flex-direction: column; gap: 8px; }

/* Item rows (agenda / decision / action) */
.mtg-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.mtg-item-status {
  flex: 0 0 auto;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-2);
  font: 600 11px/1 'Inter', sans-serif;
  padding: 6px 8px;
  border-radius: 6px;
  min-width: 110px;
  cursor: pointer;
}
.mtg-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mtg-item-title {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font: 600 14px/1.4 'Inter', sans-serif;
  padding: 4px 6px;
  border-radius: 4px;
}
.mtg-item-title:focus, .mtg-item-title:hover { border-color: var(--line); background: var(--bg); outline: none; }
.mtg-item-desc {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  font: 13px/1.5 'Inter', sans-serif;
  padding: 4px 6px;
  border-radius: 4px;
  resize: none;            /* JS auto-sizes via scrollHeight */
  overflow: hidden;
  min-height: 32px;
  box-sizing: border-box;
}
.mtg-item-desc:focus, .mtg-item-desc:hover { border-color: var(--line); background: var(--bg); outline: none; }
.mtg-item-del {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font: 600 18px/1 'Inter', sans-serif;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.mtg-item-del:hover { background: rgba(212, 116, 116, 0.14); color: #d8a4a4; }

/* Action item meta row (assignee + due date) */
.mtg-action-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.mtg-action-assignee,
.mtg-action-due {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text-2);
  font: 12px/1 'Inter', sans-serif;
  padding: 5px 8px;
  border-radius: 4px;
}

/* Notes */
.mtg-note-form { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.mtg-note-form textarea {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px/1.5 'Inter', sans-serif;
  padding: 8px 10px;
  border-radius: 6px;
  resize: vertical;
}
.mtg-note-submit { margin-top: 0; padding: 9px 14px; font-size: 12px; flex: 0 0 auto; }

.mtg-notes-list { display: flex; flex-direction: column; gap: 8px; }
.mtg-note {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.mtg-note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.mtg-note-author { font: 700 12px/1 'Inter', sans-serif; color: var(--wood-light); }
.mtg-note-time   { font: 11px/1 'Inter', sans-serif; color: var(--text-3); flex: 1; }
.mtg-note-del {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  font: 600 16px/1 'Inter', sans-serif;
  padding: 2px 6px;
  border-radius: 4px;
}
.mtg-note-del:hover { background: rgba(212, 116, 116, 0.14); color: #d8a4a4; }
.mtg-note-body {
  font: 13px/1.5 'Inter', sans-serif;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Meeting attachments — photos + documents */
.mtg-photo-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.mtg-photo-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.mtg-photo-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 220ms ease;
}
.mtg-photo-img.is-loaded { opacity: 1; }
.mtg-photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  opacity: 0.85;
  transition: background 140ms ease, transform 120ms ease;
}
.mtg-photo-del:hover { background: rgba(212, 80, 80, 0.92); transform: scale(1.08); }

.mtg-doc-list { display: flex; flex-direction: column; gap: 8px; }
.mtg-doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.mtg-doc-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  color: var(--wood-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.mtg-doc-icon svg { width: 100%; height: 100%; }
.mtg-doc-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mtg-doc-name {
  background: transparent;
  border: 0;
  color: var(--text);
  font: 600 13px/1.3 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: rgba(212, 169, 106, 0.4);
  text-underline-offset: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtg-doc-name:hover { color: var(--wood-light); }
.mtg-doc-sub { font: 11px/1 'Inter', sans-serif; color: var(--text-3); }
.mtg-doc-del {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font: 600 18px/1 'Inter', sans-serif;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.mtg-doc-del:hover { background: rgba(212, 116, 116, 0.14); color: #d8a4a4; }

/* Bottom add link & carry buttons */
.mtg-add-link-bottom {
  align-self: flex-start;
  margin-top: 6px;
}
.mtg-carry-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(212, 169, 106, 0.4);
  color: var(--wood-light);
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.mtg-carry-btn:hover { background: rgba(212, 169, 106, 0.14); border-color: var(--wood-light); }
.mtg-carry-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* Carried marker pill on items — small blue pill with up-right SVG arrow,
   positioned at the bottom-right corner of the agenda/decision box. */
.mtg-carried-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 800 9px/1 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 0;
  background: rgba(31, 77, 122, 0.10);
  color: #8a6a2a;
  border: 1px solid rgba(138, 106, 42, 0.45);
  margin-top: 6px;
  align-self: flex-end;
  width: fit-content;
}
.mtg-carried-icon {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
}

/* Carry forward modal */
.mtg-carry-card {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mtg-carry-target { display: flex; flex-direction: column; gap: 8px; }
.mtg-carry-target select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px/1 'Inter', sans-serif;
  padding: 8px 10px;
  border-radius: 6px;
  width: 100%;
}
.mtg-carry-new {
  align-self: flex-start;
}
.mtg-carry-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 50vh;
  overflow-y: auto;
}
.mtg-carry-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--bg);
}
.mtg-carry-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 12px/1 'Inter', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin-bottom: 8px;
}
.mtg-carry-selectall {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font: 600 11px/1 'Inter', sans-serif;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.mtg-carry-selectall:hover { color: var(--wood-light); background: rgba(212, 169, 106, 0.08); }
.mtg-carry-list { display: flex; flex-direction: column; gap: 6px; }
.mtg-carry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  cursor: pointer;
}
.mtg-carry-row input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}
.mtg-carry-row-title {
  font: 13px/1.4 'Inter', sans-serif;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtg-carry-marker {
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(168, 155, 137, 0.10);
  padding: 3px 7px;
  border-radius: 0;
  flex: 0 0 auto;
}
.mtg-carry-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

/* ===================================================================
   MEETING DETAIL MODAL — PARCHMENT THEME (v33.1)
   Override prior styles for the meetings modal only.
   =================================================================== */

/* Parchment palette — local to .mtg-detail-card */
.mtg-detail-card {
  --p-bg:        #f5edd9;          /* aged parchment */
  --p-bg-2:      #efe4cb;          /* warmer panel */
  --p-bg-3:      #fff8e7;          /* highlight (input bg) */
  --p-line:      #d8c79e;          /* warm line */
  --p-line-2:    #c8b27c;          /* stronger border */
  --p-text:      #2a1f10;          /* near black, warm */
  --p-text-2:    #4a3826;          /* secondary */
  --p-text-3:    #7a6747;          /* muted */
  --p-accent:    #8a6a2a;          /* deep gold (instead of bright wood-light) */
  --p-accent-2:  #b8902f;          /* mid gold */
  --p-danger:    #9a2828;          /* deep red */
}

/* Make the modal HUGE (Zoom-friendly) */
.mtg-detail-backdrop { padding: 12px; }
.mtg-detail-card {
  max-width: 1400px;
  width: 100%;
  max-height: calc(100vh - 24px);
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.6), transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.10), transparent 60%);
  border: 1px solid var(--p-line-2);
  color: var(--p-text);
  font-family: 'Inter', sans-serif;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(180, 140, 70, 0.06);
}
@media (min-width: 768px) {
  .mtg-detail-backdrop { padding: 24px; }
}

/* Header */
.mtg-detail-card .mtg-detail-head {
  background: linear-gradient(180deg, rgba(255, 248, 222, 0.6), rgba(245, 237, 217, 0));
  border-bottom: 1px solid var(--p-line);
  padding: 22px 28px 16px;
}
.mtg-detail-card .mtg-edit-title {
  background: transparent;
  border: 1px solid transparent;
  color: var(--p-text);
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 800;
}
.mtg-detail-card .mtg-edit-title:focus,
.mtg-detail-card .mtg-edit-title:hover {
  background: var(--p-bg-3);
  border-color: var(--p-line);
  outline: none;
}
.mtg-detail-card .mtg-edit-date,
.mtg-detail-card .mtg-edit-status {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  color: var(--p-text);
}

/* Header action buttons in parchment palette */
.mtg-detail-card .mtg-carry-btn {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line-2);
  color: var(--p-accent);
}
.mtg-detail-card .mtg-carry-btn:hover {
  background: rgba(184, 144, 47, 0.10);
  border-color: var(--p-accent);
}
.mtg-detail-card .mtg-delete-btn {
  background: transparent;
  border: 1px solid rgba(154, 40, 40, 0.4);
  color: var(--p-danger);
}
.mtg-detail-card .mtg-delete-btn:hover {
  background: rgba(154, 40, 40, 0.08);
  border-color: var(--p-danger);
}
.mtg-detail-card .mtg-close-btn {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  color: var(--p-text-2);
}
.mtg-detail-card .mtg-close-btn:hover {
  background: var(--p-bg-2);
  color: var(--p-text);
}

/* Two-pane body */
.mtg-detail-card .mtg-detail-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
}
.mtg-pane {
  overflow-y: auto;
  padding: 18px 24px 24px;
}
.mtg-pane-left {
  flex: 1;
  border-bottom: 1px solid var(--p-line);
}
.mtg-pane-right {
  flex: 0 0 auto;
  background: rgba(239, 228, 203, 0.5);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
@media (min-width: 900px) {
  .mtg-detail-card .mtg-detail-body {
    flex-direction: row;
    gap: 0;
  }
  .mtg-pane-left {
    flex: 1 1 60%;
    border-bottom: 0;
    border-right: 1px solid var(--p-line);
  }
  .mtg-pane-right {
    flex: 0 0 40%;
    max-width: 480px;
  }
}

/* ---- Mobile drawer (phones only) ----
   Hides the right pane behind a slide-up bottom sheet so the agenda
   gets the full viewport. Above 900px this collapses to nothing — the
   side-by-side layout is untouched. */
.mtg-drawer-handle { display: none; }

@media (max-width: 899.98px) {
  .mtg-detail-card .mtg-detail-body {
    position: relative;          /* anchor for the bottom sheet */
  }
  .mtg-pane-left {
    border-bottom: 0;
    /* leave room so the bottom edge of the agenda isn't hidden by the handle */
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .mtg-drawer-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    width: 100%;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 0 18px env(safe-area-inset-bottom, 0px);
    background: linear-gradient(180deg, var(--p-bg-2) 0%, var(--p-bg) 100%);
    border-top: 1px solid var(--p-line-2);
    box-shadow: 0 -8px 24px rgba(60, 40, 10, 0.12);
    color: var(--p-accent);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.06em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease;
  }
  .mtg-drawer-handle:active {
    background: linear-gradient(180deg, var(--p-bg-3) 0%, var(--p-bg-2) 100%);
  }
  .mtg-drawer-grip {
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: var(--p-line-2);
  }
  .mtg-drawer-label {
    flex: 1;
    text-align: center;
    margin-top: 6px;            /* visually centered relative to the grip */
  }
  .mtg-drawer-chev {
    font-size: 18px;
    margin-top: 6px;
    transition: transform 0.25s ease;
  }
  .mtg-detail-card.mtg-drawer-open .mtg-drawer-chev {
    transform: rotate(180deg);
  }

  .mtg-pane-right {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    z-index: 3;
    height: 75vh;
    max-height: calc(100vh - 200px); /* keep header always visible */
    background: var(--p-bg);
    border-top: 1px solid var(--p-line-2);
    box-shadow: 0 -16px 40px rgba(60, 40, 10, 0.18);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.24, 1);
    padding-top: 24px;           /* extra breathing room at top */
    padding-bottom: 24px;
    overscroll-behavior: contain;
    will-change: transform;
  }
  .mtg-detail-card.mtg-drawer-open .mtg-pane-right {
    transform: translateY(0);
  }
  /* When drawer is open, lift the handle along with it so the user
     can tap the same surface to close. */
  .mtg-detail-card.mtg-drawer-open .mtg-drawer-handle {
    box-shadow: 0 -2px 12px rgba(60, 40, 10, 0.10);
    border-top-color: var(--p-line);
  }
}

/* Section titles in parchment */
.mtg-detail-card .mtg-section-title {
  color: var(--p-accent);
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.mtg-detail-card .mtg-add-link {
  background: transparent;
  border: 1px solid var(--p-line-2);
  color: var(--p-accent);
}
.mtg-detail-card .mtg-add-link:hover {
  background: rgba(184, 144, 47, 0.10);
  border-color: var(--p-accent);
}

/* Items (agenda, decision, action) on parchment */
.mtg-detail-card .mtg-item {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  color: var(--p-text);
}
.mtg-detail-card .mtg-item-status {
  background: var(--p-bg);
  border: 1px solid var(--p-line);
  color: var(--p-text-2);
}
.mtg-detail-card .mtg-item-title,
.mtg-detail-card .mtg-item-desc {
  color: var(--p-text);
  background: transparent;
}
.mtg-detail-card .mtg-item-title:focus,
.mtg-detail-card .mtg-item-title:hover,
.mtg-detail-card .mtg-item-desc:focus,
.mtg-detail-card .mtg-item-desc:hover {
  background: var(--p-bg);
  border-color: var(--p-line);
}
.mtg-detail-card .mtg-item-title::placeholder,
.mtg-detail-card .mtg-item-desc::placeholder {
  color: var(--p-text-3);
}
/* Agenda items only — larger, bold, dark blue title; larger, regular dark blue description.
   Scoped to .mtg-agenda-item so decisions keep their existing styling. */
.mtg-detail-card .mtg-agenda-item .mtg-item-title {
  font: 800 18px/1.4 'Inter', sans-serif;
  color: #8a6a2a;
  letter-spacing: -0.005em;
}
.mtg-detail-card .mtg-agenda-item .mtg-item-desc {
  font: 500 16px/1.5 'Inter', sans-serif;
  color: #8a6a2a;
}
.mtg-detail-card .mtg-agenda-item .mtg-item-title::placeholder,
.mtg-detail-card .mtg-agenda-item .mtg-item-desc::placeholder {
  color: rgba(31, 77, 122, 0.55);
}
.mtg-detail-card .mtg-item-del {
  color: var(--p-text-3);
}
.mtg-detail-card .mtg-item-del:hover {
  background: rgba(154, 40, 40, 0.10);
  color: var(--p-danger);
}
.mtg-detail-card .mtg-action-assignee,
.mtg-detail-card .mtg-action-due {
  background: var(--p-bg);
  border: 1px solid var(--p-line);
  color: var(--p-text-2);
}

/* Numbered agenda items */
.mtg-detail-card .mtg-agenda-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.mtg-detail-card .mtg-item-num {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 700 14px/1 'Source Serif Pro', 'Georgia', serif;
  color: var(--p-accent);
  background: var(--p-bg);
  border: 1px solid var(--p-line);
  border-radius: 50%;
  margin-top: 2px;
}

/* ---- Phone-only item layout (agenda + decisions + actions) ----
   On phones the status dropdown ate too much horizontal space, leaving
   the title squeezed into a narrow column. Switch to a 2-row grid so
   the title and description span full width, with status as a compact
   pill on the top row alongside the number and delete button. */
@media (max-width: 899.98px) {
  .mtg-detail-card .mtg-item,
  .mtg-detail-card .mtg-agenda-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "num    status del"
      "body   body   body";
    column-gap: 10px;
    row-gap: 8px;
    align-items: center;
  }
  .mtg-detail-card .mtg-item-num     { grid-area: num; margin-top: 0; }
  .mtg-detail-card .mtg-item-del     { grid-area: del; align-self: center; }
  .mtg-detail-card .mtg-item-body    { grid-area: body; }
  .mtg-detail-card .mtg-item-status  {
    grid-area: status;
    justify-self: start;             /* hug left, don't stretch */
    min-width: 0;                    /* override the 110px desktop floor */
    width: auto;
    padding: 4px 22px 4px 8px;       /* room for the native chevron */
    font-size: 11px;
    line-height: 1;
    height: 26px;
    border-radius: 13px;             /* pill */
  }
  /* For decision/action rows there's no .mtg-item-num — let status take
     the leftmost spot so the row still aligns cleanly. */
  .mtg-detail-card .mtg-item:not(.mtg-agenda-item) {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "status del"
      "body   body";
  }
}

/* Empty-state minis on parchment */
.mtg-detail-card .mtg-empty-mini {
  color: var(--p-text-3);
}

/* Notes */
.mtg-detail-card .mtg-note-form textarea {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  color: var(--p-text);
}
.mtg-detail-card .mtg-note-form textarea::placeholder { color: var(--p-text-3); }
.mtg-detail-card .mtg-note-submit {
  background: linear-gradient(180deg, #c8a058 0%, #a87c2c 50%, #7a5a1a 100%);
  border: 1px solid #7a5a1a;
  color: #fdf6e3;
  box-shadow: 0 2px 8px rgba(122, 90, 26, 0.25);
}
.mtg-detail-card .mtg-note {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
}
.mtg-detail-card .mtg-note-author { color: var(--p-accent); }
.mtg-detail-card .mtg-note-time   { color: var(--p-text-3); }
.mtg-detail-card .mtg-note-body   { color: var(--p-text); }
.mtg-detail-card .mtg-note-del    { color: var(--p-text-3); }
.mtg-detail-card .mtg-note-del:hover { background: rgba(154, 40, 40, 0.10); color: var(--p-danger); }

/* Photos / Documents on parchment */
.mtg-detail-card .mtg-photo-tile {
  background: var(--p-bg);
  border: 1px solid var(--p-line);
}
.mtg-detail-card .mtg-doc-row {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
}
.mtg-detail-card .mtg-doc-icon { color: var(--p-accent); }
.mtg-detail-card .mtg-doc-name {
  color: var(--p-text);
  text-decoration-color: rgba(138, 106, 42, 0.4);
}
.mtg-detail-card .mtg-doc-name:hover { color: var(--p-accent); }
.mtg-detail-card .mtg-doc-sub { color: var(--p-text-3); }
.mtg-detail-card .mtg-doc-del { color: var(--p-text-3); }
.mtg-detail-card .mtg-doc-del:hover { background: rgba(154, 40, 40, 0.10); color: var(--p-danger); }

/* Subtle vertical scrollbar styling within parchment */
.mtg-detail-card .mtg-pane::-webkit-scrollbar { width: 8px; }
.mtg-detail-card .mtg-pane::-webkit-scrollbar-track { background: transparent; }
.mtg-detail-card .mtg-pane::-webkit-scrollbar-thumb {
  background: rgba(184, 144, 47, 0.3);
  border-radius: 4px;
}

/* ===================================================================
   MEETING MODAL POLISH (v33.2)
   =================================================================== */

/* Logo */
.mtg-detail-logo {
  flex: 0 0 auto;
  height: 64px;
  width: auto;
  align-self: flex-start;
  margin-right: 16px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  /* The logo is solid black; it reads well against parchment */
  opacity: 0.92;
}
@media (max-width: 768px) {
  .mtg-detail-logo { height: 48px; margin-right: 10px; }
}

/* More breathing room around header content */
.mtg-detail-card .mtg-detail-head {
  padding: 24px 28px 18px;
  gap: 16px;
  align-items: flex-start;
}
.mtg-detail-card .mtg-detail-head-fields {
  flex: 1;
  min-width: 0;
  gap: 10px;
}
.mtg-detail-card .mtg-edit-meta {
  gap: 12px;
}

/* Date / Status field with explicit label above */
.mtg-edit-meta-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mtg-edit-meta-label {
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--p-accent);
  padding-left: 2px;
}

/* Buttons need to be vertically centered with the title block */
.mtg-detail-card .mtg-detail-head-actions {
  flex-shrink: 0;
  align-items: center;
  padding-top: 4px;
}

/* On narrow screens, stack header so buttons aren't cramped */
@media (max-width: 768px) {
  .mtg-detail-card .mtg-detail-head {
    flex-wrap: wrap;
  }
  .mtg-detail-card .mtg-detail-head-actions {
    width: 100%;
    justify-content: flex-end;
    padding-top: 8px;
  }
}

/* ===================================================================
   MEETING MODAL HEADER FIX (v33.4)
   - Account for iPad Safari URL bar overlapping top of modal
   - Equalize Date and Status field widths
   =================================================================== */

/* Push modal content below Safari URL bar / dynamic top inset */
.mtg-detail-card .mtg-detail-head {
  padding-top: max(40px, env(safe-area-inset-top, 24px) + 24px);
}

/* Make Date and Status the same size */
.mtg-detail-card .mtg-edit-meta-field {
  flex: 0 0 auto;
  width: 180px;
}
.mtg-detail-card .mtg-edit-date,
.mtg-detail-card .mtg-edit-status {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font: 13px/1.2 'Inter', sans-serif;
  border-radius: 6px;
}

@media (max-width: 600px) {
  .mtg-detail-card .mtg-edit-meta-field { width: 140px; }
}

/* ===================================================================
   MEETING MODAL HEADER (v33.5) — Bigger logo, dropped down
   =================================================================== */
.mtg-detail-card .mtg-detail-logo {
  height: 96px;
  margin-top: 8px;
  margin-right: 20px;
}
@media (max-width: 768px) {
  .mtg-detail-card .mtg-detail-logo {
    height: 72px;
    margin-top: 6px;
  }
}

/* ===================================================================
   DATE INPUT FIX (v33.6) — Make it look like a real bordered field
   matching the Status dropdown next to it
   =================================================================== */
.mtg-detail-card .mtg-edit-date {
  /* Force a visible border like the status select */
  background: var(--p-bg-3) !important;
  border: 1px solid var(--p-line-2) !important;
  color: var(--p-text) !important;
  -webkit-appearance: none;
  appearance: none;
  min-height: 38px;
  cursor: pointer;
  position: relative;
}
.mtg-detail-card .mtg-edit-status {
  background: var(--p-bg-3) !important;
  border: 1px solid var(--p-line-2) !important;
  color: var(--p-text) !important;
  min-height: 38px;
}

/* Show a visible "Pick date" hint when value is empty (iOS Safari hides the placeholder text on type="date") */
.mtg-detail-card .mtg-edit-date::-webkit-datetime-edit {
  color: var(--p-text);
}
.mtg-detail-card .mtg-edit-date:not([value=""]):invalid::-webkit-datetime-edit,
.mtg-detail-card .mtg-edit-date[value=""]::-webkit-datetime-edit {
  color: var(--p-text-3);
}

/* iOS calendar icon — bring it back so users see this is a date picker */
.mtg-detail-card .mtg-edit-date::-webkit-calendar-picker-indicator {
  opacity: 0.6;
  filter: invert(35%) sepia(40%) saturate(800%) hue-rotate(15deg);
  cursor: pointer;
}

/* ===================================================================
   DATE / STATUS HEIGHT MATCH (v33.7)
   =================================================================== */
.mtg-detail-card .mtg-edit-date,
.mtg-detail-card .mtg-edit-status {
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  line-height: 38px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
}

/* ===================================================================
   PENDING TAB (v33.16 / Session 8)
   Cross-meeting team dashboard — upcoming meeting pills + sortable
   action items table.
   =================================================================== */

.pending-loading,
.pending-error {
  padding: 24px;
  color: var(--text-3);
  font-style: italic;
}
.pending-error { color: var(--danger, #d4a368); }

/* ---- Upcoming meetings strip (compact gold pills) ---- */
.pending-upcoming {
  margin: 0 0 32px;
}
.pending-upcoming-label {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin-bottom: 10px;
}
.pending-upcoming-empty {
  color: var(--text-3);
  font-style: italic;
  font-size: 14px;
}
.pending-upcoming-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pending-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  background: linear-gradient(180deg, rgba(236, 199, 149, 0.16) 0%, rgba(212, 163, 104, 0.10) 100%);
  border: 1px solid var(--wood-dark);
  border-radius: 0;
  color: var(--wood-light);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  box-shadow:
    0 0 0 1px rgba(212, 163, 104, 0.10),
    0 0 14px rgba(212, 163, 104, 0.18);
}
.pending-pill:hover {
  transform: translateY(-1px);
  border-color: var(--wood);
  background: linear-gradient(180deg, rgba(236, 199, 149, 0.26) 0%, rgba(212, 163, 104, 0.16) 100%);
  box-shadow:
    0 0 0 1px rgba(212, 163, 104, 0.30),
    0 0 22px rgba(212, 163, 104, 0.40);
}
.pending-pill-date {
  font-weight: 700;
  color: var(--wood-light);
}
.pending-pill-title {
  color: var(--text);
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stale-items nudge banner — used by Pending and Notes tabs.
   Subtle warm-amber bar with a dismissable × on the right. */
.stale-notice {
  margin: 0 0 14px;
}
.stale-notice[hidden] { display: none; }
.stale-notice-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(212, 163, 104, 0.10);
  border: 1px solid rgba(212, 163, 104, 0.35);
  border-left: 3px solid var(--wood);
  border-radius: 8px;
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--text);
}
.stale-notice-body strong { color: var(--wood-light); font-weight: 800; }
.stale-notice-icon { font-size: 16px; flex: 0 0 auto; }
.stale-notice-text { flex: 1; min-width: 0; }
.stale-notice-dismiss {
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.stale-notice-dismiss:hover {
  background: rgba(212, 163, 104, 0.15);
  color: var(--wood-light);
}

/* ---- Toolbar (Show completed toggle) ---- */
.pending-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 8px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.pending-section-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pending-add-decision-btn {
  font-size: 12px;
  padding: 6px 12px;
  letter-spacing: 0.04em;
}
.pending-section-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin: 0;
}
@media (max-width: 600px) {
  .pending-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
.pending-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.pending-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg-2);
  cursor: pointer;
  position: relative;
  transition: background 140ms ease, border-color 140ms ease;
}
.pending-toggle input[type="checkbox"]:checked {
  background: var(--wood);
  border-color: var(--wood-dark);
}
.pending-toggle input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--bg);
}

/* ---- Action items table ---- */
.pending-body {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1.5px solid var(--wood);
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 0 18px rgba(212, 163, 104, 0.22),
    0 0 36px rgba(212, 163, 104, 0.10);
}
.pending-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
}
.pending-th {
  text-align: left;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--wood-light);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease;
}
.pending-th:hover {
  background: rgba(212, 163, 104, 0.10);
  color: var(--wood);
}
.pending-th::after {
  content: '↕';
  display: inline-block;
  margin-left: 6px;
  opacity: 0.35;
  font-size: 10px;
  transition: opacity 140ms ease;
}
.pending-th.is-sorted-asc::after  { content: '▲'; opacity: 1; color: var(--wood); }
.pending-th.is-sorted-desc::after { content: '▼'; opacity: 1; color: var(--wood); }

.pending-row {
  border-bottom: 1px solid rgba(212, 163, 104, 0.08);
  cursor: pointer;
  transition: background 140ms ease;
}
.pending-row:last-child { border-bottom: 0; }
.pending-row:hover {
  background: rgba(212, 163, 104, 0.06);
}
.pending-row td {
  padding: 12px 16px;
  vertical-align: middle;
}

.pending-status-cell { width: 1%; white-space: nowrap; }
.pending-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-2);
}
.pending-status-pill.is-open {
  color: var(--wood-light);
  border-color: var(--wood-dark);
  background: rgba(212, 163, 104, 0.10);
}
.pending-status-pill.is-in_progress {
  color: #ffd089;
  border-color: #b8902f;
  background: rgba(184, 144, 47, 0.18);
}
.pending-status-pill.is-complete {
  color: #8aca8a;
  border-color: #4d7d4d;
  background: rgba(77, 125, 77, 0.16);
}
.pending-status-pill.is-cancelled {
  color: var(--text-3);
  border-color: var(--line);
  background: var(--bg-2);
  text-decoration: line-through;
}

.pending-title-cell {
  font-weight: 600;
  color: var(--text);
}
.pending-assignee-cell {
  color: var(--text-2);
  white-space: nowrap;
}
.pending-due-cell {
  color: var(--text-2);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pending-meeting-cell {
  color: var(--wood-light);
  font-size: 13px;
}
.pending-meeting-link {
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 140ms ease;
}
.pending-row:hover .pending-meeting-link {
  border-bottom-color: var(--wood);
}

.pending-empty-row td {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-style: italic;
}

/* ---- Phone layout ---- */
@media (max-width: 720px) {
  .pending-pill-title { display: none; }       /* date-only pills on phone */
  .pending-pill { padding: 7px 12px; }
  .pending-th,
  .pending-row td { padding: 10px 10px; }
  .pending-th { font-size: 10px; letter-spacing: 0.06em; }
  .pending-meeting-cell { display: none; }     /* hide Meeting column on phone */
  .pending-th-meeting   { display: none; }
  .pending-due-cell     { font-size: 12px; }
}

/* ===================================================================
   NOTES TAB (v33.17 / Session 8)
   Shared parchment-themed sticky notes. Caveat handwriting font for
   the body text gives a workshop bulletin-board feel.
   =================================================================== */

/* Local parchment palette — same values as the meeting modal's --p-* */
.notes-body {
  --p-bg:        #f5edd9;
  --p-bg-2:      #efe4cb;
  --p-bg-3:      #fff8e7;
  --p-line:      #d8c79e;
  --p-line-2:    #c8b27c;
  --p-text:      #2a1f10;
  --p-text-2:    #4a3826;
  --p-text-3:    #7a6747;
  --p-accent:    #8a6a2a;
  --p-accent-2:  #b8902f;
  --p-danger:    #9a2828;
}

.notes-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---- Author filter pills + completed toggle ---- */
.notes-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: 18px;
}
.notes-user-pill {
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 0;
  padding: 5px 12px;
  font: 700 11px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: var(--text-2);
  cursor: pointer;
  transition: all 120ms ease;
}
.notes-user-pill.is-active {
  color: var(--wood-light);
  border-color: var(--wood-dark);
  background: rgba(212, 163, 104, 0.10);
}
.notes-user-pill { display: inline-flex; align-items: center; gap: 6px; }
.notes-pill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.notes-author-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 0;
  font: 700 11px/1.3 'Inter', sans-serif;
  letter-spacing: 0.04em;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-color-input {
  width: 34px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}
.people-color-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
}
.notes-completed-pill {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 0;
  padding: 5px 12px;
  font: 700 11px/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: var(--text-2);
  cursor: pointer;
  transition: all 120ms ease;
}
.notes-completed-pill.is-active {
  color: #9fd08a;
  border-color: rgba(143, 188, 122, 0.5);
  background: rgba(143, 188, 122, 0.08);
}

.notes-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- Notes modals (create + blow-up detail) — big parchment cards ----
   Base .modal-backdrop z-index (9000) is correct: the photo lightbox (13000)
   and confirm modal (12500) both stack above these. */
.notes-modal-card {
  /* Parchment palette must live here too — these modals mount at body
     level, OUTSIDE .notes-body where the --p-* vars are scoped. Without
     this the background resolved to transparent. */
  --p-bg:        #f5edd9;
  --p-bg-2:      #efe4cb;
  --p-bg-3:      #fff8e7;
  --p-line:      #d8c79e;
  --p-line-2:    #c8b27c;
  --p-text:      #2a1f10;
  --p-text-2:    #4a3826;
  --p-text-3:    #7a6747;
  --p-accent:    #8a6a2a;
  --p-accent-2:  #b8902f;
  --p-danger:    #9a2828;

  position: relative;
  width: min(860px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1px solid var(--p-line-2);
  border-radius: 10px;
  padding: 26px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--p-text);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
}
.notes-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--p-text-3);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 140ms ease, color 140ms ease;
}
.notes-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--p-text);
}
.notes-modal-shrink {
  font-size: 16px;
  border-color: var(--p-line);
  border-radius: 6px;
}
.notes-modal-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-right: 36px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--p-line);
}
.notes-modal-meta .notes-complete-wrap { margin-left: auto; }
.notes-modal-title-edit {
  font-size: 24px;
  margin-left: 0;
}
.notes-modal-body-edit {
  min-height: 160px;
  font-size: 18px;
}
.notes-modal-filelist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notes-staged-file {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--p-bg-3, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--p-line);
  border-radius: 6px;
  padding: 6px 10px;
  font: 600 12px/1.3 'Inter', sans-serif;
  color: var(--p-text-2);
}
.notes-staged-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-staged-del {
  background: transparent;
  border: 0;
  color: var(--p-text-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.notes-staged-del:hover { color: var(--p-danger, #9a2828); }
.notes-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--p-line);
}
.notes-modal-card .btn-ghost {
  margin-top: 10px;             /* btn-primary carries this — keep tops level */
  padding: 15px 20px;           /* match btn-primary's height exactly */
  font-size: 13px;
  letter-spacing: 0.16em;
  color: #9a2828;               /* red — readable on the parchment card */
  border-color: rgba(154, 40, 40, 0.45);
}
.notes-modal-card .btn-ghost:hover {
  background: rgba(154, 40, 40, 0.08);
  border-color: rgba(154, 40, 40, 0.7);
}

.notes-loading,
.notes-error {
  padding: 24px;
  color: var(--text-3);
  font-style: italic;
}
.notes-error { color: #d4a368; }

.notes-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-3);
}
.notes-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  margin-bottom: 24px;
  color: var(--wood);
  filter:
    drop-shadow(0 0 18px rgba(212, 163, 104, 0.45))
    drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}
.notes-empty-icon svg { width: 100%; height: 100%; }
.notes-empty-text { font-size: 14px; font-style: italic; }

/* ---- Card grid ---- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;   /* expanded cards grow alone — neighbors keep their height */
}

/* ---- Individual card ---- */
.notes-card {
  position: relative;
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1px solid var(--p-line-2);
  border-radius: 8px;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--p-text);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.notes-card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(212, 163, 104, 0.18),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
}
/* Brief highlight when a linked note is opened from a meeting modal —
   gold glow that fades over ~2s. */
.notes-card.is-highlighted {
  animation: notes-card-flash 2200ms ease-out;
}
@keyframes notes-card-flash {
  0%   { box-shadow: 0 0 0 0 rgba(212, 163, 104, 0.0),  0 4px 12px rgba(0,0,0,0.35); border-color: var(--wood); }
  20%  { box-shadow: 0 0 0 6px rgba(212, 163, 104, 0.55), 0 4px 18px rgba(0,0,0,0.45); border-color: var(--wood-light); }
  100% { box-shadow: 0 0 0 0 rgba(212, 163, 104, 0.0),  0 4px 12px rgba(0,0,0,0.35); border-color: var(--p-line-2); }
}

.notes-card-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--p-text-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.notes-card-del:hover {
  background: rgba(154, 40, 40, 0.10);
  color: var(--p-danger);
  border-color: rgba(154, 40, 40, 0.4);
}
/* The delete is a trash SVG now (× read as "close") — center and size it */
.notes-card-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.notes-card-del svg { width: 14px; height: 14px; }

/* ---- Body textarea — handwriting font ---- */
.notes-card-body {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--p-text);
  font-family: 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
  font-size: 17px;
  line-height: 1.5;
  font-weight: 700;
  resize: vertical;
  min-height: 80px;
  padding: 6px 8px;
  border-radius: 6px;
  letter-spacing: 0.01em;
  transition: background 120ms ease, border-color 120ms ease;
}
.notes-card-body:focus,
.notes-card-body:hover {
  background: var(--p-bg-3);
  border-color: var(--p-line);
  outline: none;
}
.notes-card-body::placeholder {
  color: var(--p-text-3);
  font-style: italic;
}

/* ---- Photos ---- */
.notes-card-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}
.notes-photo-tile {
  position: relative;
  aspect-ratio: 1;
  background: var(--p-bg-2);
  border: 1px solid var(--p-line);
  border-radius: 6px;
  overflow: hidden;
}
.notes-photo-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 200ms ease;
}
.notes-photo-img.is-loaded { opacity: 1; }
.notes-photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  background: rgba(20, 14, 8, 0.7);
  border: 0;
  border-radius: 50%;
  color: #f5edd9;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease;
}
.notes-photo-tile:hover .notes-photo-del,
.notes-photo-del:focus { opacity: 1; }
.notes-photo-del:hover { background: var(--p-danger); }

/* On iPad PWAs there's no hover, so always-visible delete badge */
@media (hover: none) {
  .notes-photo-del { opacity: 0.85; }
}

/* ---- Document rows ---- */
.notes-card-docs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.notes-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  border-radius: 6px;
}
.notes-doc-icon { font-size: 18px; flex: 0 0 auto; }
.notes-doc-meta { flex: 1; min-width: 0; }
.notes-doc-name {
  background: transparent;
  border: 0;
  color: var(--p-accent);
  font: 600 13px/1.3 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  padding: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-doc-name:hover { text-decoration: underline; }
.notes-doc-sub {
  font: 500 11px/1.2 'Inter', sans-serif;
  color: var(--p-text-3);
  margin-top: 2px;
}
.notes-doc-del {
  background: transparent;
  border: 0;
  color: var(--p-text-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.notes-doc-del:hover {
  background: rgba(154, 40, 40, 0.10);
  color: var(--p-danger);
}

/* ---- Footer ---- */
/* Header row — author + date inline at the top of the card */
.notes-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 30px;            /* clear space for the absolute × delete */
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--p-line);
  min-width: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.notes-card.is-collapsed .notes-card-head {
  padding-bottom: 0;
  border-bottom: 0;
}
.notes-card-inner {
  display: flex;
  gap: 12px;
  min-width: 0;
}
.notes-card-rail {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;     /* chevron vertically centered in the card */
  align-items: center;
  width: 30px;
}
.notes-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.notes-card-chev {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  color: var(--p-text-2);
  width: 36px;
  text-align: center;
  cursor: pointer;
}
.notes-card-expand {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 18px;
  line-height: 1;
  color: var(--p-text-2);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.notes-card-expand:hover {
  background: var(--p-bg-3);
  border-color: var(--p-line-2);
}
.notes-card-headmain {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.notes-card-title-static {
  font-family: 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  color: #8a6a2a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.notes-card-meta .notes-card-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-card-dot-meta { color: var(--p-text-3); }
.notes-card-completed-date { color: var(--p-text-3); }
.notes-link-dot {
  position: absolute;           /* pinned to the card's bottom-right corner */
  bottom: 10px;
  right: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #c9a46e;
  box-shadow: 0 0 6px rgba(201, 164, 110, 0.55);
}
.notes-complete-wrap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  cursor: pointer;
}
.notes-complete-label {
  font: 700 10px/1 Inter, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--p-text-3);
}
.notes-complete-check {
  width: 19px;
  height: 19px;
  cursor: pointer;
  accent-color: #6f9c5d;
}
.notes-card.is-completed { opacity: 0.78; }
.notes-card.is-completed .notes-card-title-static {
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
  text-decoration-color: rgba(111, 156, 93, 0.7);
}
.notes-card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.notes-card-title-edit {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: #8a6a2a;
  font-family: 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  padding: 2px 6px;
  margin-left: -6px;
  border-radius: 6px;
  transition: background 120ms ease, border-color 120ms ease;
}
.notes-card-title-edit:focus,
.notes-card-title-edit:hover {
  background: var(--p-bg-3);
  border-color: var(--p-line);
  outline: none;
}
.notes-card-title-edit::placeholder {
  color: var(--p-text-3);
  font-style: italic;
}
.notes-card-head .notes-card-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.notes-card-dot {
  display: none;                 /* visually separated by margin-auto now */
}

.notes-card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--p-line);
  flex-wrap: wrap;
}
.notes-card-author {
  font: 700 12px/1.2 'Inter', sans-serif;
  color: var(--p-text-2);
  letter-spacing: 0.02em;
}
.notes-card-date {
  font: 500 11px/1.2 'Inter', sans-serif;
  color: var(--p-text-3);
}
.notes-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.notes-add-link {
  background: transparent;
  border: 1px solid var(--p-line-2);
  color: var(--p-accent);
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 0;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.notes-add-link:hover {
  background: rgba(184, 144, 47, 0.10);
  border-color: var(--p-accent);
  color: var(--p-accent-2);
}

/* ---- Phone tweaks ---- */
@media (max-width: 720px) {
  .notes-grid { grid-template-columns: 1fr; gap: 14px; }
  .notes-card { padding: 16px 16px 12px; }
  .notes-card-body { font-size: 16px; }
}

/* ===================================================================
   PENDING TAB — split layout + decisions cards (v33.30)
   =================================================================== */
.pending-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.pending-col {
  min-width: 0;
}
.pending-col-head {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin-bottom: 10px;
}

/* Decisions cards on parchment */
.pending-decisions-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
  --p-bg:        #f5edd9;
  --p-bg-3:      #fff8e7;
  --p-line:      #d8c79e;
  --p-line-2:    #c8b27c;
  --p-text:      #2a1f10;
  --p-text-2:    #4a3826;
  --p-text-3:    #7a6747;
  --p-accent:    #8a6a2a;
}
.pending-dec-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pending-dec-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(212, 169, 106, 0.22);
}
.pending-dec-group-title {
  margin: 0;
  font: 800 italic 12px/1.2 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-light);
}
.pending-dec-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 0;
  background: rgba(212, 169, 106, 0.18);
  color: var(--wood-light);
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
}
/* Per-group color tints removed — Allan asked for all three to be the same color. */
.pending-dec-group-done .pending-dec-card {
  opacity: 0.85;
}

.pending-dec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 720px) {
  .pending-decisions-body {
    gap: 24px;
  }
  .pending-dec-grid {
    grid-template-columns: 1fr;
  }
}
.pending-decisions-empty {
  padding: 24px;
  color: var(--text-3);
  font-style: italic;
  background: var(--bg-3);
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  grid-column: 1 / -1;
}

/* Nested action items inside decision cards (parchment context).
   Action item text uses a deep red/burgundy so it pops off the cream
   background while still feeling editorial, not loud. */
.pending-acts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--p-line);
}
.pending-acts-head {
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--p-accent);
}
/* Header row: 3-column grid that matches the action row grid below.
   Left = "Action Items" over the status pill column, right two = headers
   over the assignee and due-date columns. */
.pending-acts-grid-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px dotted rgba(122, 31, 37, 0.18);
}
.pending-acts-head-left {
  margin-bottom: 0;
}
.pending-acts-head-right {
  margin-bottom: 0;
  text-align: right;
  white-space: nowrap;
}
.pending-acts-head-right + .pending-acts-head-right {
  /* second header (Due Date) — slightly looser to match the data row spacing */
  min-width: 86px;
}
.pending-act-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;          /* was baseline — pill + text now line up vertically */
  padding: 6px 0;
  font: 700 14px/1.3 'Inter', sans-serif;
  color: #7a1f25;                  /* deep burgundy */
  border-bottom: 1px dotted rgba(122, 31, 37, 0.20);
}
.pending-act-row:last-child { border-bottom: 0; }
.pending-act-status {
  font: 800 10px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid currentColor;
  flex: 0 0 auto;
}
.pending-act-row.is-open       { color: #7a1f25; }     /* deep burgundy  */
.pending-act-row.is-in_progress { color: #8a6a2a; }    /* deep blue      */
.pending-act-row.is-complete   { color: #2f5d2f; opacity: 0.7; }
.pending-act-row.is-cancelled  { color: var(--p-text-3); text-decoration: line-through; }
.pending-act-row.is-done .pending-act-status-label,
.pending-act-row.is-done .pending-act-assignee,
.pending-act-row.is-done .pending-act-due {
  text-decoration: line-through;
  text-decoration-color: rgba(47, 93, 47, 0.55);
  text-decoration-thickness: 1.5px;
}

/* Inline checkbox + status label combo (replaces standalone status pill) */
.pending-act-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}
.pending-act-toggle {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  position: relative;
  margin: 0;
  transition: background 140ms ease;
  flex: 0 0 auto;
}
.pending-act-toggle:checked {
  background: #2f5d2f;
  border-color: #2f5d2f;
}
.pending-act-toggle:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #f5edd9;
  line-height: 1;
}
.pending-act-status-label {
  font: 800 10px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0;
  border: 1px solid currentColor;
}
.pending-act-assignee {
  font-weight: 700;
  text-align: right;            /* match the right-aligned header above */
}
.pending-act-due {
  font: 600 12px/1.3 'Inter', sans-serif;
  color: inherit;
  opacity: 0.85;
  white-space: nowrap;
  text-align: right;
  min-width: 86px;
}
.pending-dec-card {
  position: relative;
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1.5px solid var(--wood);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--p-text);
  cursor: pointer;
  box-shadow:
    0 0 18px rgba(212, 163, 104, 0.22),
    0 0 36px rgba(212, 163, 104, 0.10),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}
.pending-dec-card:hover {
  transform: translateY(-1px);
  border-color: var(--wood-light);
  box-shadow:
    0 0 24px rgba(212, 163, 104, 0.42),
    0 0 48px rgba(212, 163, 104, 0.20),
    0 6px 14px rgba(0, 0, 0, 0.40),
    0 1px 0 rgba(255, 248, 222, 0.4) inset;
}
.pending-dec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--p-line);
  margin-bottom: 8px;
}
/* v34.5.6 — replaced the dark blue pill with plain dark-blue clickable
   text + arrow indicator. Reads cleaner when many cards are stacked. */
.pending-dec-from {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #8a6a2a;
  font: 700 12px/1.2 'Inter', sans-serif;
  letter-spacing: 0.04em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 140ms ease, transform 140ms ease;
}
.pending-dec-from:hover:not(.is-standalone) {
  color: #8a6a2a;
}
.pending-dec-from:hover:not(.is-standalone) .pending-dec-from-arrow {
  transform: translateX(2px);
}
.pending-dec-from:active {
  transform: translateY(0);
}
.pending-dec-from.is-standalone {
  cursor: default;
  color: var(--p-text-3, #6b6557);
}
.pending-dec-from-arrow {
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  transition: transform 140ms ease;
}
.pending-dec-title {
  font: 700 14px/1.35 'Inter', sans-serif;
  color: var(--p-text);
  margin-bottom: 4px;
}
.pending-dec-body {
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--p-text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Phone: stack columns vertically */
@media (max-width: 900px) {
  .pending-split {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

/* ===================================================================
   CARRY FORWARD MODAL — destination mode toggle (v33.30)
   =================================================================== */
.mtg-carry-mode-row {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
}
.mtg-carry-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font: 600 13px/1.2 'Inter', sans-serif;
  color: var(--text-2);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-2);
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.mtg-carry-mode input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 140ms ease, background 140ms ease;
  position: relative;
}
.mtg-carry-mode input[type="radio"]:checked {
  border-color: var(--wood);
  background: var(--wood);
  box-shadow: inset 0 0 0 3px var(--bg-2);
}
.mtg-carry-mode:has(input[type="radio"]:checked) {
  border-color: var(--wood);
  background: rgba(212, 163, 104, 0.10);
  color: var(--wood-light);
}

.mtg-carry-existing-wrap,
.mtg-carry-new-wrap {
  margin-bottom: 4px;
}
.mtg-carry-new-fields {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr;
  gap: 10px;
}
.mtg-carry-new-title-field { min-width: 0; }
@media (max-width: 600px) {
  .mtg-carry-new-fields {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   MEETINGS LIST — card layout with agenda preview (v33.30)
   Replaces the row strips. Each meeting is a gold-bordered card
   showing the date, title, status, and the first 3 agenda items.
   =================================================================== */
.mtg-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.mtg-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1.5px solid var(--wood);
  border-radius: 12px;
  cursor: pointer;
  box-shadow:
    0 0 18px rgba(212, 163, 104, 0.22),
    0 0 36px rgba(212, 163, 104, 0.10);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.mtg-card:hover {
  transform: translateY(-2px);
  border-color: var(--wood-light);
  box-shadow:
    0 0 24px rgba(212, 163, 104, 0.42),
    0 0 48px rgba(212, 163, 104, 0.20),
    0 8px 24px rgba(0, 0, 0, 0.35);
}
.mtg-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.mtg-card-date {
  font: 700 20px/1.2 'Inter', sans-serif;
  color: var(--wood-light);
  letter-spacing: 0.02em;
}
.mtg-card-title {
  font: 800 17px/1.3 'Inter', sans-serif;
  color: var(--text);
  margin: 0;
}
.mtg-row-agenda {
  list-style: none;
  margin: 0;
  padding: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px dashed rgba(212, 163, 104, 0.25);
}
.mtg-row-agenda-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--text-2);
  min-width: 0;
}
.mtg-row-agenda-num {
  flex: 0 0 auto;
  color: var(--wood);
  font-weight: 700;
}
.mtg-row-agenda-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mtg-row-agenda-more {
  font: 600 11px/1 'Inter', sans-serif;
  color: var(--wood);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}
.mtg-row-agenda-empty {
  padding-top: 8px;
  border-top: 1px dashed rgba(212, 163, 104, 0.25);
  font: 500 12px/1.4 'Inter', sans-serif;
  color: var(--text-3);
  font-style: italic;
}

/* Phone */
@media (max-width: 600px) {
  .mtg-list {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   DECISION-NESTED ACTION ITEMS (v33.32)
   Each decision card gets a row of action items inside its body.
   Status / assignee / due / delete on each row. Action rows pop visually
   with a contrasting deep-red label so they don't look like notes.
   =================================================================== */
.mtg-decision-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--p-line, var(--line-2));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mtg-decision-actions-head {
  font: 700 11px/1.2 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #b04545;            /* deep red — pop against the parchment */
  margin-bottom: 4px;
}
.mtg-decision-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto;
  grid-template-areas: "assignee due del";
  column-gap: 10px;
  row-gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(176, 69, 69, 0.06);
  border: 1px solid rgba(176, 69, 69, 0.20);
  border-radius: 6px;
}
.mtg-decision-action-row .mtg-action-assignee { grid-area: assignee; }
.mtg-decision-action-row .mtg-action-due      { grid-area: due; min-width: 0; }
.mtg-decision-action-row .mtg-action-del      { grid-area: del; }
.mtg-decision-action-row select,
.mtg-decision-action-row input[type="date"] {
  font: 600 13px/1.2 'Inter', sans-serif;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--p-bg-3, var(--bg-2));
  border: 1px solid var(--p-line, var(--line));
  color: var(--p-text, var(--text));
  cursor: pointer;
  width: 100%;
  min-width: 0;
}
/* Show "Due date" hint inside the date input until a date is picked.
   Native <input type=date> doesn't honor placeholder, so use ::before on
   an empty (non-has-value) state, hidden once .has-value is set. */
.mtg-decision-action-row .mtg-action-due { position: relative; color: var(--p-text-3, var(--text-3)); }
.mtg-decision-action-row .mtg-action-due.has-value { color: var(--p-text, var(--text)); }
.mtg-decision-action-row .mtg-action-due:not(.has-value)::-webkit-datetime-edit-fields-wrapper { color: var(--p-text-3, var(--text-3)); opacity: 0.55; }
.mtg-decision-action-row .mtg-action-due:not(.has-value)::-webkit-datetime-edit { color: transparent; }
.mtg-decision-action-row .mtg-action-due:not(.has-value)::before {
  content: 'Due date';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font: 600 12px/1 'Inter', sans-serif;
  color: var(--p-text-3, var(--text-3));
  opacity: 0.7;
  pointer-events: none;
}
.mtg-decision-action-row .mtg-action-due.has-value::before { display: none; }
.mtg-decision-action-row.is-complete {
  opacity: 0.55;
}
.mtg-decision-action-row.is-complete .mtg-action-assignee,
.mtg-decision-action-row.is-complete .mtg-action-due {
  text-decoration: line-through;
}

/* Wide layout: when the right pane has room, keep the same single-row layout */
@media (min-width: 1100px) {
  .mtg-detail-card .mtg-decision-action-row {
    grid-template-columns: minmax(0, 1.6fr) minmax(110px, 140px) auto;
    grid-template-areas: "assignee due del";
    row-gap: 0;
  }
}
.mtg-action-del {
  background: transparent;
  border: 0;
  color: var(--p-text-3, var(--text-3));
  font-size: 16px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  margin-left: 10px;
  justify-self: end;
  transition: background 140ms ease, color 140ms ease;
}
.mtg-action-del:hover { background: rgba(154, 40, 40, 0.10); color: #9a2828; }

.mtg-decision-add-action {
  align-self: flex-start;
  margin-top: 4px;
  background: transparent;
  border: 1px solid #b04545;
  color: #b04545;
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 0;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.mtg-decision-add-action:hover {
  background: rgba(176, 69, 69, 0.10);
  color: #7a2828;
}

/* ===================================================================
   FILES TAB — unified document hub (v33.33 / Session 8)
   =================================================================== */
.files-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}
.files-toolbar-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.files-upload-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  margin-top: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.files-search {
  flex: 1 1 240px;
  min-width: 200px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  font: 500 14px/1.2 'Inter', sans-serif;
  outline: none;
  transition: border-color 140ms ease;
}
.files-search::placeholder { color: var(--text-3); }
.files-search:focus {
  border-color: var(--wood);
  box-shadow: 0 0 0 1px rgba(212, 163, 104, 0.18);
}

.files-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.files-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text-2);
  font: 600 12px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 140ms ease;
}
.files-filter-chip:hover {
  border-color: var(--wood-dark);
  color: var(--text);
}
.files-filter-chip.is-active {
  background: rgba(212, 163, 104, 0.16);
  border-color: var(--wood);
  color: var(--wood-light);
}
.files-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  background: rgba(212, 163, 104, 0.20);
  border-radius: 0;
  font: 700 11px/1 'Inter', sans-serif;
  color: var(--wood-light);
}
.files-filter-chip.is-active .files-filter-count {
  background: var(--wood);
  color: var(--bg);
}

.files-body {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.files-loading,
.files-error,
.files-empty {
  padding: 40px 24px;
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  background: var(--bg-3);
  border: 1px dashed var(--line);
  border-radius: 10px;
}
.files-error { color: #d4a368; }

.files-source {
  background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%);
  border: 1.5px solid var(--wood);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow:
    0 0 18px rgba(212, 163, 104, 0.18),
    0 0 36px rgba(212, 163, 104, 0.08);
}
.files-source-title {
  font: 800 13px/1 'Inter', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wood-light);
  margin: 0 0 14px 0;
}
/* Archived bucket — visually muted to indicate orphaned/inactive */
.files-source-archived {
  border-color: var(--line-2, #3a4858);
  box-shadow: none;
  opacity: 0.92;
}
.files-source-archived .files-source-title {
  color: var(--text-3, #a89b89);
}
.files-source-archived .files-parent-label {
  color: var(--text-3, #a89b89);
  font-style: italic;
}

.files-parent {
  margin-bottom: 14px;
}
.files-parent:last-child { margin-bottom: 0; }
.files-parent-label {
  font: 600 12px/1.2 'Inter', sans-serif;
  color: var(--text-2);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(212, 163, 104, 0.18);
}

.files-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 1100px) {
  .files-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .files-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .files-list { grid-template-columns: 1fr; }
}
.files-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(212, 163, 104, 0.04);
  border: 1px solid rgba(212, 163, 104, 0.12);
  border-radius: 8px;
  min-width: 0;
  transition: background 140ms ease, border-color 140ms ease;
}
.files-row:hover {
  background: rgba(212, 163, 104, 0.10);
  border-color: rgba(212, 163, 104, 0.30);
}
.files-row-icon {
  font-size: 20px;
  width: 26px;
  text-align: center;
  flex: 0 0 auto;
}
.files-row-meta { min-width: 0; }
.files-row-name {
  display: block;
  background: transparent;
  border: 0;
  color: var(--wood-light);
  font: 600 13px/1.3 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  padding: 0;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.files-row-name:hover { text-decoration: underline; color: var(--wood); }
.files-row-sub {
  font: 500 11px/1.3 'Inter', sans-serif;
  color: var(--text-3);
  margin-top: 2px;
}
.files-row-del {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  flex: 0 0 auto;
  transition: background 140ms ease, color 140ms ease;
}
.files-row-del:hover {
  background: rgba(180, 60, 60, 0.18);
  color: #e78989;
}

/* ===================================================================
   AGENDA DRAG HANDLE + ASSIGNEE FIX (v33.36)
   =================================================================== */
.mtg-item-drag {
  flex: 0 0 auto;
  width: 26px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  color: var(--p-text-3, var(--text-3));
  font-size: 18px;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 4px;
  transition: background 140ms ease, color 140ms ease;
  touch-action: none;             /* allow touch drag on iPad */
}
.mtg-item-drag:hover {
  background: rgba(212, 163, 104, 0.12);
  color: var(--p-accent, var(--wood));
}
.mtg-item-drag:active { cursor: grabbing; }

/* Sortable ghost — the placeholder while dragging */
.mtg-item-drag-ghost {
  opacity: 0.4;
  background: rgba(212, 163, 104, 0.18) !important;
  border-color: var(--wood) !important;
}

/* Force assignee dropdown to actually have width inside the parchment
   action row. Some iPad Safari builds collapse the <select> to its
   intrinsic option width when the grid cell is narrow; this overrides
   that with an explicit min-width. */
.mtg-decision-action-row .mtg-action-assignee {
  width: 100% !important;
  min-width: 110px !important;
  display: block !important;
}

/* ===================================================================
   ADD DECISION MODAL (from Pending tab) — v33.40
   =================================================================== */
.pending-decision-card {
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pending-decision-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pending-decision-form input[type="text"],
.pending-decision-form select,
.pending-decision-form textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text);
  font: 500 13px/1.4 'Inter', sans-serif;
  padding: 8px 10px;
}
.pending-decision-form textarea { resize: vertical; min-height: 50px; }
.pending-decision-actions-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}
.pending-decision-actions-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.pending-decision-actions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pending-decision-actions-empty {
  font: 500 12px/1.4 'Inter', sans-serif;
  color: var(--text-3);
  font-style: italic;
}
.pending-decision-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(95px, 115px) auto;
  gap: 10px;
  align-items: center;
  padding-right: 4px;
}
.pending-decision-action-row select,
.pending-decision-action-row input[type="date"] {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text);
  font: 500 13px/1.2 'Inter', sans-serif;
  padding: 6px 8px;
  min-width: 0;
}
.pending-decision-action-del {
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-size: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  margin-left: 6px;
  transition: background 140ms ease, color 140ms ease;
}
.pending-decision-action-del:hover {
  background: rgba(180, 60, 60, 0.18);
  color: #e78989;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

/* ===================================================================
   NOTE → MEETING LINKING (v33.40)
   - Per-note picker in the Notes tab footer
   - Visible badge on the note card header
   - "From Notes tab" subsection inside the meeting detail modal
   =================================================================== */
.notes-card-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.notes-card-link {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}
.notes-link-select {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line);
  color: var(--p-text);
  font: 600 11px/1.2 'Inter', sans-serif;
  padding: 5px 24px 5px 8px;
  border-radius: 0;
  max-width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2010%206%27%3E%3Cpath%20d%3D%27M0%200l5%206%205-6z%27%20fill%3D%27%23998875%27%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 8px 5px;
}
/* When a meeting (or "next meeting") is selected, the select itself reads
   as the blue link pill — no separate badge. */
.notes-link-select.is-linked {
  background-color: rgba(31, 77, 122, 0.10);
  border-color: rgba(138, 106, 42, 0.45);
  color: #8a6a2a;
  font-weight: 700;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2010%206%27%3E%3Cpath%20d%3D%27M0%200l5%206%205-6z%27%20fill%3D%27%231f4d7a%27%2F%3E%3C%2Fsvg%3E");
}
.notes-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  background: rgba(31, 77, 122, 0.12);
  color: #8a6a2a;
  border: 1px solid rgba(31, 77, 122, 0.40);
  padding: 3px 8px;
  border-radius: 0;
  font: 800 10px/1.2 'Inter', sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button.notes-link-badge {
  /* Reset button-tag defaults for the clickable variant */
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
button.notes-link-badge:hover {
  background: rgba(31, 77, 122, 0.22);
  border-color: rgba(31, 77, 122, 0.70);
  transform: translateY(-1px);
}
button.notes-link-badge:active {
  transform: translateY(0);
}
.notes-link-badge.is-pending {
  background: rgba(212, 163, 104, 0.14);
  color: #8a6a2a;
  border-color: rgba(212, 163, 104, 0.50);
}

/* Linked-notes subsection inside the meeting detail modal — distinct from
   the in-meeting notes so the user can tell where each note came from. */
.mtg-linked-notes {
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(31, 77, 122, 0.05);
  border: 1px solid rgba(31, 77, 122, 0.18);
  border-left: 3px solid #8a6a2a;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mtg-linked-notes-head {
  font: 800 10px/1 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #8a6a2a;
}
.mtg-linked-note {
  /* Reset button defaults — this is now a <button> so user can tap to open the full note */
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  font: inherit;
  width: 100%;
  cursor: pointer;
  background: var(--p-bg-3, transparent);
  border: 1px solid rgba(31, 77, 122, 0.15);
  border-radius: 4px;
  padding: 8px 10px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.mtg-linked-note:hover {
  background: rgba(31, 77, 122, 0.08);
  border-color: rgba(31, 77, 122, 0.40);
  transform: translateY(-1px);
}

.mtg-linked-note-title {
  font: 700 13px/1.35 'Inter', sans-serif;
  color: var(--p-text, #2b2014);
  margin: 4px 0 2px;
}

/* ---- Linked equipment (future purchases linked to this meeting) ---- */
.mtg-equipment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mtg-linked-eq {
  appearance: none;
  -webkit-appearance: none;
  text-align: left;
  font: inherit;
  width: 100%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--p-bg-3, transparent);
  border: 1px solid rgba(140, 110, 60, 0.22);
  border-radius: 4px;
  padding: 8px 10px;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.mtg-linked-eq:hover {
  background: rgba(140, 110, 60, 0.08);
  border-color: rgba(140, 110, 60, 0.45);
  transform: translateY(-1px);
}
.mtg-linked-eq-name {
  font: 700 13px/1.3 'Inter', sans-serif;
  color: var(--p-text, #2b2014);
}
.mtg-linked-eq-meta {
  font: 600 11px/1.3 'Inter', sans-serif;
  color: var(--p-text-2, #4a3826);
}
.mtg-linked-note:active {
  transform: translateY(0);
}
.mtg-linked-note-head {
  display: flex;
  gap: 8px;
  font: 600 11px/1.2 'Inter', sans-serif;
  color: var(--p-text-3, var(--text-3));
  margin-bottom: 4px;
}
.mtg-linked-note .mtg-note-body {
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--p-text, var(--text));
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==================================================================
   v34.5 — File rename modal (shared across all upload paths)
   ================================================================== */

/* Helper used by hidden file inputs */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Miscellaneous bucket — neutral parchment tone, distinct from archived */
.files-source-misc .files-source-title {
  color: var(--wood);
}

/* ---------- Rename modal ---------- */
.rn-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 22, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12000;          /* above any toast (10000) and any modal */
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  padding: 20px;
}
.rn-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.rn-modal {
  width: 100%;
  max-width: 460px;
  background: var(--bg-2, #1d2733);
  border: 1px solid var(--wood, #d4a368);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(212, 163, 104, 0.25);
  overflow: hidden;
  transform: translateY(8px) scale(0.98);
  transition: transform 180ms ease;
}
.rn-overlay.is-open .rn-modal {
  transform: translateY(0) scale(1);
}

.rn-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px 20px;
  border-bottom: 1px solid var(--line, #2e2a24);
}
.rn-title {
  font: 800 16px/1.2 'Inter', sans-serif;
  color: var(--wood-light, #e8c89a);
  letter-spacing: 0.02em;
}
.rn-counter {
  font: 600 11px/1 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3, #a89b89);
}

.rn-body {
  padding: 18px 20px 8px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rn-original {
  font: 500 13px/1.4 'Inter', sans-serif;
  color: var(--text-2, #cbd2d9);
  word-break: break-all;
}
.rn-original-label {
  display: inline-block;
  font: 700 10px/1 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3, #a89b89);
  margin-right: 6px;
}
.rn-original-name {
  font-weight: 600;
  color: var(--text, #f0e9dc);
}
.rn-label {
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3, #a89b89);
  margin-top: 6px;
}
.rn-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--bg, #131a23);
  border: 1px solid var(--line, #2e2a24);
  border-radius: 10px;
  color: var(--text, #f0e9dc);
  font: 600 15px/1.2 'Inter', sans-serif;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.rn-input:focus {
  border-color: var(--wood, #d4a368);
  box-shadow: 0 0 0 1px rgba(212, 163, 104, 0.25);
}
.rn-hint {
  font: 500 12px/1.4 'Inter', sans-serif;
  color: var(--text-3, #a89b89);
}

.rn-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 14px 20px 18px 20px;
  border-top: 1px solid var(--line, #2e2a24);
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.18));
  flex-wrap: wrap;
}
.rn-btn {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font: 700 13px/1 'Inter', sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 140ms ease;
  border: 1px solid transparent;
}
.rn-btn-ghost {
  background: transparent;
  border-color: var(--line, #2e2a24);
  color: var(--text-2, #cbd2d9);
}
.rn-btn-ghost:hover {
  border-color: var(--wood-dark, #b8895a);
  color: var(--text, #f0e9dc);
}
.rn-btn-primary {
  background: linear-gradient(180deg, #e8c89a, #c89764);
  border-color: var(--wood, #d4a368);
  color: #1a1208;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 12px rgba(212, 163, 104, 0.22);
}
.rn-btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 16px rgba(212, 163, 104, 0.32);
}
.rn-btn-primary:active {
  transform: translateY(1px);
}

/* Phone tweak — stack footer buttons full-width when cramped */
@media (max-width: 480px) {
  .rn-footer { flex-direction: column-reverse; }
  .rn-btn { width: 100%; }
}

/* ==================================================================
   v34.5.4 — "+ Decision" button on each agenda card
   Sits in the lower right of the agenda card body. Subtle by default
   (matches the parchment palette of the agenda pane), gets a faint
   gold glow on hover. The arrow hints that clicking jumps a new card
   into the Decisions pane on the right.
   ================================================================== */
.mtg-agenda-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}
.mtg-agenda-add-decision {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(31, 77, 122, 0.22);
  color: rgba(31, 77, 122, 0.78);
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 0;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.mtg-agenda-add-decision:hover {
  background: rgba(31, 77, 122, 0.06);
  border-color: rgba(138, 106, 42, 0.45);
  color: #8a6a2a;
}
.mtg-agenda-add-decision:active {
  transform: translateY(1px);
}
.mtg-agenda-add-decision .mtg-arrow {
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  transition: transform 140ms ease;
}
.mtg-agenda-add-decision:hover .mtg-arrow {
  transform: translateX(2px);
}

/* ==================================================================
   v34.5.5 — "Summary PDF" button on meeting detail header
   Matches the carry/delete button pattern. Lives in
   .mtg-detail-head-actions inside the parchment-themed modal.
   ================================================================== */
.mtg-summary-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(212, 169, 106, 0.4);
  color: var(--wood-light);
  font: 700 11px/1 'Inter', sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.mtg-summary-btn:hover {
  background: rgba(212, 169, 106, 0.14);
  border-color: var(--wood-light);
}
.mtg-summary-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
/* Parchment-themed override inside the detail modal — same palette as carry */
.mtg-detail-card .mtg-summary-btn {
  background: var(--p-bg-3);
  border: 1px solid var(--p-line-2);
  color: var(--p-accent);
}
.mtg-detail-card .mtg-summary-btn:hover {
  background: rgba(184, 144, 47, 0.10);
  border-color: var(--p-accent);
}

/* ==================================================================
   v34.5.8 — Pending tab: per-card trash icon (gold, subtle)
   Lives in the top-right corner. Click → confirm → soft-delete the
   underlying meeting_decisions row. Lets users clear cards that have
   no action items (which previously had no way to disappear).
   ================================================================== */
.pending-dec-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--p-accent);          /* matches "ASSIGNED TO" / "DUE DATE" gold */
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
  z-index: 2;
}
.pending-dec-del svg {
  width: 16px;
  height: 16px;
  display: block;
}
.pending-dec-card:hover .pending-dec-del {
  opacity: 1;
}
.pending-dec-del:hover {
  opacity: 1;
  background: rgba(184, 144, 47, 0.10);
  border-color: var(--p-accent);
}
.pending-dec-del:active {
  transform: translateY(1px);
}
/* Make sure the delete button doesn't get hidden behind the card-clickable
   area. Card has cursor:pointer for "clickable feel" but no actual click
   handler — the trash button has its own e.stopPropagation in JS. */

/* Pending-dec-head needs space so the trash button doesn't overlap the
   "From meeting on …" link */
.pending-dec-head {
  padding-right: 28px;
}

/* ==================================================================
   v34.8 — Confirm/Delete modal (shared, used everywhere we destroy
   something). Replaces native browser confirm() with a styled prompt.
   Gold-bordered card on a dimmed backdrop, with a red-tinted icon and
   confirm button for delete actions. Subtle bounce on open.
   ================================================================== */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 22, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 12500;            /* above rename modal, toasts, everything */
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  padding: 20px;
}
.cmd-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.cmd-modal {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, #24211d, #161513);
  border: 1px solid var(--wood, #d4a368);
  border-radius: 16px;
  padding: 28px 28px 22px;
  text-align: center;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(212, 163, 104, 0.22),
    0 0 60px rgba(212, 163, 104, 0.15);
  transform: translateY(12px) scale(0.96);
  transition: transform 220ms cubic-bezier(0.2, 1.2, 0.4, 1.0);
}
.cmd-overlay.is-open .cmd-modal {
  transform: translateY(0) scale(1);
}
.cmd-icon-wrap {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(184, 47, 47, 0.25), rgba(184, 47, 47, 0.10) 60%, transparent 70%);
  color: #e26a6a;
}
.cmd-icon {
  width: 32px;
  height: 32px;
  display: block;
}
.cmd-title {
  margin: 0 0 8px 0;
  font: 800 18px/1.25 'Inter', sans-serif;
  letter-spacing: 0.01em;
  color: var(--text, #f0e9dc);
}
.cmd-message {
  margin: 0 0 22px 0;
  font: 500 13.5px/1.5 'Inter', sans-serif;
  color: var(--text-2, #cbd2d9);
  white-space: pre-wrap;
}
.cmd-footer {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.cmd-btn {
  flex: 1 1 auto;
  min-width: 120px;
  height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font: 700 13px/1 'Inter', sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 140ms ease;
  border: 1px solid transparent;
}
.cmd-btn-cancel {
  background: transparent;
  border-color: var(--line, #2e2a24);
  color: var(--text-2, #cbd2d9);
}
.cmd-btn-cancel:hover {
  border-color: var(--wood-dark, #b8895a);
  color: var(--text, #f0e9dc);
}
.cmd-btn-confirm {
  background: linear-gradient(180deg, #e8c89a, #c89764);
  border-color: var(--wood, #d4a368);
  color: #1a1208;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 4px 12px rgba(212, 163, 104, 0.22);
}
.cmd-btn-confirm:hover {
  filter: brightness(1.05);
}
.cmd-btn-confirm.is-danger {
  background: linear-gradient(180deg, #d34a4a, #a82828);
  border-color: #c43838;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, 0 4px 14px rgba(180, 30, 30, 0.34);
}
.cmd-btn-confirm.is-danger:hover {
  filter: brightness(1.08);
  box-shadow: 0 1px 0 rgba(255,255,255,0.22) inset, 0 6px 18px rgba(180, 30, 30, 0.44);
}
.cmd-btn-confirm:active,
.cmd-btn-cancel:active {
  transform: translateY(1px);
}
@media (max-width: 480px) {
  .cmd-footer { flex-direction: column-reverse; }
  .cmd-btn { width: 100%; }
}

/* ==================================================================
   v34.9 — Pending tab action item urgency
   The status pill itself reflects how close the action is to its due
   date. Green (>14d) → orange (3-14d) → red (≤2d / overdue / no due).
   Pulses while still open or in-progress; goes static once complete.
   ================================================================== */
.pending-act-row.urgency-healthy .pending-act-status-label,
.pending-act-row.urgency-warning .pending-act-status-label,
.pending-act-row.urgency-urgent  .pending-act-status-label {
  /* These override the per-status colors below — the urgency wins for
     open/in_progress rows because the user cares about deadline pressure
     more than the workflow state. */
  border-color: currentColor;
}

.pending-act-row.urgency-healthy {
  color: #2f7a2f;                         /* deep green */
}
.pending-act-row.urgency-healthy .pending-act-status-label {
  background: rgba(47, 122, 47, 0.10);
  animation: pending-urgency-pulse-healthy 2.4s ease-in-out infinite;
}
.pending-act-row.urgency-warning {
  color: #c47a1f;                         /* burnt orange */
}
.pending-act-row.urgency-warning .pending-act-status-label {
  background: rgba(196, 122, 31, 0.12);
  animation: pending-urgency-pulse-warning 1.6s ease-in-out infinite;
}
.pending-act-row.urgency-urgent {
  color: #b8273a;                         /* deep red */
}
.pending-act-row.urgency-urgent .pending-act-status-label {
  background: rgba(184, 39, 58, 0.14);
  animation: pending-urgency-pulse-urgent 1.0s ease-in-out infinite;
}

/* The assignee + due-date text inherit the row's `color`, so they shift
   together with the pill — single source of truth. */
.pending-act-row.urgency-healthy .pending-act-assignee,
.pending-act-row.urgency-warning .pending-act-assignee,
.pending-act-row.urgency-urgent  .pending-act-assignee,
.pending-act-row.urgency-healthy .pending-act-due,
.pending-act-row.urgency-warning .pending-act-due,
.pending-act-row.urgency-urgent  .pending-act-due {
  color: inherit;
}

/* Pulse keyframes — different glow color per state.
   Subtle shadow that breathes; doesn't change layout. */
@keyframes pending-urgency-pulse-healthy {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 122, 47, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(47, 122, 47, 0.18); }
}
@keyframes pending-urgency-pulse-warning {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196, 122, 31, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(196, 122, 31, 0.28); }
}
@keyframes pending-urgency-pulse-urgent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184, 39, 58, 0); }
  50%      { box-shadow: 0 0 0 5px rgba(184, 39, 58, 0.36); }
}

/* Respect users who disable motion */
@media (prefers-reduced-motion: reduce) {
  .pending-act-row.urgency-healthy .pending-act-status-label,
  .pending-act-row.urgency-warning .pending-act-status-label,
  .pending-act-row.urgency-urgent  .pending-act-status-label {
    animation: none;
  }
}

/* ==================================================================
   v35.0 — Linked-note attachments in the meeting detail view
   When a note from the Notes tab is linked to a meeting, its photo
   thumbnails and document chips render under the note text inside the
   meeting's right-pane Notes section. Matches the parchment palette.
   ================================================================== */
.mtg-linked-note-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mtg-linked-note-wrap + .mtg-linked-note-wrap {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(140, 110, 60, 0.20);
}

.mtg-linked-note-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 0 4px;
}
.mtg-linked-note-photo {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 1px solid rgba(140, 110, 60, 0.25);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  transition: border-color 140ms ease, transform 140ms ease;
}
.mtg-linked-note-photo:hover {
  border-color: var(--p-accent, #8a6a2a);
  transform: scale(1.04);
}
.mtg-linked-note-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: rgba(140, 110, 60, 0.08);    /* skeleton while signed URL resolves */
}

.mtg-linked-note-docs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 0 4px;
}
.mtg-linked-note-doc {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(140, 110, 60, 0.06);
  border: 1px solid rgba(140, 110, 60, 0.22);
  border-radius: 6px;
  color: var(--p-text-2, #4a3826);
  font: 600 12px/1.3 'Inter', sans-serif;
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  transition: background 140ms ease, border-color 140ms ease;
}
.mtg-linked-note-doc:hover {
  background: rgba(140, 110, 60, 0.12);
  border-color: var(--p-accent, #8a6a2a);
}
.mtg-linked-note-doc-icon {
  flex: 0 0 auto;
  font-size: 14px;
}
.mtg-linked-note-doc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================================================================
   v35.4 — Photo thumbnail in Files tab rows + shared lightbox
   ================================================================== */

/* Photo thumbnail replaces the doc-icon slot when a Files-tab row is
   a photo. Same footprint as the icon (~28px) but with a real image. */
.files-row-icon-photo {
  padding: 0;
  width: 56px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  flex: 0 0 auto;
  cursor: pointer;
  background: rgba(212, 169, 106, 0.08);
  border: 1px solid rgba(212, 169, 106, 0.18);
  transition: border-color 140ms ease, transform 140ms ease;
}
.files-row-icon-photo:hover {
  border-color: var(--wood-light, #d4a96a);
  transform: scale(1.04);
}
.files-row-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: transparent;
}

/* ---- Lightbox overlay ---- */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.92);
  z-index: 13000;            /* above confirm modal (12500), rename (12000) */
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  padding: 24px;
}
.lb-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.lb-img {
  max-width: 100%;
  max-height: calc(100vh - 80px);   /* leave room for caption + close button */
  object-fit: contain;
  display: block;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  /* While loading, transparent placeholder; once loaded, the image shows. */
  background: transparent;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.lb-overlay.is-open .lb-img {
  transform: scale(1);
  opacity: 1;
}
.lb-overlay.is-loading .lb-img {
  visibility: hidden;
}
.lb-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  font: 500 13px/1.4 'Inter', sans-serif;
  color: rgba(240, 233, 220, 0.92);
  padding: 0 60px;
  pointer-events: none;
}
.lb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f5edd9;
  font: 400 24px/1 'Inter', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms ease, transform 140ms ease;
}
.lb-close:hover {
  background: rgba(255, 255, 255, 0.20);
  transform: scale(1.05);
}
.lb-close:active {
  transform: scale(0.98);
}
.lb-spinner {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--wood-light, #d4a96a);
  animation: lb-spin 0.9s linear infinite;
  opacity: 0;
  transition: opacity 160ms ease;
}
.lb-overlay.is-loading .lb-spinner {
  opacity: 1;
}
@keyframes lb-spin {
  to { transform: rotate(360deg); }
}

/* The button-styled photo tiles (equipment, meetings, notes) need to
   look identical to the old div-styled versions. Strip default button
   chrome so the existing tile CSS still applies cleanly. */
button.eq-photo-img,
button.mtg-photo-img,
button.notes-photo-img {
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 0;
  outline: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
button.eq-photo-img:focus-visible,
button.mtg-photo-img:focus-visible,
button.notes-photo-img:focus-visible {
  outline: 2px solid var(--wood-light, #d4a96a);
  outline-offset: 2px;
}

/* ==================================================================
   WHAT'S NEW MODAL (v36.6) — parchment announcement card with
   self-contained mock previews of the new UI
   ================================================================== */
.wn-card {
  /* Parchment palette local to the modal (mounts at body level) */
  --p-bg:        #f5edd9;
  --p-bg-3:      #fff8e7;
  --p-line:      #d8c79e;
  --p-line-2:    #c8b27c;
  --p-text:      #2a1f10;
  --p-text-2:    #4a3826;
  --p-text-3:    #7a6747;

  position: relative;
  width: min(820px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--p-bg);
  background-image:
    radial-gradient(ellipse at top left,    rgba(255, 248, 222, 0.7), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(190, 160, 100, 0.12), transparent 60%);
  border: 1px solid var(--p-line-2);
  border-radius: 10px;
  color: var(--p-text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 248, 222, 0.4) inset;
  overflow: hidden;
}
.wn-head {
  padding: 24px 28px 14px;
  border-bottom: 1px dashed var(--p-line);
}
.wn-eyebrow {
  font: 700 11px/1 Inter, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--p-text-3);
  margin-bottom: 6px;
}
.wn-title {
  font-family: 'Architects Daughter', 'Bradley Hand', cursive;
  font-size: 32px;
  font-weight: 700;
  color: #8a6a2a;
  margin: 0 0 4px;
}
.wn-sub { font: 400 13px/1.4 Inter, sans-serif; color: var(--p-text-2); margin: 0; }
.wn-body {
  padding: 18px 28px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.wn-section { display: flex; flex-direction: column; gap: 10px; }
.wn-h3 {
  font: 800 15px/1.3 Inter, sans-serif;
  color: var(--p-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.wn-tag {
  font: 700 9.5px/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wood-dark, #9b7542);
  border: 1px solid var(--p-line-2);
  border-radius: 0;
  padding: 3px 8px;
}
.wn-p { font: 400 13.5px/1.55 Inter, sans-serif; color: var(--p-text-2); margin: 0; }
.wn-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: 400 13.5px/1.5 Inter, sans-serif;
  color: var(--p-text-2);
}

/* ---- mock note previews (non-interactive) ---- */
.wn-duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  pointer-events: none;
  user-select: none;
}
@media (max-width: 640px) { .wn-duo { grid-template-columns: 1fr; } }
.wn-mock-note {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--p-bg-3);
  border: 1px solid var(--p-line-2);
  border-radius: 8px;
  padding: 12px 30px 12px 10px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
.wn-mock-chev { font-size: 22px; line-height: 1; color: var(--p-text-2); align-self: center; }
.wn-mock-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.wn-mock-title {
  font-family: 'Architects Daughter', 'Bradley Hand', cursive;
  font-size: 15px;
  font-weight: 700;
  color: #8a6a2a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wn-mock-meta { font: 600 10.5px/1.3 Inter, sans-serif; color: var(--p-text-3); display: flex; align-items: center; gap: 6px; }
.wn-mock-author {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 0;
  font: 700 10px/1.3 Inter, sans-serif;
}
.wn-mock-bodyline {
  height: 7px;
  width: 92%;
  border-radius: 4px;
  background: rgba(74, 56, 38, 0.18);
}
.wn-mock-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.wn-mock-select {
  font: 700 9.5px/1 Inter, sans-serif;
  color: #8a6a2a;
  background: rgba(31, 77, 122, 0.10);
  border: 1px solid rgba(138, 106, 42, 0.45);
  border-radius: 0;
  padding: 4px 9px;
}
.wn-mock-check {
  font: 700 9.5px/1 Inter, sans-serif;
  letter-spacing: 0.08em;
  color: #557a47;
}
.wn-mock-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--p-line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--p-text-2);
  background: transparent;
}
.wn-mock-bluedot {
  position: absolute;
  bottom: 8px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9a46e;
  box-shadow: 0 0 6px rgba(201, 164, 110, 0.55);
}

/* ---- mock filter pills ---- */
.wn-pillrow { display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; user-select: none; }
.wn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--p-line-2);
  border-radius: 0;
  padding: 5px 12px;
  font: 700 11px/1 Inter, sans-serif;
  color: var(--p-text-2);
  background: transparent;
}
.wn-pill.is-on { background: rgba(232, 146, 63, 0.10); }
.wn-pill-dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---- foot ---- */
.wn-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 28px 18px;
  border-top: 1px dashed var(--p-line);
}
.wn-foot .btn-ghost {
  margin-top: 10px;
  padding: 15px 20px;            /* match btn-primary height */
  font-size: 13px;
  letter-spacing: 0.16em;
  color: var(--p-text-2);
  border-color: var(--p-line-2);
}
.wn-foot .btn-ghost:hover { background: rgba(0, 0, 0, 0.05); }

/* ==================================================================
   QC SPECIFICATION TAB (v1 / Session 10)
   Navy/wood/gold, dark premium. Namespace: qc-*
   ================================================================== */
.qc-loading, .qc-error, .qc-empty, .qc-empty-sm {
  color: var(--text-3); padding: 24px; text-align: center;
}
.qc-error { color: var(--red); }
.qc-empty { padding: 48px 24px; font-size: 0.95rem; }
.qc-empty-sm { padding: 18px; font-size: 0.85rem; }
.qc-muted { color: var(--text-3); font-style: italic; }

/* ---- buttons (local, on existing tokens) ---- */
.qc-btn-primary {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: #2a1c0c; border: none; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 0.9rem; padding: 9px 16px; cursor: pointer;
  letter-spacing: 0.01em; transition: filter 0.15s, transform 0.05s;
}
.qc-btn-primary:hover { filter: brightness(1.06); }
.qc-btn-primary:active { transform: translateY(1px); }
.qc-btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.qc-btn-ghost {
  background: transparent; color: var(--wood-light);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.85rem; padding: 6px 12px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.qc-btn-ghost:hover { background: rgba(212, 163, 104, 0.1); border-color: var(--wood-dark); }
.qc-icon-btn {
  background: transparent; border: none; color: var(--text-3);
  width: 30px; height: 30px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.qc-icon-btn svg { width: 17px; height: 17px; }
.qc-icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-2); }
.qc-icon-btn.qc-danger:hover { color: var(--red); background: rgba(212,116,116,0.12); }

/* ---- General Rules card ---- */
.qc-rules-card {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.qc-rules-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.qc-rules-title { font-size: 1.05rem; color: var(--chrome); margin: 0; font-weight: 700; }
.qc-rules-sub { color: var(--wood); font-weight: 500; font-size: 0.9rem; }
.qc-rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.qc-rule-stat {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.qc-rule-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.qc-rule-val { font-size: 1rem; color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.qc-rule-edit { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.qc-rule-edit input, .qc-rule-edit textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); padding: 8px 10px; font: inherit; width: 100%; box-sizing: border-box;
}
.qc-rules-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ---- Workspace: toolbox + builder ---- */
.qc-workspace { display: grid; grid-template-columns: 270px 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .qc-workspace { grid-template-columns: 1fr; } }

.qc-toolbox {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; position: sticky; top: 12px;
}
.qc-tool-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.qc-tool-title { font-size: 0.95rem; color: var(--chrome); margin: 0; font-weight: 700; letter-spacing: 0.02em; }
.qc-tool-hint { font-size: 0.75rem; color: var(--text-3); margin: 0 0 12px; line-height: 1.35; }
.qc-tool-list { display: flex; flex-direction: column; gap: 7px; min-height: 20px; }
.qc-tool-card {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 9px; cursor: grab;
}
.qc-tool-card:active { cursor: grabbing; }
.qc-tool-ghost { opacity: 0.4; }
.qc-tool-handle { color: var(--text-3); display: inline-flex; }
.qc-tool-handle svg { width: 14px; height: 14px; }
.qc-tool-thumb {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 5px;
  background: var(--bg-elev) center/cover no-repeat; border: 1px solid var(--line);
}
.qc-tool-thumb-empty { background-image: linear-gradient(135deg, var(--bg-elev), var(--bg)); }
.qc-tool-name {
  flex: 1; background: none; border: none; color: var(--text); text-align: left;
  font: inherit; font-size: 0.85rem; cursor: pointer; padding: 0;
}
.qc-tool-name:hover { color: var(--wood-light); text-decoration: underline; }
.qc-tool-photos { font-size: 0.7rem; color: var(--text-3); }

/* ---- Species builder ---- */
.qc-species-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.qc-species-tab {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 0; padding: 7px 15px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s;
}
.qc-species-tab:hover { border-color: var(--wood-dark); color: var(--text); }
.qc-species-tab.is-active {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: #2a1c0c; border-color: var(--wood);
}
.qc-species-add { border-style: dashed; color: var(--wood-light); }

.qc-species-info {
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  border-left: 3px solid var(--wood);
}
.qc-species-info-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qc-species-name { font-size: 1.25rem; color: var(--chrome); margin: 0; font-weight: 700; }
.qc-species-actions { display: flex; align-items: center; gap: 4px; }
.qc-spec-row { display: flex; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.qc-spec-row:first-child { border-top: none; }
.qc-spec-key { flex: 0 0 92px; color: var(--text-3); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; padding-top: 2px; }
.qc-spec-text { color: var(--text); line-height: 1.4; }

/* ---- Size ranges ---- */
.qc-ranges { display: flex; flex-direction: column; gap: 16px; margin-bottom: 14px; }
.qc-range {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.qc-range-head {
  display: flex; align-items: flex-end; gap: 16px; justify-content: space-between;
  padding: 14px 16px; background: var(--bg-3); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.qc-range-sliders { display: flex; align-items: flex-end; gap: 14px; flex: 1; min-width: 280px; }
.qc-slider-block { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 90px; }
.qc-slider-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.qc-slider { width: 100%; accent-color: var(--wood); cursor: pointer; }
.qc-slider-out { font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; color: var(--gold); font-weight: 600; }
.qc-board-preview { flex: 1; min-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qc-board-svg { width: 100%; height: 38px; }
.qc-board-caption { font-size: 0.75rem; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }
.qc-range-meta { display: flex; align-items: center; gap: 8px; }
.qc-thick-input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); padding: 7px 10px; font: inherit; font-size: 0.85rem; width: 190px;
}

/* ---- Face / Back ---- */
.qc-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 620px) { .qc-sides { grid-template-columns: 1fr; } }
.qc-side { padding: 12px 14px; }
.qc-side-face { border-right: 1px solid var(--line); }
@media (max-width: 620px) { .qc-side-face { border-right: none; border-bottom: 1px solid var(--line); } }
.qc-side-head {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
  margin-bottom: 10px; color: var(--wood-light);
}
.qc-side-back .qc-side-head { color: var(--text-3); }
.qc-dropzone {
  min-height: 64px; border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm);
  padding: 8px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, background 0.15s;
}
.qc-dropzone.sortable-drag-over, .qc-dropzone:hover { border-color: var(--wood); background: rgba(212,163,104,0.05); }
.qc-drop-hint { color: var(--text-3); font-size: 0.8rem; text-align: center; padding: 14px 0; }

.qc-rule-chip {
  background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--green);
  border-radius: var(--radius-sm); padding: 9px 10px; display: flex; flex-direction: column; gap: 7px;
}
.qc-chip-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qc-chip-name { font-weight: 600; font-size: 0.88rem; color: var(--text); }
.qc-chip-del { width: 26px; height: 26px; }
.qc-chip-del svg { width: 15px; height: 15px; }
.qc-chip-limit, .qc-chip-notes {
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text); padding: 6px 8px; font: inherit; font-size: 0.82rem; width: 100%; box-sizing: border-box;
}
.qc-chip-notes { resize: vertical; line-height: 1.4; }
.qc-add-range { margin-top: 4px; }

/* ---- Defect detail modal ---- */
.qc-modal {
  position: fixed; inset: 0; background: rgba(8,12,18,0.72); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 1200; padding: 20px;
}
.qc-modal.is-open { display: flex; }
.qc-modal-card {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius);
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow);
}
.qc-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--bg-2); z-index: 1;
}
.qc-modal-head h2 { font-size: 1rem; color: var(--chrome); margin: 0; }
.qc-modal-body { padding: 18px; }
.qc-def-head { margin-bottom: 14px; }
.qc-def-name {
  width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--chrome); font-size: 1.15rem; font-weight: 700; padding: 9px 12px;
}
.qc-def-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.qc-def-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.qc-def-text, .qc-def-field input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); padding: 9px 11px; font: inherit; width: 100%; box-sizing: border-box; line-height: 1.45;
}
.qc-def-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.qc-def-actions .qc-btn-primary { flex: 1; }
.qc-def-photos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.qc-upload-label { cursor: pointer; }
.qc-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.qc-photo { position: relative; aspect-ratio: 1; }
.qc-photo-img {
  width: 100%; height: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--bg-elev) center/cover no-repeat; cursor: pointer; padding: 0;
}
.qc-photo-img.is-loaded { border-color: var(--line-2); }
.qc-photo-del {
  position: absolute; top: 4px; right: 4px; background: rgba(8,12,18,0.78);
  width: 26px; height: 26px;
}
.qc-photo-del svg { width: 14px; height: 14px; }

/* ---- toasts ---- */
.qc-toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 1400; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.qc-toast {
  padding: 10px 18px; border-radius: 0; font-size: 0.85rem; font-weight: 600;
  box-shadow: var(--shadow); transition: opacity 0.3s, transform 0.3s;
}
.qc-toast-success { background: var(--green); color: #11240c; }
.qc-toast-error { background: var(--red); color: #2a0c0c; }
.qc-toast.is-out { opacity: 0; transform: translateY(8px); }

/* ---- QC Spec v2: brand hero, species wood tiles, real-wood plank ---- */
.qc-brand-hero {
  display: flex; align-items: center; gap: 20px;
  position: relative;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 20px; margin-bottom: 18px; overflow: hidden;
}
.qc-brand-img { width: 190px; max-width: 42%; height: auto; flex: 0 0 auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45)); }
.qc-brand-copy { flex: 1; min-width: 0; }
.qc-brand-title { font-size: 1.4rem; color: var(--chrome); margin: 0 0 4px; font-weight: 800; letter-spacing: 0.01em; }
.qc-brand-sub { font-size: 0.9rem; color: var(--text-2); margin: 0; line-height: 1.4; }
@media (max-width: 620px) {
  .qc-brand-hero { flex-direction: column; text-align: center; gap: 10px; }
  .qc-brand-img { width: 220px; max-width: 70%; }
}

.qc-species-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.qc-species-tile {
  position: relative; padding: 0; border: 2px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
  aspect-ratio: 510 / 225; background: var(--bg-2);
  transition: border-color 0.15s, transform 0.08s, box-shadow 0.15s;
}
.qc-species-tile img { width: 100%; height: 100%; object-fit: cover; object-position: left center; display: block; }
.qc-species-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.35); border-color: var(--wood-dark); }
.qc-species-tile.is-active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(224,182,108,0.35), 0 6px 18px rgba(0,0,0,0.4); }
.qc-species-tile-text {
  display: flex; align-items: center; justify-content: center; color: var(--text);
  font-weight: 700; font-size: 0.95rem; background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
}
.qc-species-add {
  display: flex; align-items: center; justify-content: center;
  border-style: dashed; color: var(--wood-light); font-weight: 700; font-size: 0.9rem;
  background: transparent;
}
.qc-species-add:hover { background: rgba(212,163,104,0.08); }

/* real-wood plank preview (replaces the SVG gradient) */
.qc-board-plank {
  height: 46px; border-radius: 6px; background-size: cover; background-position: center;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 3px 8px rgba(0,0,0,0.4);
  transition: width 0.12s ease-out; min-width: 26px;
}

/* ==================================================================
   QC Spec v3 — strong active tile, hero, thickness/width sizer,
   cross-section profile, allowed/not-allowed columns
   ================================================================== */

/* --- active species tile: bold gold border + glow + green check --- */
.qc-species-tile.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(224,182,108,0.55), 0 0 22px 2px rgba(224,182,108,0.45), 0 8px 22px rgba(0,0,0,0.5);
  transform: translateY(-3px) scale(1.02);
}
.qc-tile-check {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  background: var(--green); border-radius: 50%; display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45); border: 2px solid #11240c;
}
.qc-tile-check svg { width: 15px; height: 15px; }
.qc-species-tile.is-active .qc-tile-check { display: flex; }

/* --- species info: hero + meta side by side --- */
.qc-species-info {
  display: flex; gap: 18px; align-items: stretch;
}
@media (max-width: 700px) { .qc-species-info { flex-direction: column; } }
.qc-species-hero {
  flex: 0 0 280px; max-width: 42%; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-3); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; min-height: 150px;
}
@media (max-width: 700px) { .qc-species-hero { max-width: 100%; flex-basis: auto; } }
.qc-species-hero img { width: 100%; height: 100%; object-fit: contain; padding: 10px; box-sizing: border-box; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); }
.qc-species-meta { flex: 1; min-width: 0; }

/* --- size range --- */
.qc-range-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.qc-range-dims { color: var(--text-2); font-size: 0.95rem; }
.qc-range-dims strong { color: var(--gold); font-family: 'JetBrains Mono', monospace; }

/* sizer: vertical thickness slider | profile + horizontal width slider */
.qc-sizer { display: flex; gap: 18px; align-items: stretch; padding: 4px 0 8px; }
.qc-thick-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 0 0 56px; }
.qc-thick-out { font-family: 'JetBrains Mono', monospace; color: var(--gold); font-weight: 600; font-size: 0.9rem; }
.qc-thick-slider {
  -webkit-appearance: slider-vertical; appearance: slider-vertical;
  writing-mode: vertical-lr; direction: rtl;
  width: 26px; flex: 1; min-height: 120px; accent-color: var(--wood); cursor: pointer;
}
.qc-axis-label { font-size: 0.66rem; letter-spacing: 0.12em; color: var(--text-3); font-weight: 700; }
.qc-profile-col { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.qc-profile-stage {
  height: 150px; display: flex; align-items: flex-end; justify-content: center;
  background:
    repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(255,255,255,0.03) 23px, rgba(255,255,255,0.03) 24px),
    var(--bg-3);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; box-sizing: border-box;
}
.qc-profile-board {
  background-size: cover; background-position: center;
  border-radius: 4px 4px 2px 2px;
  border: 1px solid rgba(0,0,0,0.4);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.22), inset 0 -3px 6px rgba(0,0,0,0.3), 0 5px 12px rgba(0,0,0,0.45);
  transition: width 0.1s ease-out, height 0.1s ease-out;
}
.qc-width-slider { width: 100%; accent-color: var(--wood); cursor: pointer; }
.qc-axis-width { text-align: center; }
.qc-axis-width span { color: var(--gold); font-family: 'JetBrains Mono', monospace; }

/* --- face / back: centered, allowed / not-allowed columns --- */
.qc-side { padding: 10px 0; border-top: 1px solid var(--line); }
.qc-side-head { text-align: center; font-size: 0.8rem; letter-spacing: 0.16em; font-weight: 800; color: var(--chrome); margin-bottom: 10px; }
.qc-side-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .qc-side-cols { grid-template-columns: 1fr; } }
.qc-dropcol { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); }
.qc-col-head { text-align: center; font-size: 0.72rem; letter-spacing: 0.12em; font-weight: 800; padding: 6px; color: #1a1208; }
.qc-col-allowed .qc-col-head { background: var(--green); }
.qc-col-denied .qc-col-head { background: var(--red); }
.qc-dropcol .qc-dropzone {
  min-height: 60px; border: none; border-radius: 0; padding: 8px; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-3);
}
.qc-col-allowed .qc-dropzone:hover { background: rgba(143,188,122,0.08); }
.qc-col-denied .qc-dropzone:hover { background: rgba(212,116,116,0.08); }
.qc-rule-chip.qc-chip-allowed { border-left: 4px solid var(--green); }
.qc-rule-chip.qc-chip-denied { border-left: 4px solid var(--red); }

/* ==================================================================
   QC Spec v4 — black check, unified species card, geometric profile,
   flared Face/Back headings, single drop box, chip allow toggle,
   centered general-rules boxes, slogan
   ================================================================== */

/* brand slogan */
.qc-brand-slogan { font-size: 0.98rem; color: var(--gold); font-style: italic; margin: 2px 0 6px; font-weight: 500; }

/* black checkbox (no green circle) */
.qc-tile-check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  background: rgba(255,255,255,0.92); border: 1.5px solid #0d0d0d; border-radius: 4px;
  display: none; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.qc-tile-check svg { width: 14px; height: 14px; }
.qc-species-tile.is-active .qc-tile-check { display: flex; }

/* unified species card: image left, text right, ONE box */
.qc-species-info {
  display: flex; gap: 0; align-items: stretch;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-3));
  border: 1px solid var(--line); border-left: 3px solid var(--wood);
  border-radius: var(--radius); overflow: hidden;
}
.qc-species-hero {
  flex: 0 0 200px; max-width: 36%; background: transparent;
  display: flex; align-items: center; justify-content: center; border: none;
}
@media (max-width: 700px) { .qc-species-info { flex-direction: column; } .qc-species-hero { max-width: 100%; flex-basis: 180px; border-right: none; border-bottom: 1px solid var(--line); } }
.qc-species-hero img { width: 100%; height: 100%; object-fit: contain; padding: 12px; box-sizing: border-box; filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4)); }
.qc-species-meta { flex: 1; min-width: 0; padding: 16px 18px; }

/* general-rules boxes centered */
.qc-rule-stat { align-items: center; text-align: center; }
.qc-rule-label { text-align: center; }
.qc-rule-val { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.qc-rule-part { white-space: nowrap; }
.qc-rule-div { width: 1px; height: 16px; background: var(--line-2); display: inline-block; }

/* geometric cross-section profile (no photo) */
.qc-profile-stage {
  height: 86px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; box-sizing: border-box;
}
.qc-profile-board {
  border-radius: 3px; border: 1px solid rgba(0,0,0,0.45);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  transition: width 0.1s ease-out, height 0.1s ease-out; min-width: 24px;
}
.qc-thick-slider { min-height: 96px; }
.qc-thick-col { flex: 0 0 50px; }

/* Face / Back flared heading */
.qc-side { padding: 14px 0 6px; border-top: none; }
.qc-side-flare { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.qc-flare-line { flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--wood-dark), var(--wood)); }
.qc-side-flare .qc-flare-line:last-child { background: linear-gradient(90deg, var(--wood), var(--wood-dark), transparent); }
.qc-side-label {
  font-size: 1.15rem; font-weight: 800; letter-spacing: 0.22em; color: var(--chrome);
  text-transform: uppercase;
}

/* single drop box per side */
.qc-side-zone {
  border: 1.5px dashed var(--line-2); border-radius: var(--radius-sm); padding: 10px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; min-height: 64px;
}
.qc-side-zone:hover { border-color: var(--wood); }
.qc-side-zone .qc-drop-hint { grid-column: 1 / -1; text-align: center; color: var(--text-3); padding: 16px 0; }

/* chip allowed/not-allowed inline toggle */
.qc-chip-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 0; overflow: hidden; margin-left: auto; }
.qc-tog { background: transparent; border: none; color: var(--text-3); font: inherit; font-size: 0.7rem; font-weight: 700; padding: 4px 9px; cursor: pointer; letter-spacing: 0.02em; }
.qc-tog-yes.is-on { background: var(--green); color: #11240c; }
.qc-tog-no.is-on { background: var(--red); color: #2a0c0c; }
.qc-chip-head { gap: 8px; }

/* ==================================================================
   QC Spec v5 — fixed thickness × width matrix, dropdown assignment
   ================================================================== */
.qc-matrix { margin-top: 20px; display: flex; flex-direction: column; gap: 22px; }

.qc-thick-block {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.qc-thick-head {
  font-size: 1.3rem; font-weight: 800; color: var(--gold); margin: 0 0 14px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.qc-thick-s4s { font-size: 0.7rem; color: var(--text-3); letter-spacing: 0.18em; font-family: 'Inter', sans-serif; font-weight: 700; vertical-align: middle; margin-left: 6px; }

.qc-width-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.qc-wcard { background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.qc-wcard-head {
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-3));
  padding: 10px 14px; font-weight: 700; color: var(--chrome); font-size: 0.92rem;
  border-bottom: 1px solid var(--line); text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

/* face/back stacked within a width card */
.qc-wcard .qc-side { padding: 12px 14px; border-top: none; }
.qc-wcard .qc-side + .qc-side { border-top: 1px solid var(--line); }
.qc-side-flare { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qc-flare-line { flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--wood-dark), var(--wood)); }
.qc-side-flare .qc-flare-line:last-child { background: linear-gradient(90deg, var(--wood), var(--wood-dark), transparent); }
.qc-side-label { font-size: 0.92rem; font-weight: 800; letter-spacing: 0.2em; color: var(--chrome); }

.qc-side-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.qc-side-list:empty { display: none; }

.qc-add-select {
  width: 100%; background: var(--bg); border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  color: var(--wood-light); padding: 8px 10px; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.qc-add-select:hover { border-color: var(--wood); }

/* chip toggle wraps nicely in the narrower card */
.qc-chip-head { flex-wrap: wrap; }
.qc-chip-toggle { margin-left: 0; }

/* ---- QC Spec v6: width ranges as stacked rows + editable labels ---- */
.qc-width-cards { display: flex; flex-direction: column; gap: 12px; }
.qc-wcard { width: 100%; }
.qc-wcard-label {
  width: 100%; box-sizing: border-box; background: transparent; border: 1px solid transparent;
  color: var(--chrome); font: inherit; font-family: 'JetBrains Mono', monospace; font-size: 0.92rem;
  font-weight: 700; text-align: center; padding: 4px 8px; border-radius: var(--radius-sm); cursor: text;
}
.qc-wcard-label:hover { border-color: var(--line-2); }
.qc-wcard-label:focus { outline: none; border-color: var(--wood); background: var(--bg); }
.qc-wcard-label-static { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: var(--chrome); }

/* ==================================================================
   QC Spec v8 — defect-primary grid (Session 11)
   - defects are rows, width ranges are columns
   - each defect = 3 stacked rows: Allowed (tri-state) / Thickness / Back
   - toolbox removed; defects edited via popup from the row label
   - thin gold bounding boxes; bold ALL-SPECIES + tolerance headers
   ================================================================== */

/* Gold bounding boxes on the major cards */
.qc-brand-hero,
.qc-rules-card,
.qc-species-info,
.qc-dgrid {
  border: 1px solid rgba(224, 182, 108, 0.55);
  box-shadow: 0 0 0 1px rgba(224, 182, 108, 0.08), 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* Builder is full width now (no sidebar) */
.qc-builder-full { width: 100%; }

/* ---- Brand hero: FAS Plus+ wordmark ---- */
.qc-fas { color: var(--gold); font-weight: 900; letter-spacing: 0.01em; white-space: nowrap; }
.qc-fas-plus { font-weight: 900; vertical-align: super; font-size: 0.66em; margin-left: 1px; }
.qc-brand-slogan {
  font-size: 0.95rem; color: var(--text-2); font-style: normal;
  letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; margin: 2px 0 8px;
}
.qc-brand-sub { font-size: 1rem; color: var(--gold); line-height: 1.55; font-weight: 600; font-style: italic; max-width: none; }

/* ---- General Rules: bolder, higher-contrast ---- */
.qc-rules-all {
  font-size: 0.92rem; font-weight: 800; letter-spacing: 0.12em;
  color: var(--gold); text-transform: uppercase;
}
.qc-rules-card .qc-rule-label {
  text-align: center; color: var(--chrome) !important;
  font-weight: 800 !important; letter-spacing: 0.07em; opacity: 1;
}
.qc-rules-card .qc-rule-val,
.qc-rules-card .qc-rule-part { color: var(--gold); font-weight: 800; }

/* ---- Defects bar (above grid) ---- */
.qc-defects-bar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 0 10px;
}
.qc-defects-title {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--text-2);
}

/* ==================================================================
   Defect-primary grid
   columns: [defect/row-label | 0-4 | 4-8 | 8-12]
   ================================================================== */
.qc-dgrid {
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: 0;
  overflow-x: auto;
}

/* shared column template so header + every row align */
.qc-dgrid-head,
.qc-dgrid-row {
  display: grid;
  grid-template-columns: 84px repeat(3, minmax(120px, 1fr));
  gap: 8px;
  align-items: stretch;
}

/* column header — editable width labels */
.qc-dgrid-head {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-3);
  padding: 12px 0 10px;
  border-bottom: 2px solid rgba(224, 182, 108, 0.45);
  align-items: center;
}
.qc-dgrid-corner {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-3);
}
.qc-dgrid-wlabel, .qc-dgrid-wlabel-static {
  font-size: 0.84rem; font-weight: 800; color: var(--gold);
  text-align: center; letter-spacing: 0.01em;
}
.qc-dgrid-wlabel {
  background: rgba(224, 182, 108, 0.08);
  border: 1px solid rgba(224, 182, 108, 0.30);
  border-radius: var(--radius-sm); padding: 6px 8px; min-width: 0;
}
.qc-dgrid-wlabel:focus { outline: none; border-color: var(--gold); background: var(--bg-2); }

/* defect block — a floating "card"; gold divider spans the full card width,
   alternating background (nth-child auto-restripes on drag-reorder) */
.qc-dgrid-defect {
  position: relative;
  border-top: 2px solid rgba(224, 182, 108, 0.55);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  padding: 16px 16px;
  background: var(--bg-2);
}
.qc-dgrid-defect:nth-child(even) { background: var(--bg-3); }
.qc-dgrid-defect:first-of-type { border-top: none; }
.qc-dgrid-defect:last-of-type { border-bottom: none; }

/* full-width defect header band (thumb + name + definition) */
.qc-dgrid-deflabel {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  background: #1a1815; border: 1px solid #0b0b0b;
  border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 12px;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.30);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.qc-dgrid-deflabel:hover { border-color: var(--gold); }
.qc-dgrid-thumb {
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: var(--radius-sm);
  background-color: var(--bg-3); background-size: cover; background-position: center;
  border: 1px solid var(--line);
}
.qc-dgrid-thumb-empty { background-image: linear-gradient(135deg, var(--wood-dark), var(--bg-3)); opacity: 0.6; }
.qc-dgrid-deftext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.qc-dgrid-defname { font-size: 0.95rem; font-weight: 800; color: var(--chrome); }
.qc-dgrid-def {
  font-size: 0.76rem; color: var(--text-2); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.qc-dgrid-edit {
  flex: 0 0 auto; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gold);
  border: 1px solid rgba(224,182,108,0.4); border-radius: 0; padding: 3px 10px;
}

.qc-dgrid-rows { display: flex; flex-direction: column; gap: 6px; }
.qc-dgrid-rowlabel {
  display: flex; align-items: center; justify-content: flex-end;
  font-size: 0.64rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--gold); padding-right: 4px; text-align: right;
}

/* tri-state allow/deny cell */
.qc-cell {
  display: flex; align-items: center; justify-content: center;
  min-height: 38px; border-radius: var(--radius-sm);
  font-size: 1.2rem; font-weight: 900; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--bg-2);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.qc-cell:hover { transform: translateY(-1px); }
.qc-cell-unset { color: var(--text-3); border-style: dashed; }
.qc-cell-allow {
  color: #14361a; background: var(--green); border-color: var(--green);
}
.qc-cell-deny {
  color: #fff; background: var(--red); border-color: var(--red);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18);
}
.qc-cell-na { display: flex; align-items: center; justify-content: center; color: var(--text-3); }

/* notes cells (thickness + back) */
.qc-dgrid-tnote .qc-dgrid-rowlabel { color: var(--gold); }
.qc-dgrid-note {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); padding: 7px 9px; font-family: inherit; font-size: 0.8rem;
  resize: none; overflow: hidden; line-height: 1.35; min-height: 36px; width: 100%;
}
.qc-dgrid-note:focus { outline: none; border-color: var(--gold); background: var(--bg-3); }
/* All note + empty-cell boxes share one shade per card and shift with the
   alternating card background, so Allowed / Thickness / Back stay consistent. */
.qc-dgrid-defect:nth-child(odd) .qc-dgrid-note,
.qc-dgrid-defect:nth-child(odd) .qc-cell-unset { background: var(--bg); }
.qc-dgrid-defect:nth-child(even) .qc-dgrid-note,
.qc-dgrid-defect:nth-child(even) .qc-cell-unset { background: var(--bg-2); }

/* tighten on phones; iPad keeps the full grid */
@media (max-width: 560px) {
  .qc-dgrid-head, .qc-dgrid-row { grid-template-columns: 58px repeat(3, minmax(86px, 1fr)); gap: 5px; }
  .qc-dgrid-vlines { grid-template-columns: 58px repeat(3, minmax(86px, 1fr)); gap: 5px; }
  .qc-dgrid-vlines i:nth-child(2), .qc-dgrid-vlines i:nth-child(3), .qc-dgrid-vlines i:nth-child(4) { transform: translateX(-2.5px); }
  .qc-dgrid-deflabel-wrap { grid-template-columns: 58px 1fr; gap: 5px; }
  .qc-dgrid-rowlabel { font-size: 0.56rem; }
  .qc-dgrid-note { font-size: 0.74rem; }
}

/* ---- QC v8.1: PDF button, per-defect width row, drag handle ---- */

/* Generate PDF — top-right of brand hero */
.qc-brand-hero { position: relative; }
.qc-pdf-btn {
  position: absolute; top: 16px; right: 16px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em;
  color: #14210a; cursor: pointer;
  background: linear-gradient(180deg, #f0cd86, var(--gold));
  border: 1px solid rgba(224,182,108,0.7);
  border-radius: 0; padding: 8px 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}
.qc-pdf-btn:hover { filter: brightness(1.05); }
.qc-pdf-btn:active { transform: translateY(1px); }

/* top-right action cluster: Defect Admin (ghost) + Generate PDF (solid) */
.qc-hero-actions { position: absolute; top: 16px; right: 16px; z-index: 3; display: flex; gap: 8px; align-items: center; }
.qc-hero-actions .qc-pdf-btn { position: static; top: auto; right: auto; }
.qc-hero-btn {
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em;
  color: var(--gold); cursor: pointer;
  background: rgba(20, 24, 33, 0.82);
  border: 1px solid rgba(224, 182, 108, 0.55);
  border-radius: 0; padding: 8px 16px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.qc-hero-btn:hover { background: rgba(224, 182, 108, 0.14); }
.qc-hero-btn:active { transform: translateY(1px); }

/* display-only defect label (in-grid edit retired; thumbnail still opens gallery) */
.qc-dgrid-deflabel-static { cursor: default; }
.qc-dgrid-deflabel-static:hover { border-color: #0a0d12; }

/* ---- Defect Admin modal ---- */
.qc-admin-card { max-width: 640px; }
.qc-admin-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.qc-admin-row:first-child { padding-top: 2px; }
.qc-admin-row:last-child { border-bottom: none; padding-bottom: 2px; }
.qc-admin-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qc-admin-name {
  flex: 1; min-width: 0; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--chrome); font-size: 1.02rem; font-weight: 700; padding: 8px 11px;
}
.qc-admin-def {
  width: 100%; box-sizing: border-box; resize: none; overflow: hidden;
  min-height: 2.8em;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); padding: 8px 11px; font: inherit; line-height: 1.45; margin-bottom: 10px;
}
.qc-admin-photos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.qc-admin-photos-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }

/* per-defect width-range row — reads as column headers, not buttons */
.qc-dgrid-wrow { margin-bottom: 6px; align-items: end; }
.qc-dgrid-wrow .qc-dgrid-wlabel,
.qc-dgrid-wrow .qc-dgrid-wlabel-static {
  text-align: center; font-size: 0.8rem; font-weight: 800; color: var(--gold);
  letter-spacing: 0.05em; text-transform: uppercase;
  background: transparent; border: none; border-radius: 0;
  padding: 4px 4px 8px; min-width: 0;
  border-bottom: 1.5px solid rgba(224, 182, 108, 0.40);
}
.qc-dgrid-wrow .qc-dgrid-wlabel { cursor: text; transition: background 0.12s ease; }
.qc-dgrid-wrow .qc-dgrid-wlabel:hover { background: rgba(224, 182, 108, 0.06); }
.qc-dgrid-wrow .qc-dgrid-wlabel:focus {
  outline: none; background: rgba(224, 182, 108, 0.10); box-shadow: inset 0 -1.5px 0 var(--gold);
}

/* continuous vertical separators between the three width columns */
.qc-dgrid-colwrap { position: relative; }
.qc-dgrid-vlines {
  position: absolute; inset: 0; pointer-events: none;
  display: grid; grid-template-columns: 84px repeat(3, minmax(120px, 1fr)); gap: 8px;
}
.qc-dgrid-vlines i { display: block; }
.qc-dgrid-vlines i:nth-child(2),
.qc-dgrid-vlines i:nth-child(3),
.qc-dgrid-vlines i:nth-child(4) {
  border-left: 1.5px solid rgba(224, 182, 108, 0.32);
  transform: translateX(-4px);
}

/* defect header band with drag handle */
.qc-dgrid-deflabel-wrap { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: center; margin-bottom: 12px; }
.qc-dgrid-deflabel-wrap .qc-dgrid-deflabel { grid-column: 2; margin-bottom: 0; }
.qc-dgrid-handle {
  display: flex; align-items: center; justify-content: flex-end; padding-right: 4px;
  color: var(--text-3); cursor: grab; touch-action: none;
  background: transparent; border: none;
}
.qc-dgrid-handle:hover { color: var(--gold); border-color: rgba(224,182,108,0.4); }
.qc-dgrid-handle:active { cursor: grabbing; }
.qc-dgrid-handle svg { width: 18px; height: 18px; }
.qc-dgrid-ghost { opacity: 0.45; }

/* ==================================================================
   QC Spec — session 12 additions (species edit form, photo primary,
   gallery lightbox nav)
   ================================================================== */

/* species edit form: anchor to top so it doesn't stretch with the
   tall board image, and keep each label tight to its own box */
/* species edit form: compact block layout — each label hugs its own box */
.qc-spec-editform { display: block; align-self: start; }
.qc-spec-edit-group { margin: 0 0 14px; }
.qc-spec-edit-label {
  display: block; margin: 0 0 5px;
  color: var(--text-3); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.qc-spec-edit-box {
  display: block; width: 100%; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  color: var(--text); font: inherit; padding: 8px 10px; line-height: 1.4; resize: vertical;
}
.qc-spec-edit-box:focus { outline: none; border-color: var(--gold); }
.qc-spec-editform .qc-rules-actions { margin-top: 2px; }

/* editable species title (replaces the H3 while editing) */
.qc-species-name-input {
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 4px 10px; font-size: 1.25rem; font-weight: 700; color: var(--chrome);
  font-family: inherit; max-width: 340px; width: 100%;
}
.qc-species-name-input:focus { outline: none; border-color: var(--gold); }

/* cover thumb is now tappable to open the gallery */
.qc-dgrid-thumb-clickable { cursor: pointer; transition: box-shadow 0.12s ease, transform 0.12s ease; }
.qc-dgrid-thumb-clickable:hover { box-shadow: 0 0 0 2px rgba(224, 182, 108, 0.55); transform: translateY(-1px); }

/* photo modal: primary badge + set-primary control */
.qc-photo.is-primary .qc-photo-img { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.qc-photo-badge {
  position: absolute; left: 4px; top: 4px; z-index: 2;
  background: var(--gold); color: #2a1d07; font-size: 0.6rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px;
}
.qc-photo-setprimary {
  position: absolute; left: 4px; bottom: 4px; z-index: 2;
  background: rgba(20, 24, 33, 0.82); color: var(--gold);
  border: 1px solid rgba(224, 182, 108, 0.45); border-radius: 4px;
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 6px; cursor: pointer;
}
.qc-photo-setprimary:hover { background: rgba(224, 182, 108, 0.18); }

/* gallery lightbox: prev/next arrows + counter (only shown when >1 image) */
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f5edd9; font: 400 30px/1 'Inter', sans-serif; cursor: pointer; display: none;
  align-items: center; justify-content: center;
}
.lb-overlay.is-gallery .lb-nav { display: flex; }
.lb-nav:hover { background: rgba(255, 255, 255, 0.18); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-count {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3;
  color: #f5edd9; font-size: 0.85rem; letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.35); padding: 4px 10px; border-radius: 0;
}
@media (max-width: 560px) {
  .lb-nav { width: 40px; height: 40px; font-size: 26px; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

/* ==================================================================
   PERSONNEL — collapsible File Repository + divider (v40.1)
   ================================================================== */
.pers-section-head {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--wood-dark);
  border-radius: var(--radius);
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.pers-section-head:hover { border-color: var(--wood); }
.pers-section-title {
  color: var(--wood-light);
  font-size: 14px;
  font-weight: 600;
}
.pers-section-chevron {
  color: var(--wood-light);
  font-size: 18px;
  line-height: 1;
  transition: transform 0.18s ease;
}
.pers-section-head[aria-expanded="true"] .pers-section-chevron {
  transform: rotate(90deg);
}
.pers-section-body { margin-top: 14px; }
.pers-section-body .files-toolbar-row {
  max-width: 520px;
}
.pers-section-body .files-search {
  border-radius: var(--radius-sm);
}
.pers-divider {
  border: 0;
  border-top: 1px solid var(--wood-dark);
  margin: 22px 0;
}
.pers-uploading {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  color: var(--text-2);
  font-size: 13px;
}
.pers-uploading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: persSpin 0.8s linear infinite;
  flex: 0 0 auto;
}
@keyframes persSpin { to { transform: rotate(360deg); } }

/* ==================================================================
   PERSONNEL — EMPLOYEES (v40.4)
   Department groups, employee cards, and the pay-band indicator.
   ================================================================== */

.pers-emp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 18px 0 14px;
}
.pers-emp-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--wood-light);
  letter-spacing: 0.02em;
  margin: 0;
}
.pers-emp-actions { display: flex; gap: 8px; }

/* ---- Department group ---- */
.pers-dept { margin-bottom: 14px; }
.pers-dept-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--bg-2), rgba(212, 163, 104, 0.06));
  border: 1px solid var(--wood-dark);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.pers-dept-head:hover { border-color: var(--wood); }
.pers-dept-chevron {
  color: var(--wood);
  font-size: 1.1rem;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform 0.18s ease;
}
.pers-dept-head[aria-expanded="false"] .pers-dept-chevron { transform: rotate(0deg); }
.pers-dept-name { flex: 1; text-align: left; letter-spacing: 0.02em; }
.pers-dept-count {
  min-width: 26px;
  padding: 2px 8px;
  text-align: center;
  background: rgba(212, 163, 104, 0.14);
  border: 1px solid var(--wood-dark);
  border-radius: var(--radius-sm);
  color: var(--wood-light);
  font-size: 0.8rem;
  font-weight: 700;
}

.pers-dept-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 2px 2px;
  min-height: 34px;
}
.pers-dept-empty {
  padding: 10px 12px;
  color: var(--text-3);
  font-size: 0.85rem;
  font-style: italic;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
}

/* ---- Employee card ---- */
.pers-emp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.pers-emp-card:hover { border-color: var(--wood-dark); }
.pers-emp-ghost { opacity: 0.35; }
.pers-emp-dragging {
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.pers-emp-grip {
  color: var(--text-3);
  font-size: 0.95rem;
  cursor: grab;
  padding: 6px 2px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pers-emp-grip:active { cursor: grabbing; }

.pers-emp-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--wood-dark), var(--wood));
  border: 1px solid var(--wood-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pers-emp-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.pers-emp-avatar.is-loaded img { opacity: 1; }
.pers-emp-initials {
  color: #1c1408;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.pers-emp-main { flex: 1; min-width: 0; }
.pers-emp-toprow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pers-emp-name {
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}
.pers-emp-status {
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--line-2);
  color: var(--text-2);
}
.pers-emp-status.is-on_leave,
.pers-emp-status.is-on-leave { border-color: #b8912f; color: #e8c76a; }
.pers-emp-status.is-terminated,
.pers-emp-status.is-resigned { border-color: #8a4141; color: #d98a8a; }

.pers-emp-subrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.pers-emp-role {
  padding: 1px 9px;
  border-radius: var(--radius-sm);
  background: rgba(212, 163, 104, 0.12);
  border: 1px solid var(--wood-dark);
  color: var(--wood-light);
  font-size: 0.74rem;
  font-weight: 700;
}
.pers-emp-station {
  color: var(--text-3);
  font-size: 0.8rem;
}

/* ---- Pay band indicator ---- */
.pers-emp-bandrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.pers-emp-rate {
  font-weight: 800;
  color: var(--gold);
  font-size: 0.95rem;
  min-width: 52px;
}
.pers-emp-rate-unit {
  font-weight: 600;
  color: var(--text-3);
  font-size: 0.72rem;
}
.pers-emp-band {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 150px;
  max-width: 320px;
}
.pers-emp-band-min,
.pers-emp-band-max {
  color: var(--text-3);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.pers-emp-band-track {
  position: relative;
  flex: 1;
  height: 6px;
  border-radius: 0;
  background: var(--line);
  overflow: visible;
}
.pers-emp-band-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 0;
  background: linear-gradient(90deg, var(--wood-dark), var(--gold));
}
.pers-emp-band-marker {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--gold);
  border: 2px solid #0b0b0b;
  box-shadow: 0 0 0 2px rgba(224, 182, 108, 0.35), 0 0 10px rgba(224, 182, 108, 0.5);
}
.pers-emp-band-marker.is-over {
  background: #7fd18a;
  box-shadow: 0 0 0 2px rgba(127, 209, 138, 0.35), 0 0 10px rgba(127, 209, 138, 0.55);
}
.pers-emp-band-marker.is-under {
  background: #d98a8a;
  box-shadow: 0 0 0 2px rgba(217, 138, 138, 0.35), 0 0 10px rgba(217, 138, 138, 0.55);
}
.pers-emp-increase {
  color: var(--text-3);
  font-size: 0.74rem;
  white-space: nowrap;
}
.pers-emp-increase-none { font-style: italic; opacity: 0.8; }

/* ---- Employee modal extras ---- */
.pers-emp-form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.pers-emp-photo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.pers-emp-photo-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--wood-dark);
}
.pers-emp-delete { color: #d98a8a; margin-right: auto; }

/* ---- Departments & Roles admin modal ---- */
.pers-admin-heading {
  margin: 16px 0 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wood-light);
}
.pers-admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.pers-admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.pers-admin-row:hover { border-color: var(--wood-dark); }
.pers-admin-row-name { flex: 1; font-weight: 600; color: var(--text); }
.pers-admin-row-band { color: var(--wood-light); font-size: 0.8rem; font-weight: 700; }
.pers-admin-row-count {
  min-width: 22px;
  text-align: center;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  color: var(--text-3);
  font-size: 0.72rem;
  font-weight: 700;
}
.pers-admin-form {
  display: flex;
  gap: 8px;
  align-items: center;
}
.pers-admin-form input[type="text"] { flex: 1; min-width: 0; }
.pers-admin-form input[type="number"] { width: 74px; }

/* ==================================================================
   v40.5 — Personnel polish pass
   ================================================================== */

/* Header buttons: equal height; steel variant for Departments & Roles */
.pers-emp-header .btn-primary { margin-top: 0; }
.pers-btn-steel {
  background: linear-gradient(180deg, #4a4337 0%, #332d25 100%);
  color: var(--text);
  border-color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.pers-btn-steel:hover { filter: brightness(1.08); }

/* Wider Departments & Roles modal */
#persAdminModal .modal-card { max-width: 640px; }

/* Add-buttons under each admin list */
.pers-admin-addbtn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--wood-light);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pers-admin-addbtn:hover {
  border-color: var(--wood);
  background: rgba(212, 163, 104, 0.06);
}

/* Dropdown add/edit form: roomy fields, compact buttons */
.pers-admin-form {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 10px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.pers-admin-form input[type="text"] {
  width: 100%;
  flex: none;
  font-size: 15px;
  padding: 12px 14px;
}
.pers-admin-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.pers-admin-form .btn-primary.pers-admin-savebtn {
  margin-top: 0;
  padding: 9px 18px;
  font-size: 12px;
  box-shadow: 0 1px 6px rgba(212, 163, 104, 0.2);
}

/* Dual-handle wage-band slider ($15–$60) */
.pers-band-wrap { display: flex; flex-direction: column; gap: 4px; }
.pers-band-caption {
  font: 700 11px/1.2 Inter, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.pers-band-slider {
  position: relative;
  height: 54px;
  margin: 6px 12px 0;
}
.pers-band-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  height: 6px;
  background: var(--line);
  border-radius: 0;
}
.pers-band-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--wood-dark), var(--wood-light));
  border-radius: 0;
}
.pers-band-handle {
  position: absolute;
  bottom: 6px;
  width: 22px;
  height: 22px;
  margin-left: -11px;
  background: var(--bg-2);
  border: 2px solid var(--gold);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.pers-band-handle:active { cursor: grabbing; border-color: var(--wood-light); }
.pers-band-val {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  font: 700 12px/1 Inter, sans-serif;
  color: var(--gold);
  white-space: nowrap;
}
.pers-band-scale {
  display: flex;
  justify-content: space-between;
  margin: 2px 4px 0;
  font: 600 11px/1 Inter, sans-serif;
  color: var(--text-3);
}

/* Add Employee modal: cream-gold labels, subtle placeholders, parchment notes */
#persEmpModal .field-label { color: var(--wood-light, #d4a96a); }
#persEmpModal input::placeholder,
#persEmpModal textarea::placeholder {
  color: var(--text-3);
  opacity: 0.45;
}
#persEmpNotes {
  background: #f0e6cf;
  color: #2b2416;
  border: 1px solid #c9b98f;
  border-radius: var(--radius-sm);
  font: 14px/1.5 Inter, sans-serif;
  padding: 12px 14px;
  min-height: 96px;
  resize: vertical;
  outline: none;
}
#persEmpNotes::placeholder { color: #8a7a58; opacity: 0.7; }
#persEmpNotes:focus { border-color: var(--wood-dark); }

/* ==================================================================
   v40.6 — Personnel feedback pass
   ================================================================== */

/* Department groups: drag grip + permanent gold border + decorative name */
.pers-dept-headrow {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.pers-dept-grip {
  display: flex;
  align-items: center;
  padding: 0 6px;
  color: var(--wood-dark);
  cursor: grab;
  touch-action: none;
  font-size: 1rem;
  user-select: none;
}
.pers-dept-grip:active { cursor: grabbing; color: var(--wood); }
.pers-dept-headrow .pers-dept-head { flex: 1; }
.pers-dept-head { border-color: var(--wood-dark); }
.pers-dept-head:hover { border-color: var(--wood-light); }
.pers-dept-name {
  font-size: 1.45rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 55%, var(--wood-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding: 2px 0;
}

/* Admin modal rows/cards: permanent gold border */
.pers-admin-row { border-color: var(--wood-dark); }
.pers-admin-row:hover { border-color: var(--wood-light); }

/* Role cards: always-on inline editing */
.pers-role-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--wood-dark);
  border-radius: var(--radius-sm);
}
.pers-role-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pers-role-name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 700 15px/1.3 Inter, sans-serif;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pers-role-name-input:hover { border-color: var(--line-2); }
.pers-role-name-input:focus {
  border-color: var(--wood);
  background: var(--bg-1, #100b08);
}
.pers-role-card .pers-band-slider { margin: 4px 14px 0; }
.pers-role-card .pers-band-scale { margin: 0 6px; }

/* Steel button: match Add Employee's gold border */
.pers-btn-steel { border-color: var(--wood-dark); }

/* Inline notes pill on employee rows */
.pers-emp-card { flex-wrap: wrap; }
.pers-emp-note {
  position: relative;
  flex: 1 1 40%;
  min-width: 230px;
  display: block;
  cursor: text;
}
.pers-emp-note-label {
  position: absolute;
  top: 6px;
  left: 10px;
  font: 700 9px/1 Inter, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a7a58;
  opacity: 0.65;
  pointer-events: none;
}
.pers-emp-note-input {
  width: 100%;
  min-height: 58px;
  background: #f0e6cf;
  color: #2b2416;
  border: 1px solid #c9b98f;
  border-radius: var(--radius-sm);
  font: 13px/1.45 Inter, sans-serif;
  padding: 18px 10px 8px;
  resize: vertical;
  outline: none;
}
.pers-emp-note-input:focus { border-color: var(--wood-dark); }

/* Employee modal action buttons: equal heights, red delete + cancel */
#persEmpModal .modal-actions { align-items: stretch; }
#persEmpModal .modal-actions .btn-primary { margin-top: 0; }
.btn-danger {
  background: linear-gradient(180deg, #d97a6f 0%, #b8453a 50%, #8c2e25 100%);
  color: #fff2ef;
  border: 1px solid #6e2019;
  border-radius: var(--radius-sm);
  padding: 15px 20px;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
  box-shadow: 0 2px 10px rgba(184, 69, 58, 0.3);
}
.btn-danger:hover { filter: brightness(1.08); }
#persEmpModal .pers-emp-delete { color: #fff2ef; margin-right: auto; }
#persEmpModal .pers-btn-cancel {
  border-color: #8c3a32;
  color: #d98a8a;
  padding: 15px 20px;
  font-size: 13px;
}
.pers-photo-remove { color: #d98a8a; border-color: #6e2f2a; }
.pers-emp-main { flex: 1 1 46%; min-width: 260px; }

/* ==================================================================
   v40.7 — Personnel feedback round 3
   ================================================================== */

/* Department name: dialed back a notch (was 1.45rem) */
.pers-dept-name { font-size: 1.2rem; }

/* Employee rows: permanent gold border + ~50% more breathing room */
.pers-emp-card { border-color: var(--wood-dark); }
.pers-emp-card:hover { border-color: var(--wood-light); }
.pers-dept-body { gap: 12px; }

/* Employee name is the focus of the card (~50% bigger) */
.pers-emp-name {
  font-size: 1.3rem;
  letter-spacing: 0.005em;
}

/* Wage band: full company scale with the role band as a region */
.pers-emp-band-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
  border-radius: 3px;
  opacity: 0.85;
}
.pers-emp-band-track { position: relative; }

/* Role + station cluster: stacked, sits just left of the notes pill */
.pers-emp-rolecol {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 110px;
}

/* Rebalance the row now that the role cluster moved out of main */
.pers-emp-main { flex: 1 1 38%; min-width: 240px; }
.pers-emp-note { flex: 1 1 34%; }

/* --- Employee modal: wider card, condensed rows --- */
#persEmpModal .modal-card { max-width: 620px; }
.pers-emp-form-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.pers-emp-form-payrow { grid-template-columns: 0.6fr 1fr 1fr; }
@media (max-width: 560px) {
  .pers-emp-form-3col { grid-template-columns: 1fr; }
}

/* Employee paperwork section */
.pers-emp-files { margin-top: 4px; }
.pers-emp-files-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--wood-light);
  margin-bottom: 8px;
}
.pers-emp-filedrop { padding: 12px 14px; }
.pers-emp-filelist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* Delete + Save buttons: black borders */
#persEmpModal .modal-actions .btn-danger,
#persEmpModal .modal-actions .btn-primary { border-color: #000; }

/* ==================================================================
   v40.8 — Personnel feedback round 4
   ================================================================== */

/* Main-row wage figure: ~12% bigger; /hr unit unchanged */
.pers-emp-rate { font-size: 1.07rem; }

/* Role/station cluster hugs the left; notes pill fixed width */
.pers-emp-main { flex: 0 1 38%; }
.pers-emp-rolecol { margin-right: auto; }
.pers-emp-note { flex: 0 0 32%; min-width: 240px; }

/* Employee modal payrow: date box shrunk to match rate + status */
.pers-emp-form-payrow .field input,
.pers-emp-form-payrow .field select {
  height: 52px;
  padding-top: 0;
  padding-bottom: 0;
}

/* Departments & Roles admin: tighter role cards */
.pers-role-card { padding: 7px 12px; gap: 4px; }
.pers-role-card .pers-role-name-input { padding: 3px 8px; }

/* Inline notes pill: notes-tab handwriting font, a touch larger */
.pers-emp-note-input {
  font: 500 15px/1.35 'Architects Daughter', 'Bradley Hand', 'Segoe Script', cursive;
}

/* Department header rows: charcoal-to-black gradient, gold hairline,
   gold-gradient lettering (v40.9 — dialed back from parchment) */
.pers-dept-head {
  background: linear-gradient(180deg, #2a2620 0%, #1a1815 55%, #0b0b0b 100%);
  border-color: var(--wood-dark);
}
.pers-dept-head:hover { border-color: var(--wood-light); }

/* Employee paperwork dropzone: full width, a touch taller */
.pers-emp-filedrop {
  display: flex;
  width: 100%;
  max-width: none;
  justify-content: center;
  padding: 18px 16px;
}

/* ==================================================================
   v40.9 — Personnel feedback round 5
   ================================================================== */

/* Department headers: quiet charcoal-to-black gradient, gold hairline;
   the name keeps its gold-gradient glint */
.pers-dept-head {
  background: linear-gradient(180deg, #2e2a24 0%, #1c1a17 55%, #0f0e0c 100%);
  border-color: var(--wood-dark);
}
.pers-dept-head:hover { border-color: var(--wood-light); }
.pers-dept-name {
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 55%, var(--wood-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pers-dept-chevron { color: var(--wood); }
.pers-dept-count {
  background: rgba(212, 163, 104, 0.14);
  border-color: var(--wood-dark);
  color: var(--wood-light);
}

/* Wage bar: nudge right of the salary figure; fade the $15/$40 ends */
.pers-emp-band { margin-left: 8px; }
.pers-emp-band-min,
.pers-emp-band-max { opacity: 0.45; }

/* ==================================================================
   v41.0 — Parchment employee cards (full light-card inversion)
   NOTE: self-contained override block — delete this block to revert.
   ================================================================== */

/* The card: layered parchment with a lit top edge, floating on the dark bg */
.pers-emp-card {
  background:
    linear-gradient(180deg, #fff8e7 0%, #f5edd9 45%, #ecdfc2 100%);
  border: 1px solid #c8b27c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 2px 10px rgba(0, 0, 0, 0.38);
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.pers-emp-card:hover {
  border-color: #8a6a2a;
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 6px 18px rgba(0, 0, 0, 0.45);
}
.pers-emp-dragging {
  border-color: var(--gold);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

/* Grip + avatar tuned for light ground */
.pers-emp-grip { color: #a08a5c; }
.pers-emp-avatar { border-color: #8a6a2a; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }

/* Ink: espresso name, warm secondary text */
.pers-emp-name { color: #2a1f10; }
.pers-emp-station { color: #7a6747; }
.pers-emp-increase { color: #7a6747; }

/* Status pills in dark ink */
.pers-emp-status { border-color: #c8b27c; color: #7a6747; background: rgba(255, 255, 255, 0.35); }
.pers-emp-status.is-on_leave,
.pers-emp-status.is-on-leave { border-color: #a87c14; color: #8a6208; }
.pers-emp-status.is-terminated,
.pers-emp-status.is-resigned { border-color: #9a2828; color: #8c2020; }

/* Role pill: bronze on parchment */
.pers-emp-role {
  background: rgba(138, 106, 42, 0.12);
  border-color: #b8902f;
  color: #5c4517;
}

/* Wage figure: deep bronze so it pops off the cream */
.pers-emp-rate { color: #6e4f14; }
.pers-emp-rate-unit { color: #9a8760; }

/* Wage band re-inked for light ground */
.pers-emp-band-min,
.pers-emp-band-max { color: #7a6747; }
.pers-emp-band-track { background: #d8c79e; }
.pers-emp-band-region {
  background: linear-gradient(180deg, #b8902f 0%, #8a6a2a 100%);
  opacity: 1;
}
.pers-emp-band-marker {
  border-color: #fff8e7;
  box-shadow: 0 0 0 2px rgba(138, 106, 42, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
}
.pers-emp-band-marker.is-over {
  background: #3f9a4e;
  box-shadow: 0 0 0 2px rgba(63, 154, 78, 0.35), 0 1px 4px rgba(0, 0, 0, 0.3);
}
.pers-emp-band-marker.is-under {
  background: #b83a3a;
  box-shadow: 0 0 0 2px rgba(184, 58, 58, 0.35), 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Notes: inset writing panel so it reads as its own field on parchment */
.pers-emp-note-label { color: #8a6a2a; opacity: 0.8; }
.pers-emp-note-input {
  background: #efe4c8;
  border: 1px solid #c8b27c;
  box-shadow: inset 0 1px 4px rgba(107, 84, 40, 0.18);
  color: #2a1f10;
}
.pers-emp-note-input:focus {
  border-color: #8a6a2a;
  background: #f5edd9;
}

/* ==================================================================
   v41.1 — Personnel round 6: colored role pills, wider notes,
   scale labels tucked under the bar ends
   ================================================================== */

/* Role pills: distinct border/text color per role (keyed by roster order) */
.pers-emp-role { background: rgba(255, 255, 255, 0.4); }
.pers-emp-role[data-role-color="0"] { border-color: #2e7d3a; color: #245c2d; }
.pers-emp-role[data-role-color="1"] { border-color: #2a5d9e; color: #1f477a; }
.pers-emp-role[data-role-color="2"] { border-color: #6d3fa0; color: #533078; }
.pers-emp-role[data-role-color="3"] { border-color: #b5541c; color: #8a3f13; }
.pers-emp-role[data-role-color="4"] { border-color: #1e7a72; color: #175c56; }
.pers-emp-role[data-role-color="5"] { border-color: #a02440; color: #7a1b30; }
.pers-emp-role[data-role-color="6"] { border-color: #4a5a70; color: #374557; }
.pers-emp-role[data-role-color="7"] { border-color: #6a6f1d; color: #4f5316; }

/* Notes pill: ~10% wider, growing left into the open space */
.pers-emp-note { flex: 0 0 35%; }

/* Scale labels: pinned just under each end of the track, no extra row height */
.pers-emp-band-min,
.pers-emp-band-max {
  position: absolute;
  top: 100%;
  margin-top: 2px;
  font-size: 0.62rem;
  line-height: 1;
  pointer-events: none;
}
.pers-emp-band-min { left: 0; }
.pers-emp-band-max { right: 0; }

/* ==================================================================
   v41.3 — Pay-rate marker heartbeat: breathing glow, color-matched
   ================================================================== */
.pers-emp-band-marker {
  --pulse: 138, 106, 42; /* bronze default */
  animation: persMarkerBreathe 2.6s ease-in-out infinite;
}
.pers-emp-band-marker.is-over  { --pulse: 63, 154, 78; }
.pers-emp-band-marker.is-under { --pulse: 184, 58, 58; }

@keyframes persMarkerBreathe {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(var(--pulse), 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(var(--pulse), 0.15), 0 0 10px 2px rgba(var(--pulse), 0.35), 0 1px 4px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%) scale(1.12);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pers-emp-band-marker { animation: none; }
}

/* ==================================================================
   v41.4 — Employee modal: $ prefix on pay rate; paperwork 3-up grid
   ================================================================== */
.pers-rate-wrap { position: relative; }
.pers-rate-dollar {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--wood);
  font-weight: 600;
  pointer-events: none;
}
.pers-rate-wrap input { width: 100%; padding-left: 26px; }

/* Paperwork list: three tiles per row to save vertical space */
#persEmpFileList {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
#persEmpFileList .files-row {
  margin: 0;
  padding: 8px 10px;
  gap: 8px;
  min-width: 0;
}
#persEmpFileList .files-row-meta { min-width: 0; }
#persEmpFileList .files-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  display: block;
}
#persEmpFileList .files-row-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 560px) {
  #persEmpFileList { grid-template-columns: repeat(2, 1fr); }
}

/* v41.7 — 3col rows shrink to fit the card; tame the iOS date input
   so Last Increase stays in its own column and the payrow sits balanced */
.pers-emp-form-3col .field { min-width: 0; }
.pers-emp-form-3col .field input,
.pers-emp-form-3col .field select { width: 100%; min-width: 0; }
.pers-emp-form-payrow input[type="date"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

/* ==================================================================
   v41.8 — Microsoft login button + no-access screen
   ================================================================== */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 12px;
  color: var(--ink-3, #6b7889);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line, rgba(255,255,255,0.12));
}
.login-ms-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line, rgba(255,255,255,0.14));
  border-radius: var(--radius-sm, 6px);
  color: var(--ink-1, #e8edf4);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.login-ms-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--wood, #d4a368); }
.login-ms-btn:disabled { opacity: 0.6; cursor: default; }

.noaccess-body { text-align: center; padding: 6px 4px 2px; }
.noaccess-title { margin: 0 0 10px; font-size: 1.25rem; color: var(--wood, #d4a368); }
.noaccess-text { margin: 0 0 18px; line-height: 1.55; color: var(--ink-2, #aab6c5); font-size: 0.95rem; }
.noaccess-text strong { color: var(--ink-1, #e8edf4); word-break: break-all; }
.noaccess-signout { width: 100%; }


/* ============ Nantucket Mill Co. additions ============ */
.login-brand-logo { display:block; width:min(300px, 80vw); height:auto; margin:0 auto 14px; }
.brand-logo { height:52px; filter:none; }
.mtg-detail-logo { height:56px; }
.fin-wrap { margin:-4px -4px 0; height:calc(100vh - 150px); min-height:600px; }
.fin-frame { width:100%; height:100%; border:0; display:block; background:#F5F0E6; border-radius:var(--radius-sm); }
@media (max-width: 768px) { .fin-wrap { height:calc(100vh - 128px); } }

/* ============ Checklist tab ============ */
.ck-toolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; margin:6px 0 18px; }
.ck-toolbar-actions { display:flex; align-items:center; gap:14px; }
.ck-count { color:var(--text-3); font-size:12px; letter-spacing:.08em; text-transform:uppercase; font-weight:600; }
.ck-add-section { margin-top:0; padding:10px 16px; font-size:11px; }
.ck-body { display:grid; gap:22px; }
/* parchment cards: dark text, deep gold accents */
.ck-section {
  --ck-ink:#1a1410; --ck-ink-2:#4a3826; --ck-mute:#8a7a62; --ck-gold:#8a6a2a; --ck-gold-2:#b8902f; --ck-line:#d8c79e; --ck-line-2:#c8b27c;
  background:#f5edd9;
  background-image:radial-gradient(ellipse at top left, rgba(255,248,222,.9), transparent 55%), linear-gradient(180deg, #f8f1e0 0%, #f0e4c9 60%, #e9dbbd 100%);
  border:1px solid var(--ck-line-2); border-radius:var(--radius); padding:18px 20px 14px; color:var(--ck-ink);
  box-shadow:0 6px 24px rgba(0,0,0,.35);
}
.ck-section-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid var(--ck-line-2); }
.ck-section-title { margin:0; font-size:15px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--ck-ink); cursor:text; }
.ck-section-count { color:var(--ck-gold); font-size:12px; font-weight:700; font-variant-numeric:tabular-nums; }
.ck-cat { font-size:10px; font-weight:800; letter-spacing:.14em; text-transform:uppercase; color:var(--ck-gold); margin:12px 0 4px 34px; }
.ck-cat:first-child { margin-top:2px; }
.ck-item { display:flex; align-items:flex-start; gap:10px; padding:8px 6px 8px 2px; border-bottom:1px dotted var(--ck-line-2); }
.ck-item:last-child { border-bottom:0; }
.ck-grip { color:var(--ck-mute); cursor:grab; user-select:none; font-size:14px; line-height:22px; width:16px; text-align:center; letter-spacing:-3px; }
.ck-check { position:relative; width:20px; height:20px; flex:0 0 20px; margin-top:1px; }
.ck-check input { position:absolute; inset:0; opacity:0; margin:0; cursor:pointer; }
.ck-check span { position:absolute; inset:0; border:1.5px solid var(--ck-gold); background:#fff8e7; }
.ck-check input:checked + span { background:var(--ck-gold); border-color:var(--ck-gold); }
.ck-check input:checked + span::after { content:''; position:absolute; left:6px; top:2px; width:5px; height:10px; border:solid #fff8e7; border-width:0 2px 2px 0; transform:rotate(45deg); }
.ck-text { flex:1; min-width:0; }
.ck-title { font-size:14px; font-weight:600; line-height:1.4; cursor:text; color:var(--ck-ink); }
.ck-item.is-done .ck-title { color:var(--ck-mute); font-weight:500; text-decoration:line-through; }
.ck-title-input { width:100%; background:#fff8e7; border:1px solid var(--ck-gold); color:var(--ck-ink); font:600 14px/1.4 'Inter', sans-serif; padding:3px 6px; outline:0; border-radius:0; }
.ck-notes { font-family:'Architects Daughter', 'Caveat', cursive; font-size:14px; color:var(--ck-ink-2); margin-top:2px; cursor:text; white-space:pre-wrap; }
.ck-note-add { background:none; border:0; color:var(--ck-gold); font:700 10px/1 'Inter', sans-serif; letter-spacing:.1em; text-transform:uppercase; padding:4px 0 0; cursor:pointer; opacity:0; transition:opacity .15s; }
.ck-item:hover .ck-note-add { opacity:1; }
.ck-del { background:none; border:0; color:var(--ck-mute); font-size:18px; line-height:1; cursor:pointer; padding:2px 6px; opacity:.5; }
.ck-del:hover { color:#9a2828; opacity:1; }
.ck-add { margin-top:10px; background:transparent; border:1px solid var(--ck-line-2); color:var(--ck-gold); font:700 11px/1 'Inter', sans-serif; letter-spacing:.08em; text-transform:uppercase; padding:8px 12px; cursor:pointer; border-radius:0; }
.ck-add:hover { border-color:var(--ck-gold); background:rgba(184,144,47,.10); }
.ck-empty { color:var(--text-3); font-style:italic; padding:10px 0; }
.ck-empty-sec { color:var(--ck-mute); font-style:italic; padding:10px 0; }
@media (max-width: 640px) { .ck-toolbar { flex-direction:column; align-items:flex-start; } .ck-cat { margin-left:0; } .ck-note-add { opacity:1; } }

/* Files tab thumbnails */
.files-row-icon-pdf { position: relative; background: #fff; }
.files-row-icon-photo { background: rgba(255,255,255,0.04); }
.files-row-icon-pdf img { object-fit: contain; }
.files-row-pdf-tag { position: absolute; right: 0; bottom: 0; font: 800 8px/1 'Inter', sans-serif; letter-spacing: .08em; color: #fff8e7; background: #9a2828; padding: 3px 4px; }
