@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaLight.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaBook.otf") format("opentype");
  font-weight: 350;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaRegular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaRegularItalic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaBold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaBoldItalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaXBold.otf") format("opentype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nexa";
  src: url("/fonts/NexaHeavy.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary: #0f1b2d;
  --primary-mid: #1a365d;
  --primary-light: #2b6cb0;
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --red: #ef4444;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-mid: #475569;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family:
    "Nexa",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Navigation ─── */
.navbar {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-mid) 100%
  );
  color: white;
  box-shadow: 0 4px 20px rgba(15, 27, 45, 0.25);
  position: sticky;
  top: 0;
  z-index: 10000;
}

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 2.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

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

.navbar-logo {
  height: 50px;
  width: auto;
  opacity: 0.95;
  transition: opacity 0.2s;
}

.navbar-brand:hover .navbar-logo {
  opacity: 1;
}

.navbar-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-decoration: none;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  pointer-events: auto;
  line-height: 1;
}

.navbar-title-accent {
  color: #4a7c59;
}

.nav-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2.5rem;
  background: rgba(0, 0, 0, 0.12);
  overflow: visible;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  flex-shrink: 0;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  padding: 0.7rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-links a svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-links a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.nav-links a:hover svg {
  opacity: 1;
}

.nav-links a.active {
  color: white;
  border-bottom-color: var(--accent);
}

.nav-links a.active svg {
  opacity: 1;
}

/* ─── Admin Dropdown ─── */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-toggle {
  cursor: pointer;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border, #2a3a4a);
  border-radius: 8px;
  padding: 0.4rem 0;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  list-style: none;
  margin: 0;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu li {
  list-style: none;
}
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem !important;
  color: var(--text-dark, #1a1a2e);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: none !important;
  transition:
    background 0.15s,
    color 0.15s;
}
.nav-dropdown-menu a:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary, #0f1b2d);
}
.nav-dropdown-menu a.active {
  color: var(--accent);
  border-bottom: none !important;
}
.nav-dropdown-menu a svg {
  opacity: 0.6;
  flex-shrink: 0;
}
.nav-dropdown-menu a:hover svg,
.nav-dropdown-menu a.active svg {
  opacity: 1;
}
.nav-dropdown-section-label {
  padding: 0.4rem 1rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.nav-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
  padding: 0;
}

/* ─── Layout ─── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
}
.container-wide {
  max-width: 95%;
}
.container-full {
  max-width: calc(100% - 3rem);
}

/* ─── Page Header ─── */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.03em;
}

.page-header p {
  color: var(--text-light);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* ─── Hero Banner (Dashboard) ─── */
.hero-banner {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-mid) 50%,
    var(--primary-light) 100%
  );
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem 1.25rem;
  color: white;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(59, 130, 246, 0.2) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero-banner::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.15) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
}

.hero-logo-img {
  height: 72px;
  width: auto;
  filter: brightness(0) invert(1);
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.hero-banner h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.hero-banner h1 .title-rugged {
  color: #4a7c59;
}

.hero-banner h1 .title-portal {
  color: #ffffff;
}

.hero-banner p {
  opacity: 0.8;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ─── Cards ─── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card + .card {
  margin-top: 1.5rem;
}

.card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  background: linear-gradient(to bottom, #fafcff, #f8faff);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 1.75rem;
}

/* ─── Section Headings ─── */
.section-heading {
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.section-heading h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.section-heading p {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-top: 0.1rem;
}

/* ─── Dashboard Grid ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.dashboard-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.dashboard-grid.grid-1 {
  grid-template-columns: 1fr;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E")
    center/contain no-repeat;
  opacity: 0;
  transition:
    opacity 0.25s,
    transform 0.25s;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--accent);
}

.stat-card:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(3px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.holidays {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #2563eb;
}
.stat-icon.incidents {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
}
.stat-icon.policies {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #059669;
}
.stat-icon.knowledge {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #4338ca;
}

.stat-icon.expenses {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}

.stat-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.stat-info p {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ─── Forms ─── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.35rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

.form-group label .required {
  color: var(--red);
  margin-left: 0.1rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  background: white;
  color: var(--text);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Per Diem locked field state */
.perdiem-locked {
  background: var(--bg-subtle, #f8fafc) !important;
  color: var(--text-mid) !important;
  cursor: not-allowed !important;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.75rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

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

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: 0.75rem;
}

/* ─── Alerts ─── */
.alert {
  padding: 1rem 1.35rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.alert-success {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-success::before {
  content: "";
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23059669' viewBox='0 0 16 16'%3E%3Cpath d='M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z'/%3E%3C/svg%3E")
    center/contain no-repeat;
  flex-shrink: 0;
}

/* ─── Tables ─── */
.table-wrapper {
  overflow-x: auto;
  scrollbar-width: none;
}

.table-wrapper:hover {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}

.table-wrapper::-webkit-scrollbar {
  height: 6px;
  display: none;
}

.table-wrapper:hover::-webkit-scrollbar {
  display: block;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table tbody tr {
  white-space: nowrap;
}

th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  background: linear-gradient(to bottom, #fafcff, #f8faff);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
}

tr {
  transition: background 0.15s;
}

tr:hover td {
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 1.6rem;
  min-height: 1.4rem;
  text-align: center;
  line-height: 1;
  vertical-align: middle;
  box-sizing: border-box;
}

.badge-pending {
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}
.badge-approved {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-superadmin {
  background: linear-gradient(135deg, #1a365d, #2b6cb0);
  color: white;
  border: 1px solid #2b6cb0;
  font-weight: 700;
}
.badge-open {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.badge-resolved {
  background: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-synced {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.badge-declined {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}
.badge-cancelled {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}
.badge-closed {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.row-cancelled {
  opacity: 0.55;
}

.date-changed {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #d97706;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  cursor: help;
}

/* ─── File Upload ─── */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  transition:
    border-color 0.2s,
    background 0.2s;
  cursor: pointer;
  position: relative;
}

.file-upload-area:hover,
.file-upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.file-upload-area input[type="file"] {
  position: absolute;
  left: -9999px;
  opacity: 0;
}

.file-upload-text {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.file-upload-hint {
  font-size: 13px;
  color: var(--text-light);
}

.file-upload-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}

.file-item-folder {
  background: var(--accent-glow) !important;
  border: 1px solid var(--accent) !important;
  font-weight: 600;
}

.btn-browse {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-browse:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-browse-folder {
  background: #059669;
}

.btn-browse-folder:hover {
  background: #047857;
}

.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.file-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--text-mid);
}

/* ─── Upload Progress Bar ─── */
.upload-progress {
  display: none;
  margin-bottom: 12px;
}

.upload-progress-bar-track {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.upload-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.2s ease;
}

.upload-progress-bar-fill.upload-complete {
  background: #16a34a;
}

.upload-progress-bar-fill.upload-error {
  background: #dc2626;
}

.upload-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
}

.upload-progress-percent {
  font-weight: 600;
  color: var(--text);
}

.upload-progress-detail {
  color: var(--text-light);
}

/* ─── Attachment Links ─── */
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}

.attachment-link:hover {
  background: var(--accent-glow);
  text-decoration: underline;
}

.text-muted {
  color: var(--text-light);
}

/* ─── Clickable Table Rows ─── */
.clickable-row {
  cursor: pointer;
}
.clickable-row:hover td {
  background: #eef2ff;
}

/* ─── Back Link ─── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  transition: color 0.15s;
}
.back-link:hover {
  color: var(--primary-light);
}

/* ─── Detail Page ─── */
.detail-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.detail-rows {
  display: flex;
  flex-direction: column;
}

.detail-row {
  display: flex;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  width: 180px;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-light);
}

.detail-value {
  font-size: 0.9rem;
  color: var(--text);
}

.detail-text {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ─── Attachment Grid (Detail View) ─── */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.attachment-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
  display: flex;
  flex-direction: column;
}

.attachment-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.attachment-image img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.attachment-video video {
  width: 100%;
  display: block;
}

.attachment-file {
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.attachment-file-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.attachment-card-wrapper {
  display: flex;
  flex-direction: column;
}

.attachment-card-wrapper .attachment-card {
  flex: 1;
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 0 0 var(--radius) var(--radius);
  transition: background 0.2s;
}

.btn-download:hover {
  background: var(--primary-light);
}

.attachment-card-wrapper .attachment-card {
  border-radius: var(--radius) var(--radius) 0 0;
}

.attachment-ext {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.attachment-name {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border-light);
}

.attachment-file .attachment-name {
  border-top: none;
  padding: 0;
}

.attachment-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ─── Folder display ─── */
.attachment-folder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.attachment-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.attachment-folder-header:hover {
  background: var(--hover);
}

.attachment-folder-header svg {
  color: var(--accent);
  flex-shrink: 0;
}

.folder-chevron {
  transition: transform 0.2s ease;
}

.folder-open > .attachment-folder-header .folder-chevron {
  transform: rotate(90deg);
}

.attachment-folder-files {
  display: none;
  flex-direction: column;
}

.folder-open > .attachment-folder-files {
  display: flex;
}

.folder-open > .attachment-folder-header {
  border-bottom: 1px solid var(--border);
}

.attachment-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-light);
}

.attachment-file-row:last-child {
  border-bottom: none;
}

.attachment-file-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  padding: 4px 0;
  transition: color 0.15s;
}

.attachment-file-link:hover {
  color: var(--accent);
}

.attachment-file-link svg {
  flex-shrink: 0;
  color: var(--text-light);
}

.btn-delete-file {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}

.btn-delete-file:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ─── Incident Detail Actions ─── */
.inline-form {
  display: inline-block;
  margin-left: 0.75rem;
}

.btn-close-incident {
  font-size: 0.75rem;
  padding: 0.3rem 0.85rem;
  background: #374151;
  color: white;
  border-radius: 6px;
}

.btn-close-incident:hover {
  background: #1f2937;
}

.btn-reopen-incident {
  font-size: 0.75rem;
  padding: 0.3rem 0.85rem;
  background: var(--warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.btn-reopen-incident:hover {
  background: #fde68a;
}

.add-files-form {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
}

.add-files-form .form-actions {
  justify-content: flex-start;
  padding-top: 0.75rem;
}

.btn-upload {
  font-size: 0.82rem;
  padding: 0.55rem 1.25rem;
}

/* ─── Email Report ─── */
.email-report-desc {
  font-size: 0.88rem;
  color: var(--text-mid);
  margin-bottom: 1rem;
}

.email-report-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.email-input {
  flex: 1;
  min-width: 220px;
  padding: 0.65rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.email-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-send-email {
  font-size: 0.85rem;
  padding: 0.65rem 1.25rem;
  white-space: nowrap;
}

.alert-error {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ─── Policies ─── */
.policy-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.policy-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.policy-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, var(--accent), #6366f1);
  border-radius: 4px 0 0 4px;
  opacity: 0;
  transition: opacity 0.25s;
}

.policy-item:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.policy-item:hover::before {
  opacity: 1;
}

.policy-item h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}

.policy-item p {
  font-size: 0.9rem;
  color: var(--text-mid);
  line-height: 1.65;
}

.policy-meta {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
}

/* Policy document sections */
.policy-doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.policy-doc-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.policy-doc-row:hover {
  border-color: var(--border);
}

.policy-doc-info {
  flex: 1;
}

.policy-doc-info h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.policy-doc-entry {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.policy-doc-entry:last-of-type {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.policy-doc-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.policy-doc-header .policy-doc-info {
  flex: 1;
}

.policy-doc-header .policy-doc-info h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.policy-doc-files {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.policy-file-viewer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.policy-file-compact {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4rem 0.625rem;
  background: var(--border-light);
}

.policy-file-thumb {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  overflow: hidden;
}
.policy-file-thumb svg {
  width: 18px;
  height: 18px;
}

.policy-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.policy-file-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
}

.policy-file-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.btn-view-file,
.btn-download-file {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.2s;
}

.btn-view-file {
  background: var(--accent);
  color: white;
}

.btn-view-file:hover {
  background: var(--primary-light);
}

.btn-download-file {
  background: var(--primary);
  color: white;
}

.btn-download-file:hover {
  background: var(--primary-mid);
}

.btn-delete-file {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 5px;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  background: #dc2626;
  color: #fff;
  white-space: nowrap;
  transition:
    background 0.2s,
    color 0.2s;
}

.btn-delete-file:hover {
  background: #b91c1c;
  color: #000;
}

.inline-delete-form {
  display: flex;
  margin: 0;
  padding: 0;
}

.policy-file-name {
  font-size: 0.78rem;
  color: var(--text-light);
}

/* Compact section heading on the policies page */
.policy-section-heading {
  margin-bottom: 0.4rem;
  margin-top: 0.75rem;
}
.policy-section-heading h2 {
  font-size: 1rem;
  margin-bottom: 0;
}
.policy-section-heading p {
  font-size: 0.78rem;
  margin-top: 0.1rem;
}
.policy-section-card {
  margin-bottom: 0.5rem;
}

.upload-toggle {
  margin-top: 0.5rem;
}

.upload-toggle summary {
  cursor: pointer;
  list-style: none;
}

.upload-toggle summary::-webkit-details-marker {
  display: none;
}

/* ─── Knowledge Base ─── */
.kb-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

a.kb-category {
  text-decoration: none;
  color: inherit;
}

.kb-category {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all 0.25s ease;
  cursor: pointer;
}

.kb-category:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.kb-category-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.kb-category-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.01em;
}

.kb-category-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kb-category-icon svg {
  width: 22px;
  height: 22px;
}

.kb-category-icon.equipment {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
}

.kb-category-icon.workflows {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #2563eb;
}

.kb-category-icon.venues {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #059669;
}

.kb-category-icon.training {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #4338ca;
}

.kb-category-icon.piero-docs {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  color: #be185d;
}

.kb-category-icon.piero-software {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #b45309;
}

.kb-category-icon.piero-presets {
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  color: #4338ca;
}

.kb-category-icon.piero-touchapp {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #059669;
}

/* Download list */
.download-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.download-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition:
    background 0.15s,
    border-color 0.15s;
}

.download-item:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.download-item svg {
  flex-shrink: 0;
  color: var(--accent);
}

.download-name {
  flex: 1;
  font-weight: 500;
  word-break: break-all;
}

.download-size {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

.stat-icon.piero {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  color: #be185d;
}
.stat-icon.notes {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
}
.stat-icon.mileage {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: #0369a1;
}

.kb-category-desc {
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.kb-empty {
  font-size: 0.82rem;
  color: var(--text-light);
  font-style: italic;
  padding: 0.75rem 1rem;
  background: var(--border-light);
  border-radius: var(--radius);
  text-align: center;
}

.kb-count {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 500;
}

/* KB Article List */
.kb-article-list {
  display: flex;
  flex-direction: column;
}

.kb-article-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.kb-article-row:last-child {
  border-bottom: none;
}
.kb-article-row:hover {
  background: #f8fafc;
}

.kb-article-info {
  flex: 1;
  min-width: 0;
}

.kb-article-info h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.kb-article-meta {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}

.kb-article-preview {
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.5;
}

.kb-article-arrow {
  flex-shrink: 0;
  color: var(--text-light);
  margin-left: 1rem;
  transition: transform 0.2s;
}

.kb-article-row:hover .kb-article-arrow {
  transform: translateX(3px);
  color: var(--accent);
}

/* Compact KB list — thinner rows, no preview body */
.kb-article-list--compact .kb-article-row {
  padding: 0.4rem 0.875rem;
}
.kb-article-list--compact .kb-article-info h3 {
  font-size: 0.875rem;
  margin-bottom: 0.1rem;
}
.kb-article-list--compact .kb-article-meta {
  font-size: 0.75rem;
  margin-bottom: 0;
}

/* Compact incident table — thinner rows */
.incident-table--compact th,
.incident-table--compact td {
  padding: 0.4rem 0.625rem;
  font-size: 0.8125rem;
}
.incident-table--compact .badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
}

/* KB Article Content */
.kb-article-content {
  font-size: 0.92rem;
  color: var(--text-mid);
  line-height: 1.8;
  white-space: pre-wrap;
}

/* KB Edit Form */
.kb-edit-form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.kb-edit-form .form-group {
  margin-bottom: 1rem;
}

.kb-edit-form .form-group input,
.kb-edit-form .form-group textarea {
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.kb-edit-form .form-group input:focus,
.kb-edit-form .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.card-header-actions {
  margin-left: auto;
}

.btn-edit-article {
  font-size: 0.75rem;
  padding: 0.3rem 0.85rem;
  background: var(--accent-glow);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-edit-article:hover {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #cbd5e1;
  margin-left: 0.5rem;
}

.btn-secondary:hover {
  background: #cbd5e1;
  color: #1e293b;
}

.btn-danger {
  background: var(--danger-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 0.82rem;
  padding: 0.55rem 1.25rem;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-info {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: white;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.btn-info:hover {
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.4);
  transform: translateY(-1px);
}

.btn-info:active {
  transform: translateY(0);
}

.btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: white;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn-warning:hover {
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.4);
  transform: translateY(-1px);
}

.btn-warning:active {
  transform: translateY(0);
}

.btn-purple {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn-purple:hover {
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.btn-purple:active {
  transform: translateY(0);
}

.kb-danger-zone {
  border-color: #fecaca;
}

.kb-danger-zone .card-body {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.75rem;
}

/* ─── Piero ─── */

.piero-doc-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.piero-doc-row .kb-article-info {
  flex: 1;
}

.piero-file-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.piero-file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.2s;
}

.piero-file-link:hover {
  background: var(--primary-light);
}

.piero-file-link .file-size {
  opacity: 0.7;
  font-weight: 400;
}

.piero-delete-form {
  flex-shrink: 0;
}

.btn-icon-delete {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text-light);
  transition:
    color 0.2s,
    border-color 0.2s;
  display: flex;
  align-items: center;
}

.btn-icon-delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Software releases */
.software-release-list {
  display: flex;
  flex-direction: column;
}

.software-release {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
}

.software-release:last-child {
  border-bottom: none;
}

.software-release-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.software-release-info h3 {
  font-size: 1rem;
  font-weight: 600;
}

.software-version {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.software-release-notes {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-mid);
  line-height: 1.6;
  white-space: pre-line;
  background: var(--border-light);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
}

.software-download-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.software-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background 0.2s;
}

.software-download-btn:hover {
  background: var(--primary-light);
}

.software-download-btn .file-size {
  opacity: 0.7;
  font-weight: 400;
}

/* ─── Footer ─── */
.site-footer {
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-logo {
  height: 72px;
  width: auto;
  opacity: 0.4;
}

.site-footer p {
  margin: 0;
}

/* ─── Ask Eve ─── */

.eve-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-mid) 100%
  );
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.5rem 1.25rem 0.5rem 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.eve-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.18),
    0 4px 10px rgba(0, 0, 0, 0.1);
}

.eve-fab img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  object-fit: cover;
}

.eve-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.eve-modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  z-index: 1001;
  overflow: hidden;
}

.eve-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.eve-modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.eve-modal-title h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.eve-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.eve-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  border-radius: var(--radius);
  transition:
    background 0.15s,
    color 0.15s;
}

.eve-close:hover {
  background: var(--border-light);
  color: var(--text);
}

.eve-chips-section {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.eve-chips-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.eve-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.eve-chip {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  color: var(--text-mid);
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
  line-height: 1.4;
}

.eve-chip:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.eve-chip-loading {
  cursor: default;
  color: var(--text-light);
}

.eve-chat {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 200px;
}

.eve-question-bubble {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 16px 16px 4px 16px;
  max-width: 80%;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.eve-answer-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  max-width: 90%;
}

.eve-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.eve-answer-bubble {
  background: var(--border-light);
  padding: 0.6rem 1rem;
  border-radius: 16px 16px 16px 4px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}

.eve-answer-bubble strong {
  font-weight: 600;
}

.eve-sources {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.35rem;
  padding-left: 0.25rem;
}

.eve-sources span {
  font-weight: 600;
}

.eve-sources a {
  color: var(--accent);
  text-decoration: none;
}

.eve-sources a:hover {
  text-decoration: underline;
}

.eve-source-external {
  color: var(--accent);
  text-decoration: none;
}

.eve-source-external:hover {
  text-decoration: underline;
}

.eve-source-host {
  color: var(--text-light);
  font-size: 0.72rem;
}

.eve-ext-icon {
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
  opacity: 0.65;
  position: relative;
  top: -1px;
}

.eve-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.eve-input-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.eve-input-row input:focus {
  border-color: var(--accent);
}

.eve-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.eve-send:hover {
  background: var(--primary-light);
}

/* Eve thinking animation */
.eve-thinking .eve-thinking-text {
  color: var(--text-light);
  font-style: italic;
  font-size: 0.85rem;
}

.eve-avatar-thinking {
  animation: evePulse 1.5s ease-in-out infinite;
}

@keyframes evePulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 16px 4px rgba(59, 130, 246, 0.35);
  }
}

.eve-error {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ─── Hamburger Menu ─── */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: 12px;
  flex-shrink: 0;
}

.navbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.navbar-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 10000;
  display: none;
  animation: navbar-fade-in 0.15s ease;
}

.navbar-mobile-overlay.active {
  display: block;
}

@keyframes navbar-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.navbar-mobile {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  height: 100%;
  background: var(--primary);
  padding: 20px 0;
  overflow-y: auto;
  animation: navbar-slide-in 0.2s ease;
}

@keyframes navbar-slide-in {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.navbar-mobile__close {
  font-size: 32px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  padding: 0 20px 20px;
  text-align: right;
  transition: color 0.15s;
}

.navbar-mobile__close:hover {
  color: #fff;
}

.navbar-mobile__section {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-mobile__section:last-child {
  border-bottom: none;
}

.navbar-mobile__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.35);
  padding: 4px 20px 8px;
}

.navbar-mobile__link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  transition:
    background 0.1s,
    color 0.1s;
}

.navbar-mobile__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.navbar-mobile__link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.navbar-mobile__link svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* ─── Responsive ─── */
/* Half-width viewport (e.g., browser at 50% screen width) */
@media (max-width: 1200px) {
  /* Hide desktop nav, show hamburger */
  .nav-bottom {
    display: none;
  }

  /* Keep user dropdown visible at half-width */
  .nav-user {
    display: flex !important;
    margin-left: auto;
    gap: 0.5rem;
  }

  .navbar-hamburger {
    display: flex;
    margin-left: 0;
  }

  .navbar-title {
    font-size: 1.65rem;
  }

  /* Adjust nav-top to use flexbox for proper alignment */
  .nav-top {
    display: flex;
    align-items: center;
    gap: 1rem;
  }
}

@media (max-width: 768px) {
  .nav-top {
    padding: 0.75rem 1rem;
  }
  .nav-bottom {
    padding: 0 1rem;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: visible;
  }
  .brand-divider,
  .brand-portal {
    display: none;
  }
  .navbar-logo {
    height: 36px;
  }
  .nav-links a {
    padding: 0.55rem 0.75rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }
  .nav-links a svg {
    display: none;
  }
  .nav-dropdown-toggle svg {
    display: inline !important;
  }
  .nav-dropdown-toggle svg:first-of-type {
    display: none !important;
  }
  .nav-dropdown-menu {
    right: auto;
    left: 0;
  }
  .nav-user {
    font-size: 0.75rem;
    gap: 0.5rem;
  }
  .nav-logout {
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
  }
  .container {
    padding: 1.5rem 1rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid,
  .dashboard-grid.grid-2 {
    grid-template-columns: 1fr;
  }
  .kb-grid {
    grid-template-columns: 1fr;
  }
  .hero-banner {
    padding: 2rem 1.5rem;
  }
  .hero-logo-img {
    height: 96px;
  }
  .hero-banner h1 {
    font-size: 1.5rem;
  }
  .eve-modal {
    max-height: calc(100vh - 2rem);
    max-width: none;
  }
  .eve-fab {
    bottom: 1rem;
    right: 1rem;
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    font-size: 0.8rem;
  }
  .eve-fab img {
    width: 38px;
    height: 38px;
  }
  .eve-chips-section {
    padding: 0.6rem 1rem;
  }
  .eve-chip {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
  }
  .eve-chat {
    padding: 0.75rem;
    min-height: 150px;
  }
  .eve-input-row {
    padding: 0.6rem 0.75rem;
  }
}

/* ─── Login Page ─── */
.login-page {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-mid) 60%,
    var(--primary-light) 100%
  );
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@media (max-width: 640px) {
  .login-page {
    align-items: flex-start;
    padding: 2rem 1rem;
  }
  .login-logo {
    height: 80px;
    margin-bottom: 0.75rem;
  }
  .login-title {
    font-size: 1.8rem;
  }
  .login-branding {
    margin-bottom: 1.25rem;
  }
  .login-container {
    padding: 1.75rem 1.5rem;
  }
}

.login-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-branding {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 840px;
  max-width: 90vw;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
}

.login-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.login-container {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2.5rem;
  width: 100%;
  text-align: center;
}

.login-heading {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-form {
  text-align: left;
}

.login-field {
  margin-bottom: 1.25rem;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.login-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  background: var(--bg);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-btn {
  width: 100%;
  padding: 0.85rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-mid) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    opacity 0.2s,
    transform 0.1s;
  margin-top: 0.5rem;
}

.login-btn:hover {
  opacity: 0.9;
}

.login-btn:active {
  transform: scale(0.98);
}

/* ─── Nav User Area ─── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  white-space: nowrap;
}

.nav-user-dropdown {
  position: relative;
}

.nav-user-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  transition:
    background 0.15s,
    color 0.15s;
  cursor: pointer;
  border-bottom: none !important;
}

.nav-user-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: white;
}

.nav-user-toggle svg:first-of-type {
  opacity: 0.7;
}

.nav-user-toggle:hover svg:first-of-type {
  opacity: 1;
}

.nav-user-name {
  font-weight: 500;
}

.nav-logout {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-logout:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

/* ─── View As Mode ─── */
.view-as-active-bar {
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.view-as-active-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #92400e;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-exit-view-as {
  padding: 0.3rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-exit-view-as:hover {
  background: #b91c1c;
}

/* ─── Web Links (Knowledge Base) ─── */
.weblink-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.weblink-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.weblink-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.weblink-row input[type="url"] {
  flex: 2;
  min-width: 0;
}

.btn-remove-weblink {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.btn-remove-weblink:hover {
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-add-weblink {
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
}

.kb-weblinks {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.kb-weblinks h4 {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.kb-weblink-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--accent);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
  transition: background 0.2s;
}

.kb-weblink-btn:hover {
  background: var(--primary-light);
}

/* ─── Admin Styles ─── */
.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 0.9rem;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-mid);
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--border);
  color: var(--text);
}

.btn-small.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.btn-small.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
}

.btn-small.btn-warning {
  background: #f59e0b;
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.btn-small.btn-warning:hover {
  background: #d97706;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45);
}

.btn-small-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-small-danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.recon-dismiss-btn {
  color: #9ca3af;
  border-color: #e5e7eb;
  font-size: 0.6875rem;
  padding: 1px 6px;
  background: transparent;
}
.recon-dismiss-btn:hover {
  color: #dc2626;
  border-color: #fca5a5;
  background: #fef2f2;
}

.inline-form {
  display: inline;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.log-filter-input {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: var(--bg);
}

.log-filter-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Permissions ─── */
.permissions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-top: 0.25rem;
}

.perm-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  font-weight: 400;
}

.perm-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

.perm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.perm-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
}

.perm-on {
  background: var(--success-bg);
  color: var(--success);
}

.perm-off {
  background: var(--border-light);
  color: var(--text-light);
  text-decoration: line-through;
}

.perm-all {
  background: var(--accent-glow);
  color: var(--accent);
}

.perm-edit-form {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.perm-edit-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

/* ─── Expenses ─── */
.expense-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.expense-tab {
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  color: var(--text-mid);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.expense-tab:hover {
  color: var(--text);
}
.expense-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.expense-actions {
  white-space: nowrap;
}
.expense-actions .decline-form {
  white-space: normal;
}
.expense-desc-row td {
  padding-top: 0 !important;
}

.page-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.25rem;
}

.receipt-capture-area {
  text-align: center;
}

.receipt-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.receipt-preview-container {
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f8fafc;
}

.receipt-preview-container canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Reconciliation UI ── */
.recon-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.recon-stat-card {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.recon-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.recon-stat-info {
  display: flex;
  flex-direction: column;
}

.recon-stat-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.recon-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.recon-stat-amount {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 2px;
}

.recon-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.recon-table th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mid);
  border-bottom: 2px solid var(--border);
}
/* Data-grid pattern for the recon + expense tab tables. The wrapper is a
   bounded scroll area: horizontal AND vertical scroll happen INSIDE it, never
   on the page. The thead pins to the top of the wrapper, so column headers
   stay visible while rows scroll under them. Filters, pagination, and the
   rest of the page chrome stay put above and below the wrapper.
   max-height: a viewport-relative cap that leaves room for navbar + tab bar
   + filter/summary area + pagination footer. Tune if a layout grows taller. */
.recon-table-card {
  overflow: hidden;
}
.recon-sticky-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}
.recon-sticky-wrap .recon-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card, #ffffff);
  /* border-bottom can drop out when a cell is sticky on some engines — back
     it with an inset shadow so the divider is always drawn. */
  box-shadow: inset 0 -2px 0 var(--border);
}

.table-wrapper.expense-sticky-wrap {
  overflow: auto;
  max-height: calc(100vh - 260px);
}
/* position: sticky on <th> is silently no-op'd by border-collapse: collapse
   in Chrome/Safari. The base `table { border-collapse: collapse }` rule
   (line ~739) inherits down, so expense-tab tables need separate spacing
   restored for sticky to anchor. border-spacing: 0 keeps the visual identical
   to collapse mode. */
.expense-sticky-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}
.expense-sticky-wrap table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card, #ffffff);
  box-shadow: inset 0 -2px 0 var(--border);
}
.recon-table td {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border-light, #f0f0f0);
}
.recon-match-detail {
  display: block;
  font-size: 0.7rem;
  color: var(--text-mid);
  margin-top: 2px;
}
.recon-expense-link {
  color: var(--primary, #3b82f6);
  text-decoration: none;
  display: block;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.recon-expense-link:hover {
  background: var(--primary-bg, #eff6ff);
  color: var(--accent, #3b82f6);
  text-decoration: underline;
}
.recon-expense-link:hover .recon-match-detail {
  color: var(--accent, #3b82f6);
}

.recon-badge-matched {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}

.recon-badge-suggested {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}

.recon-badge-unmatched {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #fee2e2;
  color: #991b1b;
}

.recon-badge-orphan {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #6b7280;
}

.recon-badge-conf-high {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}

.recon-badge-conf-medium {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
}

.recon-badge-conf-low {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #fee2e2;
  color: #991b1b;
}

.recon-badge-conf-manual {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
}

.recon-row-matched {
  background: rgba(34, 197, 94, 0.06);
}
.recon-row-suggested {
  background: rgba(245, 158, 11, 0.06);
}
.recon-row-unmatched {
  background: rgba(239, 68, 68, 0.06);
}
.recon-row-orphan {
  background: rgba(107, 114, 128, 0.06);
}

.recon-candidate-list {
  max-height: 400px;
  overflow-y: auto;
}

.recon-candidate-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
  transition: background 0.15s;
}

.recon-candidate-item:last-child {
  border-bottom: none;
}

.recon-candidate-item:hover {
  background: rgba(59, 130, 246, 0.04);
}

.recon-candidate-info {
  flex: 1;
  min-width: 0;
}

/* Recon filter section spacing */
.recon-filters {
  margin-bottom: 1.25rem;
}

/* Recon section divider */
.recon-section-gap {
  margin-bottom: 1.25rem;
}

/* Match modal overlay (used by both synced and reconciliation tabs) */
.qb-error-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.qb-error-modal {
  background: var(--card, #fff);
  border-radius: var(--radius-lg, 12px);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border, #e5e7eb);
}
.qb-error-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.qb-error-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text, #111);
}
.qb-error-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light, #6b7280);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  line-height: 1;
  transition:
    color 0.2s,
    background 0.2s;
}
.qb-error-modal-close:hover {
  color: var(--text, #111);
  background: var(--border-light, #f3f4f6);
}
.qb-error-modal-body {
  padding: 1.25rem;
}
.qb-error-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* Professional pagination */
.recon-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-light, #f0f0f0);
}
.recon-pagination-info {
  font-size: 0.8125rem;
  color: var(--text-mid);
  margin-right: auto;
}
.recon-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--card, #fff);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.recon-page-btn:hover {
  background: var(--bg, #f9fafb);
  border-color: var(--primary, #3b82f6);
  color: var(--primary, #3b82f6);
}
.recon-page-btn.active {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: #fff;
  font-weight: 600;
}
.recon-page-btn.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}
.recon-page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  font-size: 0.8125rem;
  color: var(--text-mid);
}

@media (max-width: 768px) {
  .recon-summary {
    flex-direction: column;
  }
  .recon-stat-card {
    min-width: 100%;
  }
  .recon-pagination-info {
    display: none;
  }
}

.receipt-crop-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

.receipt-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.receipt-gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #f8fafc;
}

.expense-report-table {
  font-size: 0.82rem;
}

.expense-report-table th,
.expense-report-table td {
  padding: 0.45rem 0.6rem;
}

.receipt-gallery-label {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: white;
  border-bottom: 1px solid var(--border);
}

.receipt-gallery-img {
  width: 50%;
  height: auto;
  display: block;
}

.report-filter-form .form-grid {
  align-items: flex-end;
}

.report-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.report-filter-bar select,
.report-filter-bar input[type="date"],
.report-filter-bar input[type="text"] {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-family: inherit;
}

.report-filter-bar select:focus,
.report-filter-bar input[type="date"]:focus,
.report-filter-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

@media (max-width: 768px) {
  .expense-tabs {
    overflow-x: auto;
  }
  .receipt-gallery {
    grid-template-columns: 1fr;
  }
}

/* ─── Notes ─── */
.notes-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.35rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.35rem;
}

.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.note-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.note-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-card-meta {
  font-size: 0.65rem;
  color: var(--text-light);
}

.note-card-badges {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.note-badge-important {
  color: #f59e0b;
  font-size: 0.75rem;
  line-height: 1;
}

.note-badge-shared {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.note-group-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.note-group-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.note-group-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.note-group-icon svg {
  width: 14px;
  height: 14px;
}

.note-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-group-count {
  font-size: 0.6rem;
  color: var(--text-light);
  flex-shrink: 0;
}

.colour-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.colour-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition:
    border-color 0.15s ease,
    transform 0.1s ease;
}

.colour-swatch:hover {
  transform: scale(1.1);
}

.colour-swatch.selected {
  border-color: var(--text);
  box-shadow:
    0 0 0 2px var(--card),
    0 0 0 4px var(--text-light);
}

/* ─── Notes v2 — Phase 1 redesign ─── */
.notes-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.notes-search-form {
  width: 100%;
}

.notes-search-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notes-search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.notes-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

.notes-search-input {
  width: 100%;
  padding: 0.4rem 0.65rem 0.4rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8125rem;
  background: var(--bg);
  color: var(--text);
}

.notes-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(74, 124, 89, 0.15);
}

.notes-important-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8125rem;
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
}

.notes-important-label {
  user-select: none;
}

.notes-sort-bar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.notes-sort-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.15rem;
}

.notes-sort-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-mid);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.notes-sort-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.notes-sort-pill.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.notes-section-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.4rem 0;
}

/* Group cards v2 */
.notes-group-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.note-group-card-v2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
}

.note-group-card-v2:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.note-group-card-v2-icon {
  flex-shrink: 0;
}
.note-group-card-v2-icon svg {
  width: 16px;
  height: 16px;
}

.note-group-card-v2-body {
  flex: 1;
  min-width: 0;
}

.note-group-card-v2-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-group-card-v2-meta {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 0.1rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Note cards v2 */
.notes-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.note-card-v2 {
  display: flex;
  flex-direction: column;
  padding: 0.55rem 0.7rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  gap: 0.25rem;
}

.note-card-v2:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.note-card-v2-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
}

.note-card-v2-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.note-card-v2-badges {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-shrink: 0;
}

.note-badge-pin {
  font-size: 0.7rem;
  line-height: 1;
}

.note-badge-important-v2 {
  color: #f59e0b;
  font-size: 0.75rem;
  line-height: 1;
}

.note-badge-shared-v2 {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.3;
}

.note-badge-checklist {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
  line-height: 1.3;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Tag filter bar */
.note-tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}
.note-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.note-tag-pill:hover {
  opacity: 0.85;
}
.note-tag-pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Tag chips on cards */
.note-card-v2-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.note-tag-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.4;
}

/* Tag selector on forms */
.note-tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.note-tag-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border: 1.5px solid;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.note-tag-option:hover {
  opacity: 0.8;
}
.note-tag-option input[type="checkbox"] {
  display: none;
}
.note-tag-option-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.note-tag-option.checked {
  color: #fff !important;
}
.note-tag-option.checked .note-tag-option-dot {
  background: #fff;
}

/* Template picker */
.note-template-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.note-template-btn {
  padding: 0.4rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}
.note-template-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.note-template-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Bulk action bar */
.note-bulk-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--navy, #1b2a4a);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Bulk checkbox on cards */
.note-bulk-cb {
  position: absolute;
  bottom: 0.4rem;
  right: 0.45rem;
  width: 14px;
  height: 14px;
  cursor: pointer;
  z-index: 2;
  accent-color: var(--primary);
  margin: 0;
}
.note-card-v2 {
  position: relative;
}

.note-card-v2-preview {
  font-size: 0.75rem;
  color: var(--text-mid);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.note-card-v2-footer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-light, var(--border));
}

.note-card-v2-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

.note-card-v2-time {
  font-size: 0.7rem;
  color: var(--text-light);
}

.notes-pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
}

.notes-page-info {
  font-size: 0.8125rem;
  color: var(--text-mid);
}

@media (max-width: 480px) {
  .notes-grid-v2 {
    grid-template-columns: 1fr;
  }
  .notes-group-grid-v2 {
    grid-template-columns: 1fr 1fr;
  }
  .notes-search-row {
    flex-direction: column;
    align-items: stretch;
  }
  .notes-sort-bar {
    justify-content: center;
  }
}

.note-stale-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: #92400e;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.note-stale-banner a {
  color: var(--accent);
  font-weight: 600;
}

.note-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text-mid);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.note-refresh-btn:hover {
  background: var(--bg);
}

/* Rich text editor */
.note-editor-toolbar {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg);
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
}

.note-editor-toolbar .toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.note-editor-toolbar .tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-width: 40px;
  height: 32px;
  padding: 0 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text-mid);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.note-editor-toolbar .tb-highlight {
  background: #fef08a;
  color: #92400e;
}

.note-editor-toolbar .tb-btn:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent);
  border-color: var(--accent);
}

.note-editor-toolbar .tb-btn.active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4) !important;
}

.note-editor-toolbar .tb-dropdown {
  height: 32px;
  min-width: 100px;
  padding: 0 1.5rem 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23475569' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
}

.note-editor-toolbar .tb-dropdown:hover {
  border-color: var(--accent);
}

.note-editor-toolbar .tb-dropdown:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.note-editor-toolbar .tb-btn-subtle {
  background: transparent;
  color: var(--text-mid, #64748b);
  border-color: transparent;
  font-size: 1.1rem;
  padding: 0.35rem 0.5rem;
}
.note-editor-toolbar .tb-btn-subtle:hover {
  background: var(--border-light, #f1f5f9);
  color: var(--text);
  border-color: var(--border);
}

.note-editor-toolbar .tb-shortcut-hint {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-light, #94a3b8);
  align-self: center;
  padding: 0.2rem 0.5rem;
  background: var(--border-light, #f1f5f9);
  border-radius: 4px;
  white-space: nowrap;
}

.note-draft-status {
  font-size: 0.75rem;
  color: var(--text-light, #94a3b8);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
  margin-right: auto;
}

.note-editor {
  min-height: 500px;
  padding: 1.5rem;
  border: 2px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.6;
  outline: none;
  background: #fff;
  color: var(--text);
  overflow-y: auto;
  max-height: 70vh;
  position: relative;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.03);
  word-wrap: break-word;
}

.note-editor[data-empty="true"]::before {
  content: attr(data-placeholder);
  color: var(--text-light, #94a3b8);
  pointer-events: none;
  position: absolute;
  font-size: 1.05rem;
}

.note-editor:focus {
  border-color: var(--accent);
  box-shadow:
    inset 0 2px 6px rgba(0, 0, 0, 0.03),
    0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* Safety net for old content with div/p wrappers */
.note-editor div:not(.note-todo),
.note-content div:not(.note-todo) {
  display: contents;
}

.note-editor p,
.note-content p {
  margin: 0;
  padding: 0;
}

.note-editor ul,
.note-editor ol,
.note-content ul,
.note-content ol {
  margin: 0.5rem 0 0.5rem 2rem;
  padding-left: 2rem;
  list-style-position: inside;
}

.note-editor li,
.note-content li {
  padding: 0.2rem 0;
  margin-bottom: 0.25rem;
}

.note-editor mark,
.note-content mark {
  background: #fef08a;
  padding: 0.05em 0.15em;
  border-radius: 2px;
}

.note-todo {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 1.25rem 0.5rem 0;
  margin: 0.35rem 0 0.35rem 3rem;
  min-height: 2rem;
}

.note-todo input[type="checkbox"] {
  margin-top: 0.35rem;
  cursor: pointer;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.note-todo.checked span {
  text-decoration: line-through;
  opacity: 0.6;
}

.note-todo .todo-delete {
  margin-left: auto;
  background: none;
  border: 1px solid #e2e8f0;
  color: #ef4444;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.1rem 0.5rem;
  line-height: 1;
  border-radius: 4px;
  flex-shrink: 0;
  -webkit-user-select: none;
  user-select: none;
}

.note-todo .todo-delete:hover {
  color: #fff;
  background: #ef4444;
  border-color: #ef4444;
}

/* Read-only content display */
.note-content {
  line-height: 1.6;
  font-size: 0.95rem;
  padding: 1rem 0;
  word-wrap: break-word;
}

.note-content a,
.note-editor a {
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
  word-break: break-all;
}

.note-content a:hover,
.note-editor a:hover {
  color: #1d4ed8;
}

.note-content .note-todo input[type="checkbox"] {
  cursor: pointer;
}

/* ── Note tables ───────────────────────────────────────────────── */
.note-table,
.note-editor table,
.note-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.875rem;
}
.note-table th,
.note-editor table th,
.note-content table th {
  background: #f1f5f9;
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
}
.note-table td,
.note-editor table td,
.note-content table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1;
  vertical-align: top;
}
.note-table tbody tr:nth-child(even) td,
.note-editor table tbody tr:nth-child(even) td,
.note-content table tbody tr:nth-child(even) td {
  background: #f8fafc;
}
.note-editor table td:focus,
.note-editor table th:focus {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

@media (prefers-color-scheme: dark) {
  .note-card {
    background: var(--card);
    border-color: var(--border);
  }
  .note-card-title {
    color: var(--text);
  }
  .note-group-card {
    background: var(--card);
  }
  .note-group-title {
    color: var(--text);
  }
  .colour-swatch.selected {
    border-color: #f1f5f9;
    box-shadow:
      0 0 0 2px #1e293b,
      0 0 0 4px #64748b;
  }
  .note-stale-banner {
    background: #422006;
    border-color: #f59e0b;
    color: #fde68a;
  }
  .note-refresh-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
  }
  .note-refresh-btn:hover {
    background: #334155;
  }
  .note-editor-toolbar {
    background: #0f172a;
    border-color: #334155;
  }
  .note-editor-toolbar .tb-btn {
    color: #94a3b8;
    background: #1e293b;
    border-color: #334155;
  }
  .note-editor-toolbar .tb-btn:hover {
    background: #334155;
    color: #93c5fd;
    border-color: #3b82f6;
  }
  .note-editor-toolbar .tb-dropdown {
    background-color: #1e293b;
    color: #94a3b8;
    border-color: #334155;
  }
  .note-editor-toolbar .toolbar-sep {
    background: #334155;
  }
  .note-editor-toolbar .tb-btn-subtle {
    color: #64748b;
  }
  .note-editor-toolbar .tb-btn-subtle:hover {
    background: #334155;
    color: #94a3b8;
    border-color: #475569;
  }
  .note-editor-toolbar .tb-shortcut-hint {
    background: #1e293b;
    color: #64748b;
  }
  .note-editor {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.15);
  }
  .note-editor mark,
  .note-content mark {
    background: #854d0e;
    color: #fef08a;
  }
}

/* ─── AirTag / Tracking ─── */
.tracking-container {
  display: flex;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.tracking-sidebar {
  width: 320px;
  min-width: 280px;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tracking-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.tracking-sidebar-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 700;
}

.tracking-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tracking-filter {
  width: 100%;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.tracking-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-mid);
  cursor: pointer;
}

.tracking-device-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.tracking-device-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.tracking-device-item:hover {
  background: var(--bg);
}

.tracking-device-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.tracking-device-info {
  flex: 1;
  min-width: 0;
}

.tracking-device-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracking-device-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.tracking-device-account {
  color: var(--text-mid);
}

.tracking-device-battery {
  font-weight: 600;
}

.tracking-device-time {
  font-size: 0.7rem;
  color: var(--text-mid);
  margin-top: 0.15rem;
}

.tracking-sidebar-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-mid);
}

.tracking-refresh-btn {
  padding: 0.25rem 0.5rem !important;
  line-height: 1;
}

.tracking-map {
  flex: 1;
  min-width: 0;
}

.tracking-loading,
.tracking-empty,
.tracking-error {
  text-align: center;
  padding: 1rem;
  color: var(--text-mid);
  font-size: 0.85rem;
}

.tracking-error {
  color: var(--error);
}

/* Battery indicator colors */
.battery-good {
  color: #10b981;
}
.battery-warn {
  color: #f59e0b;
}
.battery-low {
  color: #ef4444;
}
.battery-unknown {
  color: var(--text-mid);
}

/* Map marker */
.tracking-marker {
  background: transparent !important;
  border: none !important;
}

.tracking-marker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Stale marker — Find My hasn't updated this device's location recently,
   so the pin is showing the LAST KNOWN position, not the current one. */
.tracking-marker-pin.tracking-marker-stale {
  background: #9ca3af !important;
  opacity: 0.55;
  filter: grayscale(0.7);
}

.tracking-marker-pin.tracking-marker-stale::after {
  content: "?";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  background: #f59e0b;
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(45deg);
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.tracking-device-stale-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.tracking-popup-stale-banner {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 6px 8px;
  margin: 6px 0;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.tracking-marker-pin svg {
  transform: rotate(45deg);
}

.tracking-marker-battery {
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  margin-top: 2px;
  white-space: nowrap;
}

/* Popup */
.tracking-popup {
  font-size: 0.85rem;
  line-height: 1.5;
}
.tracking-popup strong {
  display: block;
  margin-bottom: 0.15rem;
}
.tracking-popup-account {
  color: #64748b;
}
.tracking-popup-time {
  color: #64748b;
}
.tracking-popup-coords {
  font-family: monospace;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* Tracking settings statuses */
.tracking-status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tracking-status-ok {
  background: #dcfce7;
  color: #166534;
}
.tracking-status-error {
  background: #fef2f2;
  color: #991b1b;
}
.tracking-status-pending {
  background: #fef3c7;
  color: #92400e;
}
.tracking-status-disabled {
  background: #f1f5f9;
  color: #64748b;
}

.tracking-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

/* AirTag marker — round instead of teardrop */
.tracking-marker-airtag {
  border-radius: 50%;
  width: 26px;
  height: 26px;
}

/* Type badges in device list */
.tracking-type-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 0.2rem;
  letter-spacing: 0.03em;
}
.tracking-type-airtag {
  background: #dbeafe;
  color: #1d4ed8;
}
.tracking-type-device {
  background: #f1f5f9;
  color: #64748b;
}

/* AirTag dot in sidebar */
.tracking-dot-airtag {
  border-radius: 3px;
}

/* Popup type label */
.tracking-popup-type {
  color: #6b7280;
  font-size: 0.8rem;
  font-style: italic;
}

/* AirTag scraping status indicator */
.tracking-airtag-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
}
.tracking-airtag-status-ok {
  background: #dbeafe;
  color: #1d4ed8;
}
.tracking-airtag-status-off {
  background: #f1f5f9;
  color: #94a3b8;
}

/* Responsive tracking */
@media (max-width: 768px) {
  .tracking-container {
    flex-direction: column;
    height: auto;
  }
  .tracking-sidebar {
    width: 100%;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .tracking-map {
    height: 60vh;
  }
}

@media (prefers-color-scheme: dark) {
  .tracking-status-ok {
    background: #052e16;
    color: #86efac;
  }
  .tracking-status-error {
    background: #450a0a;
    color: #fca5a5;
  }
  .tracking-status-pending {
    background: #451a03;
    color: #fde68a;
  }
  .tracking-status-disabled {
    background: #1e293b;
    color: #94a3b8;
  }
}

/* ── Risk Assessments ── */

/* Status badges */
.ra-badge-draft {
  background: #64748b;
  color: #fff;
}
.ra-badge-signed {
  background: #16a34a;
  color: #fff;
}
.ra-badge-emailed {
  background: #2563eb;
  color: #fff;
}

/* Risk score badges */
.ra-score {
  display: inline-block;
  min-width: 28px;
  padding: 2px 6px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  color: #fff;
}
.ra-score-low {
  background: #16a34a;
}
.ra-score-medium {
  background: #f59e0b;
}
.ra-score-high {
  background: #dc2626;
}

/* Personnel tag input */
.personnel-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: text;
  min-height: 42px;
}
.personnel-tags-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.personnel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.personnel-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #e2e8f0;
  color: #1e293b;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  white-space: nowrap;
}
.personnel-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.15rem;
  margin-left: 0.1rem;
}
.personnel-tag-remove:hover {
  color: #dc2626;
}
.personnel-tags-wrapper input[type="text"] {
  flex: 1;
  min-width: 150px;
  border: none;
  outline: none;
  padding: 0.25rem;
  font-size: 0.9rem;
  background: transparent;
}
.personnel-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  pointer-events: none;
}
.personnel-dropdown.open {
  display: block;
  pointer-events: auto;
}
.personnel-dropdown-item {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}
.personnel-dropdown-item:hover,
.personnel-dropdown-item.highlighted {
  background: var(--accent, #3b82f6);
  color: #fff;
}
.personnel-dropdown-item.hidden {
  display: none;
}

/* Hazard form table */
.ra-hazard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.ra-hazard-table th {
  background: var(--card-header);
  padding: 0.5rem;
  font-size: 0.8rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.ra-hazard-table td {
  padding: 0.35rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.ra-hazard-table input[type="text"],
.ra-hazard-table textarea,
.ra-hazard-table select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.ra-hazard-table textarea {
  resize: vertical;
  min-height: 60px;
}
.ra-hazard-table select {
  width: 55px;
}
.ra-subheader td {
  padding: 0 0.35rem 0.25rem;
  border-bottom: none;
}

.btn-remove-hazard {
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-remove-hazard:hover {
  background: #b91c1c;
}

/* View page document styles */
.ra-document {
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 900px;
}

.ra-doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0f1b2d;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
.ra-doc-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #0f1b2d;
}

.ra-details-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}
.ra-details-table td {
  padding: 0.4rem 0.75rem;
  border: 1px solid #e2e8f0;
}
.ra-label {
  font-weight: 600;
  width: 120px;
  background: #f8fafc;
}

.ra-section {
  margin-bottom: 1.5rem;
}
.ra-section h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #0f1b2d;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.35rem;
}

/* Risk table in view */
.ra-risk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.ra-risk-table th {
  background: #0f1b2d;
  color: #fff;
  padding: 0.5rem 0.4rem;
  font-size: 0.8rem;
  text-align: center;
  border: 1px solid #334155;
}
.ra-risk-table th:first-child,
.ra-risk-table th:nth-child(2),
.ra-risk-table th:nth-child(6) {
  text-align: left;
}
.ra-risk-table td {
  padding: 0.5rem 0.4rem;
  border: 1px solid #e2e8f0;
  vertical-align: top;
}

/* Approval section */
.ra-approval-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.ra-approval-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ra-signature-display {
  margin-top: 0.5rem;
}
.ra-sig-img {
  max-width: 300px;
  height: auto;
  border: 1px solid #e2e8f0;
  padding: 4px;
  margin-top: 0.5rem;
  display: block;
}

/* Footer */
.ra-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
}
.ra-footer p {
  margin: 0.15rem 0;
}

/* Modal */
.ra-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ra-modal-content {
  background: #fff;
  color: #1e293b;
  border-radius: var(--radius);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.ra-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}
.ra-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
}
.ra-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 0;
  line-height: 1;
}
.ra-modal-body {
  padding: 1.25rem;
}
.ra-modal-body .form-group {
  margin-bottom: 1rem;
}
.ra-modal-body label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}
.ra-modal-body input[type="text"],
.ra-modal-body input[type="email"],
.ra-modal-body input[type="date"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.ra-modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* Signature canvas */
.ra-canvas-wrap {
  border: 2px solid #cbd5e1;
  border-radius: var(--radius);
  display: inline-block;
  cursor: crosshair;
}
.ra-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  touch-action: none;
}

/* Print styles */
@media print {
  .navbar,
  .nav-top,
  .nav-bottom,
  .site-footer,
  .no-print,
  .view-as-active-bar {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }
  .container {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }
  .ra-document {
    border: none;
    padding: 0;
    box-shadow: none;
  }
  .ra-risk-table {
    page-break-inside: auto;
  }
  .ra-risk-table tr {
    page-break-inside: avoid;
  }
  .ra-score {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ra-score-low {
    background: #16a34a !important;
    color: #fff !important;
  }
  .ra-score-medium {
    background: #f59e0b !important;
    color: #fff !important;
  }
  .ra-score-high {
    background: #dc2626 !important;
    color: #fff !important;
  }
  .ra-doc-header {
    border-bottom: 2px solid #000;
  }
}

/* ─── Global Confirm Modal ─── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: confirmFadeIn 0.15s ease;
}
@keyframes confirmFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.confirm-modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 420px;
  overflow: hidden;
  animation: confirmSlideIn 0.15s ease;
}
@keyframes confirmSlideIn {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.confirm-modal-header {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.confirm-modal-body {
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-mid);
}
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem 1rem;
}
.confirm-modal-actions .btn {
  min-width: 90px;
  text-align: center;
}

/* On Current badge & checkbox */
.on-current-badge {
  background: #dcfce7;
  color: #166534;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.foreign-currency-badge {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  margin-left: 0.35rem;
  display: inline-block;
  vertical-align: middle;
}

/* Edit history badge & collapsible row */
.edit-history-badge {
  background: #e5e7eb;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: 0.35rem;
  cursor: pointer;
  display: inline-block;
  vertical-align: middle;
  user-select: none;
}
.edit-history-badge:hover {
  background: #d1d5db;
}
.edit-history-badge-admin {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}
.edit-history-badge-admin:hover {
  background: #fde68a;
}
.expense-edit-history-cell {
  padding: 0.5rem 1rem 0.75rem !important;
  background: #fafafa;
  border-top: none;
}
.edit-history-list {
  font-size: 12px;
}
.edit-history-header {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--text-mid);
  margin-bottom: 0.4rem;
}
.edit-history-entry {
  border-left: 3px solid #d1d5db;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.4rem;
  background: #fff;
  border-radius: 0 4px 4px 0;
}
.edit-history-entry-admin {
  border-left-color: #d97706;
  background: #fffbeb;
}
.edit-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 12px;
  margin-bottom: 0.25rem;
}
.edit-history-role-tag {
  background: #fef3c7;
  color: #92400e;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.edit-history-time {
  color: var(--text-mid);
  font-size: 11px;
}
.edit-history-type {
  background: #dbeafe;
  color: #1e40af;
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.edit-history-changes {
  list-style: none;
  margin: 0;
  padding: 0;
}
.edit-history-changes li {
  padding: 0.1rem 0;
  line-height: 1.5;
}
.edit-history-field {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.25rem;
}
.edit-history-from {
  color: #991b1b;
  text-decoration: line-through;
  text-decoration-color: rgba(153, 27, 27, 0.5);
}
.edit-history-to {
  color: #166534;
  font-weight: 600;
}
.edit-history-arrow {
  color: var(--text-mid);
  margin: 0 0.2rem;
}
.on-current-cb {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #16a34a;
}
.on-current-cb:disabled {
  opacity: 0.4;
  cursor: wait;
}
.not-charged-cb {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #d97706;
}
.not-charged-cb:disabled {
  opacity: 0.4;
  cursor: wait;
}

/* Responsive */
@media (max-width: 768px) {
  .ra-approval-grid {
    grid-template-columns: 1fr;
  }
  .ra-hazard-table {
    font-size: 0.8rem;
  }
}

/* ============================================================
   Fellowship Command Centre
   ============================================================ */

/* Agent topology grid */
.fellowship-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .fellowship-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .fellowship-grid {
    grid-template-columns: 1fr;
  }
}

/* Agent card */
.fellowship-card {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.25rem 1rem 1rem;
  cursor: pointer;
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.5rem;
  position: relative;
  user-select: none;
}
.fellowship-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}
.fellowship-card.active {
  animation: pulse-border 2s ease-in-out infinite;
  border-color: #22c55e;
}
@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    transform: scale(1.01);
  }
}

.fellowship-card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-heading, #1b2a4a);
}
.fellowship-card-tagline {
  font-size: 0.8rem;
  color: var(--text-mid, #6b7280);
  line-height: 1.4;
}
.fellowship-active-indicator {
  font-size: 0.75rem;
  font-weight: 600;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
}
.fellowship-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: dot-pulse 1.5s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.75);
  }
}

/* Agent avatar circle */
.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Agent colour classes */
.avatar-arwen {
  background: #7c3aed;
} /* purple */
.avatar-elrond {
  background: #1e3a5f;
} /* navy   */
.avatar-frodo {
  background: #16a34a;
} /* green  */
.avatar-subfrodo {
  background: #f59e0b;
} /* amber  */
.avatar-gandalf {
  background: #6b7280;
} /* grey   */
.avatar-aragorn {
  background: #dc2626;
} /* red    */
.avatar-legolas {
  background: #0d9488;
} /* teal   */
.avatar-gimli {
  background: #d97706;
} /* amber  */
.avatar-samwise {
  background: #78350f;
} /* brown  */

/* Agent dot (small coloured circle for activity feed) */
.agent-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.avatar-arwen-dot {
  background: #7c3aed;
}
.avatar-elrond-dot {
  background: #1e3a5f;
}
.avatar-frodo-dot {
  background: #16a34a;
}
.avatar-subfrodo-dot {
  background: #f59e0b;
}
.avatar-gandalf-dot {
  background: #6b7280;
}
.avatar-aragorn-dot {
  background: #dc2626;
}
.avatar-legolas-dot {
  background: #0d9488;
}
.avatar-gimli-dot {
  background: #d97706;
}
.avatar-samwise-dot {
  background: #78350f;
}

/* Activity feed */
.activity-feed {
  max-height: 400px;
  overflow-y: auto;
  padding: 0;
}
.activity-empty {
  padding: 1.5rem 1.25rem;
  color: var(--text-mid, #6b7280);
  font-size: 0.9rem;
  text-align: center;
}
.activity-entry {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  flex-wrap: wrap;
}
.activity-entry:last-child {
  border-bottom: none;
}
.activity-timestamp {
  color: var(--text-mid, #6b7280);
  font-size: 0.8rem;
  white-space: nowrap;
}
.activity-agent {
  font-weight: 600;
  color: var(--text-heading, #1b2a4a);
}
.activity-task {
  color: var(--text-body, #374151);
  flex: 1;
  min-width: 0;
}

/* Action badge */
.action-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: lowercase;
}
.action-badge-start {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.action-badge-complete {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.action-badge-note {
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

/* Project pill on Fellowship activity feed */
.project-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
  white-space: nowrap;
}

/* Session accordion */
.session-accordion {
  border-top: 1px solid #f3f4f6;
}
.session-accordion-item {
  border-bottom: 1px solid #f3f4f6;
}
.session-accordion-header {
  width: 100%;
  background: none;
  border: none;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
  color: var(--text-heading, #1b2a4a);
  flex-wrap: wrap;
}
.session-accordion-header:hover {
  background: #f9fafb;
}
.session-date {
  font-weight: 700;
  white-space: nowrap;
}
.session-summary-text {
  flex: 1;
  color: var(--text-mid, #6b7280);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-entry-count {
  font-size: 0.78rem;
  color: var(--text-light, #9ca3af);
  white-space: nowrap;
}
.session-accordion-body .activity-entry {
  padding-left: 2.5rem;
  background: #fafafa;
}

/* Fellowship session history filters */
.fh-filters {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap;
}
.fh-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-mid, #6b7280);
}
.fh-filter-input {
  padding: 0.35rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8rem;
  width: 130px;
  color: var(--text-heading, #1b2a4a);
}
.fh-filter-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.fh-filter-search {
  flex: 1;
  min-width: 140px;
}
.fh-filter-search .fh-filter-input {
  width: 100%;
}
.fh-clear-filters {
  padding: 0.35rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.78rem;
  color: var(--text-mid, #6b7280);
  cursor: pointer;
  white-space: nowrap;
  display: none;
}
.fh-clear-filters:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}
.fh-results-count {
  padding: 0.35rem 1.25rem;
  font-size: 0.78rem;
  color: var(--text-light, #9ca3af);
  display: none;
}

/* Session card enhancements */
.session-header-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.session-header-summary {
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-mid, #6b7280);
  line-height: 1.4;
  padding-top: 0.15rem;
}
.session-badge-auto,
.session-badge-manual {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}
.session-badge-auto {
  background: #dbeafe;
  color: #1e40af;
}
.session-badge-manual {
  background: #fef3c7;
  color: #92400e;
}
.session-duration {
  font-size: 0.75rem;
  color: var(--text-light, #9ca3af);
  white-space: nowrap;
}
.session-chevron {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-light, #9ca3af);
  transition: transform 0.2s;
}
.session-accordion-item.open .session-chevron {
  transform: rotate(90deg);
}
.session-stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  width: 100%;
  padding-top: 0.25rem;
}
.session-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
}
.project-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
  background: #f3f4f6;
  color: var(--text-mid, #6b7280);
}

/* Agent pill background colours */
.avatar-arwen-bg {
  background: #7c3aed;
}
.avatar-elrond-bg {
  background: #1e3a5f;
}
.avatar-frodo-bg {
  background: #16a34a;
}
.avatar-subfrodo-bg {
  background: #f59e0b;
  color: #1b2a4a;
}
.avatar-gandalf-bg {
  background: #6b7280;
}
.avatar-aragorn-bg {
  background: #dc2626;
}
.avatar-legolas-bg {
  background: #0d9488;
}
.avatar-gimli-bg {
  background: #d97706;
}
.avatar-samwise-bg {
  background: #78350f;
}

/* Load more button */
.fh-load-more {
  padding: 0.5rem 1.25rem;
  text-align: center;
  display: none;
}
.fh-load-more-btn {
  padding: 0.4rem 1.25rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 0.8rem;
  color: var(--text-heading, #1b2a4a);
  cursor: pointer;
}
.fh-load-more-btn:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Fellowship modal overlay */
#agent-modal {
  position: fixed;
  inset: 0;
  z-index: 10600;
  background: rgba(0, 0, 0, 0.45);
}
#agent-modal .modal-backdrop {
  position: absolute;
  inset: 0;
  cursor: pointer;
}
#agent-modal .modal-dialog {
  position: relative;
  z-index: 10601;
  margin: auto;
}
#agent-modal .modal-content {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
#agent-modal .modal-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-mid, #6b7280);
  cursor: pointer;
  padding: 0 0.25rem;
}

/* Fellowship topology (SVG) */
.fellowship-topology-card {
  padding: 1rem 1.25rem;
}
.fellowship-topology {
  width: 100%;
  height: auto;
  max-height: 680px;
  display: block;
}
.topology-line {
  fill: none;
  stroke: #cbd5e1;
  stroke-width: 2;
  transition: stroke 0.3s;
  stroke-linecap: round;
}
.topology-line.active {
  stroke: #10b981;
  stroke-width: 5;
  stroke-dasharray: 12 6;
  animation: dashflow 1.2s linear infinite;
  filter: drop-shadow(0 0 3px rgba(16, 185, 129, 0.6));
}
.topology-line.subfrodo {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 5;
  stroke-dasharray: 12 6;
  animation: dashflow 1.8s linear infinite;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.6));
  stroke-linecap: round;
}
@keyframes dashflow {
  to {
    stroke-dashoffset: -36;
  }
}
.topology-ring {
  opacity: 0.45;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.topology-ring.active {
  animation: ringglow 4s ease-in-out infinite;
}
@keyframes ringglow {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.85;
  }
}
.agent-node {
  cursor: pointer;
}
.agent-node-inner {
  transition: transform 0.25s ease;
  transform-origin: 0 0;
  transform-box: fill-box;
}
.agent-node:hover .agent-node-inner {
  transform: scale(1.12);
}
.agent-node circle {
  transition: filter 0.3s;
}
.agent-node.active circle {
  animation: nodepulse 1.6s ease-in-out infinite;
}
.agent-portrait {
  pointer-events: none;
}
.subfrodo-shadow {
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.subfrodo-shadow.active {
  animation: subfrododpulse 1.8s ease-in-out infinite;
}
@keyframes subfrododpulse {
  0% {
    filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.9));
  }
  50% {
    filter: drop-shadow(0 0 16px rgba(245, 158, 11, 0.5));
  }
  100% {
    filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.9));
  }
}
@keyframes nodepulse {
  0% {
    filter: drop-shadow(0 0 2px rgba(16, 185, 129, 0.9));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(16, 185, 129, 0.45));
  }
  100% {
    filter: drop-shadow(0 0 2px rgba(16, 185, 129, 0.9));
  }
}
.agent-node .agent-initial {
  fill: #fff;
  font-weight: 700;
  font-size: 1.65rem;
  pointer-events: none;
}
.agent-node .agent-label {
  fill: #1f2937;
  font-weight: 600;
  font-size: 0.95rem;
}
.project-node rect {
  fill: #4a7c59;
  transition: filter 0.3s;
}
.project-node.schedule rect {
  fill: #1b2a4a;
}
.project-node.other rect {
  fill: #6b7280;
}
.project-node text {
  fill: #ffffff;
  font-weight: 600;
  font-size: 0.75rem;
}
.project-node text.subtitle {
  font-weight: 400;
  font-size: 0.625rem;
  opacity: 0.85;
}

/* Expense report clickable rows */
.expense-row-clickable {
  cursor: pointer;
  transition: background-color 0.2s;
}
.expense-row-clickable:hover {
  background-color: rgba(var(--accent-rgb, 74, 124, 89), 0.08) !important;
}

/* Generic modal styles */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal[style*="display: flex"] {
  display: flex !important;
}
.modal .modal-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal .modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text);
}
.modal .modal-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-mid);
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background-color 0.2s;
}
.modal .modal-close:hover {
  background: var(--bg-light);
  color: var(--text);
}
.modal .modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}
.modal .modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* All Expenses clickable badges */
.ae-type-badge {
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.ae-type-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ── Activity Monitor (Access Log) ─────────────────────────────── */
.al-filter-label {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.al-filter-select,
.al-filter-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1e293b;
  min-width: 120px;
  transition: border-color 0.15s;
}
.al-filter-select:focus,
.al-filter-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.al-clear-btn {
  align-self: flex-end;
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
}
.al-clear-btn:hover {
  background: #e2e8f0;
  color: #334155;
}
.al-section-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  background: #e2e8f0;
  color: #334155;
}
.al-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
  color: #64748b;
}
.al-page-btn {
  padding: 6px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.al-page-btn:hover:not(:disabled) {
  background: #f1f5f9;
}
.al-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Note group edit button (overlay on cards) */
.note-group-card-wrapper {
  position: relative;
}

.note-group-edit-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s,
    background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  z-index: 10;
}

.note-group-card-wrapper:hover .note-group-edit-btn {
  opacity: 1;
}

.note-group-edit-btn:hover {
  background: var(--card);
  color: var(--accent);
  border-color: var(--accent);
}

/* Colour swatches for group edit modal */
.colour-swatch {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    transform 0.2s,
    border-color 0.2s;
}

.colour-swatch:hover {
  transform: scale(1.1);
}

.colour-swatch.selected {
  border-color: var(--text);
  box-shadow:
    0 0 0 2px var(--card),
    0 0 0 4px var(--text);
}

/* ── Task Management ── */
.task-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.task-summary-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  text-align: center;
  background: var(--card);
  border: 2px solid var(--border);
}
.task-summary-count {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.task-summary-label {
  font-size: 0.85rem;
  color: var(--text-mid);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.task-summary-urgent {
  border-color: #dc2626;
}
.task-summary-urgent .task-summary-count {
  color: #dc2626;
}
.task-summary-medium {
  border-color: #d97706;
}
.task-summary-medium .task-summary-count {
  color: #d97706;
}
.task-summary-low {
  border-color: #16a34a;
}
.task-summary-low .task-summary-count {
  color: #16a34a;
}
.task-summary-completed {
  border-color: #6b7280;
}
.task-summary-completed .task-summary-count {
  color: #6b7280;
}

.task-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
.task-main {
  min-width: 0;
}

.task-table {
  width: 100%;
}
.task-table td {
  vertical-align: top;
  padding: 0.6rem 0.5rem;
}
.task-table th {
  padding: 0.5rem;
  font-size: 0.8rem;
}

.task-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.task-description {
  font-size: 0.8rem;
  color: var(--text-mid);
  margin-top: 0.15rem;
}

.task-priority {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.task-priority-urgent {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.task-priority-medium {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}
.task-priority-low {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.task-completed-row {
  opacity: 0.55;
}
.task-completed-row .task-title {
  text-decoration: line-through;
}

.task-overdue-row {
  background: #fef2f2;
}

.task-complete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-mid);
  transition: color 0.15s;
}
.task-complete-btn:hover {
  color: #16a34a;
}

.task-filter-bar {
  display: flex;
  gap: 0.35rem;
}

.task-status-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.stat-icon.tasks {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

@media (max-width: 900px) {
  .task-layout {
    grid-template-columns: 1fr;
  }
  .task-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Meetings ── */
.stat-icon.meetings {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.badge-meeting-instant {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.badge-meeting-scheduled {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
.badge-meeting-active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
.badge-meeting-completed {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}
.badge-meeting-cancelled {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.badge-meeting-active::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  margin-right: 4px;
  animation: meetingPulse 1.5s ease-in-out infinite;
}
@keyframes meetingPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
/* Pulsing-red "Meetings" nav tab when a meeting is in progress. Colours both
   the label text and the icon (SVG stroke uses currentColor). Wins over the
   normal/.active link colour via !important. */
.nav-links a.meeting-nav-active,
.nav-links a.meeting-nav-active.active {
  color: #ef4444 !important;
  animation: meetingNavPulse 1.4s ease-in-out infinite;
}
@keyframes meetingNavPulse {
  0%,
  100% {
    color: #ef4444;
    opacity: 1;
  }
  50% {
    color: #fca5a5;
    opacity: 0.55;
  }
}
@keyframes recordPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Meeting Room — immersive dark theme (Google Meet / Zoom inspired)
   ══════════════════════════════════════════════════════════════════ */

/* Full-viewport immersive: hide portal nav-bottom + footer */
body.meeting-room-page .nav-bottom,
body.meeting-room-page .site-footer {
  display: none !important;
}
body.meeting-room-page {
  overflow: hidden;
  background: #0b1120;
}
body.meeting-room-page .navbar {
  background: linear-gradient(135deg, #0b1120 0%, #131d36 100%);
  box-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Room shell ── */
.meeting-room {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  overflow: hidden;
  background: #0b1120;
  color: #e2e8f0;
}

/* ── Top bar ── */
.meeting-room-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1.25rem;
  background: #101828;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.meeting-room-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}
.meeting-room-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meeting-room-topbar .badge-meeting-active {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.7rem;
  padding: 1px 8px;
}
.meeting-room-count {
  color: #94a3b8;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.meeting-room-topbar .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  padding: 3px 12px;
}
.meeting-room-topbar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
}

/* Recording indicator */
.meeting-recording-indicator {
  color: #ef4444;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
.recording-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  display: inline-block;
  animation: recordPulse 1.5s ease-in-out infinite;
}
.recording-active {
  background: rgba(239, 68, 68, 0.12);
  border-radius: 6px;
  padding: 2px 8px;
}
.recording-active .recording-dot {
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}
.recording-time {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.78rem;
  color: #ef4444;
  font-weight: 600;
  margin-left: 2px;
}

/* Recording consent banner */
.recording-consent-banner {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  border: 2px solid #991b1b;
  border-radius: 8px;
  padding: 14px 20px;
  margin: 8px;
  font-size: 1.05rem;
  color: #ffffff;
  line-height: 1.6;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}
.recording-consent-banner strong {
  color: #ffffff;
  font-size: 1.15rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.recording-consent-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.recording-consent-inner .btn-secondary {
  background: #ffffff;
  color: #dc2626;
  border: 2px solid #ffffff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.2s;
}
.recording-consent-inner .btn-secondary:hover {
  background: #fee2e2;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* ── Transcript page ── */
.transcript-summary {
  border-left: 3px solid #2e8b57;
}
.transcript-summary .card-body {
  background: #f0fdf4;
}
.transcript-segment {
  padding: 0.625rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.transcript-segment:last-child {
  border-bottom: none;
}
.transcript-timestamp {
  display: inline-block;
  width: 48px;
  font-size: 0.75rem;
  color: #94a3b8;
  font-family: "Courier New", Courier, monospace;
  vertical-align: top;
  padding-top: 2px;
}
.transcript-speaker {
  font-weight: 600;
  font-size: 0.8125rem;
  margin-right: 0.25rem;
}
.transcript-text {
  margin: 0.125rem 0 0 48px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #1e293b;
}

/* Connection status pills */
.connection-status {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.status-info {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}
.status-ok {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.status-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}
.status-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* ── Body: video + sidebar ── */
.meeting-room-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.meeting-room-main {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 6px;
  background: #0b1120;
  min-width: 0;
  min-height: 0;
}

/* ── Sidebar ── */
.meeting-room-sidebar {
  width: 220px;
  background: #101828;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.meeting-sidebar-header {
  padding: 0.55rem 0.875rem;
  font-weight: 600;
  font-size: 0.8rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.participant-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow-y: auto;
  flex: 1;
}
.participant-item {
  padding: 0.4rem 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: #cbd5e1;
  transition: background 0.1s;
}
.participant-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
.participant-item.self {
  font-weight: 600;
  color: #f1f5f9;
}
.participant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.participant-dot.online {
  background: #22c55e;
  box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}
.participant-dot.offline {
  background: #475569;
}
.participant-role {
  font-size: 0.65rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── Video grid ── */
.video-grid {
  display: grid;
  gap: 6px;
  width: 100%;
  height: 100%;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}
.video-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}
.video-grid[data-count="3"],
.video-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.video-grid[data-count="5"],
.video-grid[data-count="6"] {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.video-grid[data-count="7"],
.video-grid[data-count="8"] {
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}

/* Screen sharing mode - main screen takes full space, other tiles in sidebar */
.meeting-room-body.screen-sharing-mode {
  flex-direction: row;
}
.meeting-room-body.screen-sharing-mode .meeting-room-main {
  flex: 1;
  padding: 0;
}
.meeting-room-body.screen-sharing-mode .video-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.meeting-room-body.screen-sharing-mode .video-tile.screen-share-tile {
  flex: 1;
  border-radius: 0;
  min-height: 100%;
}
.meeting-room-body.screen-sharing-mode .video-tile.screen-share-tile video {
  border-radius: 0;
  object-fit: contain;
  background: #000;
}
.meeting-room-body.screen-sharing-mode .meeting-room-sidebar {
  width: 280px;
  border-left: 2px solid rgba(255, 255, 255, 0.08);
}
.meeting-room-body.screen-sharing-mode .video-tiles-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  /* min-height:0 lets this flex child shrink below its content height so
     overflow-y can engage — without it the tiles overflow the sidebar and the
     bottom ones get clipped by .meeting-room-body { overflow: hidden }. */
  min-height: 0;
  background: #0b1120;
}
.meeting-room-body.screen-sharing-mode .video-tiles-sidebar .video-tile {
  width: 100%;
  /* Share the available height equally so every participant tile is visible
     and fully shown; shrink down to a usable floor, then scroll if there are
     too many to fit. */
  flex: 1 1 0;
  min-height: 110px;
  max-height: 240px;
}
.meeting-room-body.screen-sharing-mode .video-tiles-sidebar .video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* During screen share the participants list collapses into a dropdown pinned
   at the bottom of the sidebar (the camera tiles above take the space and
   scroll). The participants header — a direct child of the sidebar, so the
   invite-panel header isn't affected — becomes the clickable toggle. The list
   expands only when .participants-open is set on the body. */
.meeting-room-body.screen-sharing-mode
  .meeting-room-sidebar
  > .meeting-sidebar-header {
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.meeting-room-body.screen-sharing-mode
  .meeting-room-sidebar
  > .meeting-sidebar-header::after {
  content: "\25BE";
  font-size: 0.7rem;
  transition: transform 0.2s ease;
}
.meeting-room-body.screen-sharing-mode.participants-open
  .meeting-room-sidebar
  > .meeting-sidebar-header::after {
  transform: rotate(180deg);
}
.meeting-room-body.screen-sharing-mode .participant-list {
  flex: 0 0 auto;
  max-height: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  transition: max-height 0.2s ease;
}
.meeting-room-body.screen-sharing-mode.participants-open .participant-list {
  max-height: 40vh;
  overflow-y: auto;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.video-tile {
  position: relative;
  background: #1a2332;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  transition: box-shadow 0.2s;
}
.video-tile:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
.video-tile.cam-off video {
  visibility: hidden;
}
.video-tile.cam-off::after {
  content: "";
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e3a5f 0%, #2d4a6f 100%);
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.video-tile.cam-off-has-placeholder::after {
  display: none;
}
/* Camera-off placeholder image — fills the tile as the background when a
   participant's camera is off. Sits above the (hidden) video, below the name
   label (label is z-index: 2). */
.video-tile .cam-off-placeholder-img {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  z-index: 1;
}
.meeting-room-body.screen-sharing-mode
  .video-tiles-sidebar
  .video-tile
  .cam-off-placeholder-img,
.meeting-room-body.screen-sharing-mode
  .video-tile.screen-share-tile
  .cam-off-placeholder-img {
  border-radius: 0;
}
.video-tile-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f1f5f9;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Control bar ── */
.meeting-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1.5rem;
  background: #101828;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  min-height: 110px;
}
.meeting-controls-center {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.meeting-control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.5rem 0.875rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.7rem;
  position: relative;
}
.meeting-control-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  transform: translateY(-1px);
}
.meeting-control-btn:active {
  transform: translateY(0);
}
.meeting-control-btn.control-off {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
.meeting-control-btn.control-off:hover {
  background: rgba(239, 68, 68, 0.35);
}
.meeting-control-btn.control-active {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}
.meeting-control-btn.control-active:hover {
  background: rgba(34, 197, 94, 0.35);
}
.meeting-control-btn.control-leave {
  background: rgba(234, 179, 8, 0.15);
  color: #fde68a;
  margin-left: 0.75rem;
}
.meeting-control-btn.control-leave:hover {
  background: rgba(234, 179, 8, 0.3);
}
.meeting-control-btn.control-end {
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}
.meeting-control-btn.control-end:hover {
  background: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}
.meeting-control-btn svg {
  width: 20px;
  height: 20px;
}
.control-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.8;
}

/* ── Share panel ── */
.meeting-share-panel {
  background: #101828;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 1.25rem;
  flex-shrink: 0;
  color: #94a3b8;
}
.meeting-share-panel summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.3rem 0;
  color: #94a3b8;
}
.meeting-share-panel[open] {
  padding-bottom: 0.4rem;
}
.meeting-share-panel-body {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}
.meeting-share-panel-body input {
  flex: 1;
  min-width: 200px;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
}

/* ── Meeting list table (non-room pages) ── */
.meeting-list-table {
  width: 100%;
  border-collapse: collapse;
}
.meeting-list-table th,
.meeting-list-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.meeting-list-table th {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .meeting-room-body {
    flex-direction: column;
  }
  .meeting-room-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    max-height: 140px;
  }
  .video-grid[data-count="3"],
  .video-grid[data-count="4"],
  .video-grid[data-count="5"],
  .video-grid[data-count="6"],
  .video-grid[data-count="7"],
  .video-grid[data-count="8"] {
    grid-template-columns: 1fr 1fr;
  }
  .meeting-control-btn {
    padding: 0.4rem 0.65rem;
  }
  .meeting-control-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* ── Waiting room overlay (joiner) ── */
.waiting-room-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-dark, #0f172a);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-light, #e2e8f0);
}
.waiting-room-content {
  max-width: 420px;
  padding: 2rem;
}
.waiting-room-content h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #fff;
}
.waiting-room-content p {
  font-size: 1rem;
  color: var(--text-mid, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.waiting-room-pulse {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4a7c59;
  animation: waitpulse 1.4s ease-in-out infinite;
}
@keyframes waitpulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

/* ── Waiting room panel (host sidebar) ── */
.waiting-room-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.75rem;
  background: #101828;
}
.waiting-room-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-mid, #94a3b8);
  margin-bottom: 0.5rem;
}
.waiting-room-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.waiting-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border, #1e293b);
  font-size: 0.8125rem;
}
.waiting-room-item:last-child {
  border-bottom: none;
}
.waiting-room-name {
  color: var(--text-light, #e2e8f0);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.waiting-room-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.btn-admit {
  background: #2e8b57;
  color: #fff;
  border: none;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-admit:hover {
  background: #256d46;
}
.btn-reject {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-reject:hover {
  background: #b91c1c;
}

/* ── Meeting invite banner ── */
.meeting-invite-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #4a7c59 0%, #2e8b57 100%);
  color: #fff;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease-out;
}
.meeting-invite-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
}
@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ── Invite users panel ── */
.meeting-invite-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #101828;
}
.invite-panel-body {
  max-height: 300px;
  overflow-y: auto;
}
.invite-user-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 250px;
  overflow-y: auto;
}
.invite-user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8125rem;
}
.invite-user-item:last-child {
  border-bottom: none;
}
.invite-user-name {
  color: #cbd5e1;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-user-status {
  font-size: 0.7rem;
  color: #64748b;
  font-style: italic;
}
.btn-invite-user {
  background: #4a7c59;
  color: #fff;
  border: none;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-invite-user:hover {
  background: #3d6a4a;
}
.btn-invite-user:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
}

/* ── Background effects popup ── */
.bg-effects-popup {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 70px;
  background: #1a2332;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem 0.75rem 1rem 0.75rem;
  width: 240px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}
.bg-effects-popup.active {
  display: block;
}
.bg-effects-popup h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.8125rem;
  color: var(--text-mid, #94a3b8);
  font-weight: 600;
}
.bg-effects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.bg-effect-option {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg-dark, #0f172a);
  position: relative;
  transition: border-color 0.15s;
}
.bg-effect-option:hover {
  border-color: var(--text-mid, #94a3b8);
}
.bg-effect-option.active {
  border-color: #4a7c59;
}
.bg-effect-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bg-effect-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 0.625rem;
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 1px 0;
}

.user-bg-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.15s;
}
.bg-effect-option:hover .user-bg-delete {
  opacity: 1;
}
.bg-upload-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
  cursor: pointer;
}
.bg-upload-trigger:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
}

/* ── Recording consent banner ── */
/* Duplicate rule removed - using main recording-consent-banner styles above */
.recording-consent-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Pending-Review Tasks (AI-Generated) ── */
.pending-review-tasks {
  margin-bottom: 1.5rem;
}
.pending-review-task-card {
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.15s ease;
}
.pending-review-task-card:hover {
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.pending-review-task-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 1rem;
}
.pending-review-task-title {
  font-weight: 600;
  font-size: 1rem;
  color: #1e293b;
  margin: 0 0 0.25rem 0;
}
.pending-review-task-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: #475569;
}
.pending-review-task-detail-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.pending-review-task-detail-item strong {
  color: #1e293b;
  font-weight: 600;
}
.pending-review-task-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pending-review-task-actions .btn {
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}
.ai-confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.ai-confidence-badge.high {
  background: #d1fae5;
  color: #065f46;
}
.ai-confidence-badge.medium {
  background: #fef3c7;
  color: #92400e;
}
.ai-confidence-badge.low {
  background: #fee2e2;
  color: #991b1b;
}
.pending-review-approve-all {
  margin-bottom: 1rem;
}

/* ── Task Notification Badge (Nav) ── */
.nav-badge {
  display: inline-block;
  background: #ef4444;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 10px;
  margin-left: 0.375rem;
  line-height: 1;
  min-width: 18px;
  text-align: center;
}
