/* ═══════════════════════════════════════════════
   Wifey Timecard 2.0 — Styles
   Calm, professional palette: soft grays & blues
   ═══════════════════════════════════════════════ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #f4f6f8;
  --surface:     #ffffff;
  --border:      #e2e6ea;
  --border-light:#eef0f2;
  --text:        #2c3e50;
  --text-muted:  #8895a4;
  --primary:     #4a90d9;
  --primary-soft:#dce8f5;
  --focus-ring:  rgba(74, 144, 217, 0.35);
  --danger:      #d94a4a;
  --nav-bg:      #2c3548;
  --nav-text:    #c8ced6;
  --nav-active:  #4a90d9;
  --radius:      6px;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

button { cursor: pointer; font-family: inherit; }
input, textarea, button { font-size: inherit; }

/* Ensure hidden attribute always wins over display rules */
[hidden] { display: none !important; }

/* ---------- LOGIN SCREEN ---------- */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #e8edf2 0%, #d6dde6 100%);
}

.login-card {
  background: var(--surface);
  padding: 40px 36px 32px;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  width: 360px;
  max-width: 90vw;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 28px;
  text-align: center;
  color: var(--text);
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.login-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  outline: none;
  transition: border-color 0.15s;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  margin-top: 4px;
}

.login-card button[type="submit"]:hover {
  background: #3d7ec5;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
}

/* ---------- APP SHELL ---------- */
#app-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  height: 100vh;
}

/* ---------- LEFT NAV ---------- */
#left-nav {
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  padding-top: 0;
  overflow-y: auto;
}

.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.nav-title {
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

#logout-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--nav-text);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
}

#logout-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-tab {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}

.nav-tab:hover {
  background: rgba(255,255,255,0.05);
  color: #e8ecf0;
}

.nav-tab.active {
  background: rgba(74,144,217,0.12);
  color: #fff;
  border-left-color: var(--nav-active);
  font-weight: 600;
}

/* ---------- CONTENT AREA ---------- */
#content-area {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.tab-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 28px 32px 20px;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

/* Placeholder tabs */
.tab-panel > h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* ---------- DAILY TAB ---------- */
.daily-header {
  margin-bottom: 20px;
  flex-shrink: 0;
}

.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.daily-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  min-width: 320px;
  text-align: center;
}

.date-arrow {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.date-arrow:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

#date-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

#date-picker:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

.date-today-btn {
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  transition: background 0.12s;
}

.date-today-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Grid wrapper — scrollable, takes remaining space above bottom panels */
.grid-wrapper {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 180px;
}

/* ---------- ENTRY TABLE (shared: daily grid + tracking grids) ---------- */
.entry-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.entry-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.entry-table th {
  background: #f7f9fb;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 10px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.entry-table th:last-child {
  border-right: none;
}

/* Column widths */
.col-date       { width: 100px; }
.col-clientid   { width: 90px;  }
.col-clientname { width: 160px; }
.col-difficulty { width: 130px; }
.col-start      { width: 110px; }
.col-end        { width: 110px; }
.col-hours      { width: 110px; }
.col-nonbill    { width: 100px; }
.col-notes      { width: auto;  } /* takes remaining space */
.col-del        { width: 76px; }

.entry-table td {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: top;
}

.entry-table td:last-child {
  border-right: none;
}

/* Editable cells — input & textarea styling */
.entry-table td input,
.entry-table td textarea,
.entry-table td select {
  width: 100%;
  border: none;
  outline: none;
  padding: 9px 10px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  line-height: 1.4;
}

.entry-table td select {
  cursor: pointer;
  appearance: auto;
}

.entry-table td input:focus,
.entry-table td textarea:focus,
.entry-table td select:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

/* Read-only date cell */
.entry-table td .cell-readonly {
  padding: 9px 10px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: block;
}

/* Computed billable hours display */
.entry-table td .cell-computed {
  padding: 9px 10px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.4;
  display: block;
  font-weight: 500;
}

/* Notes textarea — single-line look, expands to 3 lines max then scrolls */
.entry-table td textarea.notes-input {
  resize: none;
  overflow: hidden;
  min-height: 34px;   /* ~1 line */
  max-height: 72px;   /* ~3 lines */
  line-height: 1.4;
}

.entry-table td textarea.notes-input.scrollable {
  overflow-y: auto;
}

/* Row hover */
.entry-table tbody tr:hover td {
  background: #fafbfd;
}

/* ---------- BOTTOM PANELS ---------- */
.bottom-panels {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  padding-bottom: 4px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.panel-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

/* ---------- TAB HEADER (reusable) ---------- */
.tab-header {
  margin-bottom: 20px;
  flex-shrink: 0;
}

.tab-header h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

/* ---------- WEEKLY PLANNING TABLE ---------- */
.weekly-planning-wrapper {
  flex: 1 1 auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: fit-content;
}

.weekly-planning-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.weekly-planning-table th {
  background: #f7f9fb;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 14px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
}

.weekly-planning-table th:last-child {
  border-right: none;
}

.weekly-planning-table th.col-total,
.weekly-planning-table th.col-budget,
.weekly-planning-table th.col-overage {
  min-width: 90px;
}

.weekly-planning-table td {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: middle;
}

.weekly-planning-table td:last-child {
  border-right: none;
}

.weekly-planning-table td input {
  width: 100%;
  min-width: 70px;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  text-align: center;
  /* Hide number spinners */
  -moz-appearance: textfield;
  appearance: textfield;
}

.weekly-planning-table td input::-webkit-outer-spin-button,
.weekly-planning-table td input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.weekly-planning-table td input:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

.weekly-planning-table td.wp-calc {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  background: #fafbfd;
}

.weekly-planning-table td.wp-calc.overage-negative {
  color: #2e7d32; /* green when under budget */
}

.weekly-planning-table td.wp-calc.overage-positive {
  color: #b8860b; /* yellow/amber alert when over budget */
}

/* ---------- BUDGET GRID TABLE ---------- */
#budget-grid,
#budget-archived-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#budget-grid thead,
#budget-archived-grid thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

#budget-grid th,
#budget-archived-grid th {
  background: #f7f9fb;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 10px 10px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

#budget-grid th:last-child,
#budget-archived-grid th:last-child {
  border-right: none;
}

.col-b-clientid   { width: 140px; }
.col-b-clientname { width: 240px; }
.col-b-difficulty { width: 140px; }
.col-b-hours      { width: 120px; }
.col-b-start      { width: 140px; }
.col-b-actions   { width: 140px; }

.budget-subtabs-bar {
  flex-shrink: 0;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.budget-subtabs {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  background: #e8ecf1;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.budget-subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 22px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.budget-subtab-label {
  white-space: nowrap;
}

.budget-subtab:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.45);
}

.budget-subtab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  border-color: var(--border);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}

.budget-subtab.active[data-budget-tab="active"] {
  color: #2a6cb8;
  border-color: #c5daf0;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
}

.budget-subtab.active[data-budget-tab="archive"] {
  color: #5c6773;
  border-color: #d5dbe2;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
}

.budget-subtab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.budget-subtab.active .budget-subtab-count {
  background: #dde4ec;
  color: #5c6773;
}

.budget-subtab.active[data-budget-tab="active"] .budget-subtab-count {
  background: var(--primary-soft);
  color: var(--primary);
}

.budget-subpanels {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.budget-subpanel {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.budget-subpanel.active {
  display: flex;
}

.budget-subpanel .grid-wrapper {
  flex: 1 1 auto;
  min-height: 0;
}

.budget-archived-wrapper {
  opacity: 0.95;
}

.budget-archived-table tbody tr.budget-archived-row td {
  background: #fafbfc;
}

.budget-empty-msg {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
}

.budget-actions-cell {
  text-align: center;
  vertical-align: middle;
}

.budget-actions-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.budget-archive-btn,
.budget-restore-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

.budget-archive-btn:hover {
  background: #f0f2f5;
  border-color: var(--text-muted);
}

.budget-restore-btn {
  border-color: var(--primary);
  color: var(--primary);
}

.budget-restore-btn:hover {
  background: var(--primary-soft);
}

.budget-del-btn {
  background: var(--danger);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.12s;
}

.budget-del-btn:hover,
.entry-del-btn:hover {
  background: #a93226;
}

.entry-del-btn {
  background: var(--danger);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  line-height: 1;
  transition: background 0.12s;
}

.entry-table td.del-cell {
  text-align: center;
  vertical-align: middle;
}

#budget-grid td,
#budget-archived-grid td {
  padding: 0;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: top;
}

#budget-grid td:last-child,
#budget-archived-grid td:last-child {
  border-right: none;
  text-align: center;
  vertical-align: middle;
}

#budget-grid td input,
#budget-archived-grid td input,
#budget-grid td select,
#budget-archived-grid td select {
  width: 100%;
  border: none;
  outline: none;
  padding: 9px 10px;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  line-height: 1.4;
}

#budget-grid td select,
#budget-archived-grid td select {
  cursor: pointer;
  appearance: auto;
}

#budget-grid td input:focus,
#budget-archived-grid td input:focus,
#budget-grid td select:focus,
#budget-archived-grid td select:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

#budget-grid tbody tr:hover td,
#budget-archived-grid tbody tr:hover td {
  background: #fafbfd;
}

/* ---------- CLIENT ID AUTOCOMPLETE DROPDOWN ---------- */
.client-cell {
  position: relative;
}

.client-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 360px;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 180px;
  overflow-y: auto;
}

.client-dropdown-item {
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

.client-dropdown-item:hover,
.client-dropdown-item.active {
  background: var(--primary-soft);
}

.client-dropdown-item .dd-id {
  font-weight: 600;
  color: var(--text);
}

.client-dropdown-item .dd-name {
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

/* ---------- BUDGET STATUS TABLE ---------- */
#budget-status-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

#budget-status-body th {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

#budget-status-body td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

#budget-status-body .status-green  { color: #2e8b57; font-weight: 600; }
#budget-status-body .status-amber  { color: #c08a20; font-weight: 600; }
#budget-status-body .status-red    { color: #c0392b; font-weight: 600; }

#budget-status-body .empty-status {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
  padding: 4px 0;
}

/* ---------- SCROLLABLE TAB PANEL ---------- */
.tab-panel.tab-scrollable {
  overflow-y: auto;
}

/* ---------- WEEK SNAPSHOT (Daily tab panel) ---------- */
#week-snapshot-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: center;
}

#week-snapshot-body th,
#week-snapshot-body td {
  padding: 5px 6px;
  white-space: nowrap;
}

#week-snapshot-body th {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

#week-snapshot-body td {
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

#week-snapshot-body .snap-label {
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
}

#week-snapshot-body .snap-today {
  background: var(--primary-soft);
  font-weight: 600;
}

#week-snapshot-body .snap-blank {
  color: var(--border);
}

#week-snapshot-body .snap-empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 13px;
  padding: 4px 0;
  text-align: left;
}

/* ---------- TRACKING TAB — WEEK GROUPS ---------- */
.week-group {
  margin-bottom: 28px;
}

.week-group:last-child {
  margin-bottom: 0;
}

.week-group-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 8px 0 10px;
  border-bottom: none;
}

.week-group .grid-wrapper {
  min-height: auto;
}

#tracking-content .entry-table thead {
  position: static;
}

/* ---------- MASTER TOTALS — PLANNING TABLE ---------- */
.master-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.master-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.master-table th {
  background: #f7f9fb;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.master-table th:last-child {
  border-right: none;
}

.col-m-remain { width: 90px; }
.col-m-start  { width: 120px; }
.col-m-week   { width: 80px; }
.col-m-actual { width: 130px; }
.col-m-target { width: 130px; }
.col-m-diff   { width: 130px; }

.master-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  font-size: 13.5px;
  color: var(--text);
}

.master-table td:last-child {
  border-right: none;
}

.master-table tbody tr:hover td {
  background: #fafbfd;
}

.master-table .current-week-row td {
  background: var(--primary-soft);
  font-weight: 600;
}

.master-table .current-week-row:hover td {
  background: #cddff0;
}

.master-table .future-week td {
  color: var(--text-muted);
}

.diff-positive {
  color: #2e8b57;
  font-weight: 600;
}

.diff-negative {
  color: #c0392b;
  font-weight: 600;
}

.diff-zero {
  color: var(--text-muted);
}

.master-table td input.target-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 0;
  font-size: 13.5px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.master-table td input.target-input:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

#master-planning-wrapper {
  min-height: auto;
}

/* ---------- SEASON TAB — SPLIT LAYOUT ---------- */
.season-layout {
  padding: 20px 24px 16px !important;
}

.season-layout .season-header {
  margin-bottom: 14px;
}

.season-split {
  display: flex;
  gap: 20px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Left: Calendar panel */
.season-calendar {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  padding-right: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: start;
}

/* Right: Ledger panel */
.season-ledger-wrapper {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- SEASON — MINI MONTH CALENDARS ---------- */
.mini-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.mini-month-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  text-align: center;
  margin-bottom: 4px;
}

.mini-month table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.mini-month th {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
}

.mini-month td {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0;
  height: 20px;
  position: relative;
}

.mini-month td.today-cell {
  font-weight: 700;
  color: var(--primary);
}

.mini-month td.holiday-cell {
  color: #c0392b;
  font-weight: 700;
}

.mini-month td.today-cell.holiday-cell {
  color: #c0392b;
  text-decoration: underline;
}

.mini-month tr.week-current td {
  background: var(--primary-soft);
  font-weight: 600;
}

.mini-month td .cal-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
}

.mini-month td .cal-badge {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #c08a20;
  position: absolute;
  bottom: 1px;
  left: calc(50% + 4px);
  transform: translateX(-50%);
}

/* ---------- SEASON — PLANNING LEDGER TABLE ---------- */
.season-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.season-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.season-table th {
  background: #f7f9fb;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  padding: 8px 6px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.season-table th:last-child {
  border-right: none;
}

/* Grouped header rows */
.header-group-row th.col-s-group {
  background: #eaf1f8;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.header-sub-row th {
  border-bottom: 2px solid var(--border);
}

.col-s-week    { width: 48px; }
.col-s-start   { width: 82px; }
.col-s-ptotal  { width: 76px; }
.col-s-pbill   { width: 76px; }
.col-s-pbudget { width: 72px; }
.col-s-pvar    { width: 76px; }
.col-s-ctotal  { width: 76px; }
.col-s-cbill   { width: 76px; }
.col-s-cbudget { width: 76px; }
.col-s-cvar    { width: 80px; }

.season-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text);
  vertical-align: middle;
  text-align: right;
}

.season-table td:first-child,
.season-table td:nth-child(2) {
  text-align: left;
}

.season-table td:last-child {
  border-right: none;
}

.season-table tbody tr:hover td {
  background: #fafbfd;
}

.season-table .current-week-row td {
  background: #d6f0d6;
  font-weight: 600;
}

.season-table .current-week-row:hover td {
  background: #c4e6c4;
}

.season-table .future-week td {
  color: var(--text-muted);
}

/* Accounting-style negative values: red text with parentheses */
.season-table td.val-negative {
  color: #c0392b;
}

/* Editable cell background hint */
.season-table td.editable-cell {
  background: #fafff6;
}

.season-table .current-week-row td.editable-cell {
  background: #c8e8c8;
}

/* Totals row */
.season-table .totals-row td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: #f7f9fb;
}

.season-table td input.season-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 0;
  font-size: 12px;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  text-align: right;
}

.season-table td input.season-input:focus {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--focus-ring);
}

/* ---------- CONFIRM MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 28px 32px 24px;
  min-width: 340px;
  max-width: 420px;
  text-align: center;
}

.modal-card p {
  font-size: 15px;
  color: var(--text);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 22px;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.12s;
}

.btn-danger:hover {
  background: #a93226;
}

.modal-actions .btn-secondary {
  padding: 9px 22px;
}

/* ---------- UTILITIES TAB ---------- */
.util-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 900px;
}

.util-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.util-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}

.import-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.import-controls input[type="file"] {
  font-size: 13px;
  font-family: var(--font);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 13px;
}

.btn-primary:hover:not(:disabled) {
  background: #3d7ec5;
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 13px;
}

.btn-secondary:hover:not(:disabled) {
  background: #f0f2f5;
}

.import-status {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 12px;
}

.import-status.status-info {
  background: var(--primary-soft);
  color: var(--primary);
}

.import-status.status-success {
  background: #d6f0d6;
  color: #2e7d32;
}

.import-status.status-error {
  background: #fde8e8;
  color: #c0392b;
}

.import-preview {
  max-height: 400px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

#csv-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

#csv-preview-table th {
  background: #f7f9fb;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  padding: 8px 8px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}

#csv-preview-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

#csv-preview-table tr.row-error td {
  background: #fde8e8;
  color: #c0392b;
}

#csv-preview-table tbody tr:hover td {
  background: #fafbfd;
}
