/* ==========================================================================
   TaskDesk — modernized design tokens & component styles
   Drop-in replacement/extension for public/assets/css/app.css
   Import this AFTER Bootstrap/Tailwind reset, BEFORE page-specific CSS.

   Brand colors sourced from the AbCoEdTech logo:
     - Green #7FBE25 → primary/accent ramp (interactive elements)
     - Navy  #240A59 → secondary brand color (brand mark, select accents)
   ========================================================================== */

:root {
  /* --- Color: neutral scale --- */
  --tk-gray-50: #F8F9FB;
  --tk-gray-100: #F1F2F5;
  --tk-gray-200: #E4E6EB;
  --tk-gray-300: #CDD1D9;
  --tk-gray-500: #7A8092;
  --tk-gray-700: #454B57;
  --tk-gray-900: #1B1E27;

  /* --- Color: accent (primary actions) — brand green ramp --- */
  --tk-accent-50: #F5F9F1;
  --tk-accent-100: #E7F0DB;
  --tk-accent-500: #7FBE25;
  --tk-accent-600: #62931D;
  --tk-accent-700: #466914;

  /* --- Color: brand navy (secondary brand color, from logo wordmark) --- */
  --tk-navy-100: #E2DBF0;
  --tk-navy-500: #240A59;
  --tk-navy-600: #370F87;

  /* --- Color: status semantics (reuse across badges, chips, borders) --- */
  --tk-status-not-started-bg: var(--tk-gray-100);
  --tk-status-not-started-text: var(--tk-gray-700);
  --tk-status-in-progress-bg: #DBEAFE;
  --tk-status-in-progress-text: #1D4ED8;
  --tk-status-pending-bg: #FEF3C7;
  --tk-status-pending-text: #B45309;
  --tk-status-completed-bg: #D1FAE5;
  --tk-status-completed-text: #047857;
  --tk-status-rejected-bg: #FEE2E2;
  --tk-status-rejected-text: #B91C1C;
  --tk-status-overdue-bg: #FEE2E2;
  --tk-status-overdue-text: #991B1B;

  /* --- Surfaces --- */
  --tk-surface-page: var(--tk-gray-50);
  --tk-surface-card: #FFFFFF;
  --tk-surface-sunken: var(--tk-gray-100);

  /* --- Text --- */
  --tk-text-primary: var(--tk-gray-900);
  --tk-text-secondary: var(--tk-gray-700);
  --tk-text-muted: var(--tk-gray-500);
  --tk-text-on-accent: #FFFFFF;

  /* --- Borders --- */
  --tk-border: var(--tk-gray-200);
  --tk-border-strong: var(--tk-gray-300);

  /* --- Layout --- */
  --tk-radius-sm: 8px;
  --tk-radius-md: 12px;
  --tk-radius-pill: 999px;
  --tk-shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --tk-shadow-popover: 0 4px 12px rgba(16, 24, 40, 0.12);

  /* --- Typography --- */
  --tk-font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}

/* ==========================================================================
   Base
   ========================================================================== */

body {
  background: var(--tk-surface-page);
  color: var(--tk-text-primary);
  font-family: var(--tk-font-sans);
  font-size: 15px;
  line-height: 1.55;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--tk-text-primary);
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

p.tk-subtitle {
  color: var(--tk-text-secondary);
  font-size: 14px;
  margin-top: 2px;
}

/* ==========================================================================
   Top navigation — light, not a heavy black bar
   ========================================================================== */

.tk-nav {
  background: var(--tk-surface-card);
  border-bottom: 1px solid var(--tk-border);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 24px;
}

.tk-nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--tk-text-primary);
  margin-right: 20px;
  text-decoration: none;
}

.tk-nav-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--tk-radius-sm);
  background: var(--tk-navy-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tk-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--tk-radius-sm);
  color: var(--tk-text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.tk-nav-link:hover {
  background: var(--tk-surface-sunken);
  color: var(--tk-text-primary);
}

.tk-nav-link.active {
  background: var(--tk-accent-50);
  color: var(--tk-accent-700);
  font-weight: 500;
}

.tk-nav-spacer {
  flex: 1;
}

.tk-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tk-accent-100);
  color: var(--tk-accent-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Page shell
   ========================================================================== */

.tk-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.tk-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.tk-card {
  background: var(--tk-surface-card);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-md);
  box-shadow: var(--tk-shadow-card);
  padding: 20px;
}

/* Task card — used on employee list and dashboard */
.tk-task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tk-task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tk-task-card-title {
  font-weight: 600;
  font-size: 15px;
}

.tk-task-card-desc {
  color: var(--tk-text-secondary);
  font-size: 13px;
}

.tk-task-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--tk-border);
}

.tk-task-card-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--tk-text-muted);
  font-size: 12.5px;
}

/* Metric card — dashboard stats */
.tk-metric-card {
  background: var(--tk-surface-card);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-md);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: inherit;
}

.tk-metric-label {
  font-size: 13px;
  color: var(--tk-text-secondary);
  margin-bottom: 6px;
}

.tk-metric-value {
  font-size: 26px;
  font-weight: 600;
}

.tk-metric-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--tk-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Status badges — color + icon + text, never color alone
   ========================================================================== */

.tk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--tk-radius-pill);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tk-badge--not-started {
  background: var(--tk-status-not-started-bg);
  color: var(--tk-status-not-started-text);
}

.tk-badge--in-progress {
  background: var(--tk-status-in-progress-bg);
  color: var(--tk-status-in-progress-text);
}

.tk-badge--pending-review {
  background: var(--tk-status-pending-bg);
  color: var(--tk-status-pending-text);
}

.tk-badge--completed {
  background: var(--tk-status-completed-bg);
  color: var(--tk-status-completed-text);
}

.tk-badge--rejected {
  background: var(--tk-status-rejected-bg);
  color: var(--tk-status-rejected-text);
}

.tk-badge--overdue {
  background: var(--tk-status-overdue-bg);
  color: var(--tk-status-overdue-text);
}

/* ==========================================================================
   Filter chips
   ========================================================================== */

.tk-chip-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tk-chip {
  padding: 7px 14px;
  border-radius: var(--tk-radius-pill);
  border: 1px solid var(--tk-border);
  background: var(--tk-surface-card);
  color: var(--tk-text-secondary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s ease;
}

.tk-chip:hover {
  border-color: var(--tk-border-strong);
}

.tk-chip.active {
  background: var(--tk-text-primary);
  color: #fff;
  border-color: var(--tk-text-primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.tk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--tk-radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--tk-border-strong);
  background: var(--tk-surface-card);
  color: var(--tk-text-primary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s ease;
}

.tk-btn:hover {
  background: var(--tk-surface-sunken);
}

.tk-btn:active {
  transform: scale(0.98);
}

.tk-btn--primary {
  background: var(--tk-accent-500);
  border-color: var(--tk-accent-500);
  color: #fff;
}

.tk-btn--primary:hover {
  background: var(--tk-accent-600);
}

.tk-btn--sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.tk-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--tk-text-primary);
}

.tk-input,
.tk-select,
.tk-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--tk-border-strong);
  border-radius: var(--tk-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--tk-surface-card);
  color: var(--tk-text-primary);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.tk-input:focus,
.tk-select:focus,
.tk-textarea:focus {
  outline: none;
  border-color: var(--tk-accent-500);
  box-shadow: 0 0 0 3px var(--tk-accent-50);
}

.tk-field {
  margin-bottom: 18px;
}

.tk-help {
  font-size: 12.5px;
  color: var(--tk-text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Toggle switch
   ========================================================================== */

.tk-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--tk-surface-sunken);
  border-radius: var(--tk-radius-sm);
  padding: 12px 14px;
}

.tk-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: var(--tk-radius-pill);
  background: var(--tk-gray-300);
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.tk-switch[aria-checked="true"] {
  background: var(--tk-accent-500);
}

.tk-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.tk-switch[aria-checked="true"] .tk-switch-thumb {
  transform: translateX(18px);
}

/* ==========================================================================
   Multiselect (see employee-multiselect.php + employee-multiselect.js)
   ========================================================================== */

.tk-multiselect {
  position: relative;
}

.tk-multiselect-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--tk-border-strong);
  border-radius: var(--tk-radius-sm);
  background: var(--tk-surface-card);
  cursor: text;
}

.tk-multiselect-control:focus-within {
  border-color: var(--tk-accent-500);
  box-shadow: 0 0 0 3px var(--tk-accent-50);
}

.tk-chip-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--tk-accent-50);
  color: var(--tk-accent-700);
  font-size: 12.5px;
  font-weight: 500;
  padding: 4px 6px 4px 10px;
  border-radius: var(--tk-radius-pill);
}

.tk-chip-tag button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
  display: flex;
}

.tk-multiselect-search {
  flex: 1;
  min-width: 120px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  padding: 4px;
}

.tk-multiselect-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--tk-surface-card);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-sm);
  box-shadow: var(--tk-shadow-popover);
  max-height: 220px;
  overflow-y: auto;
}

.tk-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 13.5px;
}

.tk-multiselect-option:hover {
  background: var(--tk-surface-sunken);
}

.tk-multiselect-option-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--tk-accent-100);
  color: var(--tk-accent-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.tk-multiselect-empty {
  padding: 14px 10px;
  text-align: center;
  color: var(--tk-text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Empty states
   ========================================================================== */

.tk-empty {
  text-align: center;
  padding: 48px 24px;
}

.tk-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--tk-surface-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--tk-text-muted);
}

.tk-empty-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.tk-empty-body {
  color: var(--tk-text-secondary);
  font-size: 13.5px;
}

/* ==========================================================================
   Bottom nav (mobile PWA chrome)
   ========================================================================== */

.tk-bottom-nav {
  display: none;
}

@media (max-width: 720px) {
  .tk-bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--tk-surface-card);
    border-top: 1px solid var(--tk-border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  }

  .tk-bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--tk-text-muted);
    font-size: 10px;
    text-decoration: none;
  }

  .tk-bottom-nav-item.active {
    color: var(--tk-accent-600);
  }
}

/* Accessibility: minimum touch target size on interactive controls */
.tk-btn,
.tk-chip,
.tk-nav-link,
.tk-switch,
.tk-multiselect-option {
  min-height: 36px;
}

@media (max-width: 720px) {

  .tk-btn,
  .tk-chip,
  .tk-nav-link,
  .tk-bottom-nav-item {
    min-height: 44px;
  }
}

/* ==========================================================================
   Kanban board
   ========================================================================== */

.cursor-grab {
  cursor: grab;
}

.cursor-grab:active {
  cursor: grabbing;
}

.kanban-column {
  min-height: 120px;
  transition: background 0.15s ease;
}

.kanban-column.drag-over {
  background: var(--tk-accent-50);
  border: 2px dashed var(--tk-accent-500);
}

.border-dashed {
  border-style: dashed !important;
}

.photo-preview-container {
  max-width: 200px;
  border-radius: var(--tk-radius-sm);
  overflow: hidden;
}

.photo-preview-container img {
  width: 100%;
  height: auto;
  display: block;
}