/* =====================================================================
   TMS — design system (full ownership, no AdminLTE)
   ===================================================================== */

/* ---------- design tokens ----------------------------------------- */
:root {
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --gray-0:  #ffffff;
  --gray-25: #fafafa;
  --gray-50: #f5f5f5;
  --gray-75: #f0f0f0;
  --gray-100:#ebebeb;
  --gray-150:#e1e1e1;
  --gray-200:#d4d4d4;
  --gray-300:#a3a3a3;
  --gray-400:#737373;
  --gray-500:#525252;
  --gray-600:#404040;
  --gray-700:#262626;
  --gray-800:#171717;
  --gray-900:#0a0a0a;

  --green-50:  #f0fdf4;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --amber-50:  #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --red-50:    #fef2f2;
  --red-500:   #ef4444;
  --red-600:   #dc2626;
  --red-700:   #b91c1c;
  --blue-50:   #eff6ff;
  --blue-500:  #3b82f6;
  --blue-600:  #2563eb;
  --blue-700:  #1d4ed8;

  --bg:           var(--gray-25);
  --surface:      var(--gray-0);
  --surface-2:    var(--gray-50);
  --surface-3:    var(--gray-75);
  --hairline:     var(--gray-100);
  --border:       var(--gray-150);
  --border-strong:var(--gray-200);
  --text:         var(--gray-900);
  --text-muted:   var(--gray-400);
  --text-subtle:  var(--gray-300);
  --accent:       #0d9488;
  --accent-hover: #0f766e;
  --accent-soft:  rgba(13,148,136,.10);
  --on-accent:    #ffffff;
  --primary:      #0d9488;

  --r-xs: 4px;
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.03);
  --shadow:    0 4px 16px -4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px -4px rgba(0,0,0,.10), 0 2px 6px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 24px 48px -8px rgba(0,0,0,.14), 0 8px 16px -4px rgba(0,0,0,.06);

  --ring: 0 0 0 3px rgba(13,148,136,.22);

  --sidebar-w: 244px;
  --topbar-h: 56px;
  --content-max: 1320px;

  --t-fast: 100ms;
  --t:      160ms;
  --t-slow: 240ms;
  --ease:   cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg:           #0a0a0a;
  --surface:      #111111;
  --surface-2:    #161616;
  --surface-3:    #1c1c1c;
  --hairline:     #1f1f1f;
  --border:       #262626;
  --border-strong:#333333;
  --text:         #fafafa;
  --text-muted:   #a3a3a3;
  --text-subtle:  #525252;
  --accent:       #14b8a6;
  --accent-hover: #2dd4bf;
  --accent-soft:  rgba(20,184,166,.16);
  --on-accent:    #0a0a0a;
  --primary:      #2dd4bf;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow:    0 4px 16px rgba(0,0,0,.5);
  --shadow-md: 0 8px 24px rgba(0,0,0,.6);
  --shadow-lg: 0 24px 48px rgba(0,0,0,.7);
  --ring: 0 0 0 3px rgba(20,184,166,.30);
}

/* ---------- reset / base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; font-size: 14px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
a { color: var(--text); text-decoration: none; transition: opacity var(--t-fast) var(--ease); }
a:hover { opacity: .7; }
::selection { background: var(--gray-900); color: #fff; }
[data-theme="dark"] ::selection { background: #fafafa; color: #0a0a0a; }

h1, h2, h3, h4, h5, h6 {
  margin: 0; color: var(--text); font-weight: 600;
  letter-spacing: -0.022em; line-height: 1.2;
}
h1 { font-size: 24px; letter-spacing: -0.028em; }
h2 { font-size: 20px; letter-spacing: -0.024em; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0; }
small, .text-muted { color: var(--text-muted); }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 16px 0; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--gray-300); background-clip: content-box; }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #2e2e2e; background-clip: content-box; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ---------- shell layout ------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

/* sidebar */
.app-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  z-index: 40;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--hairline);
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-brand:hover { opacity: 1; }
.sidebar-brand .brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: linear-gradient(135deg, #0d9488, #059669); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
[data-theme="dark"] .sidebar-brand .brand-mark { background: linear-gradient(135deg, #14b8a6, #10b981); color: #fff; }
.sidebar-brand .brand-text { font-weight: 600; font-size: 14px; color: var(--text); letter-spacing: -0.01em; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}
.sidebar-user .info { min-width: 0; flex: 1; }
.sidebar-user .info .name {
  font-size: 13px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user .info .role {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 500; margin-top: 1px;
}

.sidebar-nav { padding: 8px; flex: 1; }
.sidebar-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-subtle); font-weight: 600;
  padding: 16px 10px 6px;
}
.sidebar-section:first-child { padding-top: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 1px 0;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
.sidebar-link.active {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  box-shadow: inset 2px 0 0 0 var(--accent);
}
.sidebar-link i { width: 14px; text-align: center; font-size: 13px; color: var(--text-subtle); }
.sidebar-link.active i { color: var(--accent); }
.sidebar-link:hover i { color: var(--text); }

/* topbar */
.app-topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  z-index: 30;
}
.topbar-title { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); color: var(--text-muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  cursor: pointer; background: transparent; border: 0;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.user-menu { position: relative; }
.user-menu-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px; height: 36px;
  border-radius: var(--r-pill);
  background: transparent; border: 1px solid transparent;
  cursor: pointer; transition: all var(--t-fast) var(--ease);
}
.user-menu-trigger:hover { background: var(--surface-2); border-color: var(--hairline); }
.user-menu-trigger .name { font-size: 13px; font-weight: 500; color: var(--text); }
.user-menu-trigger .caret { font-size: 10px; color: var(--text-muted); }

.user-menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: none;
  z-index: 50;
}
.user-menu.open .user-menu-pop { display: block; }
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text);
}
.user-menu-item:hover { background: var(--surface-2); opacity: 1; }
.user-menu-item i { width: 14px; text-align: center; color: var(--text-muted); font-size: 12px; }
.user-menu-divider { height: 1px; background: var(--hairline); margin: 4px 0; }

/* main */
.app-main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1; min-width: 0;
  padding: 28px 32px 48px;
  background: var(--bg);
}
.app-main > .page { max-width: var(--content-max); margin: 0 auto; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); transition: transform var(--t) var(--ease); }
  .app-sidebar.open { transform: none; }
  .app-topbar { left: 0; }
  .app-main { margin-left: 0; padding: 16px; }
}

/* ---------- page header ------------------------------------------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 24px;
}
.page-head h1 { font-size: 24px; margin: 0; letter-spacing: -0.028em; }
.page-head .sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; max-width: 720px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Legacy AdminLTE page headers (.content-header / .tms-page-head) had no rules
   in this theme, so un-migrated pages rendered with no spacing below the header
   (cramped against the content). Give them the same treatment as .page-head. */
.content-header { margin-bottom: 24px; }
.content-header > .container-fluid { padding-left: 0; padding-right: 0; }
.tms-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
.content-header .sub, .tms-page-head .sub {
  color: var(--text-muted); font-size: 13px; margin-top: 4px; max-width: 720px;
}

/* ---------- KPI grid (the centerpiece) --------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--t) var(--ease);
}
.kpi:hover { border-color: var(--border); }
.kpi-label {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.kpi-label .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--gray-400); }
.kpi-label .dot.success { background: var(--green-500); }
.kpi-label .dot.warning { background: var(--amber-500); }
.kpi-label .dot.danger  { background: var(--red-500); }
.kpi-label .dot.info    { background: var(--blue-500); }
.kpi-value {
  font-size: 28px; font-weight: 600; letter-spacing: -0.028em;
  color: var(--text); line-height: 1.1;
  font-feature-settings: 'tnum'; font-variant-numeric: tabular-nums;
}
.kpi-value .unit { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-left: 2px; }
.kpi-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- panel / card ------------------------------------------ */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
  transition: border-color var(--t) var(--ease);
}
.panel-head, .card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: transparent !important;
}
.panel-head h3, .card-header .card-title {
  margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
}
.panel-head a, .card-header a {
  font-size: 12px; color: var(--text-muted); font-weight: 500; text-decoration: none;
}
.panel-head a:hover, .card-header a:hover { color: var(--text); opacity: 1; }
.panel-body, .card-body { padding: 18px; }
.panel-body.no-pad, .card-body.p-0 { padding: 0; }

/* ---------- TABLE (modern, clean) -------------------------------- */
.data-table-wrap {
  width: 100%; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table-wrap::-webkit-scrollbar { height: 6px; }
.tms-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.tms-table-scroll::-webkit-scrollbar { height: 6px; }
.tms-table-scroll > table {
  min-width: 100%;
  width: max-content;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--text);
}
.data-table thead th {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
  vertical-align: middle;
}
.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
  background: transparent;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--t-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); }

.data-table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .col-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.data-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.data-table .col-actions .btn { margin-left: 4px; }
.data-table .col-tight { width: 1%; white-space: nowrap; }

.panel-body.no-pad .data-table thead th:first-child,
.panel-body.no-pad .data-table tbody td:first-child { padding-left: 18px; }
.panel-body.no-pad .data-table thead th:last-child,
.panel-body.no-pad .data-table tbody td:last-child  { padding-right: 18px; }

/* employee cell */
.cell-employee { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-employee .avatar { flex-shrink: 0; }
.cell-employee .name { font-weight: 500; color: var(--text); line-height: 1.3; }
.cell-employee .meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* date cell */
.cell-date { display: flex; flex-direction: column; line-height: 1.3; }
.cell-date .primary { color: var(--text); font-weight: 500; }
.cell-date .relative { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* currency */
.cell-currency { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--text); white-space: nowrap; }
.cell-currency.zero { color: var(--text-subtle); font-weight: 400; }

/* ---------- pills ------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500; line-height: 1.4;
  background: var(--surface-3); color: var(--text-muted);
  border: 1px solid var(--hairline);
  white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .7; }
.pill.success { color: var(--green-700); background: var(--green-50); border-color: rgba(34,197,94,.18); }
.pill.warning { color: var(--amber-700); background: var(--amber-50); border-color: rgba(245,158,11,.20); }
.pill.danger  { color: var(--red-700);   background: var(--red-50);   border-color: rgba(239,68,68,.18); }
.pill.info    { color: var(--blue-700);  background: var(--blue-50);  border-color: rgba(59,130,246,.18); }
.pill.neutral { color: var(--text); background: var(--surface-2); border-color: var(--border); }

/* legacy alias used by JS post-processor */
.cell-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: var(--r-pill); font-size: 11px; font-weight: 500; line-height: 1.4; background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--hairline); white-space: nowrap; }
.cell-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .7; }
.cell-pill.is-success { color: var(--green-700); background: var(--green-50); border-color: rgba(34,197,94,.18); }
.cell-pill.is-warning { color: var(--amber-700); background: var(--amber-50); border-color: rgba(245,158,11,.20); }
.cell-pill.is-danger  { color: var(--red-700);   background: var(--red-50);   border-color: rgba(239,68,68,.18); }
.cell-pill.is-info    { color: var(--blue-700);  background: var(--blue-50);  border-color: rgba(59,130,246,.18); }
.cell-pill.is-accent  { color: var(--text); background: var(--surface-2); border-color: var(--border); }

[data-theme="dark"] .pill.success, [data-theme="dark"] .cell-pill.is-success { color: #4ade80; background: rgba(34,197,94,.10); }
[data-theme="dark"] .pill.warning, [data-theme="dark"] .cell-pill.is-warning { color: #fbbf24; background: rgba(245,158,11,.10); }
[data-theme="dark"] .pill.danger,  [data-theme="dark"] .cell-pill.is-danger  { color: #f87171; background: rgba(239,68,68,.10); }
[data-theme="dark"] .pill.info,    [data-theme="dark"] .cell-pill.is-info    { color: #60a5fa; background: rgba(59,130,246,.10); }

/* ---------- avatars ----------------------------------------------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 999px;
  color: #fff; font-weight: 500; font-size: 12px; letter-spacing: .02em;
  flex-shrink: 0; user-select: none;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.av-1 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.avatar.av-2 { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.avatar.av-3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar.av-4 { background: linear-gradient(135deg, #14b8a6, #06b6d4); }
.avatar.av-5 { background: linear-gradient(135deg, #84cc16, #22c55e); }
.avatar.av-6 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.avatar.av-7 { background: linear-gradient(135deg, #a855f7, #ec4899); }
.avatar.av-8 { background: linear-gradient(135deg, #f97316, #f59e0b); }

/* ---------- buttons ----------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans);
  font-weight: 500; font-size: 13px; line-height: 1.25;
  letter-spacing: -0.005em;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent; color: var(--text);
  cursor: pointer;
  height: 32px;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn i { font-size: 12px; }
.btn-sm { padding: 4px 8px; font-size: 12px; height: 28px; }
.btn-lg { padding: 9px 16px; font-size: 14px; height: 38px; }
.btn-block { width: 100%; justify-content: center; }

.btn-primary {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); opacity: 1; }

.btn-secondary, .btn-light, .btn-info {
  background: var(--surface); color: var(--text); border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover, .btn-light:hover, .btn-info:hover {
  background: var(--surface-2); border-color: var(--border-strong); opacity: 1;
}

.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: transparent;
  width: 28px; height: 28px; padding: 0; justify-content: center;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); opacity: 1; }

.btn-success { background: var(--green-600); border-color: var(--green-600); color: #fff; }
.btn-success:hover { background: var(--green-700); border-color: var(--green-700); color: #fff; opacity: 1; }
.btn-warning { background: var(--amber-500); border-color: var(--amber-500); color: #fff; }
.btn-warning:hover { background: var(--amber-600); border-color: var(--amber-600); color: #fff; opacity: 1; }
.btn-danger  { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); border-color: var(--red-700); color: #fff; opacity: 1; }
.btn-link    { color: var(--text); padding: 0; height: auto; background: transparent; border: 0; }

/* ---------- forms ------------------------------------------------- */
.form-group { margin-bottom: 14px; }
label, .form-group label {
  display: inline-block; margin-bottom: 6px;
  font-size: 12px; font-weight: 500; color: var(--text);
}
.form-control, .custom-select, input[type="text"]:not(.no-style),
input[type="email"]:not(.no-style), input[type="password"]:not(.no-style),
input[type="date"]:not(.no-style), input[type="number"]:not(.no-style),
input[type="search"]:not(.no-style), input[type="tel"]:not(.no-style),
input[type="url"]:not(.no-style), input[type="time"]:not(.no-style),
select:not(.no-style), textarea:not(.no-style) {
  display: block; width: 100%;
  padding: 7px 12px;
  font-family: var(--font-sans);
  font-size: 13px; line-height: 1.5;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  height: 36px;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
textarea.form-control, textarea:not(.no-style) { height: auto; min-height: 80px; resize: vertical; }
.form-control:focus, .custom-select:focus,
input:focus:not(.no-style):not([type="checkbox"]):not([type="radio"]),
select:focus:not(.no-style), textarea:focus:not(.no-style) {
  outline: none; border-color: var(--text); box-shadow: var(--ring);
}
.form-control::placeholder { color: var(--text-subtle); }
/* Native checkbox/radio: keep browser-default sizing, just tint */
input[type="checkbox"], input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--gray-900);
  margin: 0; vertical-align: middle;
  cursor: pointer;
}

.input-group { display: flex; flex-wrap: wrap; align-items: stretch; width: 100%; }
.input-group > .form-control { flex: 1 1 auto; }
.input-group-text {
  display: inline-flex; align-items: center;
  padding: 0 12px; font-size: 13px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.input-group > .input-group-prepend > .input-group-text { border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-append > .input-group-text { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > .form-control:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.form-check { display: flex; align-items: center; gap: 8px; padding: 0; }
.form-check-input { margin: 0; accent-color: var(--gray-900); width: 16px; height: 16px; }
.form-check-label { font-size: 13px; color: var(--text); margin: 0; }

.text-danger { color: var(--red-600); font-size: 12px; font-weight: 500; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  padding: 24px; margin-bottom: 14px;
}
.form-section h3 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
.form-section .form-section-sub { color: var(--text-muted); font-size: 12px; margin-bottom: 18px; }
.form-row-tight { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 768px) {
  .form-row-tight.cols-2 { grid-template-columns: 1fr 1fr; }
  .form-row-tight.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
  .form-row-tight.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
}

/* ---------- alerts ------------------------------------------------ */
.alert {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  background: var(--surface);
  margin-bottom: 14px;
}
.alert-success { background: var(--green-50);  border-color: rgba(34,197,94,.18); color: var(--green-700); }
.alert-warning { background: var(--amber-50);  border-color: rgba(245,158,11,.18); color: var(--amber-700); }
.alert-danger  { background: var(--red-50);    border-color: rgba(239,68,68,.18); color: var(--red-700); }
.alert-info    { background: var(--blue-50);   border-color: rgba(59,130,246,.18); color: var(--blue-700); }
.alert-fixed { position: fixed; top: 70px; right: 24px; z-index: 1080; min-width: 300px; box-shadow: var(--shadow-md); }
.alert .close { float: right; background: transparent; border: 0; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.alert .close:hover { opacity: 1; }

/* ---------- modals (Bootstrap 4 base + custom skin) -------------- */
/* Hidden by default. JS toggles .show. */
.modal {
  display: none;
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1050; overflow: hidden; outline: 0;
}
.modal.show { display: block; }
.modal-open { overflow: hidden; }
.modal-open .modal { overflow-x: hidden; overflow-y: auto; }

.modal-dialog {
  position: relative; width: auto;
  margin: 0.5rem; pointer-events: none;
}
@media (min-width: 576px) { .modal-dialog { max-width: 500px; margin: 1.75rem auto; } }
@media (min-width: 992px) { .modal-lg, .modal-xl { max-width: 800px; } }
@media (min-width: 1200px) { .modal-xl { max-width: 1140px; } }

.modal-dialog-centered { display: flex; align-items: center; min-height: calc(100% - 1rem); }

.modal-content {
  position: relative;
  display: flex; flex-direction: column;
  width: 100%; pointer-events: auto;
  border: 0; border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg);
  background-clip: padding-box; outline: 0;
}
.modal-header { border-bottom: 1px solid var(--hairline); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 14px; font-weight: 600; margin: 0; }
.modal-body   { padding: 18px; position: relative; flex: 1 1 auto; }
.modal-footer { border-top: 1px solid var(--hairline); padding: 12px 18px; gap: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; }

.modal-backdrop {
  position: fixed; top: 0; left: 0;
  width: 100vw; height: 100vh; z-index: 1040;
  background-color: var(--gray-900);
}
.modal-backdrop.fade { opacity: 0; }
.modal-backdrop.show { opacity: 0.55; }

.modal-header .close { background: transparent; border: 0; font-size: 20px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 4px 8px; }
.modal-header .close:hover { color: var(--text); }

/* fade transitions */
.fade { transition: opacity 0.15s linear; }
.fade:not(.show) { opacity: 0; }
.modal.fade .modal-dialog { transition: transform 0.25s ease-out; transform: translate(0, -30px); }
.modal.show .modal-dialog { transform: none; }

/* ---------- tabs -------------------------------------------------- */
.nav-tabs {
  display: flex; gap: 4px; padding: 0 4px;
  border-bottom: 1px solid var(--hairline);
  list-style: none; margin: 0;
}
.nav-tabs .nav-link {
  display: inline-block; padding: 10px 14px;
  border: 0; border-radius: 0;
  color: var(--text-muted); font-weight: 500; font-size: 13px;
  position: relative; text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
.nav-tabs .nav-link:hover { color: var(--text); opacity: 1; }
.nav-tabs .nav-link.active {
  color: var(--text); font-weight: 500;
}
.nav-tabs .nav-link.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--text); border-radius: 2px;
}

/* ---------- badges ----------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 500; padding: 2px 8px; border-radius: var(--r-pill);
  font-size: 11px; line-height: 1.4;
  border: 1px solid var(--hairline);
}
.badge-primary, .badge-info { background: var(--surface-2); color: var(--text); border-color: var(--hairline); }
.badge-success { background: var(--green-50); color: var(--green-700); border-color: rgba(34,197,94,.18); }
.badge-warning { background: var(--amber-50); color: var(--amber-700); border-color: rgba(245,158,11,.18); }
.badge-danger  { background: var(--red-50);   color: var(--red-700);   border-color: rgba(239,68,68,.18); }
.badge-secondary { background: var(--surface-3); color: var(--text-muted); }

/* ---------- empty state ------------------------------------------ */
.empty-state {
  padding: 56px 20px; text-align: center; color: var(--text-muted);
}
.empty-state .icon {
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; color: var(--text-subtle); font-size: 16px;
}
.empty-state h4 { font-size: 14px; color: var(--text); margin: 0 0 4px; font-weight: 500; }
.empty-state p  { font-size: 12px; margin: 0; }

/* ---------- list groups (used in Profile) ----------------------- */
.list-group-unbordered { list-style: none; padding: 0; margin: 0; }
.list-group-unbordered .list-group-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.list-group-unbordered .list-group-item:last-child { border-bottom: 0; }
.list-group-unbordered .list-group-item b { color: var(--text-muted); font-weight: 500; }

/* ---------- profile box ----------------------------------------- */
.box-profile { padding: 24px; text-align: center; }
.profile-username { font-size: 18px; font-weight: 600; margin: 12px 0 4px; }

/* ---------- progress -------------------------------------------- */
.progress { background: var(--surface-3); border-radius: var(--r-pill); height: 6px; overflow: hidden; }
.progress-bar { background: var(--text); transition: width var(--t-slow) var(--ease); }

/* ---------- dropdowns (Bootstrap 4 popup) ----------------------- */
.dropdown-menu {
  border: 1px solid var(--hairline); border-radius: var(--r);
  box-shadow: var(--shadow-md); background: var(--surface);
  padding: 4px; min-width: 200px;
}
.dropdown-item {
  display: block; padding: 7px 10px; font-size: 13px;
  color: var(--text); border-radius: var(--r-sm); text-decoration: none;
}
.dropdown-item:hover { background: var(--surface-2); opacity: 1; }
.dropdown-divider { border-top: 1px solid var(--hairline); margin: 4px 0; height: 0; }

/* ---------- Bootstrap utility back-fills ------------------------- */
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.row > [class*="col-"] { padding: 0 8px; }
.col, [class*="col-"] { flex: 0 0 auto; max-width: 100%; }
.col { flex: 1 1 0; }
.col-12 { flex: 0 0 100%; max-width: 100%; }
@media (min-width: 576px) {
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 768px) {
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-md-5 { flex: 0 0 41.666%; max-width: 41.666%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333%; max-width: 58.333%; }
  .col-md-8 { flex: 0 0 66.666%; max-width: 66.666%; }
  .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}
@media (min-width: 992px) {
  .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
  .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
  .col-lg-5 { flex: 0 0 41.666%; max-width: 41.666%; }
  .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
  .col-lg-7 { flex: 0 0 58.333%; max-width: 58.333%; }
  .col-lg-8 { flex: 0 0 66.666%; max-width: 66.666%; }
  .col-lg-9 { flex: 0 0 75%; max-width: 75%; }
  .col-lg-12 { flex: 0 0 100%; max-width: 100%; }
}

.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }
.d-block { display: block; }
.d-inline-block { display: inline-block; }
.d-none { display: none; }
@media (min-width: 768px) { .d-md-flex { display: flex; } .d-md-block { display: block; } .d-md-none { display: none; } .d-md-inline-block { display: inline-block; } }
@media (min-width: 992px) { .d-lg-flex { display: flex; } .d-lg-block { display: block; } .d-lg-none { display: none; } }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-items-center { align-items: center; }
.align-items-start { align-items: flex-start; }
.align-items-end { align-items: flex-end; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; } .mt-5 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }
.ml-1 { margin-left: 4px; } .ml-2 { margin-left: 8px; } .ml-3 { margin-left: 16px; } .ml-auto { margin-left: auto; }
.mr-1 { margin-right: 4px; } .mr-2 { margin-right: 8px; } .mr-3 { margin-right: 16px; } .mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-0 { padding: 0; } .p-2 { padding: 8px; } .p-3 { padding: 16px; } .p-4 { padding: 24px; }
.float-right { float: right; }

/* ---------- entrance animation ---------------------------------- */
/* Opacity-only — DO NOT add transform here. A transform on .page creates a
   containing block that traps position:fixed children (modals) inside
   .app-main, which makes modals render in the wrong area / get covered by
   the backdrop. */
@keyframes tms-fade-in { from { opacity: 0; } to { opacity: 1; } }
.app-main > .page { animation: tms-fade-in var(--t) var(--ease) both; }

/* ---------- print ---------------------------------------------- */
@media print {
  .app-sidebar, .app-topbar { display: none !important; }
  .app-main { margin: 0 !important; }
}

/* ---------- legacy AdminLTE class hide-overrides ---------------- */
/* In case any page still uses .info-box, render it like .kpi */
.info-box {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-xs); margin-bottom: 12px;
}
.info-box-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text); flex-shrink: 0;
}
.info-box-icon.bg-info     { background: var(--blue-50); color: var(--blue-600); }
.info-box-icon.bg-success  { background: var(--green-50); color: var(--green-600); }
.info-box-icon.bg-warning  { background: var(--amber-50); color: var(--amber-600); }
.info-box-icon.bg-danger   { background: var(--red-50); color: var(--red-600); }
.info-box-content { flex: 1; min-width: 0; padding: 0; }
.info-box-text { display: block; font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.info-box-number { display: block; font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.022em; line-height: 1.1; }

/* hide things from old AdminLTE shell that we replace */
body.hold-transition { transition: none !important; }

/* compatibility: any page using ASP.NET GridView CssClass="table" */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; color: var(--text); }
.table thead th { background: transparent; color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--hairline); border-top: 0; white-space: nowrap; }
.table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--hairline); border-top: 0; vertical-align: middle; background: transparent; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background var(--t-fast) var(--ease); }
.table-hover tbody tr:hover { background: var(--surface-2); }
.table-bordered, .table-bordered th, .table-bordered td { border: 0 !important; }
.table-bordered tbody td { border-bottom: 1px solid var(--hairline) !important; }

/* status-pill shim */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-muted); font-size: 11px; font-weight: 500; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; opacity: .7; }

/* DataTables small overrides if used */
.dataTables_wrapper { padding: 12px 16px 8px; }
.dataTables_wrapper .row { align-items: center; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate {
  color: var(--text-muted); font-size: 12px; padding: 8px 0;
}
.dataTables_wrapper .dataTables_filter { text-align: right; }
.dataTables_wrapper .dataTables_filter label { margin: 0; font-size: 0; }
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 6px 12px 6px 30px; font-size: 13px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 9px 50%;
  background-size: 13px 13px; color: var(--text);
  margin-left: 0; min-width: 220px; box-shadow: var(--shadow-xs); height: 32px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button,
.dataTables_wrapper .pagination .page-link {
  border: 1px solid transparent !important; border-radius: var(--r-sm) !important;
  padding: 5px 10px !important; margin: 0 !important;
  background: transparent !important; color: var(--text-muted) !important;
  font-weight: 500; font-size: 12px; min-width: 28px; text-align: center;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover,
.dataTables_wrapper .pagination .page-link:hover {
  background: var(--surface-2) !important; color: var(--text) !important; border-color: var(--border) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .pagination .page-item.active .page-link {
  background: var(--gray-900) !important; color: #fff !important; border-color: var(--gray-900) !important;
}
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current,
[data-theme="dark"] .dataTables_wrapper .pagination .page-item.active .page-link {
  background: #fafafa !important; color: #0a0a0a !important; border-color: #fafafa !important;
}

/* =====================================================================
   COMPREHENSIVE TABLE FIX — kills GridView attribute borders, makes the
   table footer/pagination compact, ghost-style action buttons, and gives
   every admin page the same modern look.
   ===================================================================== */

/* IMPORTANT: FullCalendar (root: .fc) has its own table layout. None of
   our generic table rules below should bleed into it, otherwise the day
   grid duplicates / breaks. */

/* Kill ASP.NET GridView's HTML border="1" / cellspacing attributes */
table.table[border], table.data-table[border], table.tms-table[border] { border: 0 !important; }
table.table, table.data-table, table.tms-table { border-collapse: separate !important; border-spacing: 0 !important; }
.table:not(.fc *) th, .table:not(.fc *) td,
.data-table:not(.fc *) th, .data-table:not(.fc *) td,
.tms-table:not(.fc *) th, .tms-table:not(.fc *) td {
  border-style: none !important; border-width: 0 !important;
}
.table:not(.fc *) tbody td, .data-table:not(.fc *) tbody td, .tms-table:not(.fc *) tbody td {
  border-bottom: 1px solid var(--hairline) !important;
}
.table:not(.fc *) thead th, .data-table:not(.fc *) thead th, .tms-table:not(.fc *) thead th {
  border-bottom: 1px solid var(--hairline) !important;
}
.table:not(.fc *) tbody tr:last-child td, .data-table:not(.fc *) tbody tr:last-child td, .tms-table:not(.fc *) tbody tr:last-child td {
  border-bottom: 0 !important;
}

/* Reset everything inside .fc to its own defaults */
.fc, .fc table, .fc thead, .fc tbody, .fc tr, .fc th, .fc td {
  background: initial; border-collapse: initial; font-size: initial;
  text-transform: none; letter-spacing: normal;
  padding: revert; border: revert;
}

/* =====================================================================
   FULLCALENDAR — modern Cron/Linear-style override
   ===================================================================== */
.fc { font-family: var(--font-sans); color: var(--text); --fc-border-color: var(--hairline); --fc-today-bg-color: var(--surface-2); --fc-neutral-bg-color: var(--surface-2); --fc-page-bg-color: var(--surface); --fc-event-bg-color: var(--gray-900); --fc-event-border-color: var(--gray-900); --fc-event-text-color: #fff; }
[data-theme="dark"] .fc { --fc-event-bg-color: #fafafa; --fc-event-border-color: #fafafa; --fc-event-text-color: #0a0a0a; }

/* Hide default toolbar — we render our own */
.fc .fc-toolbar.fc-header-toolbar { display: none !important; }

/* Day grid */
.fc .fc-scrollgrid { border: 1px solid var(--hairline) !important; border-radius: var(--r-md) !important; overflow: hidden; }
.fc .fc-scrollgrid td, .fc .fc-scrollgrid th { border-color: var(--hairline) !important; }
.fc .fc-scrollgrid-section > * { border-top: 0 !important; border-left: 0 !important; }

/* Column headers (Sun, Mon, ...) */
.fc .fc-col-header-cell {
  background: var(--surface-2);
  padding: 10px 8px !important;
}
.fc .fc-col-header-cell-cushion {
  font-size: 11px !important; font-weight: 600 !important;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted) !important;
  text-decoration: none !important; padding: 0 !important;
}

/* Day cells */
.fc .fc-daygrid-day { transition: background var(--t-fast) var(--ease); }
.fc .fc-daygrid-day:hover { background: var(--surface-2); }
.fc .fc-daygrid-day-frame { padding: 4px 6px !important; min-height: 100px; }
.fc .fc-daygrid-day-top { justify-content: flex-start; }
.fc .fc-daygrid-day-number {
  font-size: 12px !important; font-weight: 500;
  color: var(--text) !important;
  padding: 4px 6px !important;
  text-decoration: none !important;
  font-variant-numeric: tabular-nums;
}
/* Off-month days */
.fc .fc-day-other .fc-daygrid-day-number { color: var(--text-subtle) !important; }
.fc .fc-day-other { background: var(--surface-2) !important; }

/* Today */
.fc .fc-day-today { background: transparent !important; }
.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--gray-900); color: #fff !important;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 0 !important; font-weight: 600;
}
[data-theme="dark"] .fc .fc-day-today .fc-daygrid-day-number { background: #fafafa; color: #0a0a0a !important; }

/* Weekend subtle tint */
.fc .fc-day-sun, .fc .fc-day-sat { background: rgba(0,0,0,0.012); }
[data-theme="dark"] .fc .fc-day-sun, [data-theme="dark"] .fc .fc-day-sat { background: rgba(255,255,255,0.02); }

/* Events */
.fc .fc-event, .fc .fc-daygrid-event {
  border-radius: 4px !important; border: 0 !important;
  padding: 2px 6px !important; margin: 1px 4px !important;
  font-size: 11px !important; font-weight: 500;
  cursor: pointer;
}
.fc .fc-daygrid-event-dot { border-color: currentColor !important; }
.fc .fc-event-title { font-weight: 500; }
.fc .fc-event:hover { opacity: .85; }

/* List view */
.fc-list { border: 1px solid var(--hairline) !important; border-radius: var(--r-md) !important; overflow: hidden; background: var(--surface) !important; }
.fc .fc-list-day-cushion { background: var(--surface-2) !important; }
.fc .fc-list-day-cushion .fc-list-day-text,
.fc .fc-list-day-cushion .fc-list-day-side-text { color: var(--text) !important; font-weight: 600 !important; font-size: 12px !important; }
.fc .fc-list-event:hover td { background: var(--surface-2) !important; }
.fc .fc-list-event-dot { border-color: var(--gray-900) !important; }
.fc .fc-list-empty { color: var(--text-muted); padding: 60px 20px; }

/* Custom toolbar (we render outside FC) */
.tms-cal-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.tms-cal-toolbar .nav-group {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.tms-cal-toolbar .nav-group button {
  background: transparent; border: 0;
  padding: 0 12px; height: 32px;
  font-size: 12px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tms-cal-toolbar .nav-group button:hover { background: var(--surface-2); color: var(--text); }
.tms-cal-toolbar .nav-group button + button { border-left: 1px solid var(--hairline); }
.tms-cal-toolbar .nav-group button.is-today { padding: 0 14px; color: var(--text); }
.tms-cal-toolbar .cal-title {
  font-size: 18px; font-weight: 600; letter-spacing: -0.022em;
  color: var(--text); margin: 0 4px;
}
.tms-cal-toolbar .view-group { margin-left: auto; }
.tms-cal-toolbar .view-group button.active {
  background: var(--gray-900); color: #fff;
}
[data-theme="dark"] .tms-cal-toolbar .view-group button.active { background: #fafafa; color: #0a0a0a; }
.tms-cal-toolbar .spacer { flex: 1; }

/* All tables fit nicely inside their container, no double frame */
.card .table, .card .data-table, .card .tms-table,
.panel .table, .panel .data-table, .panel .tms-table,
.dataTables_wrapper .table, .dataTables_wrapper .data-table, .dataTables_wrapper .tms-table {
  margin-bottom: 0 !important;
}

/* Card-body wraps a DataTables table: drop padding so the table extends edge-to-edge */
.card-body > .dataTables_wrapper { padding: 0 !important; margin: 0; }
.card-body > .dataTables_wrapper > .row { margin: 0; }

/* DataTables wrapper layout fixes */
.dataTables_wrapper {
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
}
.dataTables_wrapper > .row:first-child {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin: 0 !important;
  gap: 12px;
}
.dataTables_wrapper > .row:first-child > div {
  padding: 0 !important;
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
}
.dataTables_wrapper > .row:last-child {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin: 0 !important;
  border-top: 1px solid var(--hairline);
  gap: 12px;
  background: var(--surface);
}
.dataTables_wrapper > .row:last-child > div {
  padding: 0 !important;
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
}
.dataTables_wrapper > .row:nth-child(2) {
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}
.dataTables_wrapper > .row:nth-child(2) > div {
  padding-left: 0 !important;
  padding-right: 0 !important;
}
.dataTables_wrapper table.dataTable {
  width: 100% !important;
  margin: 0 !important;
}
.dataTables_wrapper table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > td.dtr-control,
.dataTables_wrapper table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > th.dtr-control,
.dataTables_wrapper table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > td:first-child,
.dataTables_wrapper table.dataTable.dtr-inline.collapsed > tbody > tr:not(.child) > th:first-child {
  position: relative;
  padding-left: 42px !important;
}
.dataTables_wrapper table.dataTable > tbody > tr.child ul.dtr-details {
  width: 100%;
}
.dataTables_wrapper table.dataTable > tbody > tr.child span.dtr-title {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.dataTables_wrapper table.dataTable > tbody > tr.child span.dtr-data {
  color: var(--text);
}

/* Length select — modernize: "Rows: [25 v]" pill */
.dataTables_wrapper .dataTables_length {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); padding: 0 !important;
}
.dataTables_wrapper .dataTables_length label {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 500;
}
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-sm) !important;
  padding: 4px 24px 4px 10px !important;
  background-color: var(--surface) !important;
  color: var(--text) !important;
  font-size: 12px !important;
  height: 28px !important;
  font-family: var(--font-sans);
  min-width: 64px;
}

/* Search input — modernize */
.dataTables_wrapper .dataTables_filter {
  text-align: right; padding: 0 !important;
}
.dataTables_wrapper .dataTables_filter label { margin: 0 !important; font-size: 0 !important; }
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border) !important;
  border-radius: var(--r-sm) !important;
  padding: 6px 12px 6px 32px !important;
  font-size: 13px !important;
  height: 32px !important; min-width: 240px;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px 50% !important;
  background-size: 14px 14px !important;
  color: var(--text) !important;
  font-family: var(--font-sans);
  margin-left: 0 !important;
  box-shadow: var(--shadow-xs);
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--text) !important; box-shadow: var(--ring) !important; outline: none !important; }

/* Footer info line */
.dataTables_wrapper .dataTables_info {
  font-size: 12px; color: var(--text-muted); padding: 0 !important;
}

/* Pagination — fix vertical bullets, force horizontal flex */
.dataTables_wrapper .dataTables_paginate { padding: 0 !important; text-align: right; }
.dataTables_wrapper .pagination,
.dataTables_wrapper ul.pagination {
  display: inline-flex !important; flex-direction: row !important;
  list-style: none !important; padding: 0 !important; margin: 0 !important;
  gap: 2px;
  justify-content: flex-end;
}
.dataTables_wrapper .pagination li,
.dataTables_wrapper .pagination .page-item {
  display: inline-flex !important; list-style: none !important;
  margin: 0 !important;
}
.dataTables_wrapper .pagination li::before,
.dataTables_wrapper .pagination .page-item::before { content: none !important; }
.dataTables_wrapper .pagination .page-item .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex !important; align-items: center; justify-content: center;
  border: 1px solid transparent !important;
  border-radius: var(--r-sm) !important;
  padding: 0 10px !important; margin: 0 !important;
  height: 28px; min-width: 28px;
  background: transparent !important; color: var(--text-muted) !important;
  font-weight: 500; font-size: 12px;
  font-family: var(--font-mono);
  text-decoration: none !important;
  cursor: pointer;
}
.dataTables_wrapper .pagination .page-item .page-link:hover,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-2) !important; color: var(--text) !important;
  border-color: var(--border) !important;
}
.dataTables_wrapper .pagination .page-item.active .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--gray-900) !important; color: #fff !important; border-color: var(--gray-900) !important;
}
[data-theme="dark"] .dataTables_wrapper .pagination .page-item.active .page-link,
[data-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #fafafa !important; color: #0a0a0a !important; border-color: #fafafa !important;
}
.dataTables_wrapper .pagination .page-item.disabled .page-link,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--text-subtle) !important; background: transparent !important; cursor: default;
}

/* Sort indicators */
table.dataTable thead th { position: relative; cursor: pointer; }
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc { padding-right: 24px !important; }
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--text-subtle); opacity: .4; font-size: 10px;
}
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after { color: var(--text); opacity: 1; }

/* DataTables empty row */
.dataTables_wrapper .dataTables_empty {
  padding: 56px 16px !important;
  color: var(--text-muted);
  font-size: 13px; text-align: center !important;
}

/* =====================================================================
   ACTION BUTTONS in tables — auto-width ghost style.
   Buttons size to their content (icon-only OR icon+text).
   ===================================================================== */
.table tbody td:last-child .btn,
.data-table tbody td:last-child .btn,
.tms-table tbody td:last-child .btn,
.dataTables_wrapper table tbody td:last-child .btn {
  display: inline-flex !important; align-items: center; justify-content: center;
  height: 28px !important; line-height: 1 !important;
  padding: 0 10px !important;
  border-radius: var(--r-sm) !important;
  font-size: 12px !important; font-weight: 500 !important;
  margin: 0 2px !important;
  white-space: nowrap !important; gap: 6px !important;
  width: auto !important; min-width: 28px;
}
/* Explicit .btn-icon for square icon-only buttons */
.btn.btn-icon {
  width: 28px !important; padding: 0 !important; min-width: 28px;
}

/* Ghost styling for the typical "secondary" colored buttons */
.table tbody td:last-child .btn-info,
.table tbody td:last-child .btn-secondary,
.table tbody td:last-child .btn-light,
.data-table tbody td:last-child .btn-info,
.data-table tbody td:last-child .btn-secondary,
.data-table tbody td:last-child .btn-light,
.tms-table tbody td:last-child .btn-info,
.tms-table tbody td:last-child .btn-secondary,
.tms-table tbody td:last-child .btn-light,
.dataTables_wrapper table tbody td:last-child .btn-info,
.dataTables_wrapper table tbody td:last-child .btn-secondary,
.dataTables_wrapper table tbody td:last-child .btn-light {
  background: transparent !important; border-color: transparent !important;
  color: var(--text-muted) !important; box-shadow: none !important;
}
.table tbody td:last-child .btn-info:hover,
.table tbody td:last-child .btn-secondary:hover,
.table tbody td:last-child .btn-light:hover,
.data-table tbody td:last-child .btn-info:hover,
.data-table tbody td:last-child .btn-secondary:hover,
.data-table tbody td:last-child .btn-light:hover,
.tms-table tbody td:last-child .btn-info:hover,
.tms-table tbody td:last-child .btn-secondary:hover,
.tms-table tbody td:last-child .btn-light:hover,
.dataTables_wrapper table tbody td:last-child .btn-info:hover,
.dataTables_wrapper table tbody td:last-child .btn-secondary:hover,
.dataTables_wrapper table tbody td:last-child .btn-light:hover {
  background: var(--surface-2) !important; color: var(--text) !important; opacity: 1;
}

/* Danger: ghost red */
.table tbody td:last-child .btn-danger,
.data-table tbody td:last-child .btn-danger,
.tms-table tbody td:last-child .btn-danger,
.dataTables_wrapper table tbody td:last-child .btn-danger {
  background: transparent !important; border-color: transparent !important;
  color: var(--red-600) !important; box-shadow: none !important;
}
.table tbody td:last-child .btn-danger:hover,
.data-table tbody td:last-child .btn-danger:hover,
.tms-table tbody td:last-child .btn-danger:hover,
.dataTables_wrapper table tbody td:last-child .btn-danger:hover {
  background: var(--red-50) !important; color: var(--red-700) !important; opacity: 1;
}
[data-theme="dark"] .table tbody td:last-child .btn-danger:hover,
[data-theme="dark"] .data-table tbody td:last-child .btn-danger:hover,
[data-theme="dark"] .tms-table tbody td:last-child .btn-danger:hover {
  background: rgba(239,68,68,.10) !important; color: #f87171 !important;
}

/* Warning / Success keep their fill but compact size for primary row actions */
.table tbody td:last-child .btn-success,
.table tbody td:last-child .btn-warning,
.data-table tbody td:last-child .btn-success,
.data-table tbody td:last-child .btn-warning,
.tms-table tbody td:last-child .btn-success,
.tms-table tbody td:last-child .btn-warning,
.dataTables_wrapper table tbody td:last-child .btn-success,
.dataTables_wrapper table tbody td:last-child .btn-warning {
  /* keep filled background — these are primary row actions like "New batch" */
  padding: 0 12px !important;
}

/* Consistent last-cell alignment + right-align actions */
.table tbody td:last-child:has(.btn),
.data-table tbody td:last-child:has(.btn),
.tms-table tbody td:last-child:has(.btn) {
  text-align: right; white-space: nowrap;
}

/* "Actions" column header right-aligned to match — but only when the
   column actually holds buttons. Without the :has() guard this rule
   right-aligned every last header, including plain-text columns like
   "Name" in the participant-picker modals, which then drifted to the
   right edge while the data stayed flush-left. */
.table:has(tbody td:last-child .btn) thead th:last-child,
.data-table:has(tbody td:last-child .btn) thead th:last-child,
.tms-table:has(tbody td:last-child .btn) thead th:last-child {
  text-align: right;
}

/* Numbers / IDs in tables: always tabular & subtle */
.table tbody td.id-cell,
.data-table tbody td.id-cell,
.tms-table tbody td .id-cell,
.table tbody td:first-child:not(:has(*)):not(:has(.cell-employee)):not(:has(div)) {
  font-feature-settings: 'tnum';
}

/* Card body wrapping a DataTables wrapper: zero padding everywhere */
.card-body.p-0 .dataTables_wrapper,
.panel-body.no-pad .dataTables_wrapper {
  padding: 0 !important;
}
.card-body.p-0 .dataTables_wrapper > .row,
.panel-body.no-pad .dataTables_wrapper > .row {
  margin: 0;
}
.card-body.p-0 .dataTables_wrapper > .row:first-child,
.panel-body.no-pad .dataTables_wrapper > .row:first-child {
  padding: 14px 18px; border-bottom: 0;
}
.card-body.p-0 .dataTables_wrapper > .row:nth-child(2),
.panel-body.no-pad .dataTables_wrapper > .row:nth-child(2) {
  padding: 0; border: 0;
}

/* Mobile pagination: stack info + nav cleanly */
@media (max-width: 575.98px) {
  .dataTables_wrapper > .row:first-child,
  .dataTables_wrapper > .row:last-child {
    flex-direction: column !important;
    flex-wrap: wrap !important;
    align-items: stretch !important;
    gap: 8px;
  }
  .dataTables_wrapper > .row:first-child > div,
  .dataTables_wrapper > .row:last-child > div {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .dataTables_wrapper .dataTables_filter input { min-width: 100%; width: 100%; }
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    width: 100%;
    text-align: left;
  }
  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_length label {
    width: 100%;
  }
  .dataTables_wrapper .pagination,
  .dataTables_wrapper ul.pagination {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .panel-head,
  .card-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .panel-head .btn,
  .card-header .btn,
  .page-head .actions .btn {
    max-width: 100%;
  }
}

/* ===================================================================
   Colour accents — push the teal brand colour into high-surface-area
   areas (tables, nav, card headers) so data-heavy pages don't read as
   black-and-white. All driven by --accent / --accent-soft, so dark mode
   adapts and the whole thing is easy to dial up or down in one place.
   =================================================================== */

/* Table header rows: tinted band, teal labels, teal underline. */
.data-table thead th,
.tms-table thead th,
.table thead th {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  border-bottom: 2px solid var(--accent) !important;
}

/* Row hover picks up a teal tint instead of grey. */
.data-table tbody tr:hover,
.tms-table tbody tr:hover,
.table-hover tbody tr:hover {
  background: var(--accent-soft) !important;
}

/* Sidebar section labels (PEOPLE, MASTERS, …) in the brand colour. */
.sidebar-section { color: var(--accent); }

/* Card / panel headers: faint teal band with a teal title. */
.panel-head, .card-header {
  background: var(--accent-soft) !important;
}
.panel-head h3, .card-header .card-title { color: var(--accent); }

/* Empty-state icon in brand colour rather than grey. */
.empty-state .icon { color: var(--accent); }
