/* CSS Variables from Veerayatan Theme */
:root {
  --primary-blue: #004D99;
  /* Deep blue from Veerayatan logo */
  --primary-green: #8CD34D;
  /* Light green from Veerayatan logo */
  --tbl-teal: #2AB8A3;
  --tbl-dark: #4B3632;
  --bg-light: #F4F7F6;
  --text-dark: #333333;
  --text-light: #FFFFFF;
  --border-color: #E0E0E0;
}

/* Custom Multi-select Dropdown with Checkboxes */
.custom-multiselect {
    position: relative;
    width: 100%;
    margin-bottom: 5px;
}

.multiselect-header {
    padding: 10px 15px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    cursor: pointer !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 0.95rem !important;
    transition: all 0.2s ease !important;
    min-height: 45px !important;
    color: #334155 !important;
}

.multiselect-header:hover {
    border-color: var(--primary-blue) !important;
    background: #f8fafc !important;
}

.multiselect-options {
    position: absolute !important;
    top: calc(100% + 5px) !important;
    left: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
    z-index: 9999 !important;
    max-height: 250px !important;
    overflow-y: auto !important;
    display: none !important;
    padding: 6px !important;
}

.multiselect-options.show {
    display: block !important;
    animation: ms-slide-down 0.2s ease-out !important;
}

.multiselect-option {
    display: flex !important;
    align-items: center !important;
    padding: 0 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
    margin-bottom: 2px !important;
}

.multiselect-option:hover {
    background: #f1f5f9 !important;
}

.multiselect-option input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer !important;
    accent-color: var(--primary-blue) !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.multiselect-option label {
    cursor: pointer !important;
    font-size: 0.9rem !important;
    color: #1e293b !important;
    margin: 0 !important;
    font-weight: 500 !important;
    flex: 1 !important;
}

@keyframes ms-slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.toggle-password:hover {
  color: var(--primary-blue) !important;
}

.password-field-container {
  position: relative;
  width: 100%;
  margin-bottom: 0.8rem;
}

.password-field-container input {
  margin-bottom: 0 !important;
  width: 100% !important;
}

.toggle-password {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: #64748b;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

html {
  overflow-y: scroll;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Philosopher', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Section */
.app-header {
  background-color: var(--text-light);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  padding: 1rem 2rem;
  border-top: 5px solid var(--primary-green);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
}

.logo-left,
.logo-right {
  display: flex;
  align-items: center;
}

.logo-left img {
  height: 60px;
  margin-right: 1.5rem;
  object-fit: contain;
}

.logo-right img {
  height: 45px;
  object-fit: contain;
}

.header-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--primary-blue);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  white-space: nowrap;
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 3rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  opacity: 0;
  /* Hidden until auth check */
  transition: opacity 0.5s ease;
}

/* Hero Section Cards */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.info-card {
  padding: 1.5rem 2rem;
  border-radius: 10px;
  box-shadow: 0 6px 12px -3px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  justify-content: flex-start;
}

.info-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.12);
}

.info-card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.info-card p,
.info-card ul {
  font-size: 0.95rem;
  line-height: 1.5;
}

.info-card ul {
  padding-left: 1.2rem;
  list-style-type: disc;
}

.info-card ul li {
  margin-bottom: 0.4rem;
}

.blue-card {
  background-color: #2a446e;
  /* Faint blue */
  color: #ffffff;
}

.blue-card h3 {
  color: #fec94c;
  /* Slightly muted yellow */
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 0.5rem;
}

.yellow-card {
  background-color: #fdc745;
  /* Faint yellow */
  color: #1d3356;
}

.yellow-card h3 {
  color: #1d3356;
  border-bottom: 1px solid rgba(29, 51, 86, 0.15);
  padding-bottom: 0.5rem;
}

/* Progress Gauges */
.progress-section {
  background: var(--text-light);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
  margin-bottom: 3rem;
  text-align: center;
}

.progress-section h2 {
  color: var(--primary-blue);
  font-size: 1.8rem;
  margin-bottom: 2.5rem;
  font-weight: 700;
}

.gauges-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.gauges-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.gauge-item {
  flex: 1;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  /* Drastically reduced gap */
  padding: 1.5rem 1rem;
  border-radius: 16px;
  transition: all 0.2s ease;
  cursor: default;
}

.gauge-item:hover {
  background: rgba(43, 84, 126, 0.03);
  /* Subtle blue hint on hover */
}

.gauge-item .gauge-title {
  margin-bottom: 0;
  font-size: 1rem;
  color: var(--primary-blue);
  opacity: 0.9;
}

.section-header-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  position: relative !important;
  margin-bottom: 30px !important;
  width: 100% !important;
  min-height: 50px !important;
  overflow: visible !important;
}

.gauge-section-title {
  position: absolute !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  text-align: center;
  white-space: nowrap !important;
  color: var(--primary-blue);
  z-index: 5;
}

.gauge-hint {
  position: relative !important;
  font-size: 0.62rem !important;
  color: #64748b !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  opacity: 1 !important;
  background: #f8fafc !important;
  padding: 5px 12px !important;
  border-radius: 50px !important;
  border: 1.5px solid #e2e8f0 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  white-space: nowrap !important;
  z-index: 20 !important;
  margin: 0 !important;
}

.gauge-markings text {
  font-family: 'Philosopher', sans-serif;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.needle-gauge-svg path,
.needle-gauge-svg line {
  cursor: pointer;
  pointer-events: auto;
}

.gauge-tooltip,
.vg-tooltip {
  position: absolute;
  background: #fec94c;
  color: #1e293b;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  pointer-events: none;
  z-index: 10000;
  display: none;
  box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.1);
  min-width: 130px;
  line-height: 1.3;
}

.gauge-tooltip .tooltip-header,
.vg-tooltip .tooltip-header {
  padding-bottom: 0;
  margin-bottom: 2px;
}

.gauge-tooltip .tooltip-title,
.vg-tooltip .tooltip-title {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: #0f172a;
  font-size: 0.82rem !important;
  margin: 0;
}

.gauge-tooltip .tooltip-body,
.vg-tooltip .tooltip-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vg-tooltip .tooltip-dates {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 2px;
}

.gauge-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.gauge-tooltip .tooltip-label {
  color: #475569;
  font-weight: 600;
}

.gauge-tooltip .tooltip-value {
  color: #0f172a;
  font-weight: 800;
}

.gauge-tooltip .phase-item {
  font-size: 0.75rem;
  padding: 2px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  color: #1e293b;
}

#vg-legend-container,
#gauge-legend-container {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex !important;
  z-index: 10;
}

.tooltip-value {
  font-weight: 800;
  text-align: right;
}

.gauge-hint {
  font-size: 0.8rem;
  color: #64748b;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: 6px;
  width: fit-content;
  border-left: 3px solid var(--tbl-teal);
  white-space: nowrap;
}


.section-header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  margin-bottom: 2rem;
  width: 100%;
}

.section-header-row h2 {
  grid-column: 2;
  margin: 0 !important;
  text-align: center;
}

.section-header-row .gauge-hint {
  grid-column: 3;
  text-align: right;
}

.vg-tooltip {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  max-width: 350px;
  backdrop-filter: blur(4px);
}

.vg-tooltip .tooltip-desc {
  white-space: pre-line;
}

.svg-gauge-container {
  position: relative;
  width: 170px;
  height: 90px;
  display: flex;
  justify-content: center;
}

.half-gauge-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.05));
}

.gauge-progress {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.svg-gauge-container span {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-blue);
  line-height: 1;
}

.gauge-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #222;
  margin: 0;
  line-height: 1.2;
}

.gantt-container {
  background: var(--text-light);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
}

.gantt-container h2 {
  color: var(--primary-blue);
  font-size: 1.8rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* Detailed Gantt Table */
.detailed-table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 75vh;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.detailed-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  text-align: left;
  table-layout: auto;
}

.detailed-table th {
  background-color: var(--primary-blue);
  color: #fff;
  padding: 0.8rem 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 10;
  border-left: none !important;
  border-right: none !important;
}

.detailed-table td {
  padding: 0.8rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  line-height: 1.4;
  color: #333;
  vertical-align: top;
  word-wrap: break-word;
  white-space: normal;
}

/* Removed fixed nth-child column widths to allow dynamic distribution */
/* Edit Hint Note */
.edit-hint-note {
  grid-column: 1;
  justify-self: start;
  font-size: 0.8rem;
  color: #64748b;
  margin: 0;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: 6px;
  width: fit-content;
  border-left: 3px solid var(--tbl-teal);
  white-space: nowrap;
}


.table-phase-row {
  background-color: #f8fafc !important;
  cursor: pointer;
  transition: background-color 0.2s;
}

.table-phase-row td {
  text-align: left !important;
  font-weight: 700 !important;
  color: var(--primary-blue) !important;
  padding: 0.8rem 1rem !important;
  background-color: #f1f5f9 !important;
  border-bottom: 2px solid var(--border-color) !important;
}

.table-phase-row:hover td {
  background-color: #e2e8f0 !important;
}

.detailed-table tbody tr:hover {
  background-color: #f4f7f6;
  transition: background-color 0.2s;
}

.detailed-gantt-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 1.5rem;
  width: 100%;
}

.detailed-gantt-header h2 {
  grid-column: 2;
  margin: 0;
  text-align: center;
}

.btn-primary-gantt {
  grid-column: 3;
  justify-self: end;
  background: linear-gradient(135deg, var(--tbl-teal), var(--primary-blue));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: 'Philosopher', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(42, 184, 163, 0.25);
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 3rem;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid #f1f5f9;
}

.gauge-main-display {
  padding: 2rem 0;
  display: flex;
  justify-content: center;
}

/* Overall Gauge Styles */
.overall-progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: white;
  border-radius: 12px;
  min-height: 320px;
  justify-content: center;
}

.overall-gauge-card .gauge-section-title {
  color: #0066CC;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  width: 100%;
}

.gauge-main-display {
  position: relative;
  width: 360px;
  /* Reduced as requested */
  height: 220px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.needle-gauge-svg {
  width: 100%;
  height: 100%;
}

.gauge-center-text {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.main-perc {
  font-size: 2.8rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.sub-label {
  font-size: 0.75rem;
  color: #64748b;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-top: 2px;
}

#needle-today,
#needle-completed,
#needle-progress {
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 100px 100px;
}

.top-corner-legend {
  position: absolute;
  top: 25px;
  right: 30px;
  display: flex;
  gap: 15px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  z-index: 10;
}

.top-corner-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-corner-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.time {
  background-color: #94a3b8;
}

/* Gray for time elapsed */
.dot.target {
  background-color: #f59e0b;
}

/* Orange/Yellow for target */
.dot.actual {
  background-color: #2AB8A3;
}

/* Teal for actual */

.dot.red {
  background-color: #ef4444;
}

.dot.yellow {
  background-color: #f59e0b;
}

.dot.teal {
  background-color: #008080;
}

#needle-today,
#needle-expected,
#needle-actual {
  transition: transform 1.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 100px 100px;
}

.mt-4 {
  margin-top: 2rem;
}

.btn-primary-gantt:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(42, 184, 163, 0.3);
  opacity: 0.9;
}

.detailed-table td:first-child {
  font-weight: 700;
  color: var(--primary-blue);
  min-width: 40px;
}

.btn-complete {
  background: #fff4f4;
  border: 2px solid #ffcdcd;
  color: #ff9e9e;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
}

.btn-complete:hover {
  border-color: #ff8585;
  color: #ff8585;
  background: #ffeded;
}

.btn-complete.completed,
.status-completed {
  background: var(--primary-green) !important;
  color: #fff !important;
  border-color: var(--primary-green) !important;
}

.status-in-progress {
  background: #fec94c !important;
  /* Yellow from theme */
  color: #1d3356 !important;
  /* Dark blue text for contrast */
  border-color: #fec94c !important;
}

.status-client-pending {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
}

.status-pending {
  background: #f4f7f6 !important;
  color: #666 !important;
  border-color: #ddd !important;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 800;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  font-family: inherit;
  letter-spacing: 0.8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

select.status-badge {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px;
  padding-right: 25px !important;
  padding-left: 25px !important;
  cursor: pointer;
  color: inherit;
  text-align-last: center;
}

select.status-badge option {
  background-color: #ffffff;
  color: #334155;
  text-transform: none;
  font-weight: 600;
  padding: 10px;
  font-size: 0.9rem;
}

select.status-badge[disabled] {
  background-image: none !important;
  padding-right: 10px !important;
  cursor: default;
  opacity: 1;
  /* Keep full opacity for readability */
}

.status-badge:hover {
  filter: brightness(0.95);
}

/* Footer Section */
.app-footer {
  background-color: var(--primary-blue);
  color: var(--text-light);
  padding: 2rem 3rem;
  margin-top: auto;
}

.footer-container {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  width: 100%;
}

.footer-left p {
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.footer-logo {
  height: 70px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.footer-right {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.social-icon {
  color: var(--text-light);
  font-size: 1.6rem;
  transition: color 0.2s, transform 0.2s;
  opacity: 0.85;
}

.social-icon:hover {
  color: var(--tbl-teal);
  transform: translateY(-3px);
  opacity: 1;
}



/* Info Cards */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.info-card {
  padding: 2rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.info-card:hover {
  transform: translateY(-5px);
}

.info-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1.2rem;
  font-weight: 700;
}

.info-card p {
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.95;
}

.info-card ul {
  margin-top: 1.2rem;
  padding-left: 1.5rem;
}

.info-card li {
  margin-bottom: 0.6rem;
  font-size: 1rem;
  opacity: 0.9;
}

.blue-card {
  background: var(--primary-blue);
  color: white;
}

.blue-card h3 {
  color: #fdc745;
}

.yellow-card {
  background: #fdc745;
  color: #1d3356;
}

.yellow-card h3 {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.6rem;
}

/* Progress Gauges */
.progress-section {
  margin-bottom: 3.5rem;
  padding: 3rem 2.5rem;
  background: #ffffff;
  border-radius: 15px;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-color);
}

.progress-section h2 {
  color: var(--primary-blue);
  font-size: 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  font-weight: 700;
}

.gauges-container {
  max-width: 1100px;
  margin: 0 auto;
}

.gauges-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  /* Reduced gap to account for legend */
  max-width: 1200px;
  margin: 0 auto;
}

.gauges-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding: 8px 18px;
  background: #fdfdfd;
  border-radius: 50px;
  width: fit-content;
  align-self: flex-end;
  /* Move to bottom right */
  margin-right: 2rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  border: 1px solid #efefef;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.color-completed {
  background: linear-gradient(to right, var(--tbl-teal), var(--primary-blue));
}

.color-in-progress {
  background: #fec94c;
}

.gauges-row {
  display: flex;
  justify-content: center;
  gap: 3.5rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* Individual positions no longer needed with flex rows */

.gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 200px;
}

.gauge-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--primary-blue);
  text-align: center;
  min-height: 1.2em;
  display: flex;
  align-items: center;
}

.svg-gauge-container {
  position: relative;
  width: 180px;
  height: 100px;
}

.half-gauge-svg {
  width: 100%;
  height: 100%;
}

.gauge-in-progress {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  stroke-linecap: round;
  stroke-dashoffset: calc(125.66 * (1 - (var(--p) + var(--p-prog)) / 100));
}

.gauge-progress {
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
  stroke-linecap: round;
  stroke-dashoffset: calc(125.66 * (1 - var(--p) / 100));
}

.svg-gauge-container span {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--primary-blue);
}

.gauge-stats {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  width: 100%;
}

.comp-percent {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--primary-blue);
}

.prog-percent {
  font-size: 0.85rem;
  font-weight: 700;
  color: #eebb22;
  /* Slightly darker gold for readability */
  height: 1rem;
  /* Reserve space */
}

/* Visual Gantt Component */
.visual-gantt-container {
  background: var(--text-light);
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  padding: 2.5rem;
  margin-top: 3rem;
  margin-bottom: 3rem;
}


.visual-gantt-container h2,
.progress-section h2 {
  color: var(--primary-blue);
  font-size: 1.8rem;
  margin: 0;
  text-align: center;
}

.header-left {
  display: flex;
  justify-content: flex-start;
}

.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
}

#vg-legend-container,
#gauge-legend-container {
  justify-self: end;
}

#vg-legend-container .vg-legend,
#gauge-legend-container .vg-legend {
  display: flex;
  gap: 12px;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #1e293b;
  background: white;
  padding: 5px 12px;
  border-radius: 50px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid #e2e8f0;
  align-items: center;
}

.gauge-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.3px;
  text-transform: none;
}

.vg-wrapper {
  background-color: #ffffff;
  border-radius: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  /* Enable horizontal scroll only */
  color: var(--text-dark);
  font-family: 'Philosopher', sans-serif;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  position: relative;
}

.vg-header {
  display: flex;
  background-color: var(--text-light);
  padding: 0;
  border-bottom: 2px solid var(--border-color);
  min-width: max-content;
  /* Ensure it expands with time-col */
}

.vg-header .vg-task-col {
  border-right: 1px solid var(--border-color);
  color: var(--primary-blue);
  background-color: #f7f9fc;
}

.vg-task-col {
  width: 250px;
  min-width: 250px;
  padding: 0 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  font-size: 0.95rem;
  border-right: 1px solid var(--border-color);
  letter-spacing: 0.5px;
  position: sticky;
  left: 0;
  background-color: #ffffff;
  z-index: 30;
  /* High z-index to stay above pills during horizontal scroll */
  border-right: 1px solid var(--border-color);
}

.vg-time-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 1400px;
  /* Ensure container spans full content */
}

.vg-months {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 1rem 0 0.2rem;
  border-bottom: 1px dashed #e0e0e0;
  background-color: #f7f9fc;
}

.vg-months span {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--primary-blue);
}

.vg-weeks {
  display: flex;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  min-height: 38px;
  position: relative;
  overflow: visible;
}

.vg-week-label {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.58rem;
  color: #64748b;
  font-weight: 500;
  height: auto;
  bottom: 2px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.vg-today-line {
  position: absolute;
  top: 0;
  height: 2000px;
  width: 0;
  border-left: 2px dotted #ef4444;
  z-index: 40;
  pointer-events: none;
}

.vg-today-tag {
  position: absolute;
  top: -2px;
  left: 0;
  transform: translateX(-50%);
  background-color: #ef4444;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: center;
  z-index: 100;
}

.vg-today-tag::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #ef4444;
}

.vg-day-group {
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  font-size: 0.75rem;
  color: #777;
  font-weight: 600;
}

/* Phase Header Styles */
.vg-phase-row {
  display: flex;
  background-color: #f0f4f9;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  height: 48px;
  user-select: none;
  transition: background-color 0.2s;
  min-width: max-content;
  /* Sync with header */
}

.vg-phase-row:hover {
  background-color: #e6eef7;
}

.vg-phase-row .vg-task-col {
  background-color: inherit;
  color: var(--primary-blue);
  font-size: 1rem;
  gap: 10px;
}


.vg-phase-row.collapsed .phase-toggle-icon {
  transform: rotate(-90deg);
}

.vg-row.collapsed-task {
  display: none !important;
}

/* Phase row in table */
.table-phase-row {
  background-color: #f7f9fc !important;
  font-weight: 700;
  cursor: pointer;
}

.table-phase-row td {
  color: var(--primary-blue) !important;
  font-size: 1rem !important;
}

.table-phase-row:hover {
  background-color: #eef2f8 !important;
}

.table-task-row.collapsed-task,
.table-add-row.collapsed-task,
.task-row-timeline.collapsed-task {
  display: none !important;
}

.vg-row {
  display: flex;
  border-bottom: 1px solid #f0f0f0;
  background-color: #ffffff;
  transition: background 0.2s;
  height: 55px;
  min-width: max-content;
  /* Sync with header */
}

.vg-row:nth-child(even) {
  background-color: #fcfcfc;
}

.vg-row .vg-task-col {
  border-right: 1px solid #eaeaea;
}

.vg-row .vg-time-col {
  display: block;
  /* Overrides flex for the row bodies */
}

.grid-bg {
  /* Vertical lines for months with light grey */
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 16.666% 100%;
}

/* Redesigned Legend */
/* Redesigned Legend in Header Row handled globally above */

.vg-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.5px;
}

.vg-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  /* Squircle style */
}

.vg-legend-dot.completed {
  background: linear-gradient(135deg, #2AB8A3 0%, #004D99 100%);
}

.vg-legend-dot.in-progress {
  background: #fec94c;
}

.vg-legend-dot.pending {
  background: #cbd5e1;
}

.vg-pill {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  border-radius: 50px;
  /* Full capsule rounding */
  display: flex;
  align-items: center;
  padding: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
  cursor: pointer;
  z-index: 5;
  overflow: hidden;
  /* Important for clipping the layered pills */
}

/* Recurring Task Styling (Option B: Striped Pattern) */
.recurring-pill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.25) 10px,
    transparent 10px,
    transparent 20px
  );
  pointer-events: none;
  z-index: 10;
}

/* Layered Progress Bar approach: each layer is a full-height pill */
.vg-progress-bar-layered {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: #f1f5f9;
}

.vg-layer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 50px;
  /* Each layer is also a pill */
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.vg-layer.completed {
  background: linear-gradient(to right, #2AB8A3, #004D99);
  z-index: 4;
}

.vg-layer.in-progress {
  background: #fec94c;
  z-index: 3;
}

.vg-layer.client-pending {
  background: #3b82f6;
  z-index: 2;
}

.vg-layer.pending {
  background: #cbd5e1;
  z-index: 1;
}

.vg-pill:hover {
  transform: translateY(-50%) scale(1.02);
  opacity: 1;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  z-index: 15;
}

.pill-progress-text {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f172a;
  z-index: 20;
  /* On top of layers */
  pointer-events: none;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pill-progress-text.outside {
  right: auto;
  left: calc(100% + 8px);
  color: var(--primary-blue);
  text-shadow: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 20;
}

/* Background Layer */
.page-background-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -10;
  overflow: hidden;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 250px;
  gap: 8px;
  opacity: 0.30;
  /* White fallback — shows when no client bg images are rendered */
  background: #ffffff;
}

.bg-tile {
  background-size: cover;
  background-position: center;
  border-radius: 8px;
}

/* Hidden utility for modals */
.hidden-modal {
  display: none !important;
}

/* Password Modal CSS */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.4s ease;
}

/* --- PREMIUM MODAL STYLING --- */
.password-modal {
  background: var(--text-light);
  border-radius: 16px;
  padding: 0;
  /* Reset padding to handle scroll area */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  text-align: center;
  max-width: 600px;
  width: 95%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fix for Auth/Login Modal specifically */
.auth-modal {
  padding: 3.5rem 2.5rem;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.auth-modal h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0.5rem 0;
  font-family: 'Philosopher', sans-serif;
  color: var(--primary-blue);
  font-size: 1.8rem;
  width: 100%;
}

.auth-modal p {
  color: #64748b;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.auth-modal .auth-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 1.2rem !important;
  width: 100% !important;
}

.auth-modal input {
  width: 100% !important;
  padding: 1rem 1.2rem !important;
  border: 2px solid var(--border-color) !important;
  border-radius: 8px !important;
  font-size: 1.05rem !important;
}

.auth-modal input:focus {
  border-color: var(--primary-blue) !important;
}

.auth-modal .btn-unlock {
  margin-top: 0.5rem;
  width: 100%;
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.modal-header h3 {
  margin: 0;
  color: var(--primary-blue);
  font-size: 1.5rem;
  font-family: 'Philosopher', sans-serif;
  font-weight: 700;
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--tbl-teal) #f1f5f9;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--tbl-teal);
  border-radius: 10px;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* Premium Form Controls */
.modal-body label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background: #fff;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  border-color: var(--tbl-teal);
  outline: none;
  box-shadow: 0 0 0 4px rgba(42, 184, 163, 0.1);
  background: #fdfdfd;
}

.btn-unlock {
  background: linear-gradient(135deg, var(--primary-blue), #14284b);
  color: #fff;
  border: none;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(0, 77, 153, 0.2);
}

.btn-unlock:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 77, 153, 0.3);
  filter: brightness(1.1);
}

.password-error {
  color: #e74c3c !important;
  font-size: 0.85rem;
  margin-bottom: 0.5rem !important;
  display: none;
}

/* Auth Modal Specifics */
.auth-group {
  flex-direction: column;
}

.auth-group input {
  margin-bottom: 0.8rem;
}

.login-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.auth-footer {
  margin-top: 1.5rem;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  padding-top: 1.2rem;
  width: 100%;
  font-size: 0.8rem;
}

.header-right-controls {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-logout:hover {
  background: #fff0f0;
  border-color: #ffcdcd;
  color: #e74c3c;
}

/* Tooltip Styles */
.vg-tooltip {
  position: absolute;
  background: #fdc745;
  color: #1d3356;
  padding: 8px 14px;
  /* Reduced vertical padding */
  border-radius: 10px;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 9999;
  max-width: 280px;
  display: none;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  line-height: 1.4;
}

.vg-tooltip .tooltip-dates {
  display: block;
  color: #1d3356;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  /* Reduced */
  border-bottom: 1px solid rgba(29, 51, 86, 0.15);
  padding-bottom: 3px;
}

.vg-tooltip .tooltip-title {
  display: block;
  font-weight: 800;
  font-size: 0.85rem;
  margin-top: 4px;
  /* Reduced */
  margin-bottom: 6px;
  color: #000;
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 2px;
  /* Reduced spacing between rows */
  font-size: 0.78rem;
}

.tooltip-label {
  opacity: 0.85;
}

.tooltip-value {
  font-weight: 700;
}

.row-highlight {
  animation: highlight-row 3s ease-out;
}

@keyframes highlight-row {
  0% {
    background-color: rgba(253, 199, 69, 0.3);
  }

  100% {
    background-color: transparent;
  }
}

/* User Profile & Auth UI */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 20px;
  padding: 6px 18px;
  background: #f8fafc;
  border-radius: 50px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.user-profile:hover {
  background: #f1f5f9;
  border-color: var(--tbl-teal);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.user-avatar {
  font-size: 1.6rem;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
}

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.user-email {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--tbl-teal);
  font-weight: 800;
}

/* Gantt & Timeline */

.vg-summary-pill {
  height: 24px !important;
  border-radius: 12px !important;
  opacity: 1 !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  z-index: 10 !important;
}

/* Editable Fields */
[contenteditable="true"]:focus {
  outline: 2px solid var(--tbl-teal);
  background: rgba(168, 213, 229, 0.15);
  border-radius: 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Administrative Controls */
.btn-add-task {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px dashed #cbd5e1;
  color: #64748b;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 25px auto;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  width: auto;
  min-width: 200px;
  justify-content: center;
}

.btn-add-task:hover {
  background: #f8fafc;
  border-color: var(--tbl-teal);
  color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}

.btn-add-task svg {
  transition: transform 0.3s ease;
}

.btn-add-task:hover svg {
  transform: rotate(90deg);
}

.btn-delete {
  background: #fff5f5;
  border: 1px solid #fee2e2;
  color: #fa5252;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 8px;
}

.btn-delete:hover {
  background: #fa5252;
  color: white;
  border-color: #fa5252;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(250, 82, 82, 0.3);
}

/* Save Indicator */
.save-indicator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #2dab7d;
  color: white;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(45, 171, 125, 0.4);
  display: none;
  z-index: 10000;
  animation: slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Admin Nav Bar */
.admin-nav-bar, .back-nav-bar {
  display: flex;
  justify-content: center;
  padding: 1.5rem;
  background: transparent;
  margin: 1rem 0;
}

.btn-time-log-nav {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: #00468c;
  /* Slightly darker to match theme */
  color: white;
  padding: 12px 35px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 70, 140, 0.25);
  font-size: 1rem;
  letter-spacing: 0.5px;
}

.btn-time-log-nav:hover {
  background: var(--tbl-teal);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(42, 184, 163, 0.35);
}

.btn-time-log-nav i {
  font-size: 1.2rem;
  color: #fff;
}

/* Time Log Form Styles */
.time-log-form-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  padding-bottom: 3rem;
  width: 100%;
}

.form-card,
.logs-list-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.form-header {
  background: #f8fafc;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.form-header h2 {
  font-size: 1.2rem;
  color: var(--primary-blue);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

#time-log-form,
#expense-tracker-form {
  padding: 2rem;
}

.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-row.col-2 .form-group {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.full-width {
  width: 100% !important;
  flex: none !important;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.form-group label .required {
  color: #ef4444;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  font-family: 'Philosopher', sans-serif;
  background: #fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E') no-repeat right 18px center;
  background-size: 12px auto;
  padding-right: 45px !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--tbl-teal);
  box-shadow: 0 0 0 3px rgba(45, 171, 125, 0.1);
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  margin: 2rem 0 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary-blue);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
  width: fit-content;
}

.btn-text:hover {
  color: var(--tbl-teal);
  text-decoration: underline;
}

.form-actions {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

.btn-save-log {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 12px 35px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-save-log:hover {
  background: #14284b;
  transform: translateY(-1px);
}

.logs-table-wrapper {
  padding: 1rem;
  overflow-x: auto;
  width: 100%;
}

.detailed-table {
  width: 100%;
  min-width: 1200px;
  /* Force scrollable on narrow views */
  border-collapse: collapse;
}

/* Expense Status Pills */
.status-pill.approved {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-pill.rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.status-pill.pending {
  background: #fefce8;
  color: #854d0e;
  border: 1px solid #fef08a;
}

.form-group-title {
  font-size: 1rem;
  font-weight: 700;
  color: #004D99;
  /* Deep blue highlight */
  margin: 1.5rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #8CD34D;
  /* Green line */
  display: flex;
  align-items: center;
  gap: 10px;
}

.currency-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.currency-symbol {
  position: absolute;
  left: 12px;
  font-weight: 700;
  color: #64748b;
  pointer-events: none;
}

.currency-input-wrapper input {
  padding-left: 45px !important;
}

/* Admin Analytics Scorecards */
.admin-analytics-container {
  margin-bottom: 2.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.analytics-header {
  flex: 0 0 320px;
  /* Specific width for header/filter block */
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background: white;
  padding: 1.2rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  border: 1px solid #f1f5f9;
}

.analytics-header h2 {
  font-size: 1.05rem;
  color: var(--primary-blue);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-filter select {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 50px;
  font-family: 'Philosopher', sans-serif;
  font-size: 0.9rem;
  outline: none;
  background: #f8fafc url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E') no-repeat right 15px center;
  background-size: 10px auto;
  appearance: none;
  cursor: pointer;
  transition: all 0.2s;
}

.analytics-filter select:focus {
  border-color: var(--primary-blue);
  background-color: #fff;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%232AB8A3%22%20d%3D%22M287%20223c0%205-1.9%209.2-5.4%2012.8-3.6%203.6-7.8%205.4-12.8%205.4H18.4c-5%200-9.2-1.8-12.8-5.4A17.6%2017.6%200%200%201%200%20223c0-5%201.8-9.2%205.4-12.8L133.4%2082.3c3.6-3.6%207.8-5.4%2012.8-5.4s9.2%201.8%2012.8%205.4L287%20210.2c3.5%203.6%205.4%207.8%205.4%2012.8z%22%2F%3E%3C%2Fsvg%3E');
  box-shadow: 0 0 0 3px rgba(0, 77, 153, 0.1);
}

.scorecard-item {
  flex: 1;
  /* Distribute remaining space */
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid #f1f5f9;
  transition: all 0.2s;
}

.scorecard-item:hover {
  transform: translateY(-3px);
}

.scorecard-icon {
  width: 55px;
  height: 55px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.scorecard-icon.hours {
  background: rgba(0, 77, 153, 0.1);
  color: #004D99;
}

.scorecard-icon.expenses {
  background: rgba(42, 184, 163, 0.1);
  color: #2AB8A3;
}

.scorecard-info .label {
  display: block;
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 5px;
}

.scorecard-info h3 {
  margin: 0;
  font-size: 1.8rem;
  color: #1e293b;
  font-family: 'Philosopher', sans-serif;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 48px;
}

.checkbox-card:hover {
  border-color: #2AB8A3;
}

.checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.checkbox-card label {
  margin: 0;
  cursor: pointer;
  font-weight: 500 !important;
}

/* --- EMBEDDED ADMIN MODULES --- */
.admin-module-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #eef2f6;
  overflow: hidden;
  transition: all 0.3s ease;
  padding: 1.5rem;
}

.admin-module-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.admin-module-card .logs-list-card {
  box-shadow: none;
  border: none;
  padding: 0;
}

.admin-module-card .logs-table-wrapper {
  padding: 0;
}

/* Sr No column override for dashboard table */
.detailed-table td.sr-no-col,
.detailed-table th:first-child {
  min-width: 60px !important;
  width: 60px !important;
  text-align: center;
}

/* Restore width for other tables where first column is Date */
#embedded-time-logs .detailed-table td:first-child,
#embedded-expenses .detailed-table td:first-child {
  min-width: 140px !important;
}

/* Show More Buttons */
#btn-show-more-logs,
#btn-show-more-expenses {
  margin: 1rem auto;
  display: block;
  padding: 10px 24px;
  border-radius: 30px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--primary-blue);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#btn-show-more-logs:hover,
#btn-show-more-expenses:hover {
  background: var(--primary-blue);
  color: #fff;
  border-color: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  text-decoration: none;
}

#btn-show-more-expenses {
  color: #2AB8A3;
}

#btn-show-more-expenses:hover {
  background: #2AB8A3;
  border-color: #2AB8A3;
  box-shadow: 0 4px 12px rgba(42, 184, 163, 0.25);
}

.premium-filter-select {
  padding: 8px 40px 8px 16px;
  border-radius: 50px;
  border: 1px solid #e2e8f0;
  font-family: 'Philosopher', sans-serif;
  font-size: 0.9rem;
  min-width: 180px;
  appearance: none;
  background: #fff url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2364748b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E') no-repeat right 15px center;
  background-size: 10px auto;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}

.premium-filter-select:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.premium-filter-select:focus {
  border-color: var(--tbl-teal);
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%232AB8A3%22%20d%3D%22M287%20223c0%205-1.9%209.2-5.4%2012.8-3.6%203.6-7.8%205.4-12.8%205.4H18.4c-5%200-9.2-1.8-12.8-5.4A17.6%2017.6%200%200%201%200%20223c0-5%201.8-9.2%205.4-12.8L133.4%2082.3c3.6-3.6%207.8-5.4%2012.8-5.4s9.2%201.8%2012.8%205.4L287%20210.2c3.5%203.6%205.4%207.8%205.4%2012.8z%22%2F%3E%3C%2Fsvg%3E');
  box-shadow: 0 0 0 3px rgba(42, 184, 163, 0.1);
}

/* New Close Form Button Styles */
.btn-close-form {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-form:hover {
  background: #fee2e2;
  color: #ef4444;
  border-color: #fecaca;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(239, 68, 68, 0.1);
}

.btn-close-form i {
  font-size: 1.1rem;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-blue);
  cursor: pointer;
  padding: 10px;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
}

/* --- COMPREHENSIVE MOBILE RESPONSIVENESS --- */
/* Map Section */
.map-section {
  padding: 1.5rem 40px;
  margin: 0 0 2rem;
  width: 100%;
  max-width: none;
  position: relative; /* Create stacking context */
}

.map-header {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1000; /* Stay above leaflet tiles */
}

.map-header h2 {
  font-size: 1.25rem;
  color: var(--primary-blue);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-wrapper {
  position: relative;
}

.map-add-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000; /* Above Leaflet tiles (which default to z-index 200-400) */
  background: var(--primary-blue) !important;
  color: #fff !important;
  border: none;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}

.map-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
}

#india-map {
  width: 100%;
  height: 450px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #f1f5f9;
}

/* Make sure Leaflet tooltips/popups look premium */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

@media (max-width: 992px) {
  .gauges-row {
    gap: 1.5rem;
  }
  .gauge-item {
    width: 45%;
  }
  .admin-analytics-container {
    flex-wrap: wrap;
  }
  .scorecard-item {
    min-width: 45%;
  }
}

@media (max-width: 768px) {
  /* Header Adjustments */
  .mobile-menu-btn {
    display: block;
  }
  .header-container {
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 15px 0 !important;
    position: relative;
    min-height: 60px;
    box-sizing: border-box;
  }
  .header-title {
    display: none !important;
  }
  .mobile-project-title {
    display: block !important;
  }
  .header-right-controls, .logo-right, .admin-nav-bar, .expense-nav-bar, .time-log-nav {
    display: none !important;
  }
  .logo-left {
    display: flex !important;
  }
  .logo-left img {
    height: 40px !important;
    margin: 0 !important;
  }
  .back-nav-bar {
    padding: 1rem 0;
    justify-content: center;
  }
  .header-title {
    position: static !important;
    transform: none !important;
    font-size: 1.6rem !important;
    white-space: normal !important;
    text-align: center !important;
    margin: 0 !important;
  }
  
  /* Layout Padding */
  .main-content {
    padding: 1rem;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }
  .card, .progress-section, .gantt-container, .visual-gantt-container, .admin-analytics-container {
    padding: 1.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .admin-analytics-container {
    grid-template-columns: 1fr !important; /* Stack analytics cards vertically */
    gap: 1rem !important;
  }
  
  .client-selector-container {
    padding: 1rem !important; /* Override inline padding */
    flex-direction: column !important;
    gap: 1rem;
    align-items: stretch !important;
  }

  /* Gauges & Progress */
  .gauges-row {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    gap: 0 !important;
  }
  .gauge-item {
    width: 48% !important;
    max-width: none !important;
    margin-bottom: 1.5rem;
  }
  .gauge-main-display {
    width: 100%;
    height: auto;
    min-height: 120px;
  }
  .overall-progress-wrapper {
    min-height: auto;
    padding: 10px;
  }
  .gauges-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-right: 0;
    align-self: center;
  }
  #gauge-legend-container, #vg-legend-container {
    position: static;
    transform: none;
    margin-top: 1rem;
    justify-content: center;
    width: 100%;
  }
  #gauge-legend-container .vg-legend, #vg-legend-container .vg-legend {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Section Headers */
  .section-header-row, .detailed-gantt-header, .form-header {
    display: flex !important;
    flex-direction: column;
    gap: 15px;
    align-items: center !important;
    text-align: center;
  }
  .gauge-section-title {
    position: static !important;
    transform: none !important;
    white-space: normal !important;
    font-size: 1.4rem !important;
  }
  .gauge-hint {
    white-space: normal !important;
    text-align: center;
  }

  /* Tables */
  .detailed-table-wrapper, .vg-wrapper, .logs-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .vg-task-col, .vg-header-task {
    position: static !important;
    z-index: auto !important;
  }
  .detailed-table th, .detailed-table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  /* Modals */
  .password-modal {
    max-width: 90% !important;
    margin: 20px auto;
  }
  .password-modal.auth-modal {
    padding: 2rem 1.5rem !important;
  }
  .modal-body {
    padding: 1rem !important;
  }
  .auth-group {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .auth-group > div {
    grid-column: span 1 !important;
  }
  
  /* Hero Section */
  .hero-section {
    grid-template-columns: 1fr;
  }
  
  /* Login / Forms */
  .auth-box {
    padding: 2rem 1.5rem;
    width: 90%;
  }
  
  /* Time Logs / Expenses */
  .top-controls-container {
    flex-direction: column;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header-title {
    font-size: 1.5rem;
  }
  .scorecard-item {
    min-width: 100%;
  }
  .analytics-header {
    flex-direction: column;
    align-items: stretch;
  }
  .gantt-actions-wrapper {
    flex-direction: column;
    width: 100%;
  }
  .btn-primary-gantt {
    width: 100%;
    justify-content: center;
  }
  .btn-auth {
    width: 100%;
  }
}