@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Prompt:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Enterprise Luxury & Clean Design System Tokens
   ========================================================================== */
:root {
  /* Surfaces & Backgrounds */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-elevated: #ffffff;
  
  /* Text & Contrast */
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --muted-light: #94a3b8;
  
  /* Borders & Lines */
  --line: #e2e8f0;
  --line-subtle: #f1f5f9;
  --line-focus: #2563eb;
  
  /* Brand Palette (Executive Sapphire & PTT Cyan) */
  --navy: #0f172a;
  --navy-2: #1e293b;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-subtle: #eff6ff;
  --cyan: #0284c7;
  --cyan-subtle: #ecfeff;
  
  /* Semantic Badges & Signals */
  --green: #059669;
  --green-subtle: #ecfdf5;
  --green-text: #065f46;
  
  --amber: #d97706;
  --amber-subtle: #fffbeb;
  --amber-text: #92400e;
  
  --red: #dc2626;
  --red-subtle: #fef2f2;
  --red-text: #991b1b;

  --purple: #7c3aed;
  --purple-subtle: #f5f3ff;
  --purple-text: #5b21b6;
  
  /* Shadows & Elevation */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.07), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-float: 0 25px 50px -12px rgba(15, 23, 42, 0.15);
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  
  /* Fonts */
  --font-heading: 'Plus Jakarta Sans', 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Transitions */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
}

[data-theme="dark"] {
  --bg: #090d16;
  --bg-subtle: #0f172a;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-elevated: #1f293d;
  
  --text: #f8fafc;
  --text-secondary: #e2e8f0;
  --muted: #94a3b8;
  --muted-light: #64748b;
  
  --line: #1e293b;
  --line-subtle: #162032;
  
  --blue: #3b82f6;
  --blue-hover: #60a5fa;
  --blue-subtle: rgba(59, 130, 246, 0.14);
  --cyan: #38bdf8;
  --cyan-subtle: rgba(56, 189, 248, 0.14);
  
  --green: #10b981;
  --green-subtle: rgba(16, 185, 129, 0.14);
  --green-text: #6ee7b7;
  
  --amber: #f59e0b;
  --amber-subtle: rgba(245, 158, 11, 0.14);
  --amber-text: #fcd34d;
  
  --red: #ef4444;
  --red-subtle: rgba(239, 68, 68, 0.16);
  --red-text: #fca5a5;

  --purple: #a855f7;
  --purple-subtle: rgba(168, 85, 247, 0.16);
  --purple-text: #d8b4fe;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 24px -3px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 35px -5px rgba(0, 0, 0, 0.65);
  --shadow-float: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
}

/* ==========================================================================
   Global Reset & Base Typography
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  min-height: 100vh;
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .eyebrow {
  font-family: var(--font-heading);
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--duration-fast) var(--ease-smooth);
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--duration-fast);
}

a:hover {
  color: var(--blue-hover);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ==========================================================================
   Executive Login Screen Layout
   ========================================================================== */
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--surface);
}

.login-visual {
  position: relative;
  padding: 64px;
  color: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 90% 10%, rgba(56, 189, 248, 0.35), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(37, 99, 235, 0.45), transparent 50%),
    linear-gradient(145deg, #090d16 0%, #0f172a 45%, #1e3a8a 100%);
  background-size: 200% 200%;
  animation: bgMesh 20s ease infinite;
}

@keyframes bgMesh {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}

.login-visual::after {
  content: "";
  position: absolute;
  width: 500px;
  height: 500px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  right: -100px;
  top: 15%;
  box-shadow: 0 0 0 90px rgba(255, 255, 255, 0.02), 0 0 0 180px rgba(255, 255, 255, 0.015);
  pointer-events: none;
}

.brand-mark {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: white;
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.35);
  margin-bottom: 32px;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 0;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.login-copy .eyebrow {
  color: #38bdf8;
  margin-bottom: 16px;
  font-size: 12px;
  letter-spacing: 0.15em;
}

.login-copy h1 {
  margin: 0 0 20px;
  font-size: clamp(36px, 4.5vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #ffffff;
}

.login-copy p:last-child {
  max-width: 580px;
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 400;
}

/* ESG Public Stats Cards */
.esg-stats-container {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.esg-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform var(--duration-fast), background var(--duration-fast);
}

.esg-stat-card:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
}

.esg-stat-card .stat-icon {
  font-size: 24px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.esg-stat-card .stat-details {
  display: flex;
  flex-direction: column;
}

.esg-stat-card .stat-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.esg-stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.03em;
}

.login-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
}

.auth-card {
  width: min(420px, 100%);
  margin: auto 0;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  text-align: left;
  width: 100%;
}

.auth-card label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-card input {
  height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  width: 100%;
  transition: all var(--duration-fast);
}

.auth-card input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrap input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 4px;
}

.security-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--blue-subtle);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: var(--blue);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 28px;
}

.company-logo-wrap {
  min-height: 56px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
}

.company-logo {
  display: block;
  width: min(200px, 65%);
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all var(--duration-fast) var(--ease-smooth);
  user-select: none;
  white-space: nowrap;
}

.button.primary {
  background: linear-gradient(135deg, var(--blue), var(--blue-hover));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.button.primary:hover {
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38);
  transform: translateY(-1px);
}

.button.primary:active {
  transform: translateY(0);
}

.button.ghost {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-secondary);
}

.button.ghost:hover {
  background: var(--bg-subtle);
  border-color: var(--line-focus);
  color: var(--text);
}

.button.danger {
  background: var(--red-subtle);
  border: 1px solid var(--red);
  color: var(--red-text);
}

.button.danger:hover {
  background: var(--red);
  color: #ffffff;
}

.button.wide, .button.full {
  width: 100%;
}

.login-footer {
  width: min(420px, 100%);
  padding-top: 32px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
}

.policy-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin-bottom: 12px;
}

.policy-links a {
  color: var(--muted);
  font-size: 11px;
}

.policy-links a:hover {
  color: var(--blue);
}

/* ==========================================================================
   Main Application Layout (App Layout & Sidebar)
   ========================================================================== */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-subtle);
  margin-bottom: 18px;
}

.sidebar-logo-surface {
  display: flex;
  align-items: center;
}

.sidebar-company-logo {
  height: 38px;
  max-width: 120px;
  object-fit: contain;
}

.sidebar-product-name {
  display: flex;
  flex-direction: column;
}

.sidebar-product-name strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-product-name span {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}

#main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

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

[data-theme="dark"] .nav-item.active {
  background: rgba(59, 130, 246, 0.16);
  color: #60a5fa;
}

.nav-item span:first-child {
  font-size: 15px;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}

.sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid var(--line-subtle);
}

.system-status-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-production {
  background: var(--green);
  animation: pulseGlow 2s infinite;
}

.status-details {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

/* ==========================================================================
   Workspace & Topbar Navigation
   ========================================================================== */
.workspace {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  min-width: 0;
}

.topbar {
  height: 72px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.icon-button:hover {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--muted-light);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: white;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-weight: 700;
}

.user-menu strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.user-menu span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

/* ==========================================================================
   Page Content Area & Panels
   ========================================================================== */
.page-content {
  padding: 32px;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: box-shadow var(--duration-normal);
}

.panel:hover {
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

/* ==========================================================================
   Executive KPI & Grand Metric Cards
   ========================================================================== */
.kpi-grid, .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card, .stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--ease-smooth);
}

.kpi-card:hover, .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-focus);
}

.kpi-card::before, .stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  opacity: 0.85;
}

.kpi-card.kpi-active::before { background: linear-gradient(90deg, var(--green), #34d399); }
.kpi-card.kpi-expiring::before { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.kpi-card.kpi-expired::before { background: linear-gradient(90deg, var(--red), #f87171); }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--blue-subtle);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 16px;
}

.kpi-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 10px;
}

.kpi-subtext {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* KPI Chips Bar (above Contract Register) */
.kpi-chips-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-chip {
  flex: 1;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-fast);
}

.kpi-chip:hover {
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}

.kpi-chip-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-chip-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

/* ==========================================================================
   Pill Status Badges with Glowing Status Dots
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

@keyframes pulseGlow {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseGlowAmber {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.badge.ACTIVE, .badge.APPROVED, .badge.PAID, .badge.GOOD {
  background: var(--green-subtle);
  color: var(--green-text);
  border: 1px solid rgba(5, 150, 105, 0.2);
}
.badge.ACTIVE .badge-dot, .badge.APPROVED .badge-dot, .dot-active {
  background: var(--green);
  animation: pulseGlow 2s infinite;
}

.badge.EXPIRING_30, .badge.EXPIRING_60, .badge.EXPIRING_90, .badge.PENDING, .badge.WATCH {
  background: var(--amber-subtle);
  color: var(--amber-text);
  border: 1px solid rgba(217, 119, 6, 0.2);
}
.badge.EXPIRING_30 .badge-dot, .badge.EXPIRING_60 .badge-dot, .badge.EXPIRING_90 .badge-dot, .dot-expiring {
  background: var(--amber);
  animation: pulseGlowAmber 2s infinite;
}

.badge.EXPIRED, .badge.TERMINATED, .badge.CRITICAL, .badge.OVERDUE, .badge.REJECTED {
  background: var(--red-subtle);
  color: var(--red-text);
  border: 1px solid rgba(220, 38, 38, 0.2);
}
.badge.EXPIRED .badge-dot, .dot-expired {
  background: var(--red);
}

.badge.DRAFT, .badge.IN_REVIEW, .badge.NEUTRAL {
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
}
.dot-neutral {
  background: var(--muted);
}

/* ==========================================================================
   Modern Data Grid & Tables
   ========================================================================== */
.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-tools {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.search-input {
  height: 42px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  width: min(340px, 100%);
  transition: all var(--duration-fast);
}

.search-input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

select {
  height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: all var(--duration-fast);
}

select:focus {
  border-color: var(--blue);
  outline: none;
}

.data-table-wrap, .table-wrap {
  overflow-x: auto;
  width: 100%;
}

table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

th {
  background: var(--surface-2);
  padding: 14px 18px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
  transition: background var(--duration-fast);
}

tr:hover td {
  background: var(--bg-subtle);
  color: var(--text);
}

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

.table-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

/* Actions in Table Cell */
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Contract 360° View & Lifecycle Stepper
   ========================================================================== */
.detail-hero {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.detail-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.detail-hero-top h3 {
  margin: 4px 0 6px;
  font-size: 24px;
  color: #ffffff;
}

.detail-hero-top p {
  margin: 0;
  color: #94a3b8;
  font-size: 13.5px;
}

.hero-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-kpi span {
  font-size: 12px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.hero-kpi strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  margin-top: 4px;
}

/* Lifecycle Stepper */
.lifecycle-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  position: relative;
}

.step-item::after {
  content: "";
  position: absolute;
  top: 16px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 1;
}

.step-item:last-child::after {
  display: none;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  position: relative;
  z-index: 2;
  transition: all var(--duration-fast);
}

.step-item.completed .step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.step-item.completed::after {
  background: var(--green);
}

.step-item.active .step-dot {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.step-item.active .step-label {
  color: var(--blue);
  font-weight: 700;
}

.step-item.completed .step-label {
  color: var(--text);
}

/* Detail Tab Navigation */
.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.detail-tab {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all var(--duration-fast);
}

.detail-tab:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.detail-tab.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   Modals & Dialogs (Frosted Blur)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn var(--duration-fast) var(--ease-smooth);
}

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

.modal {
  width: min(880px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  animation: slideUp var(--duration-normal) var(--ease-smooth);
}

@keyframes slideUp {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 19px;
}

.modal-close {
  font-size: 24px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  padding: 20px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface-2);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-grid label span {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-grid input, .form-grid select, .form-grid textarea {
  height: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13.5px;
  width: 100%;
}

.form-grid textarea {
  height: auto;
  min-height: 80px;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  padding-top: 12px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Toasts & Alerts
   ========================================================================== */
.toast-root {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  background: var(--navy);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideIn 250ms var(--ease-smooth);
}

@keyframes toastSlideIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .login-layout {
    grid-template-columns: 1fr;
  }
  .login-visual {
    display: none;
  }
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}
