:root {
  --tc-navy: #1a438c;
  --tc-blue: #4e84c4;
  --tc-sky: #b0cbea;
  --tc-ink: #1c244b;
  --tc-muted: #69727d;
  --tc-surface: #f5f8fc;
  --tc-panel: #ffffff;
  --tc-sidebar: #1c244b;
  --tc-sidebar-hover: #24305f;
  --tc-border: #d9e3f0;
  --tc-success: #1f7a4d;
  --tc-danger: #c0392b;
  --font-display: "Poppins", sans-serif;
  --font-body: "Lato", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
}

body.app-body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--tc-ink);
  background:
    radial-gradient(circle at top right, rgba(176, 203, 234, 0.45), transparent 40%),
    linear-gradient(180deg, #eef3fa 0%, var(--tc-surface) 40%, #e8eef7 100%);
}

h1, h2, h3, h4, .page-title, .brand-tagline, .auth-title {
  font-family: var(--font-display);
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-close,
.btn-menu {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-close {
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-menu {
  border-color: var(--tc-border);
  background: #fff;
  color: var(--tc-navy);
}

.btn-menu:hover,
.btn-menu[aria-expanded="true"] {
  background: var(--tc-navy);
  border-color: var(--tc-navy);
  color: #fff;
}

.btn-menu i,
.sidebar-close i {
  font-size: 1.35rem;
  line-height: 1;
}

.topbar-leading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-title-block {
  min-width: 0;
}

.app-sidebar {
  background: linear-gradient(180deg, var(--tc-sidebar) 0%, #12182f 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
}

.sidebar-brand {
  padding: 0.5rem 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

.brand-logo {
  height: 42px;
  width: auto;
  filter: brightness(0) invert(1);
}

.brand-tagline {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--tc-sky);
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-link-item {
  display: block;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  padding: 0.65rem 0.85rem;
  border-radius: 0.45rem;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link-item:hover {
  background: var(--tc-sidebar-hover);
  color: #fff;
}

.nav-link-item.active {
  background: var(--tc-navy);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--tc-sky);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tc-blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--tc-ink);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.75rem 0.5rem;
}

.page-title {
  margin: 0;
  font-size: 1.55rem;
  color: var(--tc-navy);
  font-weight: 600;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--tc-muted);
  font-size: 0.95rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.btn-settings {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--tc-border);
  background: #fff;
  color: var(--tc-navy);
  border-radius: 0.5rem;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-settings:hover,
.btn-settings[aria-expanded="true"] {
  background: var(--tc-navy);
  border-color: var(--tc-navy);
  color: #fff;
}

.topbar-settings-menu {
  min-width: 190px;
  border: 1px solid var(--tc-border);
  border-radius: 0.55rem;
  box-shadow: 0 10px 28px rgba(28, 36, 75, 0.12);
  padding: 0.35rem;
  margin-top: 0.4rem !important;
}

.topbar-settings-menu .dropdown-item {
  border-radius: 0.35rem;
  font-size: 0.9rem;
  color: var(--tc-ink);
  padding: 0.55rem 0.75rem;
}

.topbar-settings-menu .dropdown-item:hover,
.topbar-settings-menu .dropdown-item:focus {
  background: #edf3fb;
  color: var(--tc-navy);
}

.topbar-settings-menu button.dropdown-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.topbar-settings-menu .dropdown-divider {
  margin: 0.25rem 0;
}

/* Custom multi-select — wrapping chips, modern control */
.tc-ms-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.tc-ms {
  position: relative;
  width: 100%;
}

.tc-ms-toggle {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
  border: 1px solid var(--tc-border);
  border-radius: 0.65rem;
  padding: 0.45rem 2.25rem 0.45rem 0.55rem;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tc-ms.is-open .tc-ms-toggle,
.tc-ms-toggle:focus {
  border-color: var(--tc-navy);
  box-shadow: 0 0 0 0.2rem rgba(26, 67, 140, 0.16);
  outline: none;
  background: #fff;
}

.tc-ms-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
  overflow: visible;
}

.tc-ms-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  background: #e8f0fa;
  color: var(--tc-navy);
  border: 1px solid #c5d7ef;
  border-radius: 999px;
  padding: 0.28rem 0.3rem 0.28rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  flex: 0 1 auto;
}

.tc-ms-chip-label {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tc-ms-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(26, 67, 140, 0.12);
  color: var(--tc-navy);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.tc-ms-chip-remove:hover {
  background: var(--tc-navy);
  color: #fff;
}

.tc-ms-placeholder {
  color: #8a94a6;
  font-size: 0.92rem;
  padding: 0.2rem 0.15rem;
  white-space: nowrap;
}

.tc-ms-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex: 0 0 auto;
  align-self: center;
}

.tc-ms-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tc-navy);
  background: #dce9fb;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.tc-ms-clear {
  border: 0;
  background: transparent;
  color: var(--tc-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.35rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.tc-ms-clear:hover {
  color: var(--tc-danger);
  background: #fde2e0;
}

.tc-ms-caret {
  position: absolute;
  right: 0.85rem;
  top: 1.05rem;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--tc-muted);
  transition: transform 0.15s ease;
}

.tc-ms.is-open .tc-ms-caret {
  transform: rotate(180deg);
}

.tc-ms-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  background: #fff;
  border: 1px solid var(--tc-border);
  border-radius: 0.75rem;
  box-shadow: 0 16px 36px rgba(28, 36, 75, 0.14);
  padding: 0.65rem;
}

.tc-ms-search {
  width: 100%;
  border: 1px solid var(--tc-border);
  border-radius: 0.45rem;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.45rem;
  font-size: 0.9rem;
  background: #f7fafc;
}

.tc-ms-search:focus {
  outline: none;
  border-color: var(--tc-navy);
  background: #fff;
  box-shadow: 0 0 0 0.15rem rgba(26, 67, 140, 0.12);
}

.tc-ms-options {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

.tc-ms-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--tc-ink);
}

.tc-ms-option::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1.5px solid #b7c6db;
  border-radius: 0.3rem;
  flex: 0 0 auto;
  background: #fff;
}

.tc-ms-option:hover {
  background: #edf3fb;
}

.tc-ms-option.is-selected {
  background: #e8f0fa;
  color: var(--tc-navy);
  font-weight: 600;
}

.tc-ms-option.is-selected::before {
  border-color: var(--tc-navy);
  background: var(--tc-navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E") center / 12px no-repeat;
}

.tc-ms-empty {
  padding: 0.75rem;
  color: var(--tc-muted);
  font-size: 0.9rem;
  text-align: center;
}

.tc-ms.is-open {
  margin-bottom: 14rem;
}

.app-content {
  padding: 0.75rem 1.75rem 1.75rem;
  flex: 1;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.75rem 1.25rem;
  color: var(--tc-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--tc-border);
}

.app-footer a {
  color: var(--tc-navy);
  text-decoration: none;
}

.panel, .card-panel {
  background: var(--tc-panel);
  border: 1px solid var(--tc-border);
  border-radius: 0.85rem;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(28, 36, 75, 0.04);
}

.btn-primary, .btn-tc {
  --bs-btn-bg: var(--tc-navy);
  --bs-btn-border-color: var(--tc-navy);
  --bs-btn-hover-bg: #0f2f6f;
  --bs-btn-hover-border-color: #0f2f6f;
  --bs-btn-active-bg: #0d2860;
  --bs-btn-active-border-color: #0d2860;
  background: var(--tc-navy);
  border-color: var(--tc-navy);
}

.btn-outline-primary {
  --bs-btn-color: var(--tc-navy);
  --bs-btn-border-color: var(--tc-navy);
  --bs-btn-hover-bg: var(--tc-navy);
  --bs-btn-hover-border-color: var(--tc-navy);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: linear-gradient(160deg, #fff 0%, #f3f7fc 100%);
  border: 1px solid var(--tc-border);
  border-radius: 0.85rem;
  padding: 1rem;
}

.stat-card .label {
  color: var(--tc-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--tc-navy);
  font-weight: 600;
  margin-top: 0.25rem;
}

.stat-card-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stat-card-clickable:hover,
.stat-card-clickable:focus {
  border-color: var(--tc-navy);
  box-shadow: 0 0 0 0.15rem rgba(19, 61, 141, 0.12);
  outline: none;
}

.stat-card .stat-hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--tc-muted);
}

.table thead th {
  background: #edf3fb;
  color: var(--tc-navy);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom-color: var(--tc-border);
}

.badge-status {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-draft { background: #e8eef7; color: var(--tc-muted); }
.badge-submitted { background: #dce9fb; color: var(--tc-navy); }
.badge-approved { background: #d9f2e5; color: var(--tc-success); }
.badge-rejected { background: #fde2e0; color: var(--tc-danger); }
.badge-pending { background: #fff3cd; color: #856404; }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(19, 61, 141, 0.92), rgba(28, 36, 75, 0.88)),
    radial-gradient(circle at 20% 20%, rgba(176, 203, 234, 0.35), transparent 45%);
}

.auth-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 1rem;
  padding: 2rem 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.auth-logo {
  height: 48px;
  margin-bottom: 1rem;
}

.auth-title {
  color: var(--tc-navy);
  font-size: 1.45rem;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  color: var(--tc-muted);
  margin-bottom: 1.5rem;
}

/* Timesheet grid */
.timesheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
}

.timesheet-panel {
  background:
    linear-gradient(180deg, rgba(19, 61, 141, 0.04), transparent 120px),
    var(--tc-panel);
}

.timesheet-wrap {
  overflow: auto;
  border: 1px solid var(--tc-border);
  border-radius: 0.85rem;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 24px rgba(28, 36, 75, 0.06);
}

.timesheet-grid {
  --ts-project-w: 260px;
  --ts-info-w: 180px;
  --ts-day-w: 44px;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 100%;
  font-size: 0.8rem;
  table-layout: fixed;
}

.timesheet-grid th,
.timesheet-grid td {
  border-right: 1px solid var(--tc-border);
  border-bottom: 1px solid var(--tc-border);
  padding: 0.2rem;
  text-align: center;
  vertical-align: middle;
}

.timesheet-grid .col-day {
  width: var(--ts-day-w);
  min-width: var(--ts-day-w);
  max-width: var(--ts-day-w);
  box-sizing: border-box;
}

.timesheet-grid .col-total {
  width: 56px;
  min-width: 56px;
  font-weight: 600;
  background: #f7fafc;
}

.timesheet-grid .col-project,
.timesheet-grid th.col-project,
.timesheet-grid td.col-project {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
  width: var(--ts-project-w);
  min-width: var(--ts-project-w);
  max-width: var(--ts-project-w);
  text-align: left;
  padding-left: 0.75rem;
  padding-right: 0.5rem;
}

.timesheet-grid .col-info,
.timesheet-grid th.col-info,
.timesheet-grid td.col-info {
  position: sticky;
  left: var(--ts-project-w);
  background: #fff;
  z-index: 2;
  width: var(--ts-info-w);
  min-width: var(--ts-info-w);
  max-width: var(--ts-info-w);
}

.timesheet-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, #e8f0fa 0%, #edf3fb 100%);
  color: var(--tc-navy);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 0 var(--tc-border);
}

.timesheet-grid thead th.col-project,
.timesheet-grid thead th.col-info {
  z-index: 4;
  background: linear-gradient(180deg, #e8f0fa 0%, #edf3fb 100%);
}

.timesheet-grid .day-weekday {
  font-size: 0.65rem;
  color: var(--tc-muted);
  line-height: 1.1;
  text-transform: uppercase;
}

.timesheet-grid .day-num {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tc-ink);
  line-height: 1.2;
}

.timesheet-grid .project-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--tc-ink);
}

.timesheet-grid tbody tr:nth-child(even) td.col-project,
.timesheet-grid tbody tr:nth-child(even) td.col-info {
  background: #fafcfe;
}

.timesheet-grid tbody tr:hover td {
  background-color: rgba(78, 132, 196, 0.08);
}

.timesheet-grid tbody tr:hover td.col-project,
.timesheet-grid tbody tr:hover td.col-info {
  background-color: #eef4fb;
}

.timesheet-grid input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  padding: 0.4rem 0.1rem;
  font-size: 0.8rem;
  border-radius: 0.25rem;
}

.timesheet-grid .info-input {
  text-align: left;
  padding-left: 0.35rem;
}

.timesheet-grid input:focus {
  outline: 2px solid var(--tc-blue);
  background: #fff;
}

.timesheet-grid input[readonly] {
  cursor: default;
  color: var(--tc-ink);
}

.cell-weekend { background: #c6efce !important; }
.cell-L { background: #ffc000 !important; }
.cell-S { background: #bdd7ee !important; }
.cell-M { background: #e2c6ff !important; }
.cell-P { background: #c5e0b4 !important; }
.cell-U { background: #f4b084 !important; }
.cell-H { background: #ffe566 !important; }
.cell-W { background: #c6efce !important; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  background: #f7fafc;
  border-radius: 0.65rem;
  border: 1px solid var(--tc-border);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--tc-muted);
}

.legend i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Truncated table cells + icon buttons */
.col-truncate {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.col-truncate-sm {
  max-width: 200px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.4rem;
  line-height: 1;
}

.btn-icon i {
  font-size: 0.95rem;
}

/* DataTables polish to match portal */
.dataTables_wrapper .dt-toolbar {
  margin-bottom: 0.75rem;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 0.875rem;
  color: var(--tc-muted);
  margin-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_filter {
  text-align: left !important;
}

.dataTables_wrapper .dataTables_length {
  text-align: right !important;
}

.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_length label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-weight: 500;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--tc-border);
  border-radius: 0.4rem;
  padding: 0.35rem 0.65rem;
  margin-left: 0;
  min-width: 180px;
  background: #fff;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--tc-border);
  border-radius: 0.4rem;
  padding: 0.35rem 2rem 0.35rem 0.65rem;
  margin: 0 0.25rem;
  background-color: #fff;
  /* Prevent native + Bootstrap arrow stacking / overlap with the value */
  appearance: auto;
  -webkit-appearance: menulist;
  background-image: none !important;
  min-width: 4.5rem;
}

.dataTables_wrapper .page-link {
  color: var(--tc-navy);
}

.dataTables_wrapper .page-item.active .page-link {
  background-color: var(--tc-navy);
  border-color: var(--tc-navy);
}

.section-heading {
  font-family: var(--font-display);
  color: #133d8d;
}

.people-link {
  font-weight: 600;
  color: var(--tc-navy);
  text-decoration: underline;
}

.people-link:hover {
  color: var(--tc-blue);
}

.yet-to-update-scroll {
  max-height: 320px;
  overflow: auto;
  padding-right: 0.25rem;
}

.yet-to-update-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 420px) {
  .yet-to-update-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.yet-card {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--tc-border);
  border-radius: 0.55rem;
  background: #f8fbff;
}

.yet-select-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--tc-muted);
}

.yet-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.yet-card .yet-user-check {
  flex: 0 0 auto;
  margin: 0;
  cursor: pointer;
}

.yet-card-body {
  min-width: 0;
  flex: 1 1 auto;
}

.yet-remind-one {
  flex: 0 0 auto;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.yet-card-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--tc-navy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.yet-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tc-ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yet-card-email {
  font-size: 0.72rem;
  color: var(--tc-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manhours-report-banner {
  display: inline-block;
  background: #f4a6a6;
  color: #4a1f1f;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 0.35rem;
  margin-bottom: 0.75rem;
}

.manhours-table thead th {
  background: #ffd966 !important;
  color: #1c244b;
}

.manhours-value {
  color: #c0392b;
  font-weight: 600;
}

@media (max-width: 992px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .btn-menu,
  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(18, 24, 47, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 1050;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 28px rgba(18, 24, 47, 0.28);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.nav-open .app-sidebar {
    transform: translateX(0);
  }

  body.nav-open {
    overflow: hidden;
  }

  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    padding-bottom: 1.5rem;
  }

  .nav-link-item {
    padding: 0.8rem 0.9rem;
  }

  .app-topbar {
    padding: 0.85rem 1rem 0.35rem;
    align-items: flex-start;
  }

  .page-title {
    font-size: 1.2rem;
    line-height: 1.25;
  }

  .page-subtitle {
    font-size: 0.85rem;
  }

  .topbar-user .user-name {
    display: none;
  }

  .app-content {
    padding: 0.5rem 1rem 1.25rem;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem 1.1rem;
  }

  .panel,
  .card-panel {
    padding: 1rem;
    border-radius: 0.75rem;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .stat-card .value {
    font-size: 1.25rem;
  }

  .timesheet-toolbar {
    align-items: stretch;
  }

  .timesheet-toolbar > div {
    flex: 1 1 calc(50% - 0.75rem);
    min-width: 0;
  }

  .timesheet-toolbar .form-control,
  .timesheet-toolbar .form-select {
    width: 100% !important;
    min-width: 0 !important;
  }

  .timesheet-toolbar .ms-auto,
  .timesheet-toolbar .toolbar-actions {
    flex: 1 1 100%;
    margin-left: 0 !important;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .timesheet-grid {
    --ts-project-w: 140px;
    --ts-info-w: 110px;
    --ts-day-w: 38px;
  }

  .timesheet-wrap {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .col-truncate {
    max-width: 140px;
  }

  .col-truncate-sm {
    max-width: 110px;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    text-align: left !important;
  }

  .dataTables_wrapper .dataTables_filter input {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .dataTables_wrapper .dt-toolbar > [class*="col-"] {
    margin-bottom: 0.5rem;
  }

  .dataTables_wrapper .dataTables_paginate {
    overflow-x: auto;
    max-width: 100%;
  }

  .tc-ms-chip-label {
    max-width: 140px;
  }

  .d-flex.gap-2 {
    flex-wrap: wrap;
  }

  .modal-dialog {
    margin: 0.75rem;
  }
}

@media (max-width: 576px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 1.5rem 1.15rem;
  }

  .auth-title {
    font-size: 1.25rem;
  }

  .timesheet-toolbar > div {
    flex: 1 1 100%;
  }

  .timesheet-grid {
    --ts-project-w: 120px;
    --ts-info-w: 96px;
    --ts-day-w: 36px;
    font-size: 0.74rem;
  }

  .timesheet-grid .col-total {
    width: 48px;
    min-width: 48px;
  }

  .timesheet-grid input {
    padding: 0.45rem 0.05rem;
    font-size: 0.74rem;
  }

  .page-title {
    font-size: 1.1rem;
  }

  .btn-settings,
  .btn-menu,
  .user-avatar {
    width: 36px;
    height: 36px;
  }

  .error-page {
    margin: 0.75rem auto;
    padding: 1.25rem 1rem;
  }

  .error-page-title {
    font-size: 1.3rem;
  }
}

/* Prefer readable form controls on iOS */
@media (max-width: 992px) {
  input.form-control,
  select.form-select,
  textarea.form-control {
    font-size: 16px;
  }
}

/* Application error page */
.error-page {
  max-width: 720px;
  margin: 1.5rem auto;
  text-align: center;
  padding: 2rem 1.5rem;
}

.error-page-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: #fde2e0;
  color: var(--tc-danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.error-page-title {
  font-family: var(--font-display);
  color: var(--tc-navy);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
}

.error-page-text {
  color: var(--tc-muted);
  max-width: 36rem;
  margin: 0 auto 1rem;
}

.error-page-meta {
  font-size: 0.9rem;
  color: var(--tc-ink);
  margin-bottom: 0.35rem;
}

.error-page-details {
  text-align: left;
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 0.65rem;
  background: #f8fafc;
  border: 1px solid var(--tc-border);
}

.error-stack {
  margin: 0;
  max-height: 280px;
  overflow: auto;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #5a6472;
}

.role-checks {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--tc-border);
  border-radius: 0.55rem;
  background: #f8fbff;
  min-height: 2.75rem;
}

.role-checks-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.user-edit-panel {
  max-width: 720px;
  width: 100%;
}

.user-edit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}

.user-edit-field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-edit-field .form-label {
  margin-bottom: 0.35rem;
}

.user-edit-field .form-control,
.user-edit-field .form-select {
  width: 100%;
}

.user-edit-span {
  grid-column: 1 / -1;
}

@media (max-width: 576px) {
  .user-edit-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.page-actions > p {
  flex: 1 1 12rem;
  min-width: 0;
}

.page-actions > .btn {
  flex: 0 0 auto;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 180px;
}

.chart-wrap-bar {
  height: 320px;
  min-height: 280px;
}

.chart-wrap-donut {
  height: 280px;
  min-height: 240px;
}

.chart-wrap canvas {
  max-width: 100%;
}

.panel[style*="max-width"],
.card-panel[style*="max-width"] {
  max-width: min(100%, var(--panel-max, 640px)) !important;
  width: 100%;
}

img, svg {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}


