/*
 * Barinhall Regulatory Intelligence Workspace — Brand stylesheet
 *
 * Extends Tailwind CSS (loaded via CDN) with Barinhall-specific tokens,
 * component classes, and layout helpers.
 *
 * Brand palette:
 *   Primary:   #5B3FA6 (deep purple)
 *   Violet:    #7C5CFA
 *   Tint:      #B7A6FF
 *   Dark bg:   #0B0B12
 *   Text head: #161625
 *   Text body: #353547
 *   Text mute: #66667A
 *   Border:    #D8D4EA
 */

/* ── Typography ─────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: #353547;
  line-height: 1.6;
}

/* ── Navigation ─────────────────────────────────────────────────────────── */

.portal-nav {
  background: #0B0B12;
  border-bottom: 1px solid #1E1E2E;
  position: sticky;
  top: 0;
  z-index: 50;
}

.portal-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-logo {
  height: 24px;
  display: block;
}

.portal-nav-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #D9D9E6;
  letter-spacing: 0.01em;
}

.portal-nav-link {
  font-size: 0.85rem;
  color: #9999B2;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.portal-nav-link:hover,
.portal-nav-link.active {
  color: #FFFFFF;
  background: rgba(91, 63, 166, 0.35);
}

.portal-client-chip {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(91, 63, 166, 0.3);
  color: #B7A6FF;
  border: 1px solid rgba(183, 166, 255, 0.3);
  padding: 0.15rem 0.6rem;
  border-radius: 100px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.portal-nav-logout {
  font-size: 0.8rem;
  color: #9999B2;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
}

.portal-nav-logout:hover { color: #FFFFFF; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.portal-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.portal-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #9999B2;
  padding: 1rem;
  border-top: 1px solid #E8E6F0;
  background: #FAFAFA;
}

/* ── Login page ─────────────────────────────────────────────────────────── */

.login-page {
  background: #F7F7FB;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: #FFFFFF;
  border: 1px solid #D8D4EA;
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 4px 24px rgba(91, 63, 166, 0.07);
}

.login-logo {
  height: 28px;
  margin: 0 auto;
}

.login-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: #161625;
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-subheading {
  font-size: 0.85rem;
  color: #66667A;
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-contact-line {
  font-size: 0.8rem;
  color: #66667A;
  text-align: center;
  margin-top: 1.5rem;
}

.login-footer {
  font-size: 0.72rem;
  color: #9999B2;
  text-align: center;
  margin-top: 2rem;
}

/* ── Page header ────────────────────────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #161625;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 0.85rem;
  color: #66667A;
  margin-top: 0.2rem;
}

.section-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: #161625;
  margin-bottom: 0.75rem;
}

/* ── Alert band ─────────────────────────────────────────────────────────── */

.alert-band-t1 {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #991B1B;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.alert {
  padding: 0.75rem 1.1rem;
  border-radius: 7px;
  font-size: 0.88rem;
}

.alert-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

/* ── Stats row ──────────────────────────────────────────────────────────── */

.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  min-width: 120px;
}

.stat-card-highlight {
  border-color: #FECACA;
  background: #FEF2F2;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #161625;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: #66667A;
  margin-top: 0.3rem;
}

/* ── Table card ─────────────────────────────────────────────────────────── */

.table-card {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  background: #F7F5FC;
  color: #353547;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #D8D4EA;
  white-space: nowrap;
}

.table-row {
  border-bottom: 1px solid #F0EEF8;
  transition: background 0.1s;
}

.table-row:hover { background: #FAFAFE; }
.table-row:last-child { border-bottom: none; }

.data-table td {
  padding: 0.65rem 0.85rem;
  vertical-align: top;
}

.row-t1 { border-left: 3px solid #DC2626; }
.row-t2 { border-left: 3px solid #D97706; }
.row-gap { border-left: 3px solid #F97316; background: #FFFBEB; }

/* Column sizing */
.col-title { min-width: 220px; max-width: 340px; }
.col-score { width: 100px; text-align: center !important; }
.col-category { min-width: 140px; }
.col-date { min-width: 100px; white-space: nowrap; }
.col-days { width: 60px; text-align: center !important; }

/* ── Item link ──────────────────────────────────────────────────────────── */

.item-link {
  font-weight: 600;
  color: #161625;
  text-decoration: none;
  display: block;
  line-height: 1.35;
}

.item-link:hover { color: #5B3FA6; text-decoration: underline; }

.item-driver {
  font-size: 0.78rem;
  color: #66667A;
  margin-top: 0.2rem;
  line-height: 1.3;
}

.item-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 0.3rem;
}

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

.chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 100px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Tier chips */
.chip-t1 { background: #FEE2E2; color: #DC2626; }
.chip-t2 { background: #FEF3C7; color: #D97706; }
.chip-t3 { background: #DBEAFE; color: #2563EB; }
.chip-t4 { background: #F3F4F6; color: #6B7280; }

/* Source chip */
.chip-source {
  background: #EEEAFB;
  color: #5B3FA6;
  border: 1px solid #D8D4EA;
}

/* Confidence */
.chip-conf-high   { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.chip-conf-medium { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.chip-conf-low    { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* Doc type */
.chip-doctype { background: #F1F5F9; color: #475569; border: 1px solid #CBD5E1; }

/* Flag chips */
.chip-flag { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; font-size: 0.65rem; padding: 0.1rem 0.4rem; }
.chip-flag-detail { background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE; }

/* Function / institution chips */
.chip-function    { background: #F0F9FF; color: #0369A1; border: 1px solid #BAE6FD; }
.chip-institution { background: #F7F5FF; color: #6D28D9; border: 1px solid #DDD6FE; }

/* Effective Date Status chips — shown in place of '—' when date is intentionally null */
.chip-date-status {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-date-status--no-date-advisory-only  { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.chip-date-status--no-date-out-of-window  { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }
.chip-date-status--no-date-relative-only  { background: #FEF9C3; color: #854D0E; border: 1px solid #FDE68A; }
.chip-date-status--no-date-not-stated     { background: #F1F5F9; color: #64748B; border: 1px solid #CBD5E1; }

/* Acknowledgment chips */
.chip-ack { border: none; }
.chip-ack-unreviewed { background: #F3F4F6; color: #6B7280; }
.chip-ack-reviewed   { background: #F0FDF4; color: #166534; }
.chip-ack-routed     { background: #EFF6FF; color: #1D4ED8; }
.chip-ack-in_progress { background: #FFFBEB; color: #92400E; }
.chip-ack-closed     { background: #F1F5F9; color: #475569; }
.chip-ack-lg { font-size: 0.82rem; padding: 0.3rem 0.8rem; }

/* Score badge */
.score-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.72rem;
  border-radius: 6px;
  padding: 0.15rem 0.65rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.score-0, .score-1 { background: #F3F4F6; color: #6B7280; }
.score-2           { background: #DBEAFE; color: #1E40AF; }
.score-3           { background: #FEF3C7; color: #92400E; }
.score-4           { background: #FEE2E2; color: #991B1B; }
.score-5           { background: #DC2626; color: #FFFFFF; }

/* ── Filter card ────────────────────────────────────────────────────────── */

.filter-card {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-form { width: 100%; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.filter-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 160px; flex: 1; }
.filter-field-sm { min-width: 120px; flex: 0 1 140px; }
.filter-label { font-size: 0.75rem; font-weight: 600; color: #66667A; text-transform: uppercase; letter-spacing: 0.04em; }
.filter-input, .filter-select { font-size: 0.875rem; border: 1px solid #D1D5DB; border-radius: 6px; padding: 0.45rem 0.7rem; background: #FFFFFF; color: #161625; width: 100%; outline: none; }
.filter-input:focus, .filter-select:focus { border-color: #7C5CFA; box-shadow: 0 0 0 3px rgba(124, 92, 250, 0.12); }
.filter-actions { display: flex; gap: 0.5rem; align-items: flex-end; flex-shrink: 0; }

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

.btn-primary {
  display: inline-block;
  background: #5B3FA6;
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1.1rem;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
  text-align: center;
}
.btn-primary:hover { background: #4B338A; }

.btn-secondary {
  display: inline-block;
  background: #FFFFFF;
  color: #353547;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  border: 1px solid #D1D5DB;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}
.btn-secondary:hover { border-color: #5B3FA6; background: #F7F5FC; }

.btn-xs {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5B3FA6;
  border: 1px solid #D8D4EA;
  border-radius: 5px;
  padding: 0.2rem 0.6rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s;
}
.btn-xs:hover { background: #EEEAFB; }

/* Row action group — bookmark + View link live in a flex container so they
   share a baseline and are spaced intentionally. Used in dashboard + triage. */
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

/* Inline bookmark toggle — list views (dashboard, triage) */
.btn-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;      /* ~2× the original 0.85rem glyph size */
  line-height: 1;          /* prevent emoji from inflating line-box height */
  background: transparent;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  padding: 0.15rem 0.45rem; /* vertical matches .btn-xs so heights align */
  cursor: pointer;
  color: #94A3B8;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.btn-bookmark:hover { border-color: #F59E0B; color: #D97706; background: #FFFBEB; }
.btn-bookmark-active { color: #F59E0B; border-color: #FDE68A; background: #FFFBEB; }

.btn-danger-xs {
  font-size: 0.75rem;
  font-weight: 600;
  color: #DC2626;
  border: 1px solid #FECACA;
  border-radius: 5px;
  padding: 0.2rem 0.6rem;
  background: transparent;
  cursor: pointer;
  transition: background 0.12s;
}
.btn-danger-xs:hover { background: #FEF2F2; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #353547;
  margin-bottom: 0.3rem;
}

.form-input {
  display: block;
  width: 100%;
  font-size: 0.875rem;
  border: 1px solid #D1D5DB;
  border-radius: 7px;
  padding: 0.5rem 0.75rem;
  background: #FFFFFF;
  color: #161625;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-input:focus {
  border-color: #7C5CFA;
  box-shadow: 0 0 0 3px rgba(124, 92, 250, 0.12);
}

textarea.form-input { resize: vertical; }

.form-hint {
  font-size: 0.73rem;
  color: #66667A;
  margin-top: 0.25rem;
}

/* ── Item detail layout ─────────────────────────────────────────────────── */

.item-header {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.item-header-main { flex: 1; }

.item-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #161625;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.item-primary-driver {
  font-size: 0.88rem;
  color: #66667A;
  line-height: 1.4;
}

.item-score-block {
  text-align: center;
  flex-shrink: 0;
  padding: 0.5rem;
}

.big-score {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  border-radius: 12px;
  padding: 0.6rem 1.1rem;
  display: inline-block;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.big-score-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #66667A;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.4rem;
}

.top-cat-label {
  font-size: 0.78rem;
  color: #66667A;
  margin-top: 0.2rem;
}

.item-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  align-items: start;
}

.back-link {
  font-size: 0.85rem;
  color: #5B3FA6;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

/* ── Detail cards ───────────────────────────────────────────────────────── */

.detail-card {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.detail-card-meta {
  background: #F7F7FB;
  border-color: #E8E6F0;
}

.detail-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #66667A;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid #F0EEF8;
  padding-bottom: 0.6rem;
}

.detail-grid { display: flex; flex-direction: column; gap: 0; }

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid #F7F5FC;
  font-size: 0.875rem;
  gap: 1rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt { color: #66667A; font-weight: 500; flex-shrink: 0; }
.detail-row dd { color: #161625; text-align: right; word-break: break-word; }

.detail-sublabel {
  font-size: 0.75rem;
  font-weight: 600;
  color: #66667A;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.detail-narrative {
  font-size: 0.875rem;
  color: #353547;
  line-height: 1.65;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 5px; }

.meta-row {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: #66667A;
  flex-wrap: wrap;
}

/* ── Category scores grid ───────────────────────────────────────────────── */

.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.category-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.category-name {
  width: 140px;
  flex-shrink: 0;
  color: #353547;
  font-weight: 500;
}

.category-bar-wrap {
  flex: 1;
  background: #F0EEF8;
  border-radius: 100px;
  height: 7px;
  overflow: hidden;
}

.category-bar {
  height: 100%;
  border-radius: 100px;
  min-width: 3px;
  transition: width 0.3s ease;
}

.category-score {
  width: 20px;
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
  color: #353547;
  flex-shrink: 0;
}

/* ── Acknowledgment panel ───────────────────────────────────────────────── */

.ack-panel {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
  padding: 1.25rem;
  position: sticky;
  top: 72px;
}

.ack-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #66667A;
  margin-bottom: 1rem;
  border-bottom: 1px solid #F0EEF8;
  padding-bottom: 0.6rem;
}

.ack-current {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #F0EEF8;
}

.ack-meta { font-size: 0.8rem; color: #353547; margin-top: 0.5rem; }
.ack-note { font-size: 0.8rem; color: #66667A; margin-top: 0.35rem; font-style: italic; }
.ack-updated-by { font-size: 0.72rem; color: #9999B2; margin-top: 0.3rem; }

.ack-form { font-size: 0.875rem; }

/* ── Callout card ───────────────────────────────────────────────────────── */

.callout-card {
  background: #F7F5FC;
  border: 1px solid #D8D4EA;
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}

.callout-text { font-size: 0.875rem; color: #353547; line-height: 1.55; }

/* ── Admin layout ───────────────────────────────────────────────────────── */

.admin-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* ── Empty state ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 10px;
}

.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }

.empty-state-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: #161625;
  margin-bottom: 0.4rem;
}

.empty-state-body { font-size: 0.875rem; color: #66667A; }

/* ── N/A chip and row state ──────────────────────────────────────────────── */

.chip-na {
  background: #F3F4F6;
  color: #6B7280;
  border: 1px solid #D1D5DB;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.row-na {
  opacity: 0.55;
}

.row-na .item-link {
  color: #9999B2;
}

/* ── Item actions bar (overlay: N/A + Bookmark + Source URL) ─────────────── */

.item-actions-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: #F7F5FC;
  border: 1px solid #D8D4EA;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.item-actions-left {
  display: flex;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.item-actions-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* N/A active row (chip + reason text + clear button) */
.na-active-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.na-reason-text {
  font-size: 0.82rem;
  color: #353547;
  font-style: italic;
  flex: 1;
  min-width: 0;
}

/* N/A <details> expand pattern */
.na-details {
  width: 100%;
}

.na-details-trigger {
  font-size: 0.82rem;
  font-weight: 600;
  color: #5B3FA6;
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0;
  user-select: none;
}

.na-details-trigger::-webkit-details-marker { display: none; }

.na-details-trigger::before {
  content: '▸';
  font-size: 0.7rem;
  transition: transform 0.15s;
  display: inline-block;
}

.na-details[open] .na-details-trigger::before {
  transform: rotate(90deg);
}

.na-details-trigger:hover { color: #4B338A; }

.na-details-body {
  padding: 0.75rem 0 0.25rem 0;
}

/* ── Small form variants (used in actions bar) ───────────────────────────── */

.form-label-sm {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #353547;
  margin-bottom: 0.25rem;
}

.form-input-sm {
  display: block;
  width: 100%;
  max-width: 480px;
  font-size: 0.82rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  background: #FFFFFF;
  color: #161625;
  outline: none;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input-sm:focus {
  border-color: #7C5CFA;
  box-shadow: 0 0 0 3px rgba(124, 92, 250, 0.12);
}

/* ── Button variants ─────────────────────────────────────────────────────── */

.btn-sm {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
}

.btn-active {
  background: #F0EBF8;
  border-color: #B7A6FF;
  color: #5B3FA6;
  font-weight: 600;
}

.btn-ghost {
  background: transparent;
  border: 1px solid #D1D5DB;
  color: #6B7280;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.btn-ghost:hover {
  background: #F3F4F6;
  border-color: #9CA3AF;
}

.inline-form {
  display: inline;
}

/* ── Derived date label ──────────────────────────────────────────────────── */

.derived-date-label {
  font-size: 0.7rem;
  color: #9999B2;
  font-weight: 500;
  font-style: italic;
}

/* ── AI disclosure strip ─────────────────────────────────────────────────── */

.ai-disclosure {
  font-size: 0.75rem;
  color: #66667A;
  line-height: 1.55;
  background: #F7F7FB;
  border: 1px solid #E8E6F0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.ai-disclosure strong {
  color: #353547;
  font-weight: 600;
}

/* ── Archive info band ───────────────────────────────────────────────────── */

.archive-info-band {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #F8F7FC;
  border: 1px solid #D8D4EA;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #353547;
  margin-bottom: 1.25rem;
}

/* ── Archived row and chip ───────────────────────────────────────────────── */

.row-archived {
  opacity: 0.65;
  background: #FAFAFA;
}

.row-archived .item-link {
  color: #9999B2;
}

.chip-archived {
  background: #F3F4F6;
  color: #6B7280;
  border: 1px solid #D1D5DB;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  margin-left: 0.35rem;
  vertical-align: middle;
  text-transform: uppercase;
}

/* ── Nav count chip (Saved nav link badge) ───────────────────────────────── */

.nav-count-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  background: #7C5CFA;
  color: #FFFFFF;
  border-radius: 100px;
  min-width: 16px;
  height: 16px;
  padding: 0 0.3rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  line-height: 1;
}

/* ── New-since-last-visit chips ──────────────────────────────────────────── */

.chip-new {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chip-new-inline {
  vertical-align: middle;
  font-size: 0.58rem;
  padding: 0.1rem 0.4rem;
  margin-right: 0.2rem;
  border-radius: 3px;
}

.chip-new-lg {
  display: inline-block;
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 100px;
  padding: 0.15rem 0.6rem;
  letter-spacing: 0.03em;
}

/* ── New-since banner ────────────────────────────────────────────────────── */

.new-since-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: #166534;
  margin-bottom: 1.25rem;
}

/* ── Dashboard controls strip (source filter + sort) ─────────────────────── */

.dashboard-controls {
  background: #FFFFFF;
  border: 1px solid #E8E6F0;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
}

.dashboard-controls-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.filter-select-inline {
  width: auto;
  min-width: 130px;
  flex: 0 0 auto;
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

/* ── Sortable column headers ─────────────────────────────────────────────── */

.sortable-th {
  white-space: nowrap;
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sort-link:hover {
  color: #5B3FA6;
}

.sort-indicator {
  font-size: 0.7rem;
  color: #7C5CFA;
  margin-left: 0.15rem;
}

/* ── Executive Summary card ──────────────────────────────────────────────── */

.detail-card-summary {
  border-left: 3px solid #7C5CFA;
}

.executive-summary-text {
  font-size: 0.925rem;
  line-height: 1.7;
  color: #161625;
}

/* ── Saved items "View all saved" CTA link ───────────────────────────────── */

.saved-cta-link {
  font-size: 0.78rem;
  color: #5B3FA6;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.35rem 0;
}

.saved-cta-link:hover {
  text-decoration: underline;
}

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

@media (max-width: 900px) {
  .item-layout { grid-template-columns: 1fr; }
  .ack-panel { position: static; }
  .admin-layout { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .portal-nav-inner { flex-direction: column; height: auto; padding: 0.75rem 1.25rem; gap: 0.5rem; }
  .item-header { flex-direction: column; }
  .item-score-block { text-align: left; }
  .item-actions-bar { flex-direction: column; }
  .item-actions-right { width: 100%; justify-content: flex-start; }
  .dashboard-controls-form { gap: 0.5rem; }
}
