/* ===== Gilesmead — logo-aligned (sky blue) ===== */
:root {
  --brand: #0ea5e9;
  --brand-light: #38bdf8;
  --brand-subtle: rgba(14, 165, 233, 0.12);
  --sidebar-bg: #ffffff;
  --sidebar-text: #334155;
  --sidebar-active: #e0f2fe;
  --login-bg: #0f172a;
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: var(--brand);
  --accent-hover: var(--brand-light);
  --accent-subtle: var(--brand-subtle);
  --clean: #0ea5e9;
  --clean-bg: #e0f2fe;
  --needs-review: #b45309;
  --needs-review-bg: #fef3c7;
  --blocked: #b91c1c;
  --blocked-bg: #fee2e2;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 40px -10px rgba(15, 23, 42, 0.12);
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--main-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.dashboard {
  display: flex;
  min-height: 100vh;
}

.dashboard.hidden {
  display: none !important;
}

/* ----- Sidebar (white, professional) ----- */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
  border-right: 2px solid #e2e8f0;
  box-shadow: 4px 0 20px rgba(15, 23, 42, 0.06), inset -1px 0 0 rgba(14, 165, 233, 0.15);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.6rem 1rem 1.25rem;
  margin: 0 1rem 1.25rem;
}

.sidebar-brand::before {
  content: none;
}

.sidebar-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 88px;
  padding: 0.5rem 0;
}

.sidebar-logo-img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100px;
  object-fit: contain;
  object-position: center center;
  flex-shrink: 0;
  display: block;
}

.sidebar-logo,
.sidebar-logo-fallback {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: transparent;
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--brand);
  margin: 0;
  line-height: 1.3;
}

.sidebar-brand .sidebar-title {
  padding-top: 0.5rem;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

@media (min-width: 769px) {
  .sidebar-brand {
    padding: 0.75rem 1rem 1.5rem;
    margin: 0 0.75rem 1.5rem;
  }
  .sidebar-logo-wrap {
    min-height: 100px;
    padding: 0.5rem 0;
  }
  .sidebar-logo-img {
    max-height: 120px;
  }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9375rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav-item:hover {
  background: #f1f5f9;
  color: var(--text);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--brand);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  min-height: 20px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  color: currentColor;
}

/* ----- Processing popup (fancy loading → complete) ----- */
.processing-popup {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: processing-popup-in 0.25s ease;
}

.processing-popup.hidden {
  display: none !important;
}

@keyframes processing-popup-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.processing-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.processing-popup-card {
  position: relative;
  background: var(--card-bg);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  min-width: 280px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.8);
  border-top: 4px solid var(--brand);
  animation: processing-card-in 0.35s ease;
}

@keyframes processing-card-in {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.processing-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: processing-spin 0.9s linear infinite;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

.processing-popup-label {
  margin: 0;
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text);
}

.processing-complete-wrap {
  display: none;
}

.processing-complete-wrap.hidden {
  display: none !important;
}

.processing-popup.complete .processing-spinner-wrap {
  display: none;
}

.processing-popup.complete .processing-complete-wrap {
  display: block !important;
  animation: processing-complete-in 0.4s ease;
}

@keyframes processing-complete-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.processing-complete-icon {
  color: var(--brand);
  margin: 0 auto 1rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--clean-bg);
  animation: processing-check-pop 0.5s ease 0.2s both;
}

@keyframes processing-check-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.processing-popup-label-complete {
  color: var(--brand);
  font-size: 1.25rem;
}

/* ----- Main ----- */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-header {
  background: linear-gradient(180deg, var(--card-bg) 0%, #fafbfc 100%);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  padding: 1.35rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.welcome {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

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

.icon-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.icon-btn:hover {
  background: var(--accent-subtle);
  color: var(--brand);
  transform: translateY(-1px);
}

.header-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.header-auth .btn-logout {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.header-auth .btn-logout:hover {
  background: var(--accent-subtle);
  color: var(--brand);
  border-color: rgba(14, 165, 233, 0.3);
}

.main-content {
  flex: 1;
  padding: 2rem 2.25rem;
  background: linear-gradient(180deg, #f8fafc 0%, var(--main-bg) 100%);
}

.page-content {
  display: block;
}

.page-content.hidden {
  display: none !important;
}

.overview-cards-compact {
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.overview-cards-compact .overview-card {
  padding: 1rem 1.25rem;
}

.overview-cards-compact .card-value {
  font-size: 1.5rem;
}

.content-grid-upload {
  margin-bottom: 0;
}

.upload-panel-large .drop-zone-large {
  min-height: 240px;
  padding: 2rem;
}

.panel-desc {
  margin: -0.5rem 0 1rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.table-panel-full .table-wrap {
  min-height: 200px;
}

.audit-panel-full .audit-list-full {
  max-height: 70vh;
  overflow-y: auto;
}

.settings-panel .settings-grid {
  display: grid;
  gap: 1.5rem;
}

.settings-block h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.settings-block p {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.btn-secondary {
  background: var(--main-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

/* Auth banner (when not logged in) */
.auth-banner {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}

.auth-banner.hidden { display: none; }

.auth-area-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.auth-area-inline .login-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.auth-area-inline .login-form input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.auth-area-inline .user-info-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ----- Overview cards ----- */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.overview-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.overview-card:hover {
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  transform: translateY(-2px);
}

.overview-card h3 {
  margin: 0 0 0.6rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-value {
  margin: 0;
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.card-deco {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 80px;
  height: 80px;
  opacity: 0.15;
}

.card-deco-docs {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230ea5e9'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3C/svg%3E") no-repeat bottom right;
  background-size: 56px;
}

.card-deco-sensitive {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d97706'%3E%3Cpath d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3E%3C/svg%3E") no-repeat bottom right;
  background-size: 50px;
}

.overview-card-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 160px;
  padding: 1.75rem 1.5rem;
}

.compliance-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0 0;
}

.compliance-shield {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.compliance-shield svg {
  width: 36px;
  height: 36px;
  color: #fff;
}

.compliance-label {
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 1rem;
  border-radius: 6px;
}

.compliance-badge-none .compliance-shield {
  background: var(--text-muted);
}

.compliance-badge-none .compliance-label {
  background: var(--text-muted);
  color: #fff;
}

.compliance-badge.CLEAN .compliance-shield {
  background: var(--clean);
}

.compliance-badge.CLEAN .compliance-label {
  background: var(--clean);
  color: #fff;
}

.compliance-badge.NEEDS_REVIEW .compliance-shield {
  background: var(--needs-review);
}

.compliance-badge.NEEDS_REVIEW .compliance-label {
  background: var(--needs-review-bg);
  color: var(--needs-review);
}

.compliance-badge.BLOCKED .compliance-shield {
  background: var(--blocked);
}

.compliance-badge.BLOCKED .compliance-label {
  background: var(--blocked-bg);
  color: var(--blocked);
}

.compliance-message {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 200px;
}

/* ----- Content grid (Upload + Audit) ----- */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.panel {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
}

.panel-heading {
  margin: 0 0 1.35rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ----- Drop zone ----- */
.file-input {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, var(--main-bg) 100%);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  padding: 1.75rem;
  margin-bottom: 1rem;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--brand);
  background: linear-gradient(180deg, #f0f9ff 0%, var(--accent-subtle) 100%);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.08);
}

.drop-icon {
  color: var(--brand);
  margin-bottom: 0.85rem;
  opacity: 0.9;
}

.drop-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}

.drop-text strong {
  color: var(--accent);
  font-weight: 600;
}

.file-name {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

.btn {
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, #0284c7 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.btn-primary:not(:disabled):hover {
  background: linear-gradient(180deg, var(--brand-light) 0%, var(--brand) 100%);
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

.btn-process {
  width: 100%;
}

.result-msg {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
}

.result-msg.success { color: var(--clean); }
.result-msg.error { color: var(--blocked); }

/* ----- Audit trail ----- */
.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.audit-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0.85rem;
  margin: 0 -0.85rem;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--text);
  transition: background var(--transition);
}

.audit-list li:hover {
  background: #f8fafc;
}

.audit-list li:last-child {
  border-bottom: none;
}

.audit-icon {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audit-icon.clean { background: var(--clean-bg); color: var(--clean); }
.audit-icon.warning { background: var(--needs-review-bg); color: var(--needs-review); }
.audit-icon.upload { background: var(--accent-subtle); color: var(--accent); }
.audit-icon.user { background: var(--main-bg); color: var(--text-secondary); }

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

.audit-body {
  flex: 1;
  min-width: 0;
}

.audit-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.audit-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 1.25rem 0.85rem;
  text-align: center;
  background: #fafbfc;
  border-radius: var(--radius-sm);
}

/* ----- Redaction result panel ----- */
.redact-result-panel.hidden { display: none; }

.counts-section.hidden,
.preview-section.hidden { display: none; }

.counts-section {
  margin-top: 1rem;
}

.counts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.counts-grid span { color: var(--text-secondary); }
.counts-grid strong { color: var(--text); margin-left: 0.25rem; }

.total-count {
  margin: 0.75rem 0 0 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.preview-section {
  margin-top: 1.25rem;
}

.preview-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.preview-scroll {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--main-bg);
}

.preview-scroll pre {
  margin: 0;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-secondary);
}

/* ----- AI panel ----- */
.gate-notice {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand);
}

.ai-textarea {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  margin-bottom: 0.85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ai-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.error-msg { color: var(--blocked); font-size: 0.9rem; margin-top: 0.5rem; }
.error-msg.hidden { display: none; }

.ai-response.hidden { display: none; }

.ai-response h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.output-note {
  margin: 0.5rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ----- Recent Activity table ----- */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.activity-table th,
.activity-table td {
  padding: 0.85rem 1.2rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.activity-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #f8fafc;
}

.activity-table tbody tr:hover:not(.empty-row) {
  background: #f8fafc;
}

.empty-row td {
  color: var(--text-muted);
  font-style: italic;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.8rem;
}

.table-badge .table-badge-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.table-badge.clean {
  background: var(--clean);
  color: #fff;
}

.table-badge.redacted {
  background: var(--needs-review);
  color: #fff;
}

.table-badge.blocked {
  background: var(--blocked);
  color: #fff;
}

.table-doc-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.table-doc-name .doc-icon {
  color: var(--accent);
  flex-shrink: 0;
}

/* ----- Login screen — first screen, secure & attractive ----- */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--login-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.login-screen.hidden {
  display: none !important;
}

.login-screen-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--login-bg) 0%, #1e293b 40%, #0f172a 100%);
  opacity: 1;
}

.login-screen-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 80%, var(--brand-subtle) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.03) 0%, transparent 40%);
  pointer-events: none;
}

.login-screen-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 2.5rem 2.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255,255,255,0.06);
  border-top: 4px solid var(--brand);
}

.login-screen-logo {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-screen-logo img {
  max-height: 64px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.login-screen-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: var(--accent-subtle);
  color: var(--brand);
}

.login-screen-logo-fallback.hidden { display: none !important; }

.login-screen-head {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-screen-secure {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
}

.login-screen-secure svg {
  flex-shrink: 0;
}

.login-screen-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.login-screen-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.login-screen-form {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.login-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-top: 1rem;
}

.login-label:first-of-type { margin-top: 0; }

.login-input {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.login-error {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
  color: var(--blocked);
}

.login-error.hidden { display: none !important; }

.login-submit {
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  background: var(--brand);
}

.login-submit:hover {
  background: var(--brand-light);
}

.login-screen-footer {
  margin: 1.5rem 0 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ----- Recent Activity table (reference-style) ----- */
.activity-table tbody tr:nth-child(even):not(.empty-row) {
  background: #f8fafc;
}

.activity-table tbody tr:nth-child(odd):not(.empty-row) {
  background: var(--card-bg);
}

.activity-table th,
.activity-table td {
  border: 1px solid #e2e8f0;
}

.activity-table thead tr {
  background: #f8fafc;
}

.activity-table tbody tr:nth-child(even):not(.empty-row) {
  background: #f8fafc;
}

.activity-table tbody tr:nth-child(odd):not(.empty-row) {
  background: var(--card-bg);
}

.activity-table thead tr {
  background: #f8fafc;
}

/* ----- Utility ----- */
.hidden { display: none !important; }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .overview-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    padding: 1rem 1.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    border-right: none;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06), inset 0 -1px 0 rgba(14, 165, 233, 0.15);
  }
  .sidebar-brand {
    margin-bottom: 0;
    padding: 0;
  }
  .sidebar-nav {
    flex-direction: row;
    padding: 0;
  }
  .nav-item.active::before {
    left: 50%;
    top: auto;
    bottom: 0;
    transform: translateX(-50%);
    width: 60%;
    min-width: 24px;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }
  .sidebar-title { display: none; }
  .main-content { padding: 1.25rem; }
}
