/* ══════════════════════════════════════════════════════════════════
   Admin surface — Command Deck
   Extends the base design system from styles.css
   ══════════════════════════════════════════════════════════════════ */

:root {
  --sidebar-w: 256px;
  --content-max: 1280px;
  --head-h: 68px;
  --topbar-h: 52px;
}

.admin-body {
  display: block;
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(27,188,106,0.03), transparent 60%),
    radial-gradient(800px  500px at 108% 10%, rgba(27,188,106,0.015), transparent 60%),
    var(--bg);
}

/* ── Sidebar toggle (mobile) ───────────────────────────────────── */

.sidebar-toggle {
  position: fixed;
  top: calc(var(--topbar-h) + 0.85rem);
  left: 0.85rem;
  z-index: 40;
  width: 38px;
  height: 38px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-toggle:hover { border-color: var(--accent-border); background: rgba(255,255,255,1); }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 28;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

/* ── Sidebar ───────────────────────────────────────────────────── */

/* ── Top bar (admin) ────────────────────────────────────────────── */

.admin-portal-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
}

.admin-portal-header #whoami-email {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Sidebar ─────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 0%, rgba(27,188,106,0.05) 0%, transparent 40%),
    linear-gradient(180deg, #ffffff 0%, #f7f9fc 100%);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  opacity: 0.6;
}

.sidebar::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  right: 0;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(27,188,106,0.22) 22%,
    rgba(27,188,106,0.22) 78%,
    transparent 100%);
  opacity: 0.4;
  pointer-events: none;
}

.sidebar > * { position: relative; z-index: 1; }

/* ── Brand ─────────────────────────────────────────────────────── */

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem 1.25rem 1.15rem;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}

.brand-mark {
  width: 22px;
  height: auto;
  color: var(--fg);
  opacity: 0.82;
  flex-shrink: 0;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.brand-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.005em;
}

.brand-role {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  line-height: 1;
}

/* ── Nav ──────────────────────────────────────────────────────── */

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 4px; }

.nav-group { display: flex; flex-direction: column; gap: 0.1rem; }

.nav-group-head {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(107,127,152,0.85);
  padding: 0 0.8rem 0.55rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-group-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,0,0,0.09), transparent);
}

.nav-item {
  all: unset;
  display: grid;
  grid-template-columns: 22px 18px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  transition: color 0.12s ease, background 0.12s ease;

  /* Staggered fade-in */
  opacity: 0;
  transform: translateX(-4px);
  animation: navItemIn 0.34s cubic-bezier(0.2, 0.65, 0.25, 1) forwards;
  animation-delay: calc(var(--i, 0) * 28ms + 60ms);
}

@keyframes navItemIn {
  to { opacity: 1; transform: translateX(0); }
}

.nav-item:hover {
  color: var(--fg);
  background: rgba(0,0,0,0.04);
}

.nav-item.is-active {
  color: var(--fg);
  background: linear-gradient(90deg, rgba(27,188,106,0.11) 0%, rgba(27,188,106,0.03) 100%);
}

.nav-item.is-active::before {
  content: '';
  position: absolute;
  left: -0.1rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(27,188,106,0.45);
}

.nav-idx {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: rgba(107,127,152,0.55);
  letter-spacing: 0.04em;
  text-align: left;
  transition: color 0.12s;
}
.nav-item.is-active .nav-idx,
.nav-item:hover .nav-idx {
  color: var(--accent);
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: currentColor;
  opacity: 0.82;
}
.nav-icon svg { width: 16px; height: 16px; }
.nav-item.is-active .nav-icon { opacity: 1; }

.nav-text {
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.06);
  min-width: 1.4rem;
  text-align: center;
  line-height: 1.2;
}
.nav-badge:empty { display: none; }
.nav-item.is-active .nav-badge {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

/* ── Sidebar footer ───────────────────────────────────────────── */

.sidebar-footer {
  padding: 0.85rem 0.85rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.07);
  border-radius: 10px;
}

.user-dot {
  position: relative;
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(27,188,106,0.45);
}
.user-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.7); opacity: 0.35; }
  100% { transform: scale(1.8); opacity: 0; }
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.05rem;
}

.user-email {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  line-height: 1;
}


/* ── Main content ─────────────────────────────────────────────── */

.admin-content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 0px) 2rem 6rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem auto 0;
  max-width: var(--content-max);
  width: 100%;
}

/* ── View (page) ──────────────────────────────────────────────── */

.view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding-bottom: 2rem;
  animation: viewIn 0.3s cubic-bezier(0.2, 0.65, 0.25, 1);
}
.view[hidden] { display: none; }

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

.view-head {
  padding: 1.85rem 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  margin-bottom: 0.1rem;
}

.view-route {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.view-route::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(27,188,106,0.45);
}

.view-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.view-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.022em;
  margin: 0;
  line-height: 1.15;
}

.title-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(0,0,0,0.05);
  border: 1px solid var(--border);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.view-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.view-sub {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
  margin: 0;
  max-width: 68ch;
}

.chip-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  max-width: none;
}

/* ── Panels ───────────────────────────────────────────────────── */

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.35rem 1.6rem 1.6rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.06);
  position: relative;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.panel-head-left { display: flex; align-items: baseline; gap: 0.55rem; }

.panel-head h2 {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
}

.count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.8125rem;
  margin: 0.1rem 0 1.1rem;
  line-height: 1.65;
  max-width: 72ch;
}

.panel-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.12s;
}
.panel-link:hover { color: var(--accent); }

.panel-search {
  padding: 0.42rem 0.72rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 15rem;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.panel-search:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

/* ── Upload drop zone ────────────────────────────────────────── */

.upload-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.25rem 1.5rem;
  border: 2px dashed var(--accent-border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
  background: var(--accent-dim);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  outline: none;
}

.upload-drop-zone:hover,
.upload-drop-zone:focus-visible {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--accent);
}

.upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  border-style: solid;
}

.upload-drop-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.upload-drop-zone:hover .upload-drop-icon,
.upload-drop-zone.drag-over .upload-drop-icon {
  transform: translateY(-1px);
}

.upload-drop-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}

.upload-drop-sep {
  font-size: 0.8rem;
  opacity: 0.5;
}

.upload-drop-sub {
  font-size: 0.8125rem;
  opacity: 0.75;
}

/* ── Files filter bar ────────────────────────────────────────── */

.files-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.files-owner-select {
  padding: 0.38rem 0.65rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.files-owner-select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.files-filter-bar .panel-search { flex: 1; min-width: 12rem; }

/* ── Overview stat grid ──────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.stat-card {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem 1.1rem;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.4;
}
.stat-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-1px);
}
.stat-card:hover::before { opacity: 0.9; }

.stat-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.7rem;
}
.stat-label svg { width: 13px; height: 13px; opacity: 0.75; }

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.stat-sub strong {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ── Overview columns ─────────────────────────────────────────── */

.overview-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}
@media (max-width: 1100px) { .overview-cols { grid-template-columns: 1fr; } }

.mini-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mini-feed-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 0.82rem;
}
.mini-feed-row:first-child { border-top: none; }

.mini-feed-when {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.mini-feed-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}
.mini-feed-main .primary {
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
}
.mini-feed-main .secondary {
  color: var(--muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-feed-tail {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mini-feed-tail.bad { color: #c43030; }

.mini-feed-row.clickable { cursor: pointer; }
.mini-feed-row.clickable:hover { background: rgba(0,0,0,0.035); border-radius: 4px; margin: 0 -0.4rem; padding-left: 0.4rem; padding-right: 0.4rem; }

.mini-feed-empty {
  padding: 1.25rem 0.5rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.8125rem;
  text-align: center;
}

/* ── Buttons ──────────────────────────────────────────────────── */

.btn-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: auto;
  padding: 0.45rem 0.95rem;
  font-size: 0.875rem;
  white-space: nowrap;
  border-radius: 8px;
}

.btn-secondary {
  background: rgba(0,0,0,0.04);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(0,0,0,0.07);
  border-color: var(--border-bright);
}

.btn-danger {
  background: transparent;
  color: #c43030;
  border: 1px solid rgba(196,48,48,0.25);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(196,48,48,0.07);
  border-color: #c43030;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 7px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  font-size: 0.8125rem;
  font-family: var(--font);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
  white-space: nowrap;
}
.icon-btn:hover {
  color: var(--fg);
  background: rgba(0,0,0,0.04);
  border-color: var(--border-bright);
}
.icon-btn.danger:hover {
  color: #c43030;
  border-color: rgba(196,48,48,0.45);
  background: rgba(196,48,48,0.06);
}
.icon-btn.is-active {
  background: var(--accent-dim);
  color: #0c6636;
  border-color: var(--accent-border);
}

/* ── Tables ──────────────────────────────────────────────────── */

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0.25rem;
}

.tbl thead th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.025);
}

.tbl tbody td {
  padding: 0.65rem 0.8rem;
  font-size: 0.875rem;
  vertical-align: middle;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.tbl tbody tr:hover td { background: rgba(0,0,0,0.025); }
.tbl tbody tr:last-child td { border-bottom: none; }

.tbl input[type="text"],
.tbl input[type="email"],
.tbl select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.12s, box-shadow 0.12s;
  outline: none;
}
.tbl input:focus,
.tbl select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

.tbl code {
  display: inline-block;
  max-width: 100%;
  word-break: break-all;
}

/* Numeric columns */
.col-act   { width: 1%; white-space: nowrap; text-align: right; }
.tbl td.col-act, .tbl th.col-act { text-align: right; }
.col-id    { width: 1%; white-space: nowrap; }
.col-name  { width: 14rem; }
.col-scope { width: 1%; white-space: nowrap; }
.col-email   { width: 28%; }
.col-accts   { width: 22%; }
.col-file-id { width: 18%; white-space: nowrap; }
.grants-file-id-row { display: flex; align-items: center; gap: 0.5rem; }
.col-num   { width: 1%; white-space: nowrap; text-align: right; }
.col-dls   { width: 7rem; text-align: right; }
.col-owner  { width: 14rem; white-space: nowrap; }
.col-shared { width: 10rem; white-space: nowrap; }
.col-ua    { max-width: 22rem; }

.tbl tbody td[class*="col-num"],
.tbl tbody td[class*="col-dls"] {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tbl-hint { margin: 0.55rem 0.25rem 0; }

.count-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.count-link:hover { opacity: 0.75; }

.tbl-clickable tbody tr { cursor: pointer; transition: background 0.1s; }
.tbl-clickable tbody tr:hover { background: rgba(27,188,106,0.04); }
.tbl-clickable tbody tr:focus {
  outline: none;
  background: rgba(27,188,106,0.06);
  box-shadow: inset 3px 0 0 var(--accent);
}
.tbl-clickable tbody tr.empty-row { cursor: default; }
.tbl-clickable tbody tr.empty-row:hover { background: transparent; }

.tbl-clickable tbody tr.file-row--unshared td:first-child { box-shadow: inset 3px 0 0 var(--muted); }
.tbl-clickable tbody tr.file-row--unshared { background: rgba(107,127,152,0.04); }
.tbl-clickable tbody tr.file-row--unshared:hover { background: rgba(107,127,152,0.07); }

.tbl-clickable tbody tr.file-row--all-expired td:first-child { box-shadow: inset 3px 0 0 #b46800; }
.tbl-clickable tbody tr.file-row--all-expired { background: rgba(180,120,0,0.04); }
.tbl-clickable tbody tr.file-row--all-expired:hover { background: rgba(180,120,0,0.08); }

/* ── Grants / expiry ─────────────────────────────────────────── */

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

.grant-row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.6rem;
  row-gap: 0.25rem;
  align-items: center;
  padding: 0.35rem 0.6rem;
  background: rgba(0,0,0,0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.grant-row > .chip {
  font-family: var(--font-mono);
  grid-column: 1;
  grid-row: 1;
}
.grant-row > .pill {
  grid-column: 1;
  grid-row: 2;
  justify-self: start;
}

.grant-row-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-content: flex-end;
}

@supports not (grid-template-columns: subgrid) {
  .grant-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
  }
  .grant-row-controls { flex: 1; justify-content: flex-end; }
}

input[type="datetime-local"] {
  padding: 0.3rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font);
  color-scheme: light;
  outline: none;
}
input[type="datetime-local"]:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

/* ── Per-file access expander ────────────────────────────────── */

.grants-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-family: var(--font);
  font-size: 0.72rem;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
  font-variant-numeric: tabular-nums;
}
.grants-toggle:hover {
  border-color: var(--accent-border);
  color: #0c6636;
  background: var(--accent-dim);
}
.grants-toggle.muted { color: var(--muted); }
.grants-toggle[aria-expanded="true"] {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: #0c6636;
}

.access-row td {
  padding: 0 !important;
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid var(--border) !important;
}

.access-panel {
  padding: 1rem 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-left: 2px solid var(--accent-border);
  background:
    linear-gradient(90deg, rgba(27,188,106,0.04), transparent 60%);
}

.access-head {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.access-title code { font-size: 0.72rem; text-transform: none; letter-spacing: 0; }

.access-subhead {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin: 0.9rem 0 0.3rem;
  font-weight: 600;
}

.access-rows { display: flex; flex-direction: column; gap: 0.4rem; }

.access-grant-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.25rem 0;
}

.access-email {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--fg);
  min-width: 14rem;
}

.access-grant-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--border);
}

.access-select {
  min-width: 14rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.access-select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

/* ── Chips / pills ───────────────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 0.08rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.06em;
  line-height: 1.55;
  white-space: nowrap;
  border: 1px solid transparent;
  text-transform: uppercase;
}
.pill-warn {
  background: rgba(180,120,0,0.1);
  color: #a06500;
  border-color: rgba(180,120,0,0.3);
}
.pill-danger {
  background: rgba(196,48,48,0.1);
  color: #c43030;
  border-color: rgba(196,48,48,0.3);
}
.pill-muted {
  background: transparent;
  color: var(--muted);
  border-color: rgba(0,0,0,0.15);
}
.pill-ok {
  background: rgba(27,188,106,0.1);
  color: var(--accent);
  border-color: var(--accent-border);
}
.pill-info {
  background: rgba(59,130,246,0.1);
  color: #3b76f0;
  border-color: rgba(59,130,246,0.3);
}
.pill-purple {
  background: rgba(99,102,241,0.1);
  color: #5558d6;
  border-color: rgba(99,102,241,0.3);
}

/* ── Timeline / Stats layout ─────────────────────────────────── */

.stats-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

tr.row-bad td { color: #c43030; }

/* ── Scope pills (Files table) ───────────────────────────────── */

.scope-pill {
  display: inline-block;
  padding: 0.08rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.06em;
  line-height: 1.55;
  white-space: nowrap;
  border: 1px solid transparent;
}
.scope-pill-global {
  background: rgba(27,188,106,0.1);
  color: var(--accent);
  border-color: var(--accent-border);
}
.scope-pill-account {
  background: rgba(99,102,241,0.1);
  color: #5558d6;
  border-color: rgba(99,102,241,0.3);
}
.scope-pill-personal {
  background: transparent;
  color: var(--muted);
  border-color: rgba(0,0,0,0.12);
}

.scope-filter-btns {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.scope-filter-btn {
  all: unset;
  cursor: pointer;
  padding: 0.32rem 0.75rem;
  font-size: 0.8rem;
  font-family: var(--font);
  color: var(--muted);
  border-right: 1px solid var(--border);
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.scope-filter-btn:last-child { border-right: none; }
.scope-filter-btn:hover { color: var(--fg); background: rgba(0,0,0,0.03); }
.scope-filter-btn.active {
  color: #0c6636;
  background: var(--accent-dim);
  font-weight: 500;
}

.email-cell { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.email-cell input { flex: 1 1 14rem; }

.file-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-dim);
  color: #0c6636;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* ── Segmented file pills (Customers tab) ──────────────────── */
.file-seg {
  display: inline-flex;
  align-items: stretch;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  overflow: hidden;
}

.file-seg-name {
  padding: 0.15rem 0.5rem 0.15rem 0.65rem;
  color: #0c6636;
}

.file-seg-date {
  padding: 0.15rem 0.6rem 0.15rem 0.45rem;
  background: rgba(27, 188, 106, 0.18);
  border-left: 1px solid var(--accent-border);
  color: #0c6636;
  opacity: 0.8;
}

.file-seg-date--warn  { color: #92400e; background: rgba(245,158,11,0.15); border-left-color: rgba(245,158,11,0.35); opacity: 1; }
.file-seg-date--danger { color: #991b1b; background: rgba(239,68,68,0.12); border-left-color: rgba(239,68,68,0.3); opacity: 1; }

/* direct grant — blue */
.file-seg--direct { border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.09); }
.file-seg--direct .file-seg-name { color: #1d4ed8; }
.file-seg--direct .file-seg-date { color: #1d4ed8; background: rgba(59,130,246,0.18); border-left-color: rgba(59,130,246,0.3); }

/* account + direct — purple */
.file-seg--both { border-color: rgba(139,92,246,0.3); background: rgba(139,92,246,0.09); }
.file-seg--both .file-seg-name { color: #6d28d9; }
.file-seg--both .file-seg-date { color: #6d28d9; background: rgba(139,92,246,0.18); border-left-color: rgba(139,92,246,0.3); }

.chip-remove {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0;
  line-height: 1;
}
.chip-remove:hover { opacity: 1; color: #c43030; }

.chip-add {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 0.18rem 0.7rem;
  font-family: var(--font);
  font-size: 0.8125rem;
  cursor: pointer;
  min-width: 90px;
  outline: none;
}
.chip-add:hover { color: var(--fg); border-color: var(--border-bright); }

/* ── Upload form ──────────────────────────────────────────────── */

.version-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.version-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,0.5);
}
.version-row-current {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}
.version-tag {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(0,0,0,0.04);
}
.version-row-current .version-tag {
  color: var(--accent);
  border-color: var(--accent-border);
  background: rgba(255,255,255,0.6);
}
.version-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--fg);
}
.version-sep { color: var(--muted); }
.version-who { color: var(--muted); }
.version-size { color: var(--muted); }
.version-sha {
  grid-column: 2;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.35;
}

.upload-replace-warn {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: 10px;
  border: 1px solid rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.10);
  color: #92400e;
  font-size: 0.875rem;
  line-height: 1.45;
}
.upload-replace-warn strong { font-weight: 600; }
.upload-replace-warn .urw-line { display: block; }
.upload-replace-warn .urw-line + .urw-line { margin-top: 0.2rem; }
.upload-replace-warn code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.06);
  padding: 0 0.3rem;
  border-radius: 4px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.2rem 1.35rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background:
    radial-gradient(800px 80px at 0% 0%, rgba(27,188,106,0.025), transparent 50%),
    rgba(0,0,0,0.01);
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.upload-actions { display: flex; justify-content: flex-start; }

.scope-radios {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.3rem;
}

.scope-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
  cursor: pointer;
}

.scope-radio-label input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.scope-radio-label input[type="radio"]:disabled {
  cursor: not-allowed;
}

.scope-radio-label:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.u-share-accounts-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.35rem;
  max-height: 9rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.45rem 0.6rem;
  background: var(--bg-alt, #fafafa);
}

.u-share-account-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}

.u-share-account-row input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.u-share-expiry-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.u-share-expiry-wrap[hidden] { display: none; }

.u-direct-input-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.u-direct-input-row input[type="email"] {
  flex: 1;
  min-width: 0;
}

.u-direct-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.u-direct-list[hidden] { display: none; }

.u-direct-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-alt, #f0f0f0);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  color: var(--fg);
}

.u-direct-chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
}

.u-direct-chip-remove:hover { color: var(--fg); }

.u-direct-chip-preexisting {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--fg);
}
.u-direct-chip-tag,
.u-share-account-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}
.u-share-account-row-preexisting {
  color: var(--muted);
}
.u-share-account-row-preexisting input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: not-allowed;
}

.acct-upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.acct-upload-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ── Upload progress bar ─────────────────────────────────────── */

.upload-progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.upload-progress-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 0;
}
.upload-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.12s ease;
}
.upload-progress-pct {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--muted);
  min-width: 2.8rem;
  text-align: right;
  flex-shrink: 0;
}

/* Account drop zone */
.acct-upload-drop {
  margin-bottom: 0.75rem;
}
.upload-drop-zone.has-file {
  border-color: var(--accent-border);
  border-style: solid;
  background: var(--surface-1);
  color: var(--fg);
}
.upload-drop-zone.has-file .upload-drop-text {
  color: var(--fg);
  font-weight: 500;
}
.upload-drop-zone.has-file .upload-drop-sub {
  opacity: 1;
  color: var(--muted);
}

.acct-section-upload .form-group { margin-bottom: 0.6rem; }
.acct-section-upload label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}
.acct-section-upload textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.acct-section-upload textarea:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.acct-section-upload input[type="file"] {
  display: none;
}

.upload-form .form-group { margin-bottom: 0; }

.upload-form label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 500;
}

textarea#u-notes {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
textarea#u-notes:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

input[type="file"] {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: var(--font);
}
input[type="file"]::file-selector-button {
  margin-right: 0.75rem;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.04);
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.8125rem;
  cursor: pointer;
}

.upload-submit { min-width: 130px; }

/* ── Notes column (read-only) ─────────────────────────────────── */

.col-notes { min-width: 14rem; }
.notes-ro {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 4rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Inline add forms ─────────────────────────────────────────── */

.add-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
  padding: 0.75rem 1rem;
  background: rgba(0,0,0,0.02);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.add-form input[type="email"],
.add-form input[type="text"],
.add-form select {
  padding: 0.4rem 0.7rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 18rem;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.add-form input:focus,
.add-form select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.add-form select { min-width: 14rem; }

.add-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.add-row input[type="email"],
.add-row input[type="text"] {
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 16rem;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.add-row input:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

.inline-err {
  font-size: 0.8125rem;
  color: #c43030;
}

/* ── Accounts two-panel ───────────────────────────────────────── */

.accounts-split {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1rem;
  align-items: start;
}

.accounts-list-pane {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.06);
  position: sticky;
  top: 1rem;
}

.accounts-create-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
}

.accounts-create-form input {
  padding: 0.4rem 0.7rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.accounts-create-form input:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.accounts-create-form .btn { width: 100%; }

#accounts-list {
  overflow-y: auto;
  max-height: calc(100vh - 340px);
  min-height: 60px;
}

.account-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: background 0.1s;
  position: relative;
}
.account-nav-item:last-child { border-bottom: none; }
.account-nav-item:hover { background: rgba(0,0,0,0.03); }
.account-nav-item.is-selected {
  background: linear-gradient(90deg, rgba(27,188,106,0.10), rgba(27,188,106,0.025) 80%);
}
.account-nav-item.is-selected::before {
  content: '';
  position: absolute;
  left: 0; top: 0.3rem; bottom: 0.3rem;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 6px rgba(27,188,106,0.4);
}

.account-nav-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.account-nav-item.is-selected .account-nav-name { color: var(--fg); }
.account-nav-item:hover .account-nav-name { color: var(--fg); }

.account-nav-arrow {
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
  margin-left: 0.4rem;
  opacity: 0.4;
  transition: opacity 0.1s, color 0.1s;
}
.account-nav-item.is-selected .account-nav-arrow,
.account-nav-item:hover .account-nav-arrow { opacity: 1; color: var(--accent); }

.accounts-detail-pane {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 24px rgba(0,0,0,0.06);
  min-height: 320px;
  overflow: hidden;
}

.accounts-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 2rem;
}
.accounts-empty-state[hidden] { display: none; }

.accounts-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
  flex-wrap: wrap;
}

.accounts-detail-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--fg);
  letter-spacing: -0.005em;
  flex: 1;
  min-width: 0;
}

.accounts-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.accounts-detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  padding: 1rem 1.1rem 1.1rem;
}

/* ── Account detail sections ─────────────────────────────────── */

.acct-section {
  padding: 1rem 1.1rem 1.1rem;
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.acct-section-grants        { grid-column: 1 / -1; }
.acct-section-upload        { grid-column: 1 / -1; }
.acct-section-account-files { grid-column: 1 / -1; }

.acct-section-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.acct-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  min-height: 1.8rem;
  align-items: center;
}

.acct-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: var(--accent-dim);
  color: #0c6636;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  padding: 0.22rem 0.25rem 0.22rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
}

.acct-chip-remove {
  background: none;
  border: none;
  color: rgba(12,102,54,0.45);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.25rem;
  border-radius: 3px;
  transition: color 0.1s;
  font-family: var(--font);
  flex-shrink: 0;
}
.acct-chip-remove:hover { color: #c43030; }

.acct-add-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.acct-add-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.acct-add-input:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

.acct-add-autocomplete {
  position: relative;
  width: 100%;
}
.acct-add-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--card-bg, var(--input-bg));
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  max-height: 14rem;
  overflow-y: auto;
}
.acct-add-suggestions[hidden] { display: none; }
.acct-add-suggestion {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--fg);
}
.acct-add-suggestion:hover,
.acct-add-suggestion.active {
  background: rgba(27, 188, 106, 0.1);
  color: var(--fg);
}

.acct-inline-err {
  font-size: 0.8125rem;
  color: #c43030;
}
.acct-inline-err[hidden] { display: none; }

/* Grant pills — compact row of chips, matches Grants tab styling */
.acct-grant-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.acct-grant-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(0,0,0,0.02);
}

.acct-grant-by {
  flex: 1;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acct-grant-expiry {
  flex-shrink: 0;
}

.acct-grant-rm {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.acct-grant-rm:hover {
  color: #c43030;
  background: rgba(196,48,48,0.08);
}
.acct-grant-rm-danger {
  color: #c43030;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(196,48,48,0.35) !important;
  border-radius: 4px;
}
.acct-grant-rm-danger:hover {
  background: rgba(196,48,48,0.12) !important;
  color: #a02020;
}

.acct-grant-add {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.75rem;
  border: 1px dashed rgba(0,0,0,0.12);
  border-radius: 8px;
  background: rgba(0,0,0,0.015);
}

.acct-grant-select {
  flex: 1;
  min-width: 8rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.acct-grant-select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

/* ── Account files list ──────────────────────────────────────── */

.acct-file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.acct-file-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.acct-file-card-clickable {
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.acct-file-card-clickable:hover {
  border-color: var(--accent-border);
}
.acct-file-card-clickable:hover > .acct-file-row {
  background: var(--accent-dim);
}
.acct-file-card-clickable:focus-visible {
  outline: 2px solid var(--accent-focus-border);
  outline-offset: 2px;
}

.acct-file-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(0,0,0,0.02);
}

.acct-file-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.acct-file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.acct-file-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.acct-file-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.acct-file-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.acct-file-expiry-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
  flex-wrap: wrap;
}
.acct-file-expiry-form[hidden] { display: none; }

.acct-action-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--muted);
  font-family: var(--font);
  transition: color 0.1s;
}
.acct-action-link:hover { color: var(--fg); }
.acct-action-link.danger:hover { color: #c43030; }

.acct-expiry-never {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Expiry control — preset select + optional custom date */
.expiry-control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.expiry-select {
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: none;
  cursor: pointer;
  min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s, color 0.12s, background 0.12s;
}
.add-form .expiry-select {
  min-width: 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.8125rem;
  color: var(--muted);
  border-radius: 7px;
}
.add-form .expiry-select.has-expiry {
  color: #0c6636;
  background: var(--accent-dim);
  border-color: var(--accent-border);
}
.expiry-select:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.expiry-select.has-expiry {
  color: #0c6636;
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.expiry-custom {
  padding: 0.34rem 0.5rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  color-scheme: light;
  outline: none;
}
.expiry-custom:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.expiry-custom[hidden] { display: none; }

.account-section {
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.account-section:last-child { border-bottom: none; }

.account-section h4 {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: flex-start;
  min-height: 1.8rem;
}

/* Grants summary chip rows — chip with optional expiry badge stacked below */
.grant-chip-row {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.chip-customer {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--fg);
}

.mono { font-family: var(--font-mono); font-size: 0.8em; }

.chip-row {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 0.1rem 0.1rem 0.1rem 0.55rem;
}

.chip-row .chip {
  background: none;
  border: none;
  padding: 0;
  color: #0c6636;
  font-size: 0.78rem;
}

.chip-rm {
  background: none;
  border: none;
  color: rgba(12,102,54,0.5);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0.1rem 0.4rem;
  line-height: 1;
  border-radius: 999px;
  transition: color 0.1s, background 0.1s;
}
.chip-rm:hover {
  color: #c43030;
  background: rgba(196,48,48,0.1);
}

.grant-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.1rem;
}

/* ── Misc ────────────────────────────────────────────────────── */

code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  font-size: 0.8125rem;
  color: #3a6080;
}

.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }


.empty-row td {
  color: var(--muted);
  font-style: italic;
  padding: 1.75rem;
  text-align: center;
  font-size: 0.8125rem;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-row input {
  min-width: 14rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
.filter-row input:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

td.bad { color: #c43030; }

/* Error / notice boxes */
.error-box,
.notice-box {
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  border: 1px solid transparent;
  backdrop-filter: blur(6px);
}
.error-box {
  background: rgba(196,48,48,0.08);
  border-color: rgba(196,48,48,0.3);
  color: #c43030;
}
.notice-box {
  background: var(--notice-bg);
  border-color: var(--accent-border);
  color: var(--accent);
}

.plain-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.plain-list li {
  background: rgba(0,0,0,0.04);
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--fg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 960px) {
  :root { --sidebar-w: 0px; }

  .sidebar-toggle { display: flex; }

  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.25, 0.1, 0.25, 1);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim.is-open { display: block; }

  .admin-content { padding: calc(var(--topbar-h) + 3.5rem) 1.1rem 5rem; }

  .view-head { padding-top: 1rem; padding-bottom: 1rem; }
  .view-title { font-size: 1.35rem; }

  .panel { padding: 1.1rem 1.1rem 1.25rem; }
  .upload-row { grid-template-columns: 1fr; }
  .col-email { width: auto; }
  .tbl thead th, .tbl tbody td { padding: 0.5rem 0.6rem; }
  .panel-search { min-width: 0; width: 100%; }
  .col-shared { display: none; }
  .col-owner  { display: none; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

  .view-actions { width: 100%; }
  .view-actions .panel-search { flex: 1; }

  .accounts-split { grid-template-columns: 1fr; }
  #accounts-list { max-height: 40vh; }
  .accounts-detail-body { grid-template-columns: 1fr; }
  .stats-cols { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .admin-content { padding: 3.5rem 0.8rem 4rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .panel { padding: 1rem 0.95rem 1.1rem; }
}

/* ── File details modal ──────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(15, 25, 40, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 1rem;
  overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }

body.modal-open { overflow: hidden; }

.modal {
  width: min(720px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  animation: modalIn 0.15s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.35rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.025);
}

.modal-head-main { min-width: 0; }

.modal-kicker {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.modal-title {
  margin: 0.25rem 0 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
  word-break: break-word;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.1s, border-color 0.1s, background 0.1s;
}
.modal-close:hover {
  color: var(--fg);
  border-color: var(--border-bright);
  background: rgba(0,0,0,0.04);
}

.modal-body {
  padding: 1.1rem 1.35rem 1.35rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.file-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.25rem;
  padding: 0.9rem 1rem;
  background: rgba(0,0,0,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.file-meta-item { min-width: 0; }

.file-meta-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.file-meta-value {
  font-size: 0.875rem;
  color: var(--fg);
  line-height: 1.45;
  word-break: break-word;
}
.file-meta-value.mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #3a6080;
}
.file-meta-value.break { word-break: break-all; }

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.modal-section-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0;
}

.modal-section .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}

.modal-section label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.modal-input {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  color: var(--fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}
.modal-input:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}
.modal-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.modal-section-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .file-meta-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 1rem 1rem 1.2rem; }
  .modal-head { padding: 0.9rem 1rem 0.8rem; }
}

/* ── Access view ─────────────────────────────────────────────────── */

.axis-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0,0,0,0.02);
  flex-shrink: 0;
}
.axis-btn {
  all: unset;
  cursor: pointer;
  padding: 0.38rem 0.85rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  color: var(--muted);
  border-right: 1px solid var(--border);
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}
.axis-btn:last-child { border-right: none; }
.axis-btn:hover { color: var(--fg); background: rgba(0,0,0,0.03); }
.axis-btn.is-active {
  color: #0c6636;
  background: var(--accent-dim);
}

#access-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.access-empty {
  color: var(--muted);
  font-style: italic;
  font-size: 0.8125rem;
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* File card */
.access-file-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  transition: border-color 0.12s;
}
.access-file-card:hover { border-color: var(--border-bright); }

.access-file-card-hd {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  background: rgba(0,0,0,0.025);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.access-file-id { font-size: 0.875rem; font-weight: 500; }

.access-file-name {
  font-size: 0.8125rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.access-paths {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 700px) {
  .access-paths { grid-template-columns: 1fr; }
  .access-path-direct { border-left: none !important; border-top: 1px solid var(--border); }
}

.access-path-section {
  padding: 0.85rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.access-path-section + .access-path-section {
  border-left: 1px solid var(--border);
}

.access-path-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 0.1rem;
}

.access-path-empty {
  color: var(--muted);
  font-size: 0.8125rem;
  font-style: italic;
}

.access-manage-link {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  margin-top: 0.2rem;
  display: inline-block;
  transition: color 0.12s;
}
.access-manage-link:hover { color: var(--accent); }

/* Direct customer rows */
.access-direct-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.15rem 0;
}

.access-direct-email {
  font-size: 0.8125rem;
  min-width: 12rem;
}

.access-add-direct-btn {
  all: unset;
  cursor: pointer;
  display: inline-block;
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px dashed rgba(0,0,0,0.18);
  border-radius: 6px;
  padding: 0.22rem 0.65rem;
  margin-top: 0.2rem;
  font-family: var(--font);
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.access-add-direct-btn:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.access-inline-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  background: rgba(0,0,0,0.02);
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.access-inline-email {
  padding: 0.35rem 0.6rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  background: var(--input-bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 7px;
  min-width: 14rem;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.access-inline-email:focus {
  border-color: var(--accent-focus-border);
  box-shadow: 0 0 0 3px var(--accent-focus-shadow);
}

.access-cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.38rem 0.65rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.12s;
}
.access-cancel-btn:hover { color: var(--fg); border-color: var(--border-bright); }

/* Customer card (by-customer axis) */
.access-customer-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  transition: border-color 0.12s;
}
.access-customer-card:hover { border-color: var(--border-bright); }

.access-customer-hd {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1.25rem;
  background: rgba(0,0,0,0.025);
  border-bottom: 1px solid var(--border);
}

.access-customer-email { font-size: 0.875rem; font-weight: 500; }

.access-customer-grants {
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.5rem 0.5rem;
}

.access-customer-grants .access-direct-row {
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  border-radius: 0;
}
.access-customer-grants .access-direct-row:last-child { border-bottom: none; }
