/* style.css — PatentInsight Pro — Full Component Styles */

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;

  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 64px;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f8fafc;
  --sidebar-accent: #0d9488;
  --sidebar-hover-bg: rgba(255,255,255,0.05);

  /* Header */
  --header-h: 64px;

  /* Patent Colors */
  --patent-1: #0d9488;
  --patent-1-light: #ccfbf1;
  --patent-1-bg: rgba(13,148,136,0.08);
  --patent-2: #6366f1;
  --patent-2-light: #e0e7ff;
  --patent-2-bg: rgba(99,102,241,0.08);
  --patent-3: #d97706;
  --patent-3-light: #fef3c7;
  --patent-3-bg: rgba(217,119,6,0.08);

  /* Verdict Colors */
  --go: #059669;
  --go-bg: rgba(5,150,105,0.1);
  --conditional: #d97706;
  --conditional-bg: rgba(217,119,6,0.1);
  --nogo: #dc2626;
  --nogo-bg: rgba(220,38,38,0.1);

  /* Content Area (Light Mode) */
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-2: #f1f5f9;
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  --color-accent: #0d9488;
  --color-accent-hover: #0f766e;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-2: #334155;
  --color-text: #f1f5f9;
  --color-text-secondary: #cbd5e1;
  --color-text-muted: #64748b;
  --color-border: #334155;
  --color-border-light: #1e293b;

  --shadow-xs:  0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.25);
  --shadow-lg:  0 10px 25px rgba(0,0,0,0.35);
  --shadow-xl:  0 20px 50px rgba(0,0,0,0.4);
}

[data-theme="dark"] .sidebar {
  --sidebar-bg: #020617;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-surface-2: #334155;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #64748b;
    --color-border: #334155;
    --color-border-light: #1e293b;
  }
}

/* ===== LOGIN PAGE ===== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  padding: var(--space-4);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-10);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
  justify-content: center;
}

.login-logo svg {
  width: 40px;
  height: 40px;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  font-weight: 400;
}

.login-logo span {
  color: var(--color-accent);
}

.login-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
}

.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.form-group input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

.login-btn {
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
  margin-top: var(--space-2);
}

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

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

.login-error {
  color: var(--nogo);
  font-size: var(--text-sm);
  text-align: center;
  margin-top: var(--space-4);
  display: none;
}

.login-error.visible {
  display: block;
}

.demo-accounts {
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
}

.demo-accounts h3 {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  font-weight: 600;
}

.demo-account-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  background: transparent;
}

.demo-account-btn:hover {
  border-color: var(--color-accent);
  background: rgba(13,148,136,0.04);
  color: var(--color-text);
}

.demo-account-btn strong {
  color: var(--color-text);
}

/* ===== DASHBOARD LAYOUT ===== */
html.dashboard-active, html.dashboard-active body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  height: 100dvh;
  background: var(--color-bg);
}

/* ===== SIDEBAR ===== */
.sidebar {
  grid-row: 1 / -1;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 30;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  width: var(--sidebar-w);
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  overflow: hidden;
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-link-text,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-user-info {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
  transform: rotate(0deg);
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: all 0.2s ease;
  transform: rotate(180deg);
}

.sidebar-collapse-btn svg {
  width: 16px;
  height: 16px;
}

.sidebar-collapse-btn:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sidebar-brand h2 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: #f8fafc;
  font-weight: 400;
  white-space: nowrap;
}

.sidebar-brand span {
  color: var(--patent-1);
}

.sidebar-nav {
  padding: var(--space-4) var(--space-3);
  flex: 1;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(148,163,184,0.5);
  padding: var(--space-4) var(--space-3) var(--space-2);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  margin-bottom: 2px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
}

.sidebar-link:hover svg {
  opacity: 1;
}

.sidebar-link.active {
  background: rgba(13,148,136,0.15);
  color: var(--sidebar-text-active);
}

.sidebar-link.active svg {
  opacity: 1;
  color: var(--patent-1);
}

.patent-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--patent-1), var(--patent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  text-transform: capitalize;
}

/* ===== HEADER ===== */
.header {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 20;
  gap: var(--space-4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.hamburger {
  display: none;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
}

.hamburger:hover {
  background: var(--color-surface-2);
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.header-breadcrumb .current {
  color: var(--color-text);
  font-weight: 600;
}

.header-breadcrumb svg {
  width: 16px;
  height: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.header-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.header-btn svg {
  width: 20px;
  height: 20px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(220,38,38,0.08);
  color: var(--nogo);
}

/* ===== MAIN CONTENT ===== */
.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-6);
}

/* ===== FULL-WIDTH OVERVIEW LAYOUT ===== */
.overview-fullwidth {
  width: 100%;
  height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #0f172a;
  position: relative;
}

/* User badge top-right */
.overview-user-badge {
  position: fixed;
  top: var(--space-4);
  right: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 50;
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-2);
}

.overview-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--patent-1), var(--patent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.overview-user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
}

.overview-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.5);
  transition: all 0.18s ease;
}

.overview-logout:hover {
  background: rgba(220,38,38,0.2);
  color: #f87171;
}

.overview-admin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 500;
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
}
.overview-admin-btn:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* ===== HERO (Photo-based) ===== */
.overview-hero-photo {
  position: relative;
  width: 100%;
  min-height: 300px;
  background: url('hero-islands.jpg') center center / cover no-repeat;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-10) var(--space-6) var(--space-8);
}

/* Light overlay gradient blending into the dark background below */
.overview-hero-photo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.0) 30%,
    rgba(15, 23, 42, 0.0) 55%,
    rgba(15, 23, 42, 0.55) 80%,
    #0f172a 100%
  );
  pointer-events: none;
}

/* Overview body (below hero) */
.overview-body {
  position: relative;
  z-index: 2;
  padding: var(--space-4) var(--space-8) var(--space-10);
  max-width: 1400px;
  margin: 0 auto;
}

/* Scroll indicator dot between hero and cards */
.overview-scroll-dot {
  display: flex;
  justify-content: center;
  padding: var(--space-3) 0 var(--space-5);
}

.overview-scroll-dot span {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.25);
}

/* Frosted glass title card */
.hero-title-card {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  justify-content: center;
}

.hero-title-card-inner {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: var(--radius-2xl);
  padding: var(--space-6) var(--space-10);
  max-width: 580px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.5);
}

.hero-title-card-inner h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 1rem + 2vw, 2.8rem);
  font-weight: 400;
  color: #0f2b5b;
  margin-bottom: var(--space-2);
  text-shadow: none;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.hero-title-card-inner p {
  font-size: var(--text-sm);
  color: #1e3a6e;
  max-width: 50ch;
  margin: 0 auto;
  letter-spacing: 0.02em;
}

/* Legacy .hero-title-area (kept for compatibility) */
.hero-title-area {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-bottom: var(--space-6);
}

.hero-title-area h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: #fef3c7;
  margin-bottom: var(--space-2);
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.hero-title-area p {
  font-size: var(--text-sm);
  color: rgba(254, 243, 199, 0.7);
  max-width: 50ch;
  margin: 0 auto;
}

.hero-kpi-strip {
  position: relative;
  z-index: 2;
  padding: 0 var(--space-6);
}

.hero-kpi-strip .kpi-strip {
  margin-bottom: 0;
}

.hero-kpi-strip .kpi-chip {
  background: rgba(15, 25, 50, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
}

.hero-kpi-strip .kpi-label {
  color: rgba(148, 175, 220, 0.7);
}

.hero-kpi-strip .kpi-value {
  color: #e8f0ff;
}

/* ===== KPI STRIP (Compact) ===== */
.kpi-strip {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  padding-bottom: var(--space-2);
}

.kpi-chip {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  min-width: 150px;
  flex: 1;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.kpi-chip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.kpi-chip[data-accent="teal"]::before { background: var(--patent-1); }
.kpi-chip[data-accent="indigo"]::before { background: var(--patent-2); }
.kpi-chip[data-accent="amber"]::before { background: var(--patent-3); }
.kpi-chip[data-accent="green"]::before { background: var(--go); }
.kpi-chip[data-accent="multi"]::before { background: linear-gradient(90deg, var(--patent-1), var(--patent-2), var(--patent-3)); }

.kpi-chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.kpi-icon svg {
  width: 18px;
  height: 18px;
}

.kpi-icon.teal   { background: var(--patent-1-bg); color: var(--patent-1); }
.kpi-icon.indigo { background: var(--patent-2-bg); color: var(--patent-2); }
.kpi-icon.amber  { background: var(--patent-3-bg); color: var(--patent-3); }
.kpi-icon.green  { background: var(--go-bg); color: var(--go); }
.kpi-icon.multi  { background: linear-gradient(135deg, var(--patent-1-bg), var(--patent-2-bg)); color: var(--patent-1); }

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.kpi-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.1;
}

/* Legacy kpi-grid support */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* ===== SECTION HEADER ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  font-weight: 400;
}

/* ===== DARK OVERVIEW SECTION HEADER ===== */
.overview-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding: 0 var(--space-1);
}

.overview-section-header .section-title {
  color: #e2e8f0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
}

/* ===== PATENT DARK CARDS (Overview Grid) ===== */
.patent-square-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

/* Dark card design matching reference image */
.patent-square {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--card-accent, #0d9488);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
}

.patent-square:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
  border-left-width: 4px;
  background: #ffffff;
}

/* Colored left-border glow on hover */
.patent-square[data-color="teal"]:hover  { box-shadow: 0 12px 32px rgba(0,0,0,0.1), -2px 0 20px rgba(13,148,136,0.2); }
.patent-square[data-color="indigo"]:hover { box-shadow: 0 12px 32px rgba(0,0,0,0.1), -2px 0 20px rgba(99,102,241,0.2); }
.patent-square[data-color="amber"]:hover  { box-shadow: 0 12px 32px rgba(0,0,0,0.1), -2px 0 20px rgba(217,119,6,0.2); }

/* Keep accent strip class for compatibility but hide it */
.patent-square-accent {
  display: none;
}

.patent-square-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
}

/* Company logo badge (colored rounded rectangle) */
.patent-square-badge {
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.company-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 60px;
  line-height: 1;
}

.patent-square-id {
  font-size: var(--text-xs);
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-family: 'DM Mono', 'Fira Code', monospace;
}

.patent-square-title {
  font-size: var(--text-base);
  color: #0f172a;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.patent-square-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: #475569;
  margin-bottom: var(--space-4);
}

.patent-square-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.patent-square-meta svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.65;
}

/* Applicant label (standalone, below title) */
.patent-square-applicant {
  font-size: var(--text-xs);
  color: #64748b;
  margin-bottom: var(--space-1);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.patent-square-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-top: var(--space-3);
  margin-top: auto;
  border-top: 1px solid #e2e8f0;
}

/* Classification / status badges with colored outlines */
.patent-dark-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.patent-square-opps {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #64748b;
  margin-left: auto;
  white-space: nowrap;
}

.patent-square-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #64748b;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.patent-square-arrow svg {
  width: 14px;
  height: 14px;
}

.patent-square:hover .patent-square-arrow {
  background: var(--card-accent, #0d9488);
  color: white;
}

/* Legacy patent card classes (keep for compatibility) */
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.meta-value {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge-teal   { background: var(--patent-1-bg); color: var(--patent-1); }
.badge-indigo { background: var(--patent-2-bg); color: var(--patent-2); }
.badge-amber  { background: var(--patent-3-bg); color: var(--patent-3); }
.badge-go     { background: var(--go-bg); color: var(--go); }
.badge-conditional { background: var(--conditional-bg); color: var(--conditional); }
.badge-nogo   { background: var(--nogo-bg); color: var(--nogo); }
.badge-neutral { background: var(--color-surface-2); color: var(--color-text-secondary); }

.view-btn {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: gap var(--transition-fast);
}

.view-btn:hover {
  gap: var(--space-2);
}

/* ===== PATENT BANNER ===== */
.patent-banner {
  position: relative;
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
.patent-banner img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
  display: block;
}
.patent-banner-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(0,0,0,0.35) 0%, transparent 100%);
  pointer-events: none;
}
@media (max-width: 768px) {
  .patent-banner { max-height: 140px; }
  .patent-banner img { height: 140px; }
}

/* ===== PATENT DETAIL PAGE ===== */
.patent-detail-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.back-btn-prominent {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  align-self: flex-start;
}

.back-btn-prominent svg {
  width: 18px;
  height: 18px;
}

.back-btn-prominent:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.patent-detail-info h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-text);
  font-weight: 400;
  margin-bottom: var(--space-2);
}

.patent-detail-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.patent-detail-meta .badge {
  font-size: var(--text-xs);
}

.patent-id-display {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ===== SHEET-STYLE TABS ===== */
.sheet-tabs-bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-5);
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xl);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.sheet-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.sheet-tab-icon svg {
  width: 18px;
  height: 18px;
}

.sheet-tab-label {
  line-height: 1;
}

.sheet-tab:hover {
  border-color: var(--tab-color, var(--color-accent));
  color: var(--color-text);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.sheet-tab.active {
  background: var(--tab-color, var(--color-accent));
  border-color: var(--tab-color, var(--color-accent));
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.sheet-tab.active .sheet-tab-icon {
  color: white;
}

.tab-panels {
  /* Wrapper for tab content */
}

.tab-content {
  display: none;
  animation: tabSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-content.active {
  display: block;
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== CONTENT CARDS ===== */
.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}

/* Revenue tab opportunity color coding */
.content-card.opp-color-0 { background: #eff6ff; border-color: #bfdbfe; }
.content-card.opp-color-1 { background: #fff1f2; border-color: #fecdd3; }
.content-card.opp-color-2 { background: #f0fdf4; border-color: #bbf7d0; }

[data-theme="dark"] .content-card.opp-color-0 { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .content-card.opp-color-1 { background: #1e1a2e; border-color: #3b2840; }
[data-theme="dark"] .content-card.opp-color-2 { background: #1a2e1e; border-color: #2d4a33; }

.content-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.content-card-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}

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

.content-card-icon svg {
  width: 18px;
  height: 18px;
}

.content-card-icon.teal   { background: var(--patent-1-bg); color: var(--patent-1); }
.content-card-icon.indigo { background: var(--patent-2-bg); color: var(--patent-2); }
.content-card-icon.amber  { background: var(--patent-3-bg); color: var(--patent-3); }

/* ===== INNOVATION CARDS ===== */
.innovations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.innovation-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  transition: all var(--transition-fast);
}

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

.innovation-card .inno-number {
  font-size: var(--text-xs);
  font-weight: 700;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
}

.innovation-card .inno-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.innovation-card .inno-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== RISK CARDS ===== */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.risk-card {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border-left: 4px solid;
}

.risk-card.technical {
  background: rgba(99,102,241,0.05);
  border-left-color: var(--patent-2);
}

.risk-card.regulatory {
  background: rgba(217,119,6,0.05);
  border-left-color: var(--patent-3);
}

.risk-card.market {
  background: rgba(220,38,38,0.05);
  border-left-color: var(--nogo);
}

.risk-card.commercial {
  background: rgba(13,148,136,0.05);
  border-left-color: var(--patent-1);
}

.risk-card.legal {
  background: rgba(99,102,241,0.05);
  border-left-color: var(--patent-2);
}

.risk-card h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.risk-card ul {
  list-style: none;
  padding: 0;
}

.risk-card li {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
  padding-left: var(--space-4);
  position: relative;
}

.risk-card li::before {
  content: '•';
  position: absolute;
  left: var(--space-1);
  color: var(--color-text-muted);
}

/* ===== OPPORTUNITY CARDS ===== */
.opportunity-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xs);
}

/* Opportunity color coding: blue, rose, green for opportunities 1, 2, 3 */
.opportunity-card.opp-color-0 { background: #eff6ff; border-color: #bfdbfe; }
.opportunity-card.opp-color-1 { background: #fff1f2; border-color: #fecdd3; }
.opportunity-card.opp-color-2 { background: #f0fdf4; border-color: #bbf7d0; }

[data-theme="dark"] .opportunity-card.opp-color-0 { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .opportunity-card.opp-color-1 { background: #1e1a2e; border-color: #3b2840; }
[data-theme="dark"] .opportunity-card.opp-color-2 { background: #1a2e1e; border-color: #2d4a33; }

.opp-header {
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border);
}

.opp-header-left h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.opp-header-left .opp-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.opp-rank {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
}

.opp-score {
  font-size: var(--text-sm);
  font-weight: 700;
}

.opp-body {
  padding: var(--space-6);
}

.opp-section {
  margin-bottom: var(--space-6);
}

.opp-section:last-child {
  margin-bottom: 0;
}

.opp-section h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.opp-section p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ===== DATA TABLES ===== */
.data-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.data-table {
  width: 100%;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th {
  background: var(--color-surface-2);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(13,148,136,0.02);
}

.data-table .number {
  text-align: right;
  font-weight: 600;
}

/* ===== FIX: SVG ICON SIZE IN SECTION HEADERS ===== */
.opp-section h4 svg,
.content-card-header svg,
.opp-header svg,
.opp-section > h4 > svg,
.main svg[viewBox] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px;
  max-width: 18px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Exceptions: chart canvases and sidebar/header icons are handled separately */
.sidebar svg[viewBox] {
  width: 20px !important;
  height: 20px !important;
}

.header svg[viewBox] {
  width: 20px !important;
  height: 20px !important;
}

.sheet-tab svg[viewBox] {
  width: 18px !important;
  height: 18px !important;
}

.kpi-icon svg[viewBox] {
  width: 18px !important;
  height: 18px !important;
}

.patent-square-meta svg[viewBox] {
  width: 14px !important;
  height: 14px !important;
}

.patent-square-arrow svg[viewBox] {
  width: 16px !important;
  height: 16px !important;
}

/* Global fallback for inline SVGs without explicit size */
svg:not([width]):not([class]) {
  width: 1em;
  height: 1em;
}

/* ===== CHART CONTAINERS ===== */
.chart-container {
  position: relative;
  width: 100%;
  padding: var(--space-4);
}

.chart-container.donut {
  max-width: 200px !important;
  width: 200px !important;
  height: 200px !important;
  margin: 0 auto;
  flex-shrink: 0;
  padding: 0;
  overflow: hidden;
}

.chart-container.donut canvas {
  max-width: 200px !important;
  max-height: 200px !important;
}

.chart-container.bar {
  height: 320px;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: var(--space-6);
  align-items: start;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

/* ===== BMC GRID ===== */
.bmc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-3);
}

.bmc-cell {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.bmc-cell h5 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.bmc-cell p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== CLIMATE / ESG ===== */
.esg-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

/* ESG card opportunity color coding */
.esg-card.opp-color-0 { background: #eff6ff; border-color: #bfdbfe; }
.esg-card.opp-color-1 { background: #fff1f2; border-color: #fecdd3; }
.esg-card.opp-color-2 { background: #f0fdf4; border-color: #bbf7d0; }

[data-theme="dark"] .esg-card.opp-color-0 { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .esg-card.opp-color-1 { background: #1e1a2e; border-color: #3b2840; }
[data-theme="dark"] .esg-card.opp-color-2 { background: #1a2e1e; border-color: #2d4a33; }

.esg-card h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sdg-badges {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-top: var(--space-3);
}

.sdg-badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: rgba(5,150,105,0.1);
  color: var(--go);
}

/* ===== ABSTRACT TEXT ===== */
.abstract-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.75;
  max-width: 72ch;
}

.abstract-text p {
  margin-bottom: var(--space-4);
}

/* ===== HIGHLIGHT BOX ===== */
.highlight-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
}

.highlight-box h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.highlight-box ul {
  list-style: none;
  padding: 0;
}

.highlight-box li {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-1) 0;
  padding-left: var(--space-4);
  position: relative;
}

.highlight-box li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

/* ===== NOVELTY SECTION ===== */
.novelty-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.novelty-point {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.novelty-point h4 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.novelty-point p {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ===== ANIMATED COUNTER ===== */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: countUp 0.5s var(--ease-out) forwards;
}

/* ===== SCROLL STAGGER ===== */
.stagger > * {
  opacity: 0;
  animation: fadeSlideUp 0.4s var(--ease-out) forwards;
}

@keyframes fadeSlideUp {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(8) { animation-delay: 350ms; }
.stagger > *:nth-child(9) { animation-delay: 400ms; }

/* ===== STATUS DOT ===== */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.status-dot.audited { background: var(--go); }

/* ===== OVERVIEW TABLE ===== */
.overview-table {
  margin-top: var(--space-6);
}

/* ===== MOBILE OVERLAY ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 25;
}

.sidebar-overlay.active {
  display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .patent-square-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
  .chart-container.donut {
    max-width: 180px;
    height: 180px;
  }
  .novelty-grid {
    grid-template-columns: 1fr;
  }
  .kpi-strip {
    flex-wrap: wrap;
  }
  .kpi-chip {
    min-width: 130px;
  }
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .header {
    grid-column: 1;
  }

  .main {
    grid-column: 1;
    padding: var(--space-4);
  }

  .hero-title-card-inner {
    padding: var(--space-5) var(--space-6);
  }

  .overview-body {
    padding: 0 var(--space-4) var(--space-8);
  }

  .patent-square-grid {
    grid-template-columns: 1fr;
  }

  .patent-square {
    /* no aspect-ratio override needed — removed from dark cards */
  }

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

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

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

  .patent-detail-header {
    flex-direction: column;
  }

  .sheet-tabs-bar {
    gap: var(--space-1);
  }

  .sheet-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }

  .sheet-tab-icon {
    width: 16px;
    height: 16px;
  }

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

/* ===== RED TEAM AUDIT ===== */
.red-team-section { margin-bottom: var(--space-6); }
.red-team-section > h4 { font-size: var(--text-sm); font-weight: 700; color: var(--color-text); margin-bottom: var(--space-4); }
.red-team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.red-team-card { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); }
.red-team-card h5 { font-size: var(--text-sm); font-weight: 700; color: var(--color-text); margin-bottom: var(--space-3); text-transform: uppercase; letter-spacing: 0.04em; }
.rt-row { margin-bottom: var(--space-2); font-size: var(--text-sm); line-height: 1.5; }
.rt-label { font-weight: 600; color: var(--color-text-muted); display: inline; }
.rt-value { color: var(--color-text-secondary); }
.rt-badge { display: inline-block; padding: 2px var(--space-3); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700; }
.rt-verified { background: var(--go-bg); color: var(--go); }
.rt-caveat { background: var(--conditional-bg); color: var(--conditional); }
.rt-refuted { background: var(--nogo-bg); color: var(--nogo); }
.rt-source { font-style: italic; font-size: var(--text-xs); color: var(--color-text-muted); }

/* ===== CLICKABLE SOURCE LINKS ===== */
.source-link {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--color-accent);
  transition: all 0.18s ease;
  cursor: pointer;
}

.source-link:hover {
  color: var(--color-accent-hover);
  border-bottom-style: solid;
  border-bottom-color: var(--color-accent-hover);
}

.rt-source .source-link {
  font-style: italic;
  font-size: var(--text-xs);
}

.caution-text .source-link,
.annotation-box .source-link {
  font-weight: 600;
}

/* ===== CAUTION BOXES ===== */
.caution-box { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); margin-bottom: var(--space-3); border-left: 4px solid; }
.caution-box.caution-verified { background: var(--go-bg); border-left-color: var(--go); }
.caution-box.caution-caution { background: var(--conditional-bg); border-left-color: var(--conditional); }
.caution-box.caution-critical { background: var(--nogo-bg); border-left-color: var(--nogo); }
.caution-box.caution-pivot { background: rgba(99,102,241,0.06); border-left-color: var(--patent-2); }
.caution-box.caution-caveat { background: var(--conditional-bg); border-left-color: var(--conditional); }
.caution-emoji { font-size: var(--text-lg); flex-shrink: 0; }
.caution-text { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.6; }

/* ===== ANNOTATION BOX (for innovations) ===== */
.annotation-box { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-2); border-left: 3px solid var(--conditional); font-size: var(--text-xs); color: var(--color-text-secondary); line-height: 1.6; }

/* ===== MECHANISM TABLE ===== */
.mechanism-table h5, .validation-protocol h5, .fto-section h5 { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin-bottom: var(--space-2); }

/* ===== LONG TEXT ===== */
.long-text { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.75; max-width: 72ch; }
.long-text p { margin-bottom: var(--space-3); }
.long-text p:last-child { margin-bottom: 0; }

/* ===== EXPANDED BMC GRID (9 cells) ===== */
.bmc-grid-full { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-3); }
.bmc-grid-full .bmc-cell { background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); }
.bmc-grid-full .bmc-cell h5 { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); margin-bottom: var(--space-2); }
.bmc-grid-full .bmc-cell p { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.5; }

/* ===== FTO PROTOCOL ===== */
.fto-section .highlight-box p { font-size: var(--text-sm); color: var(--color-text-secondary); line-height: 1.6; margin-bottom: var(--space-2); }
.fto-section .highlight-box p:last-child { margin-bottom: 0; }

@media (max-width: 480px) {
  .kpi-strip {
    flex-direction: column;
  }

  .kpi-chip {
    min-width: auto;
  }

  .opp-header {
    flex-direction: column;
  }

  .login-card {
    padding: var(--space-6);
  }
}

/* ===== ADMIN PANEL STYLES ===== */

/* Admin Layout */
.admin-section {
  padding: var(--space-6);
}

.admin-section h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  font-weight: 400;
  margin-bottom: var(--space-6);
}

.admin-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xs);
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.admin-card-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Admin Table */
.admin-table {
  width: 100%;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums lining-nums;
  border-collapse: collapse;
}

.admin-table th {
  background: var(--color-surface-2);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.admin-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: rgba(13,148,136,0.02);
}

/* Admin Buttons */
.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.admin-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: rgba(13,148,136,0.04);
}

.admin-btn.primary {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.admin-btn.primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.admin-btn.danger {
  color: var(--nogo);
  border-color: transparent;
  background: transparent;
}

.admin-btn.danger:hover {
  background: rgba(220,38,38,0.08);
  border-color: rgba(220,38,38,0.2);
}

.admin-btn.small {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.admin-btn svg {
  width: 16px;
  height: 16px;
}

/* Admin Form */
.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

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

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

.admin-form select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  font-size: var(--text-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.admin-form select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

/* Admin Actions Row */
.admin-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

/* Admin Textarea */
.admin-textarea {
  width: 100%;
  min-height: 300px;
  padding: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  font-size: var(--text-sm);
  font-family: 'DM Mono', 'Fira Code', monospace;
  line-height: 1.5;
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.admin-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
}

/* Admin Feedback Messages */
.admin-feedback {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  margin-bottom: var(--space-4);
  display: none;
}

.admin-feedback.visible {
  display: block;
}

.admin-feedback.success {
  background: var(--go-bg);
  color: var(--go);
  border: 1px solid rgba(5,150,105,0.2);
}

.admin-feedback.error {
  background: var(--nogo-bg);
  color: var(--nogo);
  border: 1px solid rgba(220,38,38,0.2);
}

/* Access Toggle */
.access-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.access-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.access-toggle .toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.access-toggle .toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.access-toggle input:checked + .toggle-slider {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.access-toggle input:checked + .toggle-slider::before {
  left: calc(100% - 20px);
}

/* Admin Nav Tabs */
.admin-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--space-3);
  overflow-x: auto;
}

.admin-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-xl);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.admin-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

.admin-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: white;
}

.admin-tab svg {
  width: 18px;
  height: 18px;
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
  animation: tabSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Preview Card */
.preview-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-top: var(--space-4);
  max-height: 500px;
  overflow-y: auto;
}

.preview-card pre {
  font-size: var(--text-xs);
  font-family: 'DM Mono', 'Fira Code', monospace;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-secondary);
}

/* Admin Badge */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.admin-badge.role-admin {
  background: var(--patent-1-bg);
  color: var(--patent-1);
}

.admin-badge.role-client {
  background: var(--patent-2-bg);
  color: var(--patent-2);
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  gap: var(--space-3);
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-10);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
  opacity: 0.3;
}

/* Responsive Admin */
@media (max-width: 768px) {
  .admin-form {
    grid-template-columns: 1fr;
  }
  .admin-tabs {
    gap: var(--space-1);
  }
  .admin-tab {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
  }
}

/* ===== DOWNLOAD DROPDOWN ===== */
.patent-detail-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.download-dropdown {
  position: relative;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #ffffff;
  background: var(--color-accent);
  border: 1px solid var(--color-accent);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

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

.download-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  min-width: 190px;
  z-index: 100;
  overflow: hidden;
}

.download-menu.open {
  display: block;
  animation: fadeIn 0.15s ease;
}

.download-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
  text-align: left;
}

.download-menu-item:hover {
  background: var(--color-surface-2);
}

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