:root {
  --primary-color: #63AB8F;
  --secondary-color: #4A8C7D;
  --border-color: #ddd;
  --light-bg: #f0f0f0;
  --card-bg: #fff;
}

#app_loading_mask {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(2px);
  z-index: 9999;
  pointer-events: all;
  cursor: wait;
}

#app_loading_mask.is-active {
  display: flex;
}

.app-loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(0, 0, 0, 0.15);
  border-top-color: rgba(0, 0, 0, 0.65);
  border-radius: 50%;
  animation: app-spin 0.8s linear infinite;
}

@keyframes app-spin {
  to { transform: rotate(360deg); }
}
/* General Styles */

/* Time‑Off Calendar: colour states */
.calendar .day.available {
  background-color: #c8e6c9;
}
.calendar .day.nearly {
  background-color: #ffe0b2;
}
.calendar .day.full {
  background-color: #ffcdd2;
}


body {
    font-family: 'Proxima Nova', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f0f0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #63AB8F; /* Custom Teal */
    color: white;
}

header h1 {
    margin: 0;
}

h2, h3 {
    color: #2b3a42;
    
}

.logo {
    height: 50px;
    background-color: transparent;
}

.divider {
    border: none;
    height: 1px;
    background-color: #ddd;
    margin: 0;
}

.tab-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
    padding: 0;
    margin: 0;
}

.tab {
    display: flex;
    overflow: hidden;
}

.tab button {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
    margin: 0;
}

.tab button:hover {
    background-color: #ddd;
}

.tab button.active {
    color: white;
}

.button-container {
    display: flex;
    gap: 10px;
}

.save-button, .import-button-label {
    padding: 10px 20px;
    background-color: #63AB8F;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.import-button-label input {
    display: none;
}

.tabcontent {
    /* display: none; */
    padding: 20px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.tabcontent table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.tabcontent table, th, td {
    border: 1px solid #ddd;
}

.tabcontent th {
    background-color: #63AB8F; /* Custom Teal */
    color: white;
}

.tabcontent th, .tabcontent td {
    padding: 10px;
    text-align: left;
}

.tabcontent label {
    display: block;
}

.tabcontent select, .tabcontent textarea {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.tabcontent textarea {
    height: 100px;
}

.filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    justify-content: space-between;
}

.filters > div {
    flex: 1;
}

.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.checkbox-container label {
    margin-left: 10px;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.export-button {
    padding: 10px 20px;
    background-color: #63AB8F;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.negative {
    background-color: pink;
    color: red;
}

.search-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.search-container input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 300px;
}

.filters div h3 {
    margin-bottom: 5px;
}

.styled-form {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.styled-form .form-group {
    margin-bottom: 15px;
}

.styled-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.styled-form input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.styled-form .btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    outline: none;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    box-shadow: 0 4px #999;
}

.styled-form .btn:hover {
    background-color: #0056b3;
}

.styled-form .btn:active {
    background-color: #0056b3;
    box-shadow: 0 2px #666;
    transform: translateY(2px);
}
.file-upload-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Adjust the gap as needed */
    padding-right: 20px;
}



/* --- Time Off Calendar Styles --- */
.calendar-filters .filters {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
}

.bulk-update-panel {
  background-color: #f3f7f4;
  border-radius: 5px;
  padding: 16px;
  margin-top: 10px;
}

/* Region selector page (/login before auth) */
.region-page {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 20% 10%, #ffffff 0%, #f4f7f8 55%);
  color: #153243;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.region-page * {
  box-sizing: border-box;
}

.region-shell {
  width: min(980px, 100%);
  background: #fff;
  border: 1px solid #cfe7db;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 12px 30px rgba(74, 140, 125, 0.12);
}

.region-title {
  margin: 0 0 8px;
  font-size: 1.6rem;
  text-align: center;
}

.region-copy {
  margin: 0 0 20px;
  color: #5b7280;
  text-align: center;
}

.region-error {
  margin: 0 0 16px;
  color: #b00020;
  font-weight: 600;
}

.region-actions {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}

.region-back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--primary-color);
  color: #fff;
  border: 1px solid var(--primary-color);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.region-back-button:hover {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: translateY(-1px);
}

.region-back-button__icon {
  font-size: 16px;
  line-height: 1;
}

.region-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 220px));
  justify-content: center;
  gap: 12px;
}

.region-card-form {
  margin: 0;
}

.region-card {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
  background: #fff;
  border: 1px solid #cfe7db;
  border-radius: 12px;
  padding: 12px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.region-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(74, 140, 125, 0.18);
}

.region-card--selected {
  border-color: var(--primary-color);
  background: #e9f4ef;
}

.region-card__code {
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--secondary-color);
}

.region-card__name {
  font-size: 0.94rem;
}

.region-card__host {
  font-size: 0.8rem;
  color: #5b7280;
  word-break: break-all;
}

.bulk-update-panel label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.bulk-update-panel input {
  width: 60px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#bulk-apply-btn {
  margin-left: 10px;
  padding: 8px 16px;
  background-color: #63AB8F;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

#bulk-apply-btn:hover {
  background-color: #4A8C7D;
}

.calendar-container {
  flex: 1;
  padding: 20px;
  background-color: #fff;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0,0,0,0.05);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 60px);
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: bold;
  background-color: #f0f0f0;
  padding: 10px 0;
  border-bottom: 1px solid #ddd;
}

.calendar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 100px;
  gap: 8px;
  padding: 10px 0;
  overflow-y: auto;
}

.calendar .day {
  position: relative;
  background-color: #c8e6c9; /* available-color */
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.calendar .day.empty {
  background-color: #f9f9f9;
  border: 1px dashed #ddd;
}

.calendar .day .date {
  font-weight: bold;
  margin-bottom: 6px;
}

.calendar .day .balance-info {
  font-size: 12px;
  color: #6C757D;
  line-height: 1.2;
}

.day-input {
  width: 48px;
  font-size: 13px;
  padding: 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#calendar-save-btn {
  align-self: center;
  margin-top: 16px;
  padding: 10px 28px;
  background-color: #63AB8F;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
}

#calendar-save-btn:hover {
  background-color: #4A8C7D;
}

/* Color overrides for “nearly” and “full” */
.calendar .day[style*="var(--nearly-color)"] { background-color: #ffe0b2; }
.calendar .day[style*="var(--full-color)"]    { background-color: #ffcdd2; }

/* Responsive tweaks */
@media (max-width: 900px) {
  .calendar-container { padding: 10px; }
  .calendar { grid-auto-rows: 80px; }
}

@media (max-width: 600px) {
  .calendar-header, .calendar {
    grid-template-columns: repeat(2, 1fr);
  }
  .calendar .day { min-height: 60px; }
}




/* --- Calculator Tab Styles --- */
#Calculator {
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calc-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calc-header h2 {
  font-size: 1.3em;
  margin: 0 0 20px 0;
  color: var(--primary-color);
  font-weight: 700;
}

.flex-container {
  flex: 1;
  display: flex;
  gap: 20px;
  overflow: hidden;
}

.left-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-panel {
  flex: 0 0 35%;
}

.right-panel {
  flex: 1;
}

.panel-section {
  margin-bottom: 20px;
}

.section-title {
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 15px;
}

.calc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
  font-size: 14px;
}

.calc-table th,
.calc-table td {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.calc-table th {
  background: var(--primary-color);
  color: white;
}

.input-cell {
  width: 90%;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--light-bg);
  font-size: 14px;
}

.calculation-cell {
  background: rgba(99, 171, 143, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  padding: 6px 8px;
  font-weight: 600;
}

.monthly-tables-container {
  display: flex;
  gap: 20px;
  margin-top: 10px;
}

.monthly-input-container {
  flex: 0 0 40%;
}

.monthly-results-container {
  flex: 1;
}

.calculate-button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
  margin-top: 10px;
}

.calculate-button:hover {
  background: var(--secondary-color);
}

/* Responsive tweaks for Calculator */
@media (max-width: 1200px) {
  .flex-container {
    flex-direction: column;
  }
  .left-panel,
  .right-panel {
    min-width: 100%;
  }
  .monthly-tables-container {
    flex-direction: column;
  }
  .monthly-input-container,
  .monthly-results-container {
    width: 100%;
  }
}


/* ===== Time Off Balances tab (scoped) ===== */
#TimeOffBalances {
  /* Bring over the palette used by the original UI (scoped so it won’t touch other tabs) */
  --text-color: #2C3E50;
  --text-light: #6C757D;
  --border-color: #DEE2E6;
  --light-bg: #F8F9FA;
  --card-bg: #FFFFFF;
}

/* Filters */
#TimeOffBalances .filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
#TimeOffBalances .filters > div {
  flex: 1;
  min-width: 200px;
}
#TimeOffBalances .filters h3 {
  font-size: 14px;
  margin: 0 0 8px 0;
  color: var(--text-light);
  font-weight: 600;
}
#TimeOffBalances .filters select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  background: var(--card-bg);
}

/* Search */
#TimeOffBalances .search-container { margin-bottom: 20px; }
#TimeOffBalances .search-container input {
  width: 100%;
  max-width: 400px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

/* Tables */
#TimeOffBalances table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card-bg);
}
#TimeOffBalances th,
#TimeOffBalances td {
  padding: 12px 15px;
  text-align: left;
  border: 1px solid var(--border-color);
}
#TimeOffBalances th {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
  position: sticky; /* sticky header like the original */
  top: 0;
  z-index: 1;
}
#TimeOffBalances tbody tr:nth-child(even) {
  background-color: var(--light-bg);
}
#TimeOffBalances tbody tr:hover {
  background-color: rgba(99,171,143,0.1);
}

/* Inputs inside table */
#TimeOffBalances .balance-input.negative { color: red; }

/* Export buttons */
#TimeOffBalances .export-buttons {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}
#TimeOffBalances .export-button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
  width: auto; /* match original (remove fixed 200px width) */
}
#TimeOffBalances .export-button:hover { background: var(--secondary-color); }

/* Optional: scroll wrapper around tables for sticky headers + card border look */
#TimeOffBalances .table-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--card-bg);
  margin-top: 15px;
}



/* Settings: place the two forms side by side, stack on small screens */
#Settings .forms-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;              /* stacks on small viewports */
}

/* Override .styled-form defaults so they can sit side by side */
#Settings .styled-form {
  max-width: none;              /* remove 600px cap */
  margin: 0;                    /* remove auto centering */
  flex: 1 1 420px;              /* grow evenly, min width for comfort */
}

/* Small title inside the card */
#Settings .styled-form .form-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: var(--primary-color);
  font-weight: 700;
}



/* === Reference UI tokens & global polish === */
:root {
  --text-color:#2C3E50;
  --text-light:#6C757D;
  --available-color:#c8e6c9;
  --nearly-color:#ffe0b2;
  --full-color:#ffcdd2;
}

/* Typography + page shell to match reference */
body{
  color:var(--text-color);
  background:var(--light-bg);
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

/* Header: tighter, with subtle shadow like reference */
header{
  padding:10px 16px;
  background:var(--primary-color);
  color:#fff;
  box-shadow:0 2px 5px rgba(0,0,0,.1);
}
.divider{ background:var(--border-color); }

/* Tabs: switch to underline active state (not filled bg) */
.tab-container{
  background:var(--light-bg);
  border-bottom:1px solid var(--border-color);
}
.tab{ display:flex; }
.tab button{
  background:transparent;
  border:none;
  cursor:pointer;
  padding:12px 20px;
  font-size:15px;
  color:var(--text-light);
  font-weight:600;
  border-bottom:3px solid transparent;
  transition:.3s;
}
.tab button:hover{ color:var(--primary-color); }
.tab button.active{
  color:var(--primary-color);
  border-bottom:3px solid var(--primary-color);
}

/* Primary actions to match reference */
.button-container{ display:flex; gap:10px; align-items:center; }
.save-button,.export-button,.import-button-label{
  padding:8px 16px;
  background:var(--primary-color);
  color:#fff;
  border:none;
  border-radius:4px;
  cursor:pointer;
  font-size:14px;
  font-weight:600;
  transition:.3s;
}
.save-button:hover,.export-button:hover,.import-button-label:hover{
  background:var(--secondary-color);
}
.import-button-label input{ display:none; }

/* Generic “card-like tabcontent” and scroll handling */
.main-content{ flex:1; padding:20px; display:flex; flex-direction:column; overflow:hidden; }
.tabcontent{
  /* keep your display toggled by JS */
  overflow:hidden;
  background:var(--card-bg);
  border-radius:8px;
  box-shadow:0 2px 10px rgba(0,0,0,.05);
}

/* ===== Balances tab: visual parity with reference ===== */
#TimeOffBalances .filters{
  gap:15px; flex-wrap:wrap; margin-bottom:20px; justify-content:flex-start;
}
#TimeOffBalances .filters > div{ flex:1; min-width:200px; }
#TimeOffBalances .filters h3{
  font-size:14px; margin:0 0 8px; color:var(--text-light); font-weight:600;
}
#TimeOffBalances .filters select{
  width:100%; padding:8px 12px; border:1px solid var(--border-color);
  border-radius:4px; font-size:14px; background:var(--card-bg);
}

/* Search box */
#TimeOffBalances .search-container{ margin-bottom:20px; }
#TimeOffBalances .search-container input{
  width:100%; max-width:400px; padding:8px 12px;
  border:1px solid var(--border-color); border-radius:4px; font-size:14px;
}

/* Table wrapper like the reference */
.table-container{
  overflow:auto; margin:15px 0 20px;
  border:1px solid var(--border-color); border-radius:6px; background:var(--card-bg);
}
.table-toolbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px; flex-wrap:wrap; padding:10px;
}
.toolbar-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.toolbar-right input[type="date"]{
  padding:6px 8px; border:1px solid var(--border-color); border-radius:4px;
}

/* Tables */
#TimeOffBalances table{
  width:100%; border-collapse:collapse; font-size:14px; background:var(--card-bg);
}
#TimeOffBalances th,#TimeOffBalances td{
  padding:12px 15px; text-align:left; border:1px solid var(--border-color);
}
#TimeOffBalances th[data-export-ignore="true"],
#TimeOffBalances td[data-export-ignore="true"]{
  width:44px;
  text-align:center;
  padding:8px;
}
#TimeOffBalances .balance-row-select,
#TimeOffBalances #balances-select-all{
  width:18px;
  height:18px;
  cursor:pointer;
}
#TimeOffBalances #delete-balances-btn:disabled{
  background:#BFC6CC;
  cursor:not-allowed;
}
#TimeOffBalances th{
  background:var(--primary-color); color:#fff; font-weight:600;
  position:sticky; top:0; z-index:1;
}
#TimeOffBalances th.is-reorderable{
  cursor: grab;
  user-select: none;
}
#TimeOffBalances th.is-reorderable.is-dragging{
  opacity: 0.55;
  cursor: grabbing;
}
#TimeOffBalances th.is-reorderable.drag-over{
  box-shadow: inset 3px 0 0 #666f74;
}
#TimeOffBalances tbody tr:nth-child(even){ background-color:var(--light-bg); }
#TimeOffBalances tbody tr:hover{ background-color:rgba(99,171,143,.1); }

/* Inputs & state colouring */
#TimeOffBalances .balance-input{
  width:90%; padding: 4px 6px; border:1px solid var(--border-color);
  border-radius:4px; font-size:14px; background:var(--card-bg);
  transition:background .15s, border-color .15s, color .15s;
}
#TimeOffBalances .balance-input.low{
  background:#FFF4E5; border-color:#FFB74D;
}
#TimeOffBalances .balance-input.negative{
  background:#FFE8E8; border-color:#E57373; color:#C62828;
}

/* Details summary line used in the reference */
#details-summary{
  padding:0 10px 8px; color:var(--text-light); font-size:14px;
}

/* Calendar tweaks (parity with reference colours already set) */
.calendar .day.available { background-color: var(--available-color); }
.calendar .day.nearly    { background-color: var(--nearly-color); }
.calendar .day.full      { background-color: var(--full-color); }

/* Responsive alignment with reference */
@media (max-width:1200px){
  .flex-container{ flex-direction:column; }
  .left-panel,.right-panel{ min-width:100%; }
}
@media (max-width:900px){
  .calendar-header,.calendar{ font-size:13px; }
}
@media (max-width:700px){
  .calendar-header,.calendar{ font-size:11px; }
}



/* CSV import — match site look */
.file-upload{
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-content: center;
  justify-content: center;
  flex-direction: row;
  align-items: center;
}

.file-input{
  /* hide native input but keep it accessible */
  position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden;
}

.import-button-label{
  padding:8px 16px;
  background:var(--primary-color);
  color:#fff;
  border:none;
  border-radius:4px;
  cursor:pointer;
  font-size:14px;
  font-weight:600;
  transition:.3s;
  display:inline-flex; align-items:center; gap:8px;
}
.import-button-label:hover{ background:var(--secondary-color); }

.file-chosen{
  max-width:240px;
  color:var(--text-light);
  font-size:14px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}


/* Analytics Tab Styles */
.analytics-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 20px;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,.05);
  text-align: center;
}

.summary-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text-light);
}

.summary-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary-color);
}

.summary-card .subtext {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 5px;
}

.analytics-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,.05);
}

.chart-container h3 {
  margin: 0 0 15px;
  font-size: 16px;
  color: var(--text-color);
  font-weight: 600;
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

.analytics-table-container {
  margin-top: 20px;
}

.analytics-table-container h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--text-color);
  font-weight: 600;
}

.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card-bg);
}

.analytics-table th,
.analytics-table td {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.analytics-table th {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

.analytics-table tr:nth-child(even) {
  background-color: var(--light-bg);
}

.analytics-table tr:hover {
  background-color: rgba(99,171,143,.1);
}

.progress-bar {
  height: 20px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin: 5px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 10px;
}

.warning {
  color: #e74c3c;
  font-weight: 600;
}

.good {
  color: #2ecc71;
  font-weight: 600;
}

.neutral {
  color: #f39c12;
  font-weight: 600;
}

/* Analytics controls */
.analytics-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.analytics-controls .year-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px 10px;
}

.analytics-controls .year-selector label {
  font-weight: 600;
  color: var(--text-color);
  font-size: 14px;
  margin: 0;
}

.analytics-controls .year-selector select {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-color);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  min-width: 120px;
  cursor: pointer;
}

.analytics-controls .export-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.3s;
}

.analytics-controls .export-btn:hover {
  background: var(--secondary-color);
}

/* Responsive adjustments affecting Analytics */
@media (max-width:700px) {
  .analytics-charts {
    grid-template-columns: 1fr;
  }
  .analytics-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .analytics-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
/* ---- Fix growing charts in Analytics ---- */

#TimeOffAnalytics .analytics-charts {
  align-items: stretch;
}

/* Give each chart card a fixed height */
#TimeOffAnalytics .chart-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
}


#TimeOffAnalytics .chart-wrapper {
  position: relative;
  height: 260px;          /* controls chart height */
  flex: 1 1 auto;
  overflow: hidden;       /* prevents any canvas overflow */
}

#TimeOffAnalytics .chart-wrapper canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}





/* Make the canvas fill the card, and stop flex-auto growth loops */
#TimeOffAnalytics .chart-card canvas {
  flex: 0 0 auto;             /* disable "flex: 1" if we added it earlier */
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-height: 100%;
}

/* On small screens, you can still stack them, the height stays fixed */
@media (max-width: 700px) {
  #TimeOffAnalytics .chart-card {
    height: 240px;
    min-height: 240px;
  }
}

.table-header {
  margin-top: 2%;
  display: flex;
  justify-content: space-between;
}

.summary-card p {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0px;
}

.summary-card small {
  font-size: 12px;
  color: grey;
}


/* --- Keep CSV controls aligned even before a file is chosen --- */

/* Allow the whole header row to wrap cleanly instead of squeezing the right side */
.tab-container{
  flex-wrap: wrap;
  gap: 10px;
  margin-right: 10px;
}

/* Let tabs use remaining space and wrap if needed */
.tab{
  flex: 1 1 auto;
  flex-wrap: wrap;
}

/* Keep the CSV controls pinned to the right (or next row) and stable */
.button-container{
  flex: 0 0 auto;
  margin-left: auto;
}

/* Make the upload row never wrap internally (so buttons don't stack/weird-wrap) */
.file-upload{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* Prevent button/label text wrapping ("Choose CSV" -> 2 lines) */
.file-upload .export-button{
  display: inline-flex;   /* label + button behave the same */
  white-space: nowrap;
}

/* Make the filename behave nicely and not push buttons around */
.file-chosen{
  display: inline-block;
  max-width: 220px;       /* tweak if you want more/less */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 220px;
}

/* Add Column confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(760px, 50%);
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 18px 24px 12px 24px;
  border-bottom: 2px solid #2f2f2f;
  background-color: var(--primary-color);
  border-radius: 18px 18px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 28px;
  font-weight: 2;
  line-height: 1;
  color: #2f2f2f;
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: #2f2f2f;
}

.modal-actions {
  padding: 0 24px 22px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-btn {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--primary-color);
  color: #fff;
  font-size: 18px;
  font-weight: 2;
  cursor: pointer;
  border: none;
}

.modal-btn:hover {
  background: var(--secondary-color);
}

button#delete-balances-confirm-close {
    background: #f44b4b;
}

@media (max-width: 700px) {
  .modal-header h3 { font-size: 30px; }
  .modal-body p { font-size: 18px; }
  .modal-btn { min-width: 140px; font-size: 18px; }
}


