:root {
  color-scheme: light;
  --bg: oklch(0.985 0.002 240);
  --surface: oklch(1 0 0);
  --surface-strong: oklch(0.96 0.004 240);
  --ink: oklch(0.18 0.01 240);
  --muted: oklch(0.45 0.01 240);
  --line: oklch(0.88 0.01 240);
  --primary: oklch(0.35 0.05 240); /* Navy Blue */
  --primary-hover: oklch(0.3 0.05 240);
  --accent: oklch(0.65 0.1 190); /* Teal */
  --success-bg: oklch(0.942 0.04 154);
  --success-text: oklch(0.34 0.09 154);
  --warning-bg: oklch(0.95 0.055 88);
  --warning-text: oklch(0.39 0.08 72);
  --info-bg: oklch(0.94 0.04 250);
  --info-text: oklch(0.4 0.14 255);
  --auto-bg: oklch(0.94 0.04 295);
  --auto-text: oklch(0.42 0.13 295);
  --danger-bg: oklch(0.955 0.045 24);
  --danger-text: oklch(0.42 0.12 24);
  --radius: 8px;
  --shadow: 0 4px 12px oklch(0.18 0.01 240 / 0.05);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #020617;
  --surface: #1e293b;
  --surface-strong: #334155;
  --ink: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(255, 255, 255, 0.15);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #14b8a6;
  --success-bg: rgba(16, 185, 129, 0.2);
  --success-text: #34d399;
  --warning-bg: rgba(245, 158, 11, 0.2);
  --warning-text: #fbbf24;
  --info-bg: rgba(59, 130, 246, 0.2);
  --info-text: #93c5fd;
  --auto-bg: rgba(139, 92, 246, 0.2);
  --auto-text: #c4b5fd;
  --danger-bg: rgba(239, 68, 68, 0.2);
  --danger-text: #f87171;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

}

html[data-theme="dark"] .air-datepicker,
html[data-theme="dark"] .air-datepicker-global-container {
  --adp-background-color: var(--surface);
  --adp-border-color: var(--line);
  --adp-color: var(--ink);
  --adp-color-secondary: var(--muted);
  --adp-accent-color: var(--primary);
  --adp-cell-background-color-hover: var(--surface-strong);
  --adp-cell-background-color-selected: var(--primary);
  --adp-cell-background-color-selected-hover: var(--primary-hover);
  --adp-cell-background-color-in-range: rgba(59, 130, 246, 0.1);
  --adp-cell-background-color-in-range-hover: rgba(59, 130, 246, 0.2);
  --adp-cell-border-color-in-range: var(--primary);
  --adp-btn-color: var(--primary);
  --adp-btn-color-hover: var(--primary-hover);
  --adp-btn-background-color-hover: var(--surface-strong);
  --adp-btn-background-color-active: var(--surface-strong);
  --adp-day-name-color: var(--muted);
  --adp-day-name-color-hover: var(--ink);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #020617;
    --surface: #1e293b;
    --surface-strong: #334155;
    --ink: #f8fafc;
    --muted: #cbd5e1;
    --line: rgba(255, 255, 255, 0.15);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent: #14b8a6;
    --success-bg: rgba(16, 185, 129, 0.2);
    --success-text: #34d399;
    --warning-bg: rgba(245, 158, 11, 0.2);
    --warning-text: #fbbf24;
    --info-bg: rgba(59, 130, 246, 0.2);
    --info-text: #93c5fd;
    --auto-bg: rgba(139, 92, 246, 0.2);
    --auto-text: #c4b5fd;
    --danger-bg: rgba(239, 68, 68, 0.2);
    --danger-text: #f87171;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

  }

  html:not([data-theme="light"]) .air-datepicker,
  html:not([data-theme="light"]) .air-datepicker-global-container {
    --adp-background-color: var(--surface);
    --adp-border-color: var(--line);
    --adp-color: var(--ink);
    --adp-color-secondary: var(--muted);
    --adp-accent-color: var(--primary);
    --adp-cell-background-color-hover: var(--surface-strong);
    --adp-cell-background-color-selected: var(--primary);
    --adp-cell-background-color-selected-hover: var(--primary-hover);
    --adp-cell-background-color-in-range: rgba(59, 130, 246, 0.1);
    --adp-cell-background-color-in-range-hover: rgba(59, 130, 246, 0.2);
    --adp-cell-border-color-in-range: var(--primary);
    --adp-btn-color: var(--primary);
    --adp-btn-color-hover: var(--primary-hover);
    --adp-btn-background-color-hover: var(--surface-strong);
    --adp-btn-background-color-active: var(--surface-strong);
    --adp-day-name-color: var(--muted);
    --adp-day-name-color-hover: var(--ink);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  overflow-y: scroll;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 20px;
}

.brand,
.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand strong,
.auth-brand strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.brand span,
.auth-brand span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  color: white;
  font-size: 20px;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 500;
  padding: 12px 14px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-list a svg {
  opacity: 0.7;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transform: translateX(4px);
}

.nav-list a:hover svg {
  opacity: 1;
  transform: scale(1.1);
}

.nav-list a.active {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--ink);
  font-weight: 600;
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
}

.nav-list a.active svg {
  opacity: 1;
}

.logout {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.logout span {
  color: var(--muted);
  font-size: 13px;
}

.logout span strong,
.logout span small {
  display: block;
}

.logout span strong {
  color: var(--ink);
}

.content {
  display: grid;
  align-content: start;
  gap: 24px;
  padding: 28px;
}

.page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2 {
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-strong);
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-profile-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.user-profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-width: 0;
}

.user-profile-name {
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-profile-role {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.logout-icon-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.logout-icon-btn:hover {
  background: rgba(225, 29, 72, 0.1);
  color: #e11d48;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.metric,
.panel,
.table-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 100px;
  padding: 16px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 30px;
  line-height: 1;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.panel {
  padding: 18px;
}

.stack-form,
.inline-form {
  display: grid;
  gap: 14px;
}

.compact-form,
.table-actions {
  display: grid;
  gap: 8px;
}

.table-actions {
  min-width: 210px;
}

.inline-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

fieldset {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

legend {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  padding: 0 4px;
}

.checkbox-list {
  display: grid;
  gap: 8px;
}

.checkbox-option {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 9px !important;
  font-weight: 500 !important;
}

.checkbox-option input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  margin: 0 !important;
  flex: 0 0 auto !important;
  accent-color: var(--primary);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

.multi-select {
  min-width: 170px;
  padding: 6px;
}

input::placeholder,
textarea::placeholder {
  color: oklch(0.5 0.02 270);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  outline: 3px solid oklch(0.82 0.06 215 / 0.5);
  outline-offset: 1px;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  padding: 9px 14px;
}

.primary-button {
  background: var(--primary);
  color: white;
}

.primary-button:hover {
  background: var(--primary-hover);
}

/* Specific styling for auth screen primary button (B2B Teal) */
.auth-submit-btn {
  background: #0f766e !important;
}

.auth-submit-btn:hover {
  background: #115e59 !important;
}

html[data-theme="dark"] .auth-submit-btn {
  background: #0d9488 !important;
}

html[data-theme="dark"] .auth-submit-btn:hover {
  background: #0f766e !important;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .auth-submit-btn {
    background: #0d9488 !important;
  }
  html:not([data-theme="light"]) .auth-submit-btn:hover {
    background: #0f766e !important;
  }
}

.otp-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 12px 0 24px;
}

.otp-input {
  width: 50px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.otp-input:focus {
  border-color: #0d9488;
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
  transform: translateY(-2px);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--surface);
}

.danger-button {
  background: var(--danger-text);
  color: white;
}

.danger-button:hover {
  background: oklch(0.36 0.12 24);
}

html[data-theme="dark"] .metric,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .table-section {
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .metric,
  html:not([data-theme="light"]) .panel,
  html:not([data-theme="light"]) .table-section {
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

tbody tr:hover {
  background: var(--surface-strong);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td form {
  margin: 0;
}

td button {
  min-height: 36px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

code {
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.9em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  padding: 3px 9px;
}

.status-pill.ok {
  background: var(--success-bg);
  color: var(--success-text);
}

.status-pill.blocked {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.status-pill.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.status-pill.info {
  background: var(--info-bg);
  color: var(--info-text);
}

.status-pill.auto {
  background: var(--auto-bg);
  color: var(--auto-text);
}

.notice {
  border-radius: var(--radius);
  padding: 11px 13px;
  font-weight: 650;
}

.notice.success {
  background: var(--success-bg);
  color: var(--success-text);
}

.notice.error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notice.warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background:
    linear-gradient(180deg, var(--bg), var(--surface) 45%),
    var(--bg);
  padding: 20px;
}

.auth-panel {
  display: grid;
  width: min(100%, 430px);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 26px;
}

.auth-panel h1 {
  font-size: 26px;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 20px;
  }

  .split-layout {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Language Dropdown (Dropup) */
.lang-dropdown {
  position: relative;
  display: inline-block;
  margin-bottom: 16px;
  width: 100%;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.lang-dropdown-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.08);
}

.lang-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  z-index: 10;
  padding: 6px;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px);
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lang-dropdown.open .lang-dropdown-menu {
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  opacity: 1;
}

.lang-dropdown-menu a {
  padding: 10px 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  border-radius: 8px;
  font-weight: 500;
}

.lang-dropdown-menu a img,
.lang-dropdown-btn img {
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.lang-dropdown-menu a:hover {
  background: var(--surface-strong);
  color: var(--ink);
  transform: translateX(4px);
}

.lang-dropdown-menu a.active {
  background: rgba(225, 29, 72, 0.06);
  color: var(--primary);
  font-weight: 600;
}

/* Team Tabs */
.team-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.tab-link {
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.tab-link:hover {
  color: var(--ink);
}

.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Date Filters */
.date-filters {
  display: flex;
  align-items: center;
  gap: 24px 16px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-weight: 650;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid var(--line);
  flex-shrink: 0;
  white-space: nowrap;
}

.filter-pill:hover {
  background: var(--line);
  color: var(--ink);
}

.filter-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.date-filters input[type="date"] {
  width: auto;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
}

/* Tom Select Overrides */
.ts-wrapper {
  width: 100% !important;
}

.ts-control {
  display: flex !important;
  align-items: center !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  padding: 8px 34px 8px 12px !important;
  min-height: 40px !important;
  font: inherit !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  background: var(--surface); !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  flex-wrap: nowrap !important;
  overflow: hidden !important;
}

.ts-control .item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}

.ts-control {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  padding: 10px 34px 10px 14px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, outline 0.2s ease !important;
  background-color: var(--surface) !important;
  font-family: inherit !important;
  font-size: 15px !important;
}

.date-filters .ts-control {
  border-radius: 999px !important;
  padding: 6px 34px 6px 16px !important;
  min-height: 38px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
}

.date-filters .ts-dropdown { background: var(--surface) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
  border: 1px solid var(--line) !important;
}

.ts-wrapper.focus .ts-control {
  border-color: var(--accent) !important;
  outline: 3px solid oklch(0.82 0.06 215 / 0.3) !important;
  outline-offset: 0px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05) !important;
}

/* Fix global input styles affecting Tom Select's inner search input */
.ts-control > input {
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  min-height: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  max-width: 100% !important;
  font-family: inherit !important;
  font-size: 15px !important;
}

.ts-dropdown { background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12) !important;
  margin-top: 8px !important;
  font-size: 15px !important;
  color: var(--ink) !important;
  overflow: hidden !important;
  animation: fadeInUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ts-dropdown .option {
  padding: 10px 14px !important;
  cursor: pointer !important;
  transition: background-color 0.15s ease, color 0.15s ease !important;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover {
  background: var(--surface-strong) !important;
  color: var(--primary) !important;
  font-weight: 500 !important;
}

/* Animations & Micro-interactions */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.metric, .panel, .table-section {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.metric:nth-child(1) { animation-delay: 0.05s; }
.metric:nth-child(2) { animation-delay: 0.1s; }
.metric:nth-child(3) { animation-delay: 0.15s; }
.metric:nth-child(4) { animation-delay: 0.2s; }
.metric:nth-child(5) { animation-delay: 0.25s; }
.metric:nth-child(6) { animation-delay: 0.3s; }
.metric:nth-child(7) { animation-delay: 0.35s; }
.metric:nth-child(8) { animation-delay: 0.4s; }
.metric:nth-child(n+9) { animation-delay: 0.45s; }
.panel:nth-child(2) { animation-delay: 0.15s; }

.metric {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--accent);
}

tbody tr {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: var(--surface-strong);
}

tbody tr:nth-child(1) { animation-delay: 0.05s; }
tbody tr:nth-child(2) { animation-delay: 0.08s; }
tbody tr:nth-child(3) { animation-delay: 0.11s; }
tbody tr:nth-child(4) { animation-delay: 0.14s; }
tbody tr:nth-child(5) { animation-delay: 0.17s; }
tbody tr:nth-child(6) { animation-delay: 0.20s; }
tbody tr:nth-child(7) { animation-delay: 0.23s; }
tbody tr:nth-child(n+8) { animation-delay: 0.26s; }

svg circle.donut-segment {
  transition: stroke-width 0.2s ease, filter 0.2s ease;
}

svg circle.donut-segment:hover {
  stroke-width: 44px;
  filter: brightness(1.1);
  cursor: pointer;
}

/* Auth Page Premium Styling */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface-strong) 100%);
  padding: 24px;
}

.auth-panel {
  background: var(--surface);
  padding: 48px 40px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.03);
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--line);
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-panel .auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  justify-content: center;
}

.auth-panel .auth-brand .brand-mark {
  width: 52px;
  height: 52px;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

.auth-panel .auth-brand div {
  display: flex;
  flex-direction: column;
}

.auth-panel .auth-brand strong {
  font-size: 22px;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.auth-panel .auth-brand span {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.auth-panel h1 {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.auth-panel p {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 36px;
}

.auth-panel .stack-form {
  gap: 22px;
}

.auth-panel input {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  font-size: 15px;
}

.auth-panel input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.auth-panel label {
  font-size: 14px;
  color: var(--ink);
}

.auth-panel .primary-button {
  margin-top: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #be123c);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}

.auth-panel .primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.35);
}

/* Team Tabs Styling */
.team-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface-strong); /* Soft gray for the background of the pill container */
  padding: 6px;
  border-radius: 12px;
  margin-bottom: 24px;
  width: max-content;
  align-items: center;
}

.team-tabs .tab-link {
  padding: 10px 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 15px;
}

.team-tabs .tab-link:hover {
  color: var(--ink);
}

.team-tabs .tab-link.active {
  background: var(--primary);
  color: white;
}



.metric {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  will-change: transform;
}

.metric:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  border-color: var(--accent);
}

tbody tr {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background-color: var(--surface-strong);
}

tbody tr:nth-child(1) { animation-delay: 0.05s; }
tbody tr:nth-child(2) { animation-delay: 0.08s; }
tbody tr:nth-child(3) { animation-delay: 0.11s; }
tbody tr:nth-child(4) { animation-delay: 0.14s; }
tbody tr:nth-child(5) { animation-delay: 0.17s; }
tbody tr:nth-child(6) { animation-delay: 0.20s; }
tbody tr:nth-child(7) { animation-delay: 0.23s; }
tbody tr:nth-child(n+8) { animation-delay: 0.26s; }

svg circle.donut-segment {
  transition: stroke-width 0.2s ease, filter 0.2s ease;
}

svg circle.donut-segment:hover {
  stroke-width: 44px;
  filter: brightness(1.1);
  cursor: pointer;
}

/* Auth Page Premium Styling */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface-strong) 100%);
  padding: 24px;
}

.auth-panel {
  background: var(--surface);
  padding: 48px 40px;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.03);
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--line);
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-panel .auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
  justify-content: center;
}

.auth-panel .auth-brand .brand-mark {
  width: 52px;
  height: 52px;
  font-size: 24px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
}

.auth-panel .auth-brand div {
  display: flex;
  flex-direction: column;
}

.auth-panel .auth-brand strong {
  font-size: 22px;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.auth-panel .auth-brand span {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.auth-panel h1 {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  color: var(--ink);
  letter-spacing: -0.5px;
}

.auth-panel p {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 36px;
}

.auth-panel .stack-form {
  gap: 22px;
}

.auth-panel input {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
  font-size: 15px;
}

.auth-panel input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.auth-panel label {
  font-size: 14px;
  color: var(--ink);
}

.auth-panel .primary-button {
  margin-top: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #be123c);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
  transition: all 0.2s ease;
  letter-spacing: 0.2px;
}

.auth-panel .primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.35);
}

/* Team Tabs Styling */
.team-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface-strong); /* Soft gray for the background of the pill container */
  padding: 6px;
  border-radius: 12px;
  margin-bottom: 24px;
  width: max-content;
  align-items: center;
}

.team-tabs .tab-link {
  padding: 10px 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 15px;
}

.team-tabs .tab-link:hover {
  color: var(--ink);
}

.team-tabs .tab-link.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
}

/* Animations */
.emp-card, .dash-card, .zones-panel, .modern-table-wrap, .stat-card, .attendance-card {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.emp-card:nth-child(1), .dash-card:nth-child(1), .stat-card:nth-child(1) { animation-delay: 0.05s; }
.emp-card:nth-child(2), .dash-card:nth-child(2), .stat-card:nth-child(2) { animation-delay: 0.1s; }
.emp-card:nth-child(3), .dash-card:nth-child(3), .stat-card:nth-child(3) { animation-delay: 0.15s; }
.emp-card:nth-child(4), .dash-card:nth-child(4), .stat-card:nth-child(4) { animation-delay: 0.2s; }
.emp-card:nth-child(5), .dash-card:nth-child(5), .stat-card:nth-child(5) { animation-delay: 0.25s; }
.emp-card:nth-child(6), .dash-card:nth-child(6), .stat-card:nth-child(6) { animation-delay: 0.3s; }
.emp-card:nth-child(7), .dash-card:nth-child(7), .stat-card:nth-child(7) { animation-delay: 0.35s; }
.emp-card:nth-child(8), .dash-card:nth-child(8), .stat-card:nth-child(8) { animation-delay: 0.4s; }
.emp-card:nth-child(9), .dash-card:nth-child(9), .stat-card:nth-child(9) { animation-delay: 0.45s; }
.emp-card:nth-child(n+10), .dash-card:nth-child(n+10), .stat-card:nth-child(n+10) { animation-delay: 0.5s; }

.modern-table-wrap { animation-delay: 0.2s; }
.zones-panel { animation-delay: 0.1s; }

/* Micro-animations */
button, .primary-button, .secondary-button, .action-icon-btn, .tab-link {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
button:active, a.action-icon-btn:active, .tab-link:active {
  transform: scale(0.96);
}
.modern-table-wrap tbody tr {
  transition: background-color 0.2s, transform 0.2s;
}

/* Dialog Animation */
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

dialog {
  opacity: 0;
}
dialog[open] {
  animation: dialogIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 1;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
}
dialog[open]::backdrop {
  animation: backdropIn 0.3s ease forwards;
  opacity: 1;
}

/* TomSelect custom theme overrides */
.ts-control {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
}

.ts-wrapper.focus .ts-control,
.ts-wrapper.focus.dropdown-active .ts-control {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px oklch(0.82 0.06 215 / 0.5) !important;
}

.ts-dropdown,
.ts-dropdown.form-control,
.ts-dropdown.form-select {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}

.ts-dropdown .option {
  color: var(--ink);
  transition: all 0.2s ease;
}

.ts-dropdown .active {
  background-color: var(--surface-strong) !important;
  color: var(--ink) !important;
}

.ts-control > input {
  color: var(--ink) !important;
}

.ts-wrapper.single .ts-control:after {
  border-color: var(--muted) transparent transparent transparent !important;
}
.ts-wrapper.single.dropdown-active .ts-control:after {
  border-color: transparent transparent var(--muted) transparent !important;
}

.air-datepicker {
  box-shadow: var(--shadow);
}

/* App Switcher */
.app-switcher {
  position: relative;
  margin-bottom: 24px;
}
.app-switcher .brand-mark {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0;
  line-height: 1;
}
.app-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.app-switcher-btn:hover, .app-switcher.open .app-switcher-btn {
  background: var(--surface-strong);
  border-color: var(--line);
}
.app-switcher-btn-content {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.app-switcher-btn-content strong {
  display: block;
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.app-switcher-btn-content span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.app-switcher-chevron {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}
.app-switcher-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: none;
  z-index: 100;
  flex-direction: column;
  gap: 4px;
}
.app-switcher.open .app-switcher-menu {
  display: flex;
}
.app-switcher-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.2s;
}
.app-switcher-menu a:hover {
  background: var(--surface-strong);
}
.app-switcher-menu a.active {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.app-switcher-menu a strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
  color: var(--ink);
}
.app-switcher-menu a span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.small-mark {
  width: 32px;
  height: 32px;
  font-size: 14px;
  border-radius: 8px;
}
.op-mark {
  background: oklch(0.38 0.09 250);
}
html[data-theme="dark"] .op-mark {
  background: oklch(0.7 0.11 245);
}

/* --- Attendance Calendar --- */
.attendance-calendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  max-width: 350px;
}

.calendar-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.calendar-header .weekend {
  color: var(--danger-text);
  opacity: 0.8;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.cal-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

.cal-day:not(.empty):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 2;
}

.cal-day .day-num {
  font-size: 14px;
  font-weight: 600;
}

/* Statuses */
.cal-day.status-present {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid #10b981;
}
.cal-day.status-present .day-num { color: #10b981; }

.cal-day.status-late {
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid #eab308;
}
.cal-day.status-late .day-num { color: #eab308; }

.cal-day.status-absent {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
}
.cal-day.status-absent .day-num { color: #ef4444; }

.cal-day.status-future {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--line);
}
.cal-day.status-future .day-num { color: var(--muted); opacity: 0.7; }

.cal-day-delay {
  margin-top: 2px;
  color: var(--warning-text);
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}

.cal-day-shift-marker {
  position: absolute;
  top: 2px;
  right: 2px;
  max-width: calc(100% - 4px);
  overflow: hidden;
  border-radius: 999px;
  padding: 2px 4px;
  color: white;
  font-size: 7px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-day-shift-marker.open { background: #1d4ed8; }
.cal-day-shift-marker.auto { background: #6d5bd0; }

.cal-day.is-today {
  outline: 2px solid var(--info-text);
  outline-offset: 1px;
}

.cal-day.empty {
  visibility: hidden;
}

/* Tooltip on hover */
.cal-day[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--ink);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.cal-day[title]:hover::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 4px;
  border-style: solid;
  border-color: var(--ink) transparent transparent transparent;
  pointer-events: none;
}


/* Premium Action Buttons */
.premium-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.premium-action-btn:hover {
  background: var(--line);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.premium-action-btn:active {
  transform: scale(0.96);
}

.premium-action-btn svg {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

.premium-action-btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.premium-action-btn.primary:hover {
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}
