:root {
  /* Premium Dark Theme */
  --bg-color: #0b0c10;
  --surf: #13151a;
  --surf-elevated: #1a1c23;
  --surf-glass: rgba(19, 21, 26, 0.65);
  
  --text-primary: #f2f3f7;
  --text-dim: #9aa0a6;
  --text-muted: #5e636e;
  
  --primary: #5c6bc0;
  --primary-glow: rgba(92, 107, 192, 0.4);
  --accent: #2a9d8f;
  --accent-glow: rgba(42, 157, 143, 0.3);
  --success: #2a9e5f;
  --success-glow: rgba(42, 158, 95, 0.35);
  --danger: #ef5350;
  --warning: #ffa726;
  
  --gradient-primary: linear-gradient(135deg, #5c6bc0, #2a9d8f);

  
  --border: #23252e;
  --border-glow: #383a45;
  
  --rad-sm: 8px;
  --rad-md: 12px;
  --rad-lg: 20px;
  --rad-round: 999px;
  
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  /* Subject Colors */
  --s-fr: #c4552a;
  --s-afm: #2a7cc4;
  --s-audit: #2a9e5f;
  --s-dt: #9b59b6;
  --s-idt: #e67e22;
  --s-ibs: #1abc9c;
  
  /* Primary RGB for overlays */
  --primary-rgb: 92, 107, 192;
  --accent-rgb: 42, 157, 143;
}

body.light-theme {
  --bg-color: #f6f8fb;
  --surf: #ffffff;
  --surf-elevated: #f0f2f7;
  --surf-glass: rgba(255, 255, 255, 0.8);
  
  --text-primary: #1a1c23;
  --text-dim: #4d515a;
  --text-muted: #8a8d94;
  
  --border: #e1e4ed;
  --border-glow: #d0d4e0;
}

/* ── Header (Stealth-Minimalist) ───────────────────── */
.hdr-minimal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 32px 32px 16px; /* Added internal padding for breathing room */
  position: sticky;
  top: 0;
  background: var(--bg-color);
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.03); /* Subtle separator */
}

.hdr-left { flex: 1; }
.hdr-p-title {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  margin: 0;
  line-height: 1;
}
.hdr-p-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 8px;
}

.hdr-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.mission-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surf-elevated);
  padding: 8px 16px;
  border-radius: 40px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.m-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  animation: m-pulse 2s infinite ease-in-out;
}
@keyframes m-pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}
.m-text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-dim);
}
.m-divider {
  width: 1px;
  height: 12px;
  background: var(--border);
}
.m-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}
.m-unit {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
}

.hdr-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.stealth-dock {
  display: flex;
  align-items: center;
  gap: 8px;
}
.s-dock-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all 0.2s;
  font-size: 18px;
}
.s-dock-btn:hover {
  background: var(--surf-elevated);
  color: var(--text-main);
  transform: translateY(-2px);
}
.s-user-box {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
}
.s-user-box:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}
.s-avatar-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-dim);
}
.btn-icon:hover {
  background: var(--surf-elevated);
  transform: scale(1.1);
  color: var(--primary);
}

.i-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  cursor: help;
  padding: 0 4px;
  opacity: 0.7;
}
.i-btn:hover { opacity: 1; }

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* Glassmorphism utility */
.glass {
  background: var(--surf-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Smooth micro-animations */
.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Global Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin: 0 auto 16px;
}

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

.screen-center {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-dim);
}

.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }

/* ── Professional Budget Table (Compact) ────────── */
.pro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: var(--surf);
}
.pro-table th {
  padding: 8px 12px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.pro-table .sub-header th {
  padding: 2px 12px 8px;
  opacity: 0.5;
  font-size: 8px;
}
.pro-table td {
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.cell-pair {
  display: flex !important;
  gap: 4px; /* Tighter gap */
  align-items: center;
  justify-content: center;
}
.cell-pair input {
  width: 48px; /* Narrower */
  background: var(--bg-color);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}
.cell-pair input:focus {
  border-color: var(--primary);
  outline: none;
}
.cell-pair .inp-done {
  opacity: 0.4;
  font-weight: 400;
  background: transparent;
}
.cell-pair .inp-done:focus { opacity: 1; background: var(--bg-color); }

/* Phase Coloring Tints */
.ph-study { background: rgba(33, 150, 243, 0.02); }
.ph-r1    { background: rgba(156, 39, 176, 0.02); }
.ph-r2    { background: rgba(103, 58, 183, 0.02); }
.ph-r3    { background: rgba(255, 152, 0, 0.02); }

tr:hover .ph-study { background: rgba(33, 150, 243, 0.06); }
tr:hover .ph-r1    { background: rgba(156, 39, 176, 0.06); }
tr:hover .ph-r2    { background: rgba(103, 58, 183, 0.06); }
tr:hover .ph-r3    { background: rgba(255, 152, 0, 0.06); }

/* Progress Backgrounds per Cell */
.cell-pair {
  position: relative;
  z-index: 1;
}
.cell-prog-bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  z-index: -1;
  transition: width 0.4s ease;
  opacity: 0.15;
}
.ph-study .cell-prog-bg { background: #2196f3; }
.ph-r1 .cell-prog-bg    { background: #9c27b0; }
.ph-r2 .cell-prog-bg    { background: #673ab7; }
.ph-r3 .cell-prog-bg    { background: #ff9800; }

.inp-done.is-full {
  color: var(--success) !important;
  font-weight: 800 !important;
  opacity: 1 !important;
}

.table-container {
  border-radius: var(--rad-md);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* Phase Summary Cards */
.phase-summary-grid {
   display: grid;
   grid-template-columns: repeat(4, 1fr);
   gap: 12px;
   margin-bottom: 24px;
}
.p-sum-card {
   padding: 12px;
   border-radius: var(--rad-md);
   border: 1px solid var(--border);
   background: var(--surf-elevated);
   display: flex;
   flex-direction: column;
   gap: 4px;
   transition: transform 0.2s, border-color 0.2s;
}
.p-sum-card:hover {
   transform: translateY(-4px);
   border-color: var(--primary);
}
.p-sum-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.p-sum-val { font-family: var(--font-display); font-size: 18px; font-weight: 800; }
/* ── Ultra-Compact Budget Data Grid ────────── */
.budget-grid-wrap {
   width: 100%;
   overflow-x: auto;
   border-radius: var(--rad-md);
   border: 1px solid var(--border);
   background: var(--surf-elevated);
   box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.budget-data-grid {
   width: 100%;
   border-collapse: collapse;
}
.bdg-th {
   background: rgba(0,0,0,0.2);
   padding: 12px 16px;
   font-size: 10px;
   font-weight: 800;
   text-transform: uppercase;
   color: var(--text-dim);
   border-bottom: 1px solid var(--border);
   letter-spacing: 0.5px;
   text-align: center;
}
.bdg-th.left { text-align: left; }
.bdg-th.ph-study { border-top: 3px solid #2196f3; }
.bdg-th.ph-r1 { border-top: 3px solid #9c27b0; }
.bdg-th.ph-r2 { border-top: 3px solid #673ab7; }
.bdg-th.ph-r3 { border-top: 3px solid #ff9800; }

.bdg-td {
   padding: 0;
   border-bottom: 1px solid var(--border);
   border-right: 1px solid rgba(255,255,255,0.03);
   vertical-align: middle;
}
.bdg-td.no-border { border-right: none; }
.budget-data-grid tr:last-child .bdg-td { border-bottom: none; }

.bdg-subj {
   padding: 12px 16px;
   font-family: var(--font-display);
   font-size: 13px;
   font-weight: 800;
   color: var(--text-primary);
   display: flex;
   align-items: center;
   gap: 10px;
}
.bdg-subj-dot {
   width: 10px; height: 10px; border-radius: 50%;
   box-shadow: 0 0 6px currentColor;
}

.bdg-cell-wrap {
   position: relative;
   z-index: 1;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 10px;
   height: 100%;
}

/* The actual inputs in a self-explanatory pill */
.bdg-split-inp {
   display: flex;
   background: var(--bg-color);
   border: 1px solid var(--border);
   border-radius: 6px;
   overflow: hidden;
   box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.bdg-split-inp:focus-within {
   border-color: var(--primary);
   box-shadow: 0 0 0 2px var(--primary-glow);
}
.bdg-col {
   display: flex;
   flex-direction: column;
   padding: 4px 6px;
   width: 54px;
   transition: background 0.2s;
}
.bdg-col:hover { background: rgba(255,255,255,0.02); }
.bdg-col.done {
   border-left: 1px solid var(--border);
   background: rgba(0,0,0,0.15);
}
.bdg-col.done:hover { background: rgba(0,0,0,0.25); }

.bdg-lbl {
   font-size: 8px;
   font-weight: 800;
   color: var(--text-muted);
   text-transform: uppercase;
   text-align: center;
   margin-bottom: 2px;
   letter-spacing: 0.5px;
}
.bdg-col input {
   background: transparent;
   border: none;
   text-align: center;
   font-size: 13px;
   font-weight: 700;
   color: var(--text-primary);
   padding: 0;
   width: 100%;
   font-family: var(--font-display);
}
.bdg-col input:focus { outline: none; color: var(--primary); }
.bdg-col input.done-inp { color: var(--text-dim); }
.bdg-col input.done-inp:focus { color: var(--text-primary); }
.bdg-col input.done-inp.is-full { color: #2a9e5f !important; font-weight: 800; }

/* In-cell Progress Visualization */
.bdg-prog-bg {
   position: absolute;
   left: 0; bottom: 0; height: 100%; z-index: -1;
   transition: width 0.4s ease-out;
}
.ph-study .bdg-prog-bg { background: rgba(33, 150, 243, 0.1); border-bottom: 2px solid #2196f3; }
.ph-r1 .bdg-prog-bg { background: rgba(156, 39, 176, 0.1); border-bottom: 2px solid #9c27b0; }
.ph-r2 .bdg-prog-bg { background: rgba(103, 58, 183, 0.1); border-bottom: 2px solid #673ab7; }
.ph-r3 .bdg-prog-bg { background: rgba(255, 152, 0, 0.1); border-bottom: 2px solid #ff9800; }

.budget-tfoot td {
   background: rgba(0,0,0,0.3);
   padding: 12px 10px;
   font-size: 11px;
   font-weight: 800;
   border-top: 1px solid var(--border);
}
.tfoot-label { color: var(--text-muted); text-transform: uppercase; padding-right: 16px; text-align: right; letter-spacing: 0.5px; }
.tfoot-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tfoot-tgt { color: var(--text-primary); font-family: var(--font-display); font-size: 13px; }
.tfoot-done { color: var(--text-dim); font-size: 9px; opacity: 0.8; }

