/* ============================================
   Simex Import Management – Styles v3
   SKILL.md compliant: Collapsible Sidebar, 
   Responsive (375/768/1024/1440), 8dp spacing,
   Touch targets 44px min, 150-300ms animations,
   Focus rings, Dark/Light mode
   ============================================ */

/* === CSS CUSTOM PROPERTIES (DARK – DEFAULT) === */
:root {
  /* Background */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1629;
  --bg-surface: #141b2d;
  --bg-card: #1a2236;
  --bg-surface-high: #212b42;
  --bg-hover: rgba(255,255,255,.04);
  --bg-active: rgba(99,102,241,.12);
  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-primary: #fff;
  /* Border */
  --border-subtle: rgba(255,255,255,.06);
  --border-default: rgba(255,255,255,.1);
  --border-strong: rgba(255,255,255,.15);
  /* Primary */
  --color-primary: #6366f1;
  --color-primary-light: #818cf8;
  --color-primary-glow: rgba(99,102,241,.25);
  /* Status */
  --status-green: #22c55e;
  --status-yellow: #eab308;
  --status-red: #ef4444;
  --status-blue: #3b82f6;
  --status-orange: #f97316;
  --status-purple: #a855f7;
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  --shadow-glow: 0 0 20px var(--color-primary-glow);
  /* Sidebar */
  --sidebar-width-collapsed: 72px;
  --sidebar-width-expanded: 260px;
  /* Layout */
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  /* Animation – SKILL.md §7: 150-300ms */
  --transition-fast: 180ms cubic-bezier(.4,0,.2,1);
  --transition-normal: 250ms cubic-bezier(.4,0,.2,1);
  --transition-slow: 350ms cubic-bezier(.4,0,.2,1);
  /* Z-Index Scale – SKILL.md §5 */
  --z-base: 0;
  --z-sidebar: 20;
  --z-header: 30;
  --z-dropdown: 40;
  --z-overlay: 50;
  --z-modal: 60;
  --z-toast: 100;
}

/* === LIGHT THEME === */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-surface: #fff;
  --bg-card: #fff;
  --bg-surface-high: #e2e8f0;
  --bg-hover: rgba(0,0,0,.03);
  --bg-active: rgba(99,102,241,.08);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-subtle: rgba(0,0,0,.06);
  --border-default: rgba(0,0,0,.1);
  --border-strong: rgba(0,0,0,.15);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px; /* SKILL.md §6: base 16px */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* SKILL.md §2: reduce 300ms tap delay */
}

body {
  font-family: 'Inter', 'Public Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6; /* SKILL.md §6: 1.5-1.75 */
  overflow-x: hidden;
  min-height: 100dvh; /* SKILL.md §5: dvh over vh */
}

/* === FOCUS RING – SKILL.md §1: visible focus states === */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* === TYPOGRAPHY SCALE – SKILL.md §6 === */
h1 { font-size: 1.875rem; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: .875rem; font-weight: 600; line-height: 1.4; }
p { font-size: .875rem; color: var(--text-secondary); }

/* === APP LAYOUT === */
.app-layout {
  display: flex;
  min-height: 100dvh;
}

/* ===================================================================
   COLLAPSIBLE SIDEBAR
   Desktop: auto-collapsed (72px icons), hover → expand (260px)
   Mobile: hidden, slide-in via .sidebar-open class
   =================================================================== */
.sidebar {
  position: fixed;
  top: var(--header-height); left: 0;
  height: calc(100dvh - var(--header-height));
  width: var(--sidebar-width-collapsed);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-normal);
  will-change: width;
}

/* Hover auf Desktop: expand */
@media (min-width: 769px) {
  .sidebar:hover {
    width: var(--sidebar-width-expanded);
    box-shadow: var(--shadow-lg);
  }
}

/* Force expand class (optional toggle) */
.sidebar.sidebar-expanded {
  width: var(--sidebar-width-expanded);
}

/* Sidebar Brand – hidden (brand shown in header) */
.sidebar-brand {
  display: none;
}

.sidebar-brand .brand-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: .9rem;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}
.sidebar:hover .brand-text,
.sidebar.sidebar-expanded .brand-text {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-brand .brand-text strong {
  font-size: .85rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: .02em;
}
.sidebar-brand .brand-text span {
  font-size: .6rem;
  color: var(--text-muted);
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* Section Labels */
.sidebar-section {
  font-size: .55rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 1.25rem 1rem .5rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar:hover .sidebar-section,
.sidebar.sidebar-expanded .sidebar-section {
  opacity: 1;
}

/* Nav Links */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .5rem .75rem;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  min-height: 44px; /* SKILL.md §2: touch target min */
  transition: all var(--transition-fast);
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-item.active {
  color: var(--color-primary-light);
  background: var(--bg-active);
  font-weight: 600;
}
.nav-item .material-symbols-outlined {
  font-size: 1.25rem;
  min-width: 1.25rem;
  text-align: center;
}
.nav-item .nav-label {
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.sidebar:hover .nav-label,
.sidebar.sidebar-expanded .nav-label {
  opacity: 1;
}

/* Sidebar User Info (bottom) */
.sidebar-user {
  border-top: 1px solid var(--border-subtle);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-user-avatar {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .75rem;
}
.sidebar-user-info {
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.sidebar:hover .sidebar-user-info,
.sidebar.sidebar-expanded .sidebar-user-info {
  opacity: 1;
}
.sidebar-user-info div:first-child { font-size: .75rem; font-weight: 600; color: var(--text-primary); }
.sidebar-user-info div:last-child { font-size: .6rem; color: var(--text-muted); }

/* Sidebar Theme Toggle (icon-only) */
.sidebar-theme-toggle {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition-fast);
  margin-left: auto;
  opacity: 0;
  pointer-events: none;
}
.sidebar-theme-toggle .material-symbols-outlined { font-size: 1.1rem; }
.sidebar-theme-toggle:hover {
  color: var(--status-yellow);
  border-color: var(--status-yellow);
  background: rgba(234,179,8,.1);
  box-shadow: 0 0 12px rgba(234,179,8,.15);
}
.sidebar:hover .sidebar-theme-toggle,
.sidebar.sidebar-expanded .sidebar-theme-toggle {
  opacity: 1;
  pointer-events: auto;
}

/* === MAIN WRAPPER === */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width-collapsed);
  padding-top: var(--header-height);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  transition: margin-left var(--transition-normal);
}

/* === HEADER === */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: var(--z-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.header-left h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.breadcrumb {
  font-size: .7rem;
  color: var(--text-muted);
}

/* Search */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin: 0 1.5rem;
}
.search-wrapper input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: .625rem 1rem .625rem 2.5rem;
  color: var(--text-primary);
  font-size: .8rem;
  min-height: 44px; /* SKILL.md §2 */
  transition: all var(--transition-fast);
}
.search-wrapper input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.search-wrapper input::placeholder { color: var(--text-muted); }
.search-wrapper .search-icon {
  position: absolute;
  left: .75rem; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1.1rem;
  pointer-events: none;
}

/* Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.search-dropdown.open { display: block; animation: fadeSlideDown var(--transition-fast) ease-out; }
.search-hit {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  min-height: 44px;
}
.search-hit:hover { background: var(--bg-hover); }
.search-hit .material-symbols-outlined { font-size: 1.1rem; color: var(--text-muted); }
.search-hit-categ { font-size: .55rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; padding: .5rem 1rem; }

/* Header Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

.header-icon-btn {
  position: relative;
  width: 44px; height: 44px; /* SKILL.md §2 */
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.header-icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.header-icon-btn .material-symbols-outlined { font-size: 1.2rem; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--status-red);
  color: #fff; font-size: .55rem; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* Language / Role Select – Premium Dropdown */
.header-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: .5rem 2rem .5rem .75rem;
  color: var(--text-primary);
  font-size: .75rem;
  font-weight: 600;
  min-height: 44px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}
.header-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.header-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: .5rem;
}

/* Notification Panel */
.notification-panel {
  position: fixed;
  top: var(--header-height);
  right: -380px;
  width: 360px;
  max-height: calc(100dvh - var(--header-height));
  background: var(--bg-card);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
  overflow-y: auto;
  transition: right var(--transition-normal);
}
.notification-panel.open { right: 0; }
.notification-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.notification-panel-header h3 { font-size: .85rem; font-weight: 700; }
.notification-panel-header button {
  background: none; border: none; color: var(--color-primary-light);
  font-size: .7rem; font-weight: 600; cursor: pointer;
  min-height: 44px; display: flex; align-items: center;
}
.notification-item {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.notification-item:hover { background: var(--bg-hover); }
.notification-item.unread { background: rgba(99,102,241,.04); }
.notification-item .notif-icon {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.notification-item .notif-icon.red { background: rgba(239,68,68,.12); color: var(--status-red); }
.notification-item .notif-icon.blue { background: rgba(59,130,246,.12); color: var(--status-blue); }
.notification-item .notif-icon.green { background: rgba(34,197,94,.12); color: var(--status-green); }
.notification-item .notif-icon.yellow { background: rgba(234,179,8,.12); color: var(--status-yellow); }
.notification-item .notif-icon.orange { background: rgba(249,115,22,.12); color: var(--status-orange); }
.notification-item .notif-text { font-size: .75rem; color: var(--text-secondary); line-height: 1.5; }
.notification-item .notif-time { font-size: .6rem; color: var(--text-muted); margin-top: .25rem; }

/* === MAIN CONTENT === */
#page-content {
  flex: 1;
  padding: 1.5rem;
  max-width: 1440px; /* SKILL.md §5: container width */
}

/* === CARDS === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  border-color: var(--border-default);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: .75rem;
}
.card-header h3 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.card-body { padding: 1.5rem; }

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.glass-card:hover {
  border-color: var(--border-default);
}

/* === KPI GRID === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}
.kpi-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.kpi-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: .05em;
  margin-bottom: .5rem;
}
.kpi-value {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.kpi-card .material-symbols-outlined {
  font-size: 1.1rem;
  margin-bottom: .5rem;
  color: var(--color-primary-light);
}

/* === DATA TABLE === */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .8rem;
}
.data-table thead th {
  background: var(--bg-secondary);
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  padding: .75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.data-table tbody td {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr {
  transition: background var(--transition-fast);
}
.data-table tbody tr:hover {
  background: var(--bg-hover);
}
.data-table .mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: .75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums; /* SKILL.md §6: tabular nums */
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem .625rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-green { background: rgba(34,197,94,.12); color: var(--status-green); }
.badge-yellow { background: rgba(234,179,8,.12); color: var(--status-yellow); }
.badge-red { background: rgba(239,68,68,.12); color: var(--status-red); }
.badge-blue { background: rgba(59,130,246,.12); color: var(--status-blue); }
.badge-orange { background: rgba(249,115,22,.12); color: var(--status-orange); }
.badge-purple { background: rgba(168,85,247,.12); color: var(--status-purple); }
.badge-slate { background: rgba(148,163,184,.1); color: var(--text-muted); }

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  min-height: 44px; /* SKILL.md §2 */
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn .material-symbols-outlined { font-size: 1.1rem; }
.btn:active { transform: scale(.97); } /* SKILL.md §7: scale feedback */

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  color: #fff;
  box-shadow: 0 2px 8px var(--color-primary-glow);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px var(--color-primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}
.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-hover); }

/* === FORMS === */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: var(--text-primary);
  font-size: .85rem;
  min-height: 44px; /* SKILL.md §8 */
  transition: all var(--transition-fast);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }
.form-group textarea { min-height: 88px; resize: vertical; }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.5rem;
}
.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Checkbox / AGB */
.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  cursor: pointer;
  min-height: 44px;
  padding: .5rem 0;
}
.form-checkbox input[type="checkbox"] {
  width: 20px; height: 20px; min-width: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
  margin-top: 2px;
}
.form-checkbox span {
  font-size: .8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* === PROGRESS BAR === */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
  transition: width var(--transition-slow);
}

/* Capacity */
.capacity-bar { height: 8px; background: var(--border-subtle); border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.capacity-fill { height: 100%; border-radius: 999px; transition: width var(--transition-slow); }
.capacity-fill.green { background: var(--status-green); }
.capacity-fill.yellow { background: var(--status-yellow); }
.capacity-fill.red { background: var(--status-red); }

/* === BAR CHART === */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
  padding: 1rem 0;
  height: 200px; /* fixed chart height */
}
.bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375rem;
  height: 100%;
  justify-content: flex-end;
}
.bar-fill {
  width: 100%;
  max-width: 32px;
  background: linear-gradient(180deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
  min-height: 4px;
}
.bar-label {
  font-size: .55rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.bar-value {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === ALERT CARDS === */
.alert-item {
  display: flex;
  gap: .75rem;
  padding: 1rem;
  border-left: 3px solid;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: .75rem;
  background: var(--bg-hover);
}
.alert-item.red { border-color: var(--status-red); }
.alert-item.yellow { border-color: var(--status-yellow); }
.alert-item.orange { border-color: var(--status-orange); }
.alert-item .alert-icon {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}
.alert-item h4 { font-size: .8rem; font-weight: 600; margin-bottom: .25rem; }
.alert-item p { font-size: .7rem; color: var(--text-muted); }

/* === QUICK ACTIONS GRID === */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 80px;
  justify-content: center;
  transition: all var(--transition-fast);
}
.quick-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.quick-card .material-symbols-outlined { font-size: 1.3rem; color: var(--color-primary-light); }
.quick-card span:not(.material-symbols-outlined) { font-size: .7rem; font-weight: 600; color: var(--text-secondary); text-align: center; }

/* === TIMELINE === */
.timeline { display: flex; gap: 0; margin: 1.5rem 0; position: relative; }
.timeline::before {
  content: ''; position: absolute; top: 15px; left: 0; right: 0;
  height: 2px; background: var(--border-subtle);
}
.timeline-step {
  flex: 1; text-align: center; position: relative; z-index: 1;
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto .375rem;
  font-size: .65rem; font-weight: 700;
  transition: all var(--transition-fast);
}
.timeline-step.done .timeline-dot { background: var(--status-green); color: #fff; }
.timeline-step.current .timeline-dot { background: var(--color-primary); color: #fff; box-shadow: 0 0 12px var(--color-primary-glow); }
.timeline-step.upcoming .timeline-dot { background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border-default); }
.timeline-step .step-label { font-size: .55rem; color: var(--text-muted); font-weight: 600; }
.timeline-step.current .step-label { color: var(--color-primary-light); }

/* === PAYMENT TIMELINE === */
.payment-step { display: flex; align-items: center; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--border-subtle); }
.payment-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.payment-dot.paid { background: var(--status-green); }
.payment-dot.unpaid { background: var(--border-default); }
.payment-label { flex: 1; font-size: .8rem; }
.payment-badge { font-size: .65rem; font-weight: 700; padding: .2rem .5rem; border-radius: 999px; }
.payment-badge.paid { background: rgba(34,197,94,.1); color: var(--status-green); }
.payment-badge.unpaid { background: rgba(148,163,184,.1); color: var(--text-muted); }

/* === COMM LOG === */
.comm-item {
  display: flex; gap: .75rem; padding: 1rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.comm-avatar {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .6rem; color: #fff;
}
.comm-item:not(.system) .comm-avatar { background: linear-gradient(135deg, var(--color-primary), #8b5cf6); }
.comm-item.system .comm-avatar { background: var(--bg-secondary); color: var(--text-muted); }
.comm-name { font-size: .75rem; font-weight: 600; }
.comm-time { font-size: .6rem; color: var(--text-muted); }
.comm-msg { font-size: .8rem; color: var(--text-secondary); margin-top: .25rem; line-height: 1.5; }

/* === FILE UPLOAD === */
.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-md);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.upload-zone:hover { border-color: var(--color-primary); background: rgba(99,102,241,.04); }
.upload-zone .material-symbols-outlined { font-size: 2rem; color: var(--color-primary-light); margin-bottom: .5rem; }
.upload-zone .upload-text { font-size: .8rem; color: var(--text-secondary); }
.upload-zone .upload-hint { font-size: .65rem; color: var(--text-muted); margin-top: .25rem; }

/* === INFO CARDS === */
.info-card {
  display: flex; gap: .75rem; padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(99,102,241,.04);
  border: 1px solid rgba(99,102,241,.1);
  margin-bottom: .75rem;
}
.info-card .material-symbols-outlined { font-size: 1.2rem; color: var(--color-primary-light); flex-shrink: 0; margin-top: .125rem; }
.info-card h4 { font-size: .8rem; font-weight: 600; margin-bottom: .25rem; }
.info-card p { font-size: .7rem; color: var(--text-muted); }

/* === AI HINT === */
.ai-hint {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, rgba(99,102,241,.06), rgba(139,92,246,.06));
  border: 1px solid rgba(99,102,241,.12);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}
.ai-hint .material-symbols-outlined { font-size: 1.1rem; color: var(--color-primary-light); }
.ai-hint span:not(.material-symbols-outlined) { font-size: .75rem; color: var(--text-secondary); }

/* === STARS === */
.star { color: var(--status-yellow); font-size: .8rem; }
.star.empty { color: var(--border-default); }

/* === SUPPLIER AVATAR === */
.supplier-avatar {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; color: #fff;
}
.supplier-avatar.blue { background: linear-gradient(135deg, #3b82f6, #6366f1); }
.supplier-avatar.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.supplier-avatar.orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.supplier-avatar.purple { background: linear-gradient(135deg, #a855f7, #7c3aed); }

/* Action Icons */
.action-icons { display: flex; gap: .375rem; }
.action-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.action-icon:hover { color: var(--color-primary-light); border-color: var(--color-primary); }
.action-icon .material-symbols-outlined { font-size: .9rem; }

/* === TOGGLE SWITCH === */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; }
.toggle input { opacity: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--border-default);
  border-radius: 999px;
  transition: background var(--transition-fast);
}
.toggle input:checked ~ .toggle-track { background: var(--color-primary); }
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }

/* === SETTINGS GRID === */
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.settings-section h3 {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 44px;
}
.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: .8rem; color: var(--text-secondary); }

/* === TOAST === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: .8rem;
  color: var(--text-primary);
  animation: slideInRight var(--transition-normal) ease-out;
  min-width: 280px;
  max-width: 400px;
}
.toast.success { border-left: 3px solid var(--status-green); }
.toast.error { border-left: 3px solid var(--status-red); }
.toast.info { border-left: 3px solid var(--status-blue); }
.toast .material-symbols-outlined { font-size: 1.1rem; }
.toast.success .material-symbols-outlined { color: var(--status-green); }
.toast.error .material-symbols-outlined { color: var(--status-red); }
.toast.info .material-symbols-outlined { color: var(--status-blue); }

/* === LOGIN PAGE === */
.login-container {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  padding: 1rem;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-box h1 {
  text-align: center;
  margin-bottom: .375rem;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-box .login-subtitle {
  text-align: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.login-box .btn-primary { width: 100%; margin-top: .5rem; }
.login-box .login-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: .75rem;
  color: var(--text-muted);
}
.login-box .login-footer a {
  color: var(--color-primary-light);
  text-decoration: none;
}

/* === SKELETON LOADER === */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: .5rem; border-radius: 4px; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

/* === BURGER MENU BUTTON (mobile) === */
.burger-btn {
  display: none;
  width: 44px; height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
}
.burger-btn .material-symbols-outlined { font-size: 1.3rem; }

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(4px);
}

/* === PAGE-VIEW HELPERS === */
.page-view h2 { margin-bottom: .25rem; }
.page-view p { margin-bottom: 0; }
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { margin-bottom: .25rem; }
.page-header p { margin-bottom: 0; color: var(--text-muted); font-size: .8rem; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: 1rem 0;
}
.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: .75rem; font-weight: 600;
  transition: all var(--transition-fast);
}
.page-btn:hover { border-color: var(--color-primary); color: var(--color-primary-light); }
.page-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* === UTILITY CLASSES === */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--color-primary-light); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* === ANIMATIONS === */
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(80px); } to { opacity: 1; transform: translateX(0); } }
@keyframes shimmer { 0%, 100% { background-position: 200% 0; } 50% { background-position: -200% 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* page load stagger */
.page-view { animation: fadeIn var(--transition-normal) ease-out; }

/* ===================================================================
   MISSING COMPONENT STYLES (used by pages.js)
   Premium design, SKILL.md compliant
   =================================================================== */

/* === KPI TILES (Dashboard) === */
.kpi-tile {
  position: relative;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-fast);
  border-left: 5px solid transparent;
}
.kpi-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.kpi-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.kpi-tile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.kpi-tile-icon {
  font-size: 1.3rem;
  opacity: .7;
}
.kpi-tile-badge {
  font-size: .6rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 999px;
  letter-spacing: .02em;
}
.kpi-tile-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: .25rem;
  font-variant-numeric: tabular-nums;
}
.kpi-tile-label {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* KPI Color Variants – border + icon + hover glow */
.kpi-yellow { border-left-color: var(--status-yellow); }
.kpi-yellow .kpi-tile-icon { color: var(--status-yellow); }
.kpi-orange { border-left-color: var(--status-orange); }
.kpi-orange .kpi-tile-icon { color: var(--status-orange); }
.kpi-blue { border-left-color: var(--status-blue); }
.kpi-blue .kpi-tile-icon { color: var(--status-blue); }
.kpi-red { border-left-color: var(--status-red); }
.kpi-red .kpi-tile-icon { color: var(--status-red); }
.kpi-purple { border-left-color: var(--status-purple); }
.kpi-purple .kpi-tile-icon { color: var(--status-purple); }
.kpi-green { border-left-color: var(--status-green); }
.kpi-green .kpi-tile-icon { color: var(--status-green); }

.kpi-yellow:hover { box-shadow: 0 8px 24px rgba(234,179,8,.15); }
.kpi-orange:hover { border-color: var(--status-orange); box-shadow: 0 8px 24px rgba(249,115,22,.15); }
.kpi-blue:hover { border-color: var(--status-blue); box-shadow: 0 8px 24px rgba(59,130,246,.15); }
.kpi-red:hover { border-color: var(--status-red); box-shadow: 0 8px 24px rgba(239,68,68,.15); }
.kpi-purple:hover { border-color: var(--status-purple); box-shadow: 0 8px 24px rgba(168,85,247,.15); }
.kpi-green:hover { border-color: var(--status-green); box-shadow: 0 8px 24px rgba(34,197,94,.15); }

/* === DASHBOARD GRID === */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  margin-top: .5rem;
}

/* === QUICK ACTIONS === */
.quick-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: 90px;
  color: var(--text-primary);
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  text-align: center;
}
.quick-action-btn:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
  background: var(--bg-card);
}
.quick-action-btn:active { transform: scale(.97); }
.icon-circle {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-circle .material-symbols-outlined { font-size: 1.1rem; }

/* Icon Circle Color Variants */
.icon-circle-primary { background: rgba(99,102,241,.12); color: var(--color-primary); }
.icon-circle-blue { background: rgba(59,130,246,.12); color: var(--status-blue); }
.icon-circle-green { background: rgba(34,197,94,.12); color: var(--status-green); }
.icon-circle-purple { background: rgba(168,85,247,.12); color: var(--status-purple); }
.icon-circle-orange { background: rgba(249,115,22,.12); color: var(--status-orange); }
.icon-circle-red { background: rgba(239,68,68,.12); color: var(--status-red); }
.icon-circle-yellow { background: rgba(234,179,8,.12); color: var(--status-yellow); }

/* === ALERT PANEL === */
.alert-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.alert-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.alert-panel-header h3 {
  font-size: .85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text-primary);
}
.alert-panel .alert-item {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}
.alert-panel .alert-item:last-child { border-bottom: none; }
.alert-panel .alert-item:hover { background: var(--bg-hover); }
.alert-panel .alert-item .material-symbols-outlined {
  font-size: 1.2rem;
  color: var(--status-orange);
  flex-shrink: 0;
  margin-top: .125rem;
}

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.filter-bar .form-select,
.filter-bar .form-input {
  width: auto;
  flex: 1;
  min-width: 140px;
  max-width: 280px;
}

/* === FORM ELEMENTS (Extended) === */
.form-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: .75rem 2.5rem .75rem 1rem;
  color: var(--text-primary);
  font-size: .85rem;
  min-height: 44px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}
.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: var(--text-primary);
  font-size: .85rem;
  min-height: 44px;
  transition: all var(--transition-fast);
}
.form-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.readonly {
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .375rem;
}

.form-textarea {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  color: var(--text-primary);
  font-size: .85rem;
  min-height: 88px;
  resize: vertical;
  transition: all var(--transition-fast);
  font-family: inherit;
  line-height: 1.6;
}
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}
.form-textarea::placeholder { color: var(--text-muted); }

.form-row { display: flex; gap: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* === LANGUAGE BUTTONS === */
.lang-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .03em;
}
.lang-btn:hover {
  color: var(--text-primary);
  border-color: var(--color-primary);
  background: rgba(99,102,241,.08);
  transform: translateY(-1px);
}
.lang-btn.active {
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 3px 12px var(--color-primary-glow);
  transform: translateY(-1px);
}

/* === BALANCE CARD (Finance) === */
.balance-card {
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.balance-card::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
  pointer-events: none;
}
.balance-card h4 {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  opacity: .8;
  margin-bottom: .75rem;
}
.balance-amount {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: .5rem;
  font-variant-numeric: tabular-nums;
}
.balance-status {
  font-size: .75rem;
  opacity: .7;
  font-weight: 500;
}

/* === SUMMARY GRID (Finance) === */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.summary-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-fast);
}
.summary-stat:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}
.summary-stat-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .5rem;
}
.summary-stat-value {
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.summary-stat-change {
  font-size: .7rem;
  font-weight: 600;
}

/* === INSIGHT ROW (Dashboard Market) === */
.insight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .625rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: .8rem;
  color: var(--text-secondary);
}
.insight-row:last-of-type { border-bottom: none; }
.insight-change {
  display: flex;
  align-items: center;
  gap: .25rem;
  font-weight: 700;
  font-size: .75rem;
}
.insight-change.up { color: var(--status-red); }
.insight-change.down { color: var(--status-green); }

/* === SUPPORT CARD === */
.support-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition-fast);
}
.support-card:hover { border-color: var(--border-default); }

/* === ICON BUTTON === */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  color: var(--color-primary-light);
  border-color: var(--color-primary);
  background: var(--bg-active);
}
.icon-btn .material-symbols-outlined { font-size: 1rem; }

/* === BUTTON SIZES === */
.btn-sm {
  padding: .375rem .75rem;
  font-size: .7rem;
  min-height: 32px;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: .875rem 1.5rem;
  font-size: .9rem;
  min-height: 48px;
  border-radius: var(--radius-md);
}

/* === COMM LOG (Order Detail) === */
.comm-log {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.comm-log-messages {
  max-height: 320px;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  scrollbar-width: thin;
}
.comm-message {
  display: flex;
  gap: .625rem;
  align-items: flex-start;
}
.comm-message .comm-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .55rem;
  flex-shrink: 0;
}
.comm-message .comm-avatar.system {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}
.comm-bubble {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding: .75rem 1rem;
}
.comm-bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .375rem;
}
.comm-bubble-name {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-primary);
}
.comm-bubble-time {
  font-size: .55rem;
  color: var(--text-muted);
}
.comm-bubble p {
  font-size: .78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.comm-input {
  display: flex;
  gap: .5rem;
  align-items: center;
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}
.comm-input input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: .625rem 1rem;
  color: var(--text-primary);
  font-size: .8rem;
  min-height: 40px;
}
.comm-input input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
  outline: none;
}
.comm-input input::placeholder { color: var(--text-muted); }

/* === PAYMENT TIMELINE (Order Detail) === */
.payment-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.payment-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.payment-step:last-child { border-bottom: none; }
.payment-step-icon {
  width: 28px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.payment-step.paid .payment-step-icon { color: var(--status-green); }
.payment-step.unpaid .payment-step-icon { color: var(--text-muted); }
.payment-step-label {
  flex: 1;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.payment-step-amount {
  font-size: .85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* === TIMELINE (Order Detail – Extended) === */
.timeline-step .timeline-dot.completed {
  background: var(--status-green);
  color: #fff;
}
.timeline-step .timeline-dot.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 16px var(--color-primary-glow);
  transform: scale(1.15);
}
.timeline-step .timeline-dot.pending {
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
}
.timeline-label {
  font-size: .55rem;
  font-weight: 600;
  margin-top: .25rem;
  text-align: center;
}
.timeline-date {
  font-size: .5rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: .125rem;
}

/* === PRIORITY SELECTOR (New Order) === */
.priority-selector {
  display: flex;
  gap: .75rem;
}
.priority-option {
  flex: 1;
  cursor: pointer;
}
.priority-option input { display: none; }
.priority-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  min-height: 44px;
}
.priority-card:hover { border-color: var(--border-strong); }
.priority-card .material-symbols-outlined { font-size: 1.3rem; color: var(--text-muted); }
.priority-card span:not(.material-symbols-outlined) { font-size: .7rem; font-weight: 600; color: var(--text-secondary); }
.priority-option input:checked + .priority-card {
  border-color: var(--color-primary);
  background: var(--bg-active);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
.priority-option input:checked + .priority-card .material-symbols-outlined {
  color: var(--color-primary-light);
}

/* === INFO CARDS (New Order) === */
.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  margin-top: 1.5rem;
}
.info-cards .info-card {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

/* === LOGIN PAGE === */
.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
  padding: 1rem;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-card .brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: .375rem;
  background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-card p {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.login-card .form-group { text-align: left; }
.login-card .btn-primary { width: 100%; margin-top: .5rem; }
.login-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  font-size: .75rem;
  color: var(--text-muted);
}
.login-footer label { display: flex; align-items: center; gap: .375rem; cursor: pointer; }
.login-footer a { color: var(--color-primary-light); text-decoration: none; }

/* === TOGGLE TRACK (Settings – class-based) === */
.toggle-track {
  display: block;
  width: 44px;
  height: 24px;
  min-width: 44px;
  min-height: 24px;
  border-radius: 999px;
  background: var(--border-default);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
  box-sizing: border-box;
}
.toggle-track.active {
  background: var(--color-primary);
  box-shadow: 0 0 12px var(--color-primary-glow);
}
.toggle-track .toggle-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.toggle-track.active .toggle-thumb { transform: translateX(20px); }

/* === STAR RATING === */
.star-rating {
  display: inline-flex;
  gap: 1px;
}
.star-rating .material-symbols-outlined {
  font-size: .8rem;
  color: var(--status-yellow);
}
.star-rating .material-symbols-outlined.empty {
  color: var(--border-default);
}

/* === PAGINATION (Extended) === */
.pagination-info {
  font-size: .7rem;
  color: var(--text-muted);
  font-weight: 500;
}
.pagination-buttons {
  display: flex;
  gap: .375rem;
}

/* === FINANCE TOTAL ROW === */
.finance-total-row {
  background: var(--bg-secondary);
}
.finance-total-row td {
  border-top: 2px solid var(--border-strong);
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

/* === ACTION ICON DANGER === */
.action-icon.danger:hover {
  color: var(--status-red);
  border-color: var(--status-red);
  background: rgba(239,68,68,.06);
}

/* === UPLOAD ZONE .hint === */
.upload-zone .hint {
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

/* === ADDITIONAL UTILITIES === */
.text-green { color: var(--status-green); }
.text-red { color: var(--status-red); }
.text-orange { color: var(--status-orange); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-variant-numeric: tabular-nums; }
.flex-col { display: flex; flex-direction: column; }
.mb-2 { margin-bottom: .5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: .5rem; }
.mt-8 { margin-top: 2rem; }
.gap-6 { gap: 1.5rem; }

/* border-color fallback (used in inline styles) */
:root { --border-color: var(--border-subtle); }

/* === bg-surface-high fallback === */
:root { --bg-surface-high: var(--bg-secondary); }
[data-theme="light"] { --bg-surface-high: #f1f5f9; --border-color: var(--border-subtle); }

/* ===================================================================
   RESPONSIVE – SKILL.md §5: breakpoints 375 / 768 / 1024 / 1440
   =================================================================== */

/* TABLET: 768px - 1024px */
@media (max-width: 1024px) {
  #page-content { padding: 1.25rem; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .search-wrapper { max-width: 280px; margin: 0 .75rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr 1fr; }
}

/* MOBILE: <= 768px */
@media (max-width: 768px) {
  /* Sidebar hidden, slide in via .sidebar-open on body */
  .sidebar {
    top: var(--header-height);
    height: calc(100dvh - var(--header-height));
    width: var(--sidebar-width-expanded);
    left: calc(-1 * var(--sidebar-width-expanded));
    transition: left var(--transition-normal);
    box-shadow: var(--shadow-lg);
  }
  /* Labels always visible on mobile sidebar */
  .sidebar .brand-text,
  .sidebar .nav-label,
  .sidebar .sidebar-section,
  .sidebar .sidebar-user-info {
    opacity: 1;
    pointer-events: auto;
  }
  body.sidebar-open .sidebar { left: 0; }
  body.sidebar-open .sidebar-overlay { display: block; }

  .main-wrapper { margin-left: 0; }
  .burger-btn { display: flex; }

  /* Header adjustments */
  .header { padding: 0 1rem; gap: .5rem; }
  .header-left h1 { font-size: .85rem; }
  .breadcrumb { display: none; }
  .search-wrapper { max-width: none; margin: 0 .5rem; flex: 1; }

  /* Selects smaller on mobile */
  .header-select { font-size: .65rem; padding: .375rem 1.5rem .375rem .5rem; min-height: 40px; }

  /* Content */
  #page-content { padding: 1rem; }

  /* Grid adjustments */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-tile-value { font-size: 1.5rem; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; gap: 1rem; }
  .quick-actions { gap: .5rem; }
  .quick-action-btn { flex: 1; min-width: calc(50% - .375rem); justify-content: center; }
  .form-row-2 { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-select,
  .filter-bar .form-input { width: 100%; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .priority-selector { flex-direction: column; }
  .info-cards { grid-template-columns: 1fr; }
  .login-card { padding: 2rem 1.5rem; }
  .lang-btn { width: 32px; height: 32px; font-size: .6rem; }

  /* Tables: horizontal scroll */
  .card { border-radius: var(--radius-md); }
  .data-table { font-size: .7rem; }
  .data-table thead th, .data-table tbody td { padding: .625rem .75rem; }

  /* Timeline */
  .timeline { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .timeline-step { min-width: 60px; }

  /* Notification panel full-width on mobile */
  .notification-panel { width: 100%; right: -100%; }
  .notification-panel.open { right: 0; }

  /* Toast on mobile */
  .toast-container { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { min-width: unset; }

  /* Login */
  .login-box { padding: 2rem 1.5rem; }

  /* Hide low-priority header items */
  .header-controls .hide-mobile { display: none; }
}

/* SMALL MOBILE: <= 375px */
@media (max-width: 375px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .header-select { display: none; }
  .search-wrapper { display: none; }
  .quick-action-btn { min-width: 100%; }
  .summary-grid { grid-template-columns: 1fr; }
}

/* === REDUCED MOTION – SKILL.md §1 === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === PRINT === */
@media print {
  .sidebar, .header, .burger-btn, .toast-container, .notification-panel { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  body { background: #fff; color: #000; }
}
