/* Drone Brothers Client Portal — Admin Refresh */

:root {
  /* Brand palette (v2). The bright BRAND RED #FF391F is intentionally
     NOT used as the main accent — it's too saturated for UI. Deep Red
     (#cc2d17) is the main red instead, matching the brand "DEEP RED"
     supporting color. */
  --db-black: #1a1a1a;            /* BRAND BLACK */
  --db-red: #cc2d17;               /* DEEP RED (used as the main accent) */
  --db-red-deep: #a8240f;          /* darker variant of DEEP RED */
  --db-red-bright: #ff391f;        /* BRAND RED v2 — kept for rare use */
  --db-orange: #f5a524;
  --db-orange-hover: #e09414;
  --ink-900: #1a1a1a;              /* BRAND BLACK */
  --ink-700: #333333;              /* DARK GRAY */
  --ink-500: #555555;              /* MID GRAY */
  --ink-300: #c9c9c9;
  --ink-200: #e4e4e4;
  --ink-100: #f2f2f2;              /* LIGHT GRAY */
  --ink-50: #f8f8f8;
  --bg: #ffffff;                   /* BRAND WHITE */
  --row-stripe: #fafafa;
  --green: #2f8f3f;
  --amber: #d97706;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 36px rgba(0,0,0,0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--ink-900);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== Sticky top user bar ===== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 300;
  background: #0a0a0a;
  color: #d8d8d8;
  border-bottom: 1px solid #222;
}
.top-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.top-bar-left { display: flex; align-items: center; gap: 12px; }
.top-bar-right { display: flex; align-items: center; gap: 16px; }
.top-badge {
  background: var(--db-red);
  color: #fff;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.top-company { color: #a8a8a8; font-size: 11px; letter-spacing: 0.04em; }
.top-bar .user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a1a;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  font-size: 12px;
  color: #fff;
}
.top-bar .user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--db-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 640px) {
  .top-bar-inner { padding: 8px 20px; }
}

/* ===== Hero ===== */
.hero {
  background: var(--db-black);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 48px 80px;
  position: relative;
  min-height: 340px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 64px;
}

.brand-mark .home-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--db-red);
}

.brand-mark .label {
  font-family: 'Barlow Condensed', 'Oswald', Helvetica, sans-serif;
  font-weight: 500;
  letter-spacing: 0.18em;
  font-size: 18px;
  color: #d4d4d4;
}

.brand-mark .tagline {
  font-style: italic;
  font-size: 12px;
  color: #888;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.hero-title {
  font-family: 'Barlow Condensed', 'Oswald', Helvetica, sans-serif;
  font-weight: 700;
  font-size: 64px;
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0;
  color: white;
}

.hero-subtitle {
  color: #a8a8a8;
  font-size: 14px;
  margin-top: 12px;
  letter-spacing: 0.02em;
}

/* Logo bubbles */
.logo-bubbles {
  position: absolute;
  top: 0;
  right: 48px;
  width: 320px;
  height: 280px;
}

/* Original positions; z-index keeps the client bubble on top so the DB
   mark sits behind it. */
.bubble-db {
  position: absolute;
  top: 0;
  right: 30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--db-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', 'Oswald', sans-serif;
  font-weight: 800;
  font-style: italic;
  color: white;
  font-size: 18px;
  text-align: center;
  line-height: 0.95;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1;
}

.bubble-client {
  position: absolute;
  top: 64px;
  right: 90px;
  width: 216px;
  height: 216px;
  border-radius: 50%;
  background: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #14365e;
  font-family: 'Barlow Condensed', 'Oswald', sans-serif;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 2;
}

.bubble-client .client-main {
  font-weight: 800;
  font-size: 28px;
  letter-spacing: 0.04em;
}

.bubble-client .client-sub {
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 0.32em;
  margin-top: -2px;
}

.bubble-client .client-tag {
  font-size: 8px;
  letter-spacing: 0.32em;
  margin-top: 6px;
  border-top: 1px solid #14365e;
  padding-top: 4px;
  color: #14365e;
}

/* Real company logo inside the white client bubble */
.bubble-client-img {
  max-width: 72%;
  max-height: 72%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Text fallback when no logoUrl is provided */
.bubble-client-fallback {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #14365e;
  text-align: center;
  padding: 0 18px;
  line-height: 1;
}

/* DB white logo inside the red bubble */
.bubble-db-img {
  max-width: 78%;
  max-height: 78%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Top admin bar above hero */
.admin-bar {
  background: #161616;
  border-bottom: 1px solid #262626;
  color: #d4d4d4;
}

.admin-bar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.admin-bar-left {
  display: flex;
  gap: 28px;
  align-items: center;
}

.admin-bar-link {
  color: #a8a8a8;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.admin-bar-link:hover {
  color: white;
}

.admin-bar-link.active {
  color: white;
  border-bottom-color: var(--db-red);
}

.admin-bar-right {
  display: flex;
  gap: 16px;
  align-items: center;
}

.admin-badge {
  background: var(--db-red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 2px;
  letter-spacing: 0.12em;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  cursor: pointer;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--db-red);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

/* ===== Tabs nav (variation: tabs in hero) ===== */
.hero-tabs {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px;
  gap: 4px;
}

.hero-tab {
  background: transparent;
  border: none;
  color: #a8a8a8;
  font-family: 'Barlow Condensed', Helvetica, sans-serif;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 24px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-tab:hover { color: white; }
.hero-tab.active {
  color: white;
  border-bottom-color: var(--db-red);
}

.hero-tab .tab-count {
  font-size: 11px;
  background: rgba(255,255,255,0.1);
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.04em;
}

.hero-tab.active .tab-count {
  background: var(--db-red);
  color: white;
}

/* ===== Main content ===== */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}

.main.with-sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  max-width: 1320px;
}

/* Sidebar nav */
.sidebar {
  border-right: 1px solid var(--ink-200);
  padding-right: 24px;
  padding-top: 12px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 12px;
  padding: 0 12px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-700);
  font-weight: 500;
  transition: background 0.1s;
  user-select: none;
}

.sidebar-link:hover { background: var(--ink-100); }
.sidebar-link.active {
  background: var(--ink-900);
  color: white;
}

.sidebar-link .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-500);
}
.sidebar-link.active .count { color: rgba(255,255,255,0.6); }

.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== Control buttons row ===== */
.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.control-btn {
  background: var(--db-orange);
  color: white;
  border: none;
  font-weight: 700;
  font-size: 13px;
  padding: 11px 22px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, transform 0.05s;
  box-shadow: var(--shadow-sm);
}
.control-btn:hover { background: var(--db-orange-hover); }
.control-btn:active { transform: translateY(1px); }

.control-btn.functional {
  background: var(--db-black);
}
.control-btn.functional:hover { background: #2a2a2a; }

.control-btn.outline {
  background: white;
  color: var(--ink-900);
  border: 1.5px solid var(--ink-200);
}
.control-btn.outline:hover { border-color: var(--ink-900); }

.control-btn .badge {
  background: rgba(255,255,255,0.25);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

.control-btn svg { width: 14px; height: 14px; }

/* ===== Search bar ===== */
.search-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.search-input {
  width: 100%;
  max-width: 480px;
  padding: 14px 48px 14px 20px;
  border: 1.5px solid var(--ink-200);
  border-radius: 8px;
  font-size: 14px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat right 16px center;
  transition: border-color 0.15s;
  font-family: inherit;
}
.search-input:focus {
  outline: none;
  border-color: var(--ink-900);
}

/* ===== Section header ===== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--ink-900);
}

.section-meta {
  color: var(--ink-500);
  font-size: 13px;
}

.section-actions {
  display: flex;
  gap: 8px;
}

/* ===== Filters bar ===== */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--ink-200);
  background: white;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  transition: all 0.1s;
}
.filter-chip:hover { border-color: var(--ink-900); }
.filter-chip.active {
  background: var(--ink-900);
  color: white;
  border-color: var(--ink-900);
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  overflow: hidden;
}

.data-table thead th {
  background: var(--ink-100);
  text-align: left;
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink-200);
  user-select: none;
  cursor: pointer;
}

.data-table thead th .sort-arrow {
  margin-left: 6px;
  opacity: 0.4;
  font-size: 10px;
}
.data-table thead th.sorted .sort-arrow { opacity: 1; }

.data-table tbody tr {
  border-bottom: 1px solid var(--ink-100);
  transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--ink-50); }

.data-table td {
  padding: 16px 20px;
  vertical-align: middle;
}

.project-name {
  color: var(--db-red);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.project-name:hover { text-decoration: underline; }

.muted { color: var(--ink-500); }
.mono { font-family: 'JetBrains Mono', Menlo, monospace; font-size: 12px; }

/* User row pieces */
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-cell .av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink-200);
  color: var(--ink-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-cell .av.admin { background: var(--db-red); color: white; }
.user-cell .av.manager { background: #14365e; color: white; }

.user-cell .name { font-weight: 600; color: var(--ink-900); }
.user-cell .email { font-size: 12px; color: var(--ink-500); }

.role-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.role-tag.admin { background: #fce8e8; color: var(--db-red-deep); }
.role-tag.manager { background: #e3edf7; color: #14365e; }
.role-tag.viewer { background: var(--ink-100); color: var(--ink-700); }
.role-tag.pending { background: #fff3dc; color: #946400; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active { background: var(--green); }
.status-dot.inactive { background: var(--ink-300); }
.status-dot.pending { background: var(--db-orange); }

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}
.data-table tbody tr:hover .row-actions { opacity: 1; }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-500);
  transition: all 0.1s;
}
.icon-btn:hover { background: var(--ink-100); color: var(--ink-900); border-color: var(--ink-200); }
.icon-btn.danger:hover { color: var(--db-red); }
.icon-btn svg { width: 15px; height: 15px; }

/* Buttons */
.btn {
  padding: 9px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  transition: all 0.1s;
}
.btn-primary {
  background: var(--ink-900);
  color: white;
}
.btn-primary:hover { background: #000; }

.btn-danger {
  background: var(--db-red);
  color: white;
}
.btn-danger:hover { background: var(--db-red-deep); }

.btn-secondary {
  background: white;
  color: var(--ink-900);
  border-color: var(--ink-200);
}
.btn-secondary:hover { border-color: var(--ink-900); }

.btn-ghost {
  background: transparent;
  color: var(--ink-700);
}
.btn-ghost:hover { background: var(--ink-100); }

.btn svg { width: 14px; height: 14px; }

/* ===== Stats strip (admin overview) ===== */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  padding: 16px 20px;
}

.stat-card .stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--ink-900);
  font-family: 'Barlow Condensed', Helvetica, sans-serif;
}

.stat-card .stat-delta {
  font-size: 12px;
  color: var(--green);
  margin-top: 2px;
}
.stat-card .stat-delta.down { color: var(--db-red); }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: 12px;
  width: 520px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--ink-100);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--ink-50);
}

/* In-modal error banner — shown when an API call fails so the user can
   correct and retry without losing their input. */
.modal-error {
  background: #fce8e8;
  color: var(--db-red-deep);
  border-left: 3px solid var(--db-red);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

/* Forms */
.field { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field-input, .field-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--ink-200);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: white;
}
.field-input:focus, .field-select:focus { outline: none; border-color: var(--ink-900); }
.field-help { font-size: 12px; color: var(--ink-500); margin-top: 6px; }

/* Project assignment list */
.assign-list {
  border: 1px solid var(--ink-200);
  border-radius: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.assign-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-100);
  cursor: pointer;
  user-select: none;
}
.assign-row:last-child { border-bottom: none; }
.assign-row:hover { background: var(--ink-50); }
.assign-row input { margin: 0; }

.checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink-300);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: white;
}
.checkbox.checked {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: white;
}
.checkbox svg { width: 11px; height: 11px; }

/* ===== Reports section ===== */
.reports-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
}

.report-config {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 24px;
  position: sticky;
  top: 24px;
  align-self: start;
}

.report-history {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  overflow: hidden;
}

.report-types-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.report-type-card {
  border: 1.5px solid var(--ink-200);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.1s;
  background: white;
  text-align: left;
  font-family: inherit;
}
.report-type-card:hover { border-color: var(--ink-700); }
.report-type-card.selected {
  border-color: var(--ink-900);
  background: var(--ink-50);
}
.report-type-card .rt-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-900);
}
.report-type-card .rt-desc {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 4px;
  line-height: 1.4;
}
.report-type-card .rt-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--ink-100);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
  color: var(--ink-700);
}
.report-type-card.selected .rt-icon {
  background: var(--db-red);
  color: white;
}

/* Date range pills */
.date-range-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.date-pill {
  padding: 6px 12px;
  border: 1px solid var(--ink-200);
  background: white;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 500;
}
.date-pill.active {
  background: var(--ink-900);
  color: white;
  border-color: var(--ink-900);
}

.format-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--ink-200);
  border-radius: 6px;
  overflow: hidden;
  width: fit-content;
}
.format-toggle button {
  background: white;
  border: none;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-700);
}
.format-toggle button.active {
  background: var(--ink-900);
  color: white;
}

/* Generate button + progress */
.generate-btn {
  width: 100%;
  background: var(--db-red);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.generate-btn:hover { background: var(--db-red-deep); }
.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.progress-bar {
  height: 4px;
  background: var(--ink-100);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}
.progress-bar > div {
  height: 100%;
  background: var(--db-red);
  transition: width 0.3s;
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-500);
}
.empty .empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.4;
}

/* Toast — the SITE-WIDE standard (admin + portal; the board mirrors these
   rules in styles.css as .board-toast). Success = dark pill with a check
   icon; error = deep red, no icon. Sits above modal backdrops (z 100). */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 1000;
  max-width: min(560px, 90vw);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease-out;
}
.toast.error { background: var(--db-red-deep); }

/* Promo banner card (for promo control buttons - visible to all roles) */
.promo-card {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  color: white;
  border-radius: 10px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.promo-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(245,165,36,0.18) 0%, transparent 70%);
}

.promo-card .promo-text {
  position: relative;
  z-index: 1;
}

.promo-card .promo-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--db-orange);
  font-weight: 700;
  margin-bottom: 6px;
}

.promo-card .promo-title {
  font-family: 'Barlow Condensed', Helvetica, sans-serif;
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0;
}

.promo-card .promo-sub {
  color: #a8a8a8;
  font-size: 13px;
  margin-top: 4px;
}

.promo-card .promo-btn {
  position: relative;
  z-index: 1;
  background: var(--db-orange);
  color: var(--ink-900);
  border: none;
  padding: 12px 22px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.promo-card .promo-btn:hover { background: var(--db-orange-hover); }

/* Activity log small list */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--ink-100);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }

.activity-item .act-time {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--ink-500);
  width: 90px;
  flex-shrink: 0;
}

.activity-item .act-actor { font-weight: 600; }
.activity-item .act-text { color: var(--ink-700); flex: 1; }

/* Scrollbars (subtle) */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* Utility */
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }

/* Sortable indicator on TH */
th.sortable { cursor: pointer; }
th.sortable:hover { background: var(--ink-200); }

/* ===== Auth loading overlay (shown by auth.js while it validates) ===== */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.auth-loading-content {
  text-align: center;
  color: white;
}

.auth-spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top: 5px solid var(--db-red);
  border-radius: 50%;
  animation: db-spin 1s linear infinite;
  margin: 0 auto 16px;
}

.auth-loading-text {
  font-size: 14px;
  font-weight: 600;
  color: white;
  opacity: 0.9;
  letter-spacing: 0.04em;
  margin: 0;
}

@keyframes db-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Project status pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--ink-100);
  color: var(--ink-700);
}
.status-pill.active { background: #e6f4e8; color: var(--green); }
.status-pill.complete { background: #e3edf7; color: #14365e; }
.status-pill.scheduled { background: #fff3dc; color: #946400; }

/* ---------------------------------------------------------------------------
   Client portal analytics — Portal Activity / Projects by Engagement /
   Most Active Users / Recent Admin Actions. Ported from admin-styles.css so
   the client portal mirrors the admin board's chart design.
   --------------------------------------------------------------------------- */
.chart-stack { display: flex; flex-direction: column; gap: 16px; }

.chart-card {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  padding: 20px;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.chart-title { font-size: 14px; font-weight: 700; margin: 0; }
.chart-meta { font-size: 12px; color: var(--ink-500); white-space: nowrap; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

/* Horizontal bar charts */
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.bar-track { height: 22px; background: var(--ink-100); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--db-red) 0%, #e63b3b 100%);
  border-radius: 4px;
  transition: width 0.5s;
}
.bar-fill.alt { background: linear-gradient(90deg, #14365e 0%, #2a5a8a 100%); }
.bar-row .bar-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .bar-value {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--ink-700);
  text-align: right;
}

/* Line chart */
.line-chart { width: 100%; height: 200px; display: block; }

/* Recent Admin Actions feed */
.feed-list {
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 10px;
  overflow: hidden;
  max-height: 380px;
  overflow-y: auto;
}
.feed-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink-100);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--ink-100);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-700);
}
.feed-icon.danger { background: #fce8e8; color: var(--db-red-deep); }
.feed-icon.success { background: #e6f4e8; color: var(--green); }
.feed-icon.info { background: #e3edf7; color: #14365e; }
.feed-meta {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
  font-family: 'JetBrains Mono', Menlo, monospace;
}

/* ===== Tag filter dropdown (projects view) ===== */
/* Anchor context for the small-screen fallback below. */
.filters { position: relative; }

.tag-filter {
  position: relative;
  display: inline-flex;
}

.tag-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-filter-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ink-900);
  color: white;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.filter-chip.active .tag-filter-count { background: white; color: var(--ink-900); }

.tag-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 100;
  min-width: 200px;
  max-width: min(260px, calc(100vw - 48px));
  background: white;
  border: 1px solid var(--ink-200);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Scroll container only — .assign-list's own border would double up here. */
.tag-filter-list {
  max-height: 240px;
  overflow-y: auto;
}

.tag-filter-label {
  font-size: 13px;
  color: var(--ink-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-filter-clear {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: none;
  border-top: 1px solid var(--ink-100);
  background: var(--ink-50);
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.tag-filter-clear:hover { background: var(--ink-100); }
.tag-filter-clear:disabled { opacity: 0.5; cursor: default; }

/* Small screens: re-anchor the panel to the whole .filters row instead of
   the chip, so a chip that wrapped mid-row can't push the panel off-screen. */
@media (max-width: 520px) {
  .tag-filter { position: static; }
  .tag-filter-panel { width: 100%; max-width: none; }
}
