/* TaskFlow surfaces and component styles for VMS. */
:root {
  color-scheme: light;
  --background: #fff;
  --workspace: #f8fafc;
  --foreground: oklch(.145 0 0);
  --card: var(--background);
  --card-foreground: var(--foreground);
  --card-header-bg: transparent;
  --popover: var(--card);
  --popover-foreground: var(--foreground);
  --primary: oklch(.45 .2 264);
  --primary-hover: oklch(.40 .2 264);
  --primary-ink: var(--primary);
  --primary-foreground: #fff;
  --primary-glow: color-mix(in srgb, var(--primary) 12%, transparent);
  --secondary: oklch(.965 .001 286);
  --secondary-foreground: var(--foreground);
  --secondary-hover: #e9e9ed;
  --muted: var(--secondary);
  --muted-foreground: oklch(.51 .01 286);
  --accent: var(--secondary);
  --accent-foreground: var(--foreground);
  --destructive: #bd2626;
  --destructive-foreground: #fff;
  --destructive-glow: color-mix(in srgb, var(--destructive) 10%, transparent);
  --success: #087449;
  --success-foreground: #fff;
  --success-bg: color-mix(in srgb, var(--success) 9%, transparent);
  --success-border: color-mix(in srgb, var(--success) 30%, transparent);
  --warning: #87560a;
  --warning-foreground: #fff;
  --warning-bg: color-mix(in srgb, var(--warning) 10%, transparent);
  --warning-border: color-mix(in srgb, var(--warning) 30%, transparent);
  --border: oklch(.922 .004 286);
  --border-subtle: var(--secondary);
  --input: var(--border);
  --ring: var(--primary-ink);
  --sidebar: oklch(.985 0 0);
  --sidebar-border: var(--border);
  --sidebar-foreground: var(--foreground);
  --sidebar-muted: var(--muted-foreground);
  --sidebar-accent: var(--accent);
  --sidebar-accent-foreground: var(--foreground);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius: 10px;
  --radius-full: 9999px;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .05);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .08);
  --shadow-md: 0 4px 10px rgb(0 0 0 / .12);
  --shadow-lg: 0 10px 24px rgb(0 0 0 / .16);
  --font-sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', Consolas, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --background: oklch(.145 0 0);
  --workspace: #151517;
  --foreground: oklch(.985 0 0);
  --primary: oklch(.55 .2 264);
  --primary-hover: oklch(.60 .2 264);
  --primary-ink: #a2b1ff;
  --secondary: oklch(.215 .006 286);
  --secondary-hover: #303036;
  --muted-foreground: oklch(.72 .01 286);
  --destructive: #f38b8b;
  --destructive-foreground: #251414;
  --success: #70d7a4;
  --warning: #ebc270;
  --border: oklch(.275 .006 286);
  --sidebar: oklch(.175 0 0);
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .2);
  --shadow-sm: 0 1px 3px rgb(0 0 0 / .24);
  --shadow-md: 0 4px 10px rgb(0 0 0 / .3);
  --shadow-lg: 0 10px 24px rgb(0 0 0 / .4);
}

/* Compatibility tokens for the existing results and admin components. */
:root {
  --md-sys-color-primary: var(--primary-ink);
  --md-sys-color-on-primary: var(--primary-foreground);
  --md-sys-color-primary-container: var(--primary-glow);
  --md-sys-color-on-primary-container: var(--primary-ink);
  --md-sys-color-secondary: var(--muted-foreground);
  --md-sys-color-on-secondary: var(--secondary-foreground);
  --md-sys-color-secondary-container: var(--secondary);
  --md-sys-color-on-secondary-container: var(--secondary-foreground);
  --md-sys-color-surface: var(--card);
  --md-sys-color-surface-dim: var(--workspace);
  --md-sys-color-surface-container: var(--secondary);
  --md-sys-color-surface-container-high: var(--secondary);
  --md-sys-color-surface-container-highest: var(--secondary-hover);
  --md-sys-color-on-surface: var(--foreground);
  --md-sys-color-on-surface-variant: var(--muted-foreground);
  --md-sys-color-outline: var(--border);
  --md-sys-color-outline-variant: var(--border);
  --md-sys-color-error: var(--destructive);
  --md-sys-color-error-container: var(--destructive-glow);
  --md-sys-color-on-error: var(--destructive-foreground);
  --md-sys-color-on-error-container: var(--destructive);
  --md-sys-color-success: var(--success);
  --md-sys-color-success-container: var(--success-bg);
  --md-sys-color-on-success: var(--success-foreground);
  --md-sys-color-on-success-container: var(--success);
  --md-sys-color-warning: var(--warning);
  --md-sys-color-warning-container: var(--warning-bg);
  --md-sys-color-on-warning: var(--warning-foreground);
  --md-sys-color-on-warning-container: var(--warning);
  --md-sys-typescale-font: var(--font-sans);
  --md-sys-code-font: var(--font-mono);
  --md-sys-elevation-1: var(--shadow-xs);
  --md-sys-elevation-2: var(--shadow-sm);
  --md-sys-elevation-3: var(--shadow-md);
  --md-sys-elevation-4: var(--shadow-lg);
  --topbar-height: 56px;
}

/* ── Reset & Global Rules ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

html {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  background-color: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--foreground);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* ── TaskFlow Layout Frame ────────────────────────────────────────────────── */
.tf-app {
  display: flex;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--background);
}

/* ── Sidebar Component ────────────────────────────────────────────────────── */
.tf-sidebar {
  width: 256px;
  height: 100%;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 40;
  position: relative;
}

.tf-sidebar.collapsed {
  width: 64px;
}

/* Sidebar Brand Header */
.tf-sidebar-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.tf-sidebar.collapsed .tf-sidebar-header {
  justify-content: center;
  padding: 0 8px;
}

.tf-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.tf-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: none;
  flex-shrink: 0;
}

.tf-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tf-sidebar.collapsed .tf-brand-text {
  display: none;
}

.tf-brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-brand-sub {
  font-size: 10.5px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.tf-sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--sidebar-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.tf-sidebar-toggle-btn:hover {
  background: var(--sidebar-accent);
  color: var(--foreground);
}

.tf-sidebar.collapsed .tf-sidebar-toggle-btn {
  position: absolute;
  top: 14px;
  right: -14px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 50;
  width: 24px;
  height: 24px;
}

/* Sidebar Navigation Items */
.tf-sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tf-nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--sidebar-muted);
  padding: 0 12px;
  margin-bottom: 4px;
}

.tf-sidebar.collapsed .tf-nav-group-label {
  display: none;
}

.tf-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tf-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-muted);
  text-decoration: none;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.tf-sidebar.collapsed .tf-nav-item {
  justify-content: center;
  padding: 9px 0;
}

.tf-nav-item:hover {
  background: var(--sidebar-accent);
  color: var(--foreground);
}

.tf-nav-item.active {
  background: var(--primary-glow);
  color: var(--primary-ink);
  font-weight: 600;
}

.tf-nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.tf-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-sidebar.collapsed .tf-nav-label {
  display: none;
}

.tf-nav-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9999px;
  background: var(--secondary);
  color: var(--foreground);
  flex-shrink: 0;
}

.tf-nav-item.active .tf-nav-badge {
  background: var(--primary);
  color: var(--primary-foreground);
}

.tf-sidebar.collapsed .tf-nav-badge {
  display: none;
}

.tf-sidebar-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 0 4px;
}

/* Sidebar Footer / User Profile */
.tf-sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--sidebar);
  flex-shrink: 0;
}

.tf-sidebar.collapsed .tf-sidebar-footer {
  justify-content: center;
  padding: 12px 6px;
}

.tf-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.tf-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-weight: 600;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tf-user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tf-sidebar.collapsed .tf-user-details {
  display: none;
}

.tf-user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tf-user-role {
  font-size: 11px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Top Navigation Bar ───────────────────────────────────────────────────── */
.tf-main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--background);
}

.tf-topnav {
  height: 56px;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
}

.tf-topnav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.tf-mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}

.tf-mobile-menu-btn:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.tf-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.tf-breadcrumb-root {
  font-weight: 600;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tf-breadcrumb-sep {
  color: var(--muted-foreground);
  font-size: 14px;
}

.tf-breadcrumb-leaf {
  color: var(--muted-foreground);
  font-weight: 500;
}

/* Topbar Search Input */
.tf-topnav-center {
  flex: 1;
  max-width: 320px;
}

.tf-search-wrapper {
  position: relative;
  width: 100%;
}

.tf-search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.tf-search-input {
  width: 100%;
  height: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 32px 0 32px;
  font-size: 12.5px;
  color: var(--foreground);
  outline: none;
  transition: all 0.15s;
}

.tf-search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.tf-search-input::placeholder {
  color: var(--muted-foreground);
}

.tf-search-shortcut {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}

/* Topbar Right Actions */
.tf-topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Content Canvas ───────────────────────────────────────────────────────── */
.tf-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: var(--background);
}

/* Tab Panes */
.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ── TaskFlow Metric / KPI Stat Cards ─────────────────────────────────────── */
.tf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tf-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.tf-kpi-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-sm);
}

.tf-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tf-kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
}

.tf-kpi-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--secondary);
  color: var(--foreground);
}

.tf-kpi-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
  line-height: 1.1;
  margin-bottom: 4px;
  font-family: var(--font-sans);
}

.tf-kpi-sub {
  font-size: 11.5px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Cards Component (shadcn / TaskFlow style) ────────────────────────────── */
.tf-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 20px;
}

.tf-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tf-card-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tf-card-desc {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 2px;
}

.tf-card-body {
  padding: 20px;
}

.tf-card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Danger Card */
.tf-card.danger-card {
  border-color: rgba(239, 68, 68, 0.35);
  background: var(--card);
}

.tf-card.danger-card .tf-card-header {
  border-bottom-color: rgba(239, 68, 68, 0.2);
}

/* ── Buttons (TaskFlow Variants) ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary, .btn-tonal {
  background: var(--secondary);
  color: var(--secondary-foreground);
  border-color: var(--border);
}
.btn-secondary:hover, .btn-tonal:hover {
  background: var(--secondary-hover);
  border-color: var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--secondary);
  color: var(--foreground);
}

.btn-danger, .btn-destructive {
  background: var(--destructive);
  color: #ffffff;
  border-color: transparent;
}
.btn-danger:hover, .btn-destructive:hover {
  background: #dc2626;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover {
  background: var(--secondary);
  color: var(--foreground);
  border-color: var(--border);
}

.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
}

.btn-lg {
  height: 40px;
  padding: 0 18px;
  font-size: 13.5px;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge, .tf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1.3;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
  white-space: nowrap;
}

.badge-primary, .tf-badge-primary {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.badge-success, .tf-badge-success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: #34d399;
}

.badge-danger, .badge-fail, .tf-badge-destructive {
  background: var(--destructive-glow);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.badge-warning, .tf-badge-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: #fbbf24;
}

.badge-neutral {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--foreground);
}

/* ── Toolbar & Form Controls ──────────────────────────────────────────────── */
.tf-toolbar, .toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 380px;
}

.search-box .search-icon {
  position: absolute;
  left: 10px;
  font-size: 17px;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 34px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  font-size: 12.5px;
  outline: none;
  transition: all 0.15s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--foreground);
}

.form-control, .tf-input, .tf-select {
  height: 36px;
  padding: 0 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
  width: 100%;
}

.form-control:focus, .tf-input:focus, .tf-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-helper {
  font-size: 11.5px;
  color: var(--muted-foreground);
}

/* ── Drag & Drop Zone ─────────────────────────────────────────────────────── */
.dropzone, .tf-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  background: rgba(18, 18, 21, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}

.dropzone-icon {
  color: var(--primary);
  margin-bottom: 10px;
}

.dropzone-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 4px;
}

.dropzone-sub {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* ── Scrutineering Session Cards ─────────────────────────────────────────── */
.session-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}

.session-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.session-card.status-pass {
  border-left: 3px solid var(--success);
}

.session-card.status-fail {
  border-left: 3px solid var(--destructive);
}

.session-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.session-driver-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.01em;
}

.session-driver-car {
  font-size: 12px;
  color: var(--muted-foreground);
}

.session-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted-foreground);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 0;
}

.session-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.session-checks-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
}

.session-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.15);
}

.session-check-row.check-pass {
  color: #a7f3d0;
}

.session-check-row.check-fail {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
}

/* ── Tables (TaskFlow Table Style) ────────────────────────────────────────── */
.table-responsive, .tf-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.data-table, .tf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.data-table th, .tf-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td, .tf-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  vertical-align: middle;
}

.data-table tbody tr:last-child td, .tf-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover, .tf-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.mono-time {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ── Tabs (Pills & Radix Tab Style) ───────────────────────────────────────── */
.tf-tabs-wrapper {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}

.tf-tab-btn, .pill-btn, .class-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted-foreground);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tf-tab-btn:hover, .pill-btn:hover, .class-tab:hover {
  color: var(--foreground);
}

.tf-tab-btn.active, .pill-btn.active, .class-tab.active {
  background: var(--secondary);
  color: var(--foreground);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ── Standard Dialog / Modal Window ───────────────────────────────────────── */
.dialog-overlay, .modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.dialog-overlay.active, .modal-overlay.active {
  display: flex !important;
  opacity: 1;
}

.dialog-card, .modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dialog-header, .modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-title, .modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--foreground);
}

.dialog-body, .modal-body {
  padding: 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.dialog-footer, .modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toast Notifications ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--foreground);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--destructive);
}

.toast.toast-info {
  border-left: 3px solid var(--primary);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Mobile Responsive Drawer ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tf-mobile-menu-btn {
    display: inline-flex;
  }

  .tf-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .tf-sidebar.mobile-open {
    transform: translateX(0);
  }

  .tf-topnav-center {
    display: none;
  }

  .tf-content {
    padding: 16px;
  }
}

/* Spin animation utility */
.spin-anim {
  animation: vms-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes vms-spin {
  100% {
    transform: rotate(360deg);
  }
}

.staff-login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  height: auto;
  padding: 24px;
  overflow: auto;
}

.staff-login-card {
  width: min(100%, 390px);
  padding: clamp(20px, 6vw, 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
}

.staff-login-card h1 {
  margin: 0 0 24px;
  font-size: 1.5rem;
}

.staff-login-card form {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.staff-login-card form input {
  margin-bottom: 8px;
}

#staff-login-error {
  color: var(--destructive);
  margin: 0;
}

.staff-login-card a {
  color: var(--primary);
}

.inspection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.inspection-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

#inspection-modal .dialog-header {
  flex-wrap: wrap;
  gap: 12px;
}

.tf-topnav-left, .tf-content {
  min-width: 0;
}

.tf-content {
  overflow-x: hidden;
}

.dialog-card, .modal-card {
  max-height: calc(100dvh - 40px);
}

.dialog-header, .modal-header, .dialog-footer, .modal-footer {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .tf-topnav {
    gap: 6px;
    padding-inline: 10px;
  }

  .tf-topnav-right {
    gap: 4px;
  }

  .tf-topnav-right .btn {
    padding-inline: 6px;
  }

  .tf-topnav-right .topnav-action-label,
  .tf-topnav-right .tf-status-pill {
    display: none;
  }

  .tf-breadcrumb {
    min-width: 0;
  }

  .tf-breadcrumb-leaf {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .inspection-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dialog-header, .dialog-body, .modal-header, .modal-body {
    padding: 14px;
  }
}
.workspace-sidebar {
  width: 220px;
}

.workspace-heading {
  margin: 0 0 18px;
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.035em;
}

.workspace-brand { font-weight: 600; }
.tf-content { background: var(--workspace); }

.workspace-content > .tab-pane { max-width: 1220px; }
.workspace-content .session-cards-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.workspace-content .session-card { min-width: 0; box-shadow: var(--shadow-xs); }
.workspace-content .session-card-title { word-break: normal; overflow-wrap: anywhere; }
.session-card-file { color: var(--muted-foreground); font-size: .75rem; overflow-wrap: anywhere; }
.workspace-content .session-card-actions { gap: 6px; flex-wrap: wrap; }

.staff-login { background: var(--workspace); }
.staff-login-card { box-shadow: var(--shadow-sm); }

.workspace-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.workspace-actions, .settings-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#dash-search-input {
  flex: 1 1 230px;
  min-width: 0;
  max-width: 410px;
}

.screen-file-input {
  display: none;
}

.sync-status, .workspace-empty, .settings-note, #config-feedback {
  color: var(--muted-foreground);
  font-size: .875rem;
}

.workspace-empty {
  padding: 20px 0;
  text-align: center;
}

button.workspace-dropzone {
  display: block;
  width: 100%;
  padding: 16px;
  color: var(--muted-foreground);
  background: var(--card);
  margin-bottom: 16px;
}

.settings-form {
  max-width: 900px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  align-items: start;
}

.settings-grid fieldset {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
}

.settings-grid legend {
  font-weight: 650;
  padding-inline: 5px;
}

.settings-grid label {
  font-size: .875rem;
}

.settings-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 10px;
}

.settings-fields label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.settings-fields :is(input, select) {
  min-width: 0;
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-checkbox input {
  accent-color: var(--primary);
}

.settings-actions {
  margin-top: 18px;
}

.settings-note, #config-feedback {
  margin: 0;
}

#btn-apply-recommended-temps {
  justify-self: start;
}

#google-drive-modal .dialog-footer {
  justify-content: flex-end;
}
