/* ============================================
   SolarZ Demandas — shadcn/ui Design System
   Dark-first, adapted from shadcn components
   ============================================ */

/* --- shadcn CSS Variables --- */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 142 69% 28%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 142 69% 28%;
  --radius: 0.5rem;

  --sidebar-background: 0 0% 98%;
  --sidebar-foreground: 240 5.3% 26.1%;
  --sidebar-primary: 142 69% 28%;
  --sidebar-primary-foreground: 0 0% 98%;
  --sidebar-accent: 240 4.8% 95.9%;
  --sidebar-accent-foreground: 240 5.9% 10%;
  --sidebar-border: 220 13% 91%;
  --sidebar-ring: 142 69% 28%;

  /* Semantic */
  --color-urgent: 0 84% 60%;
  --color-high: 25 95% 53%;
  --color-normal: 217 91% 60%;
  --color-low: 220 9% 46%;
  --color-success: 142 69% 28%;
  --color-warning: 38 92% 50%;
  --color-violet: 263 70% 50%;
  --color-amber: 38 92% 50%;

  --sidebar-width: 17rem;
  --topbar-height: 4rem;
}

.dark {
  --background: 220 13% 10%;
  --foreground: 0 0% 95%;
  --card: 220 13% 12%;
  --card-foreground: 0 0% 95%;
  --popover: 220 13% 13%;
  --popover-foreground: 0 0% 95%;
  --primary: 142 60% 50%;
  --primary-foreground: 144 80% 10%;
  --secondary: 220 10% 18%;
  --secondary-foreground: 0 0% 95%;
  --muted: 220 10% 18%;
  --muted-foreground: 220 5% 58%;
  --accent: 220 10% 18%;
  --accent-foreground: 0 0% 95%;
  --destructive: 0 63% 31%;
  --destructive-foreground: 0 0% 95%;
  --border: 220 10% 20%;
  --input: 220 10% 20%;
  --ring: 142 60% 50%;

  --sidebar-background: 220 13% 9%;
  --sidebar-foreground: 0 0% 88%;
  --sidebar-primary: 142 60% 50%;
  --sidebar-primary-foreground: 144 80% 10%;
  --sidebar-accent: 220 10% 15%;
  --sidebar-accent-foreground: 0 0% 88%;
  --sidebar-border: 220 10% 16%;
}

/* --- Base Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Scrollbar (shadcn scroll-area style) --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(var(--muted-foreground) / 0.3); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: hsl(var(--muted-foreground) / 0.5); }

/* ============================================
   LAYOUT — shadcn Sidebar pattern
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar (shadcn sidebar component) --- */
.sidebar {
  width: var(--sidebar-width);
  background: hsl(var(--sidebar-background));
  border-right: 1px solid hsl(var(--sidebar-border));
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
  gap: 0.5rem;
}

.sidebar-header svg { flex-shrink: 0; border-radius: var(--radius); }

.sidebar-header .logo-text {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--sidebar-foreground));
}

.sidebar-nav {
  flex: 1;
  padding: 0.5rem;
  overflow-y: auto;
}

.sidebar-section { margin-top: 1rem; }

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.5rem;
  margin-bottom: 0.25rem;
}

/* shadcn sidebar-menu-button */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius);
  color: hsl(var(--sidebar-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.sidebar-item:hover {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-accent-foreground));
  text-decoration: none;
}

.sidebar-item.active {
  background: hsl(var(--sidebar-primary) / 0.1);
  color: hsl(var(--sidebar-primary));
  font-weight: 600;
}

.sidebar-item svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid hsl(var(--sidebar-border));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* --- Topbar --- */
.topbar {
  height: var(--topbar-height);
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }
.topbar-title { font-size: 1.125rem; font-weight: 600; }

.page-content { padding: 1.5rem; }

/* ============================================
   BUTTONS — shadcn button variants
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  height: 2.5rem;
  padding: 0 1.25rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.btn-secondary:hover { background: hsl(var(--secondary) / 0.8); }

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
}
.btn-ghost:hover { background: hsl(var(--accent)); }

.btn-outline {
  background: transparent;
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
}
.btn-outline:hover { background: hsl(var(--accent)); }

.btn-danger {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.btn-danger:hover { opacity: 0.9; }

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--muted-foreground));
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn-icon svg { width: 1.125rem; height: 1.125rem; }

.btn-sm { height: 2rem; padding: 0 0.875rem; font-size: 0.8125rem; border-radius: var(--radius); }
.btn-lg { height: 3rem; padding: 0 1.75rem; font-size: 1rem; }

/* shadcn Button Group / Toggle Group */
.btn-group {
  display: inline-flex;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  overflow: hidden;
}
.btn-group .btn-group-item {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  background: hsl(var(--background));
  color: hsl(var(--muted-foreground));
  border: none;
  border-right: 1px solid hsl(var(--input));
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.btn-group .btn-group-item:last-child { border-right: none; }
.btn-group .btn-group-item:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); text-decoration: none; }
.btn-group .btn-group-item.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }

/* ============================================
   INPUTS — shadcn input/select/textarea
   ============================================ */
.input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}
.input::placeholder { color: hsl(var(--muted-foreground)); }
.input-error { border-color: hsl(var(--destructive)); }

.textarea {
  width: 100%;
  min-height: 6rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.form-group { margin-bottom: 1rem; }

.select {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  font-family: inherit;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  padding-right: 2rem;
}
.select:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* shadcn Checkbox */
.checkbox-wrapper { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.checkbox {
  width: 1rem;
  height: 1rem;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 4px);
  appearance: none;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  background: hsl(var(--background));
}
/* Checkbox list (replaces native multi-select) */
.checkbox-list {
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  padding: 0.25rem;
  max-height: 10rem;
  overflow-y: auto;
  scrollbar-width: thin;
}
.checkbox-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.1s;
}
.checkbox-list-item:hover { background: hsl(var(--accent)); }

.checkbox:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* ============================================
   CARD — shadcn card
   ============================================ */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
}
.dark .kanban-card { background: hsl(var(--card) / 0.7); }
/* Light mode gets subtle shadow, dark mode relies on borders only (Linear pattern) */
:root .card { box-shadow: 0 1px 2px 0 rgba(0,0,0,0.06); }
.dark .card { box-shadow: none; }

.card-hover {
  transition: border-color 0.2s ease;
  cursor: pointer;
}
.card-hover:hover {
  border-color: hsl(var(--muted-foreground) / 0.2);
}
.dark .card-hover:hover {
  border-color: rgba(255,255,255,0.1);
}

/* ============================================
   BADGE — shadcn badge variants
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.4;
}

.badge-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}

.badge-urgent { background: hsl(0 84% 60% / 0.15); color: hsl(0 72% 51%); border-color: hsl(0 84% 60% / 0.2); }
.badge-urgent .badge-dot { background: hsl(0 84% 60%); }
.badge-high { background: hsl(25 95% 53% / 0.15); color: hsl(25 95% 40%); border-color: hsl(25 95% 53% / 0.2); }
.badge-high .badge-dot { background: hsl(25 95% 53%); }
.badge-normal { background: hsl(217 91% 60% / 0.15); color: hsl(217 91% 50%); border-color: hsl(217 91% 60% / 0.2); }
.badge-normal .badge-dot { background: hsl(217 91% 60%); }
.badge-low { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.badge-low .badge-dot { background: hsl(var(--muted-foreground)); }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}
.status-backlog { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.status-todo { background: hsl(217 91% 60% / 0.15); color: hsl(217 91% 50%); }
.status-in_progress { background: hsl(38 92% 50% / 0.15); color: hsl(38 92% 40%); }
.status-in_review { background: hsl(263 70% 50% / 0.15); color: hsl(263 70% 45%); }
.status-done { background: hsl(var(--primary) / 0.15); color: hsl(var(--primary)); }
.status-cancelled { background: hsl(var(--destructive) / 0.15); color: hsl(var(--destructive)); text-decoration: line-through; }

/* Label tags */
.label-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: 9999px;
  white-space: nowrap;
}

/* ============================================
   AVATAR — shadcn avatar
   ============================================ */
.avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
  color: white;
}
.avatar-xs { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: 0.6875rem; }
.avatar-md { width: 2.25rem; height: 2.25rem; font-size: 0.8125rem; }
.avatar-lg { width: 3rem; height: 3rem; font-size: 1rem; }

.avatar-0 { background: hsl(142 69% 35%); }
.avatar-1 { background: hsl(217 91% 50%); }
.avatar-2 { background: hsl(263 70% 50%); }
.avatar-3 { background: hsl(38 92% 45%); }
.avatar-4 { background: hsl(330 80% 50%); }
.avatar-5 { background: hsl(174 72% 40%); }

.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -0.375rem; border: 2px solid hsl(var(--card)); }

/* ============================================
   KANBAN BOARD v2
   ============================================ */

/* Kanban toolbar */
.kanban-toolbar {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.kanban-summary {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.kanban-summary strong { color: hsl(var(--foreground)); font-weight: 600; }

/* Filter pills */
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.filter-pill:hover { border-color: hsl(var(--muted-foreground) / 0.3); color: hsl(var(--foreground)); }
.filter-pill.active {
  background: hsl(var(--primary) / 0.12);
  border-color: hsl(var(--primary) / 0.3);
  color: hsl(var(--primary));
}
.filter-pill svg { width: 0.875rem; height: 0.875rem; }

/* Board */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
}

/* Column */
.kanban-column {
  min-width: 15rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: min-width 0.3s ease, opacity 0.3s ease, flex 0.3s ease;
  border-radius: calc(var(--radius) + 4px);
  padding: 0.5rem;
  border: 1px solid transparent;
  height: 100%;
}

/* Column tinted backgrounds per status */
.kanban-column[data-col="todo"]        { background: hsl(217 91% 60% / 0.06); }
.kanban-column[data-col="in_progress"] { background: hsl(38 92% 50% / 0.06); }
.kanban-column[data-col="in_review"]   { background: hsl(263 70% 50% / 0.06); }
.kanban-column[data-col="done"]        { background: hsl(142 60% 50% / 0.06); }
.kanban-column.collapsed {
  min-width: 3rem;
  max-width: 3rem;
  flex: 0 0 3rem;
  cursor: pointer;
  padding: 0.5rem 0.25rem;
}
.kanban-column.collapsed .kanban-column-cards,
.kanban-column.collapsed .kanban-column-actions { display: none; }

/* Column header */
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius);
  position: sticky;
  top: 0;
  z-index: 5;
  background: transparent;
}

.kanban-column-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.kanban-column-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

/* WIP warning */
.kanban-column-count.wip-warning {
  background: hsl(38 92% 50% / 0.15);
  color: hsl(38 92% 50%);
}
.kanban-column-count.wip-danger {
  background: hsl(0 84% 60% / 0.15);
  color: hsl(0 84% 60%);
}

.kanban-column-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

/* Column collapsed state */
.kanban-column.collapsed .kanban-column-header {
  flex-direction: column;
  padding: 0.75rem 0.25rem;
  gap: 0.5rem;
}
.kanban-column.collapsed .kanban-column-title {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 0.75rem;
}
.kanban-column.collapsed .kanban-column-count {
  writing-mode: horizontal-tb;
}

/* Cards container */
.kanban-column-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.25rem;
  border-radius: var(--radius);
  transition: background 0.2s, border-color 0.2s;
  scrollbar-width: thin;
}

/* Drop zone feedback */
.kanban-column-cards.drag-over {
  background: hsl(var(--primary) / 0.04);
  border: 1.5px dashed hsl(var(--primary) / 0.3);
}

/* Empty column */
.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  text-align: center;
  border: 1.5px dashed hsl(var(--border));
  border-radius: var(--radius);
  min-height: 8rem;
}
.kanban-empty-text {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.75rem;
}
.kanban-empty svg {
  width: 1.5rem;
  height: 1.5rem;
  color: hsl(var(--muted-foreground) / 0.5);
  margin-bottom: 0.5rem;
}

/* === KANBAN CARD v2 === */
.kanban-card {
  padding: 0.875rem 1rem;
  cursor: grab;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover {
  border-color: hsl(var(--muted-foreground) / 0.15);
}

/* Card header row */
.kanban-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.kanban-card-number {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  font-family: monospace;
}

.kanban-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.625rem;
}

/* Card progress bar (subtasks) */
.kanban-card-progress {
  margin-bottom: 0.625rem;
}
.kanban-card-progress-bar {
  width: 100%;
  height: 3px;
  background: hsl(var(--muted));
  border-radius: 9999px;
  overflow: hidden;
}
.kanban-card-progress-fill {
  height: 100%;
  background: hsl(var(--primary));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* Due date chip */
.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
}
.due-chip svg { width: 0.75rem; height: 0.75rem; }
.due-chip-overdue { background: hsl(0 84% 60% / 0.12); color: hsl(0 84% 60%); }
.due-chip-soon { background: hsl(38 92% 50% / 0.12); color: hsl(38 92% 50%); }
.due-chip-ok { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }

/* Card footer */
.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}
.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.kanban-card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.kanban-card-meta-item svg { width: 0.8125rem; height: 0.8125rem; }

/* Card context menu trigger */
.kanban-card-menu {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.kanban-card:hover .kanban-card-menu { opacity: 1; }

/* Priority borders */
.priority-urgent { border-left: 3px solid hsl(0 84% 60%); }
.priority-high { border-left: 3px solid hsl(25 95% 53%); }

/* Drag states */
.sortable-ghost {
  opacity: 0.3;
  border: 1.5px dashed hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.03);
}
.sortable-chosen {
  border-color: hsl(var(--primary) / 0.4);
  box-shadow: 0 0 30px -8px hsl(var(--primary) / 0.15);
  transform: rotate(1deg) scale(1.02);
  z-index: 10;
}
.sortable-drag {
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  transform: rotate(2deg) scale(1.03);
}

/* ============================================
   TABLE — shadcn table
   ============================================ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  height: 2.75rem;
  padding: 0 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}
.data-table td {
  height: 3.25rem;
  padding: 0 1rem;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.875rem;
  vertical-align: middle;
}
.data-table tr:hover td { background: hsl(var(--muted) / 0.5); }
.data-table td.title-cell { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 0; width: 100%; }

/* ============================================
   DIALOG — shadcn dialog
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 16px 70px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 36rem;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  animation: dialogIn 0.15s ease;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); }

/* ============================================
   SHEET / DRAWER — shadcn sheet
   ============================================ */
.sheet-overlay { position: fixed; inset: 0; background: hsl(var(--background) / 0.8); backdrop-filter: blur(4px); z-index: 50; }
.sheet-content {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(40rem, 90vw);
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  box-shadow: -16px 0 70px rgba(0,0,0,0.3);
  overflow-y: auto;
  animation: sheetIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 51;
}
.sheet-header {
  height: var(--topbar-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  position: sticky; top: 0;
  background: hsl(var(--card));
  z-index: 1;
}
.sheet-body { padding: 1.5rem; }

/* ============================================
   TOAST — shadcn sonner style
   ============================================ */
.toast-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  width: 22rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  font-size: 0.8125rem;
  color: hsl(var(--card-foreground));
  animation: toastIn 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toast-success { border-left: 3px solid hsl(var(--primary)); }
.toast-error { border-left: 3px solid hsl(var(--destructive)); }
.toast-warning { border-left: 3px solid hsl(38 92% 50%); }

/* ============================================
   DROPDOWN — shadcn dropdown-menu
   ============================================ */
.dropdown-menu {
  position: absolute; top: 100%; right: 0; margin-top: 0.25rem;
  min-width: 11rem;
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  padding: 0.25rem;
  z-index: 50;
  animation: dropdownIn 0.1s ease;
}
.dropdown-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.875rem;
  color: hsl(var(--popover-foreground));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.1s;
  border: none; background: none; width: 100%; text-align: left;
}
.dropdown-item:hover { background: hsl(var(--accent)); }
.dropdown-item svg { width: 0.875rem; height: 0.875rem; opacity: 0.7; }
.dropdown-separator { height: 1px; background: hsl(var(--border)); margin: 0.25rem 0; }
.dropdown-item-danger { color: hsl(var(--destructive)); }
.dropdown-item-danger:hover { background: hsl(var(--destructive) / 0.1); }

/* ============================================
   TABS — shadcn tabs
   ============================================ */
.tabs {
  display: inline-flex;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0;
  margin-bottom: 1rem;
}
.tab-item {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s;
  background: none; border: none;
}
.tab-item:hover { color: hsl(var(--foreground)); }
.tab-item.active {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ============================================
   ACTIVITY & COMMENTS
   ============================================ */
.activity-item { display: flex; gap: 0.625rem; padding: 0.5rem 0; font-size: 0.8125rem; }
.activity-content { flex: 1; color: hsl(var(--muted-foreground)); }
.activity-time { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }
.activity-user { font-weight: 500; color: hsl(var(--foreground)); }

.comment { display: flex; gap: 0.625rem; padding: 0.75rem 0; border-bottom: 1px solid hsl(var(--border)); }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.comment-name { font-size: 0.875rem; font-weight: 600; }
.comment-time { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.comment-text { font-size: 0.875rem; color: hsl(var(--muted-foreground)); line-height: 1.7; }
.comment-delivery { background: hsl(var(--primary) / 0.1); border: 1px solid hsl(var(--primary) / 0.2); border-radius: var(--radius); padding: 0.5rem 0.75rem; }

/* ============================================
   STATS — dashboard cards
   ============================================ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { padding: 1.25rem; }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: 0.375rem; letter-spacing: -0.03em; }
.stat-label { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); font-weight: 500; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 3rem 1.5rem; text-align: center; }
.empty-icon {
  width: 3rem; height: 3rem; border-radius: 9999px;
  background: hsl(var(--muted));
  display: flex; align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground));
  margin-bottom: 1rem;
}
.empty-icon svg { width: 1.25rem; height: 1.25rem; }
.empty-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; }
.empty-desc { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); max-width: 20rem; margin-bottom: 1.25rem; }

/* ============================================
   PROGRESS — shadcn progress
   ============================================ */
.progress-bar { width: 100%; height: 0.5rem; background: hsl(var(--secondary)); border-radius: 9999px; overflow: hidden; }
.progress-fill { height: 100%; background: hsl(var(--primary)); border-radius: 9999px; transition: width 0.3s ease; }

/* ============================================
   CALENDAR VIEW
   ============================================ */

/* Toolbar */
.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.cal-month-label {
  font-size: 1.125rem;
  font-weight: 700;
  min-width: 10rem;
  text-align: center;
  letter-spacing: -0.02em;
}

/* Month Grid */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
}
.cal-header-cell {
  padding: 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
  text-align: center;
  background: hsl(var(--muted) / 0.3);
  border-bottom: 1px solid hsl(var(--border));
}
.cal-day {
  min-height: 7rem;
  padding: 0.375rem;
  border-right: 1px solid hsl(var(--border) / 0.5);
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card));
  transition: background 0.15s;
  position: relative;
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: hsl(var(--accent) / 0.5); }
.cal-day.cal-day-empty {
  background: hsl(var(--muted) / 0.15);
}
.cal-day.cal-day-today {
  background: hsl(var(--primary) / 0.06);
}
.cal-day.cal-day-today .cal-day-number {
  background: hsl(var(--primary));
  color: white;
  border-radius: 9999px;
  width: 1.625rem;
  height: 1.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day.cal-day-has-overdue {
  background: hsl(var(--destructive) / 0.04);
}

.cal-day-number {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.25rem;
  padding: 0.125rem 0.25rem;
}
.cal-day-empty .cal-day-number {
  color: hsl(var(--muted-foreground) / 0.3);
}

/* Event chips on month view */
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.cal-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: opacity 0.15s;
  text-decoration: none;
  color: inherit;
}
.cal-chip:hover { opacity: 0.8; text-decoration: none; }
.cal-chip-urgent  { background: hsl(0 84% 60% / 0.15); color: hsl(0 84% 60%); border-left: 2px solid hsl(0 84% 60%); }
.cal-chip-high    { background: hsl(25 95% 53% / 0.15); color: hsl(25 95% 53%); border-left: 2px solid hsl(25 95% 53%); }
.cal-chip-normal  { background: hsl(217 91% 60% / 0.15); color: hsl(217 91% 60%); border-left: 2px solid hsl(217 91% 60%); }
.cal-chip-low     { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); border-left: 2px solid hsl(var(--muted-foreground) / 0.3); }
.cal-chip-done    { opacity: 0.5; text-decoration: line-through; }

.cal-chip-number {
  font-family: monospace;
  font-size: 0.625rem;
  opacity: 0.7;
}

.cal-more {
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--primary));
  padding: 0.125rem 0.375rem;
  cursor: pointer;
}
.cal-more:hover { text-decoration: underline; }

/* Week View */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.625rem;
  min-height: calc(100vh - var(--topbar-height) - 10rem);
}
.cal-week-day {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 20rem;
}
.cal-week-day.cal-day-today {
  border-color: hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.04);
}
.cal-week-day-header {
  text-align: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.cal-week-day-name {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground));
}
.cal-week-day-number {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cal-day-today .cal-week-day-number { color: hsl(var(--primary)); }

/* Week view cards */
.cal-week-events {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}
.cal-week-card {
  padding: 0.625rem;
  border-radius: calc(var(--radius) - 1px);
  background: hsl(var(--muted) / 0.4);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.cal-week-card:hover { background: hsl(var(--accent)); text-decoration: none; }
.cal-week-card-urgent  { border-left-color: hsl(0 84% 60%); }
.cal-week-card-high    { border-left-color: hsl(25 95% 53%); }
.cal-week-card-normal  { border-left-color: hsl(217 91% 60%); }
.cal-week-card-low     { border-left-color: hsl(var(--muted-foreground) / 0.3); }

.cal-week-card-number {
  font-size: 0.6875rem;
  font-family: monospace;
  color: hsl(var(--muted-foreground));
  margin-bottom: 0.125rem;
}
.cal-week-card-title {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.375rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cal-week-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  color: hsl(var(--muted-foreground));
}

/* No-date demands */
.cal-no-date {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--muted) / 0.2);
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.cal-no-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-right: 0.5rem;
}
.cal-no-date-label svg { width: 0.875rem; height: 0.875rem; }

/* Hover popover preview */
.cal-popover {
  position: absolute;
  z-index: 50;
  width: 16rem;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  padding: 0.75rem;
  animation: dropdownIn 0.1s ease;
}
.cal-popover-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.375rem; }
.cal-popover-meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.cal-popover-meta-row { display: flex; align-items: center; gap: 0.375rem; }
.cal-popover-meta-row svg { width: 0.75rem; height: 0.75rem; }

/* Responsive */
@media (max-width: 768px) {
  .cal-week-grid { grid-template-columns: 1fr; gap: 0.5rem; }
  .cal-week-day { min-height: auto; }
  .cal-day { min-height: 4rem; }
  .cal-month-label { min-width: auto; font-size: 1rem; }
}

/* ============================================
   SEPARATOR — shadcn separator
   ============================================ */
hr, .separator { border: none; border-top: 1px solid hsl(var(--border)); margin: 1.25rem 0; }

/* ============================================
   DASHBOARD v2
   ============================================ */

/* Greeting hero */
.dash-hero {
  margin-bottom: 1.5rem;
}
.dash-greeting {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}
.dash-summary {
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dash-date {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground) / 0.7);
  margin-top: 0.25rem;
}

/* 2-column layout */
.dash-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* Stat cards v2 — Linear/Vercel/Raycast inspired */
.stat-card-v2 {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.125rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Gradient border glow — Raycast style, appears on hover */
.stat-card-v2::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.01) 50%, rgba(255,255,255,0.04) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.stat-card-v2:hover::before { opacity: 1; }

/* Top-edge light — Vercel style */
.stat-card-v2::after {
  content: '';
  position: absolute;
  top: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.stat-card-v2:hover::after { opacity: 1; }
.stat-card-v2.stat-default::after { background: linear-gradient(90deg, transparent, hsl(var(--muted-foreground) / 0.3), transparent); }
.stat-card-v2.stat-primary::after { background: linear-gradient(90deg, transparent, hsl(var(--primary) / 0.5), transparent); }
.stat-card-v2.stat-warning::after { background: linear-gradient(90deg, transparent, hsl(38 92% 50% / 0.5), transparent); }
.stat-card-v2.stat-danger::after { background: linear-gradient(90deg, transparent, hsl(0 84% 60% / 0.5), transparent); }

/* Hover: border brighten + subtle glow — no transform (Linear style) */
.stat-card-v2:hover {
  border-color: hsl(var(--muted-foreground) / 0.15);
}
.stat-card-v2.stat-primary:hover { box-shadow: 0 0 40px -12px hsl(var(--primary) / 0.12); }
.stat-card-v2.stat-warning:hover { box-shadow: 0 0 40px -12px hsl(38 92% 50% / 0.12); }
.stat-card-v2.stat-danger:hover { box-shadow: 0 0 40px -12px hsl(0 84% 60% / 0.12); }

.stat-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.stat-icon svg { width: 1.25rem; height: 1.25rem; }
.stat-icon-default { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.stat-icon-primary { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.stat-icon-warning { background: hsl(38 92% 50% / 0.12); color: hsl(38 92% 50%); }
.stat-icon-danger { background: hsl(var(--destructive) / 0.12); color: hsl(0 84% 60%); }
.stat-icon-success { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }

.stat-card-v2 .stat-info { position: relative; z-index: 1; }
.stat-card-v2 .stat-value {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.375rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.stat-card-v2 .stat-label {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

/* Stat with danger pulse */
.stat-danger-pulse {
  border-color: hsl(var(--destructive) / 0.25);
  animation: dangerPulse 3s ease-in-out infinite;
}

/* Urgent demands cards */
.urgent-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.urgent-card:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--muted-foreground) / 0.25);
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-decoration: none;
}
.urgent-card-priority {
  width: 0.1875rem;
  height: 2.25rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.urgent-card-body { flex: 1; min-width: 0; }
.urgent-card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.urgent-card-meta {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

/* Activity timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 2rem;
  bottom: 1rem;
  width: 1px;
  background: hsl(var(--border));
}
.timeline-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.625rem 0;
  font-size: 0.875rem;
  position: relative;
}
.timeline-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: white;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 3px hsl(var(--card));
}
.timeline-body { flex: 1; min-width: 0; padding-top: 0.25rem; }
.timeline-text { color: hsl(var(--muted-foreground)); line-height: 1.5; }
.timeline-text strong { color: hsl(var(--foreground)); font-weight: 600; }
.timeline-time { font-size: 0.75rem; color: hsl(var(--muted-foreground) / 0.6); margin-top: 0.25rem; }
.timeline-demand {
  color: hsl(var(--primary));
  font-weight: 600;
  text-decoration: none;
  font-family: monospace;
  font-size: 0.8125rem;
}
.timeline-demand:hover { text-decoration: underline; }

/* Workload bars */
.workload-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
}
.workload-name {
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 7.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.workload-bar-container {
  flex: 1;
  position: relative;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  height: 1.625rem;
  overflow: hidden;
}
.workload-bar {
  height: 100%;
  border-radius: var(--radius);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  padding-left: 0.625rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  min-width: 1.75rem;
}
.workload-green { background: linear-gradient(90deg, hsl(142 69% 35%), hsl(142 69% 45%)); }
.workload-yellow { background: linear-gradient(90deg, hsl(38 92% 45%), hsl(38 92% 55%)); }
.workload-red { background: linear-gradient(90deg, hsl(0 84% 50%), hsl(0 84% 60%)); }

/* Donut chart */
.donut-container {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.donut-svg { width: 10rem; height: 10rem; flex-shrink: 0; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.15)); }
.donut-legend { display: flex; flex-direction: column; gap: 0.625rem; flex: 1; }
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  transition: background 0.15s;
}
.donut-legend-item:hover { background: hsl(var(--accent)); }
.donut-legend-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; flex-shrink: 0; }
.donut-legend-count { font-weight: 700; margin-left: auto; min-width: 1.5rem; text-align: right; font-variant-numeric: tabular-nums; }

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius);
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.quick-action:hover {
  border-color: rgba(255,255,255,0.12);
  color: hsl(var(--primary));
  text-decoration: none;
  box-shadow: 0 0 30px -10px hsl(var(--primary) / 0.1);
}
.quick-action svg { width: 1.25rem; height: 1.25rem; opacity: 0.5; transition: opacity 0.2s; }
.quick-action:hover svg { opacity: 1; color: hsl(var(--primary)); }

/* Overdue alert bar */
.overdue-alert {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, hsl(var(--destructive) / 0.08), hsl(var(--destructive) / 0.03));
  border: 1px solid hsl(var(--destructive) / 0.2);
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  color: hsl(0 84% 60%);
  position: relative;
  overflow: hidden;
}
.overdue-alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: hsl(0 84% 60%);
}
.dark .overdue-alert { color: hsl(0 84% 70%); }
.overdue-alert svg { width: 1.375rem; height: 1.375rem; flex-shrink: 0; }
.overdue-alert strong { font-weight: 700; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes dialogIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes sheetIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes toastIn { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 hsl(var(--destructive) / 0); }
  50% { box-shadow: 0 0 12px 2px hsl(var(--destructive) / 0.15); }
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: hsl(var(--muted-foreground)); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.hidden { display: none; }
.relative { position: relative; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }

.due-ok { color: hsl(var(--primary)); }
.due-soon { color: hsl(38 92% 50%); }
.due-overdue { color: hsl(var(--destructive)); font-weight: 500; }

[x-cloak] { display: none !important; }

/* ============================================
   AUTH PAGE — login / register
   ============================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--background));
  padding: 1.5rem;
}
.auth-card {
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem;
}
.auth-logo {
  width: 3rem;
  height: 3rem;
  background: hsl(var(--primary));
  border-radius: calc(var(--radius) + 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--primary-foreground));
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.auth-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.02em;
}
.auth-subtitle {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* ============================================
   ALERT — shadcn alert
   ============================================ */
.alert {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-error {
  background: hsl(var(--destructive) / 0.1);
  border: 1px solid hsl(var(--destructive) / 0.2);
  color: hsl(0 84% 60%);
}
.dark .alert-error { color: hsl(0 84% 70%); }
.alert-success {
  background: hsl(var(--primary) / 0.1);
  border: 1px solid hsl(var(--primary) / 0.2);
  color: hsl(var(--primary));
}
.alert-warning {
  background: hsl(38 92% 50% / 0.1);
  border: 1px solid hsl(38 92% 50% / 0.2);
  color: hsl(38 92% 50%);
}

/* ============================================
   FILTER BAR
   ============================================ */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.filter-select {
  width: auto;
  min-width: 9rem;
}

/* ============================================
   SEARCH — shadcn input with icon
   ============================================ */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 20rem;
}
.search-wrapper svg {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.875rem;
  height: 0.875rem;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}
.search-wrapper .input {
  padding-left: 2rem;
}

/* ============================================
   DETAIL PAGE v2 — 2-column layout
   ============================================ */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 18rem;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .detail-layout { grid-template-columns: 1fr; }
}

/* Main content (left) */
.detail-main { min-width: 0; }

.detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  cursor: text;
}
.detail-title-input {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  width: 100%;
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.375rem 0.5rem;
  color: inherit;
  outline: none;
}
.detail-title-input:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.detail-labels { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1.25rem; }

/* Description block */
.detail-desc-block {
  min-height: 6rem;
  margin-bottom: 1.5rem;
}
.detail-description {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: hsl(var(--foreground) / 0.85);
  white-space: pre-wrap;
}
.detail-desc-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  border: 1.5px dashed hsl(var(--border));
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.detail-desc-empty:hover {
  border-color: hsl(var(--muted-foreground) / 0.3);
  background: hsl(var(--accent) / 0.5);
}
.detail-desc-empty svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }

/* Sidebar (right) */
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.detail-sidebar .card { padding: 0; overflow: hidden; }

.detail-prop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  font-size: 0.8125rem;
  min-height: 2.75rem;
}
.detail-prop:last-child { border-bottom: none; }
.detail-prop-label {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 5.5rem;
}
.detail-prop-label svg { width: 0.875rem; height: 0.875rem; }
.detail-prop-value {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: calc(var(--radius) - 2px);
  transition: background 0.15s;
}
.detail-prop-value:hover { background: hsl(var(--accent)); }
.detail-prop-value svg { width: 0.625rem; height: 0.625rem; color: hsl(var(--muted-foreground)); }

.detail-prop-static {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* Media upload zone */
.media-zone {
  border: 1.5px dashed hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.media-zone:hover {
  border-color: hsl(var(--primary) / 0.4);
  background: hsl(var(--primary) / 0.03);
}
.media-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.media-zone-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: hsl(var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.625rem;
  color: hsl(var(--muted-foreground));
}
.media-zone-icon svg { width: 1.25rem; height: 1.25rem; }
.media-zone-text { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.media-zone-hint { font-size: 0.75rem; color: hsl(var(--muted-foreground) / 0.6); margin-top: 0.25rem; }

/* Attachment grid */
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.625rem;
  margin-bottom: 1rem;
}
.attachment-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
  cursor: pointer;
}
.attachment-card:hover { border-color: hsl(var(--muted-foreground) / 0.3); }
.attachment-preview {
  height: 5.5rem;
  background: hsl(var(--muted));
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.attachment-preview svg { width: 1.5rem; height: 1.5rem; }
.attachment-info {
  padding: 0.5rem 0.625rem;
  font-size: 0.75rem;
}
.attachment-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-size { color: hsl(var(--muted-foreground)); margin-top: 0.125rem; }

/* Comment input improved */
.comment-input-box {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
}
.comment-input-box:focus-within {
  border-color: hsl(var(--ring));
}
.comment-input-box .textarea {
  border: none;
  padding: 0;
  min-height: 3rem;
  resize: none;
  background: transparent;
}
.comment-input-box .textarea:focus {
  box-shadow: none;
}
.comment-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid hsl(var(--border) / 0.5);
}

/* Detail meta item */
.detail-meta-item { display: flex; align-items: center; gap: 0.375rem; font-size: 0.8125rem; }
.detail-meta-item svg { width: 0.875rem; height: 0.875rem; color: hsl(var(--muted-foreground)); }

/* ============================================
   BREADCRUMB — shadcn breadcrumb
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
}
.breadcrumb a {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover { color: hsl(var(--foreground)); text-decoration: none; }
.breadcrumb svg { width: 0.875rem; height: 0.875rem; vertical-align: middle; }
.breadcrumb-separator { color: hsl(var(--muted-foreground)); }
.breadcrumb-current { font-weight: 500; color: hsl(var(--muted-foreground)); font-family: monospace; }

/* ============================================
   SIDEBAR USER
   ============================================ */
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8125rem; font-weight: 500; }
.sidebar-user-role { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }

/* ============================================
   PROJECT DOT
   ============================================ */
.project-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
  display: inline-block;
}

/* ============================================
   CARD SECTIONS
   ============================================ */
.card-padded { padding: 1.5rem; }
.card-section { padding: 1.5rem; margin-bottom: 1rem; }
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title svg { flex-shrink: 0; }

/* ============================================
   ATTACHMENT ITEM
   ============================================ */
.attachment-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--muted));
  border-radius: var(--radius);
}
.attachment-item a { flex: 1; font-size: 0.8125rem; }
.attachment-size { font-size: 0.6875rem; color: hsl(var(--muted-foreground)); }

/* ============================================
   DELIVERY BADGE
   ============================================ */
.badge-delivery {
  display: inline-flex;
  align-items: center;
  padding: 0.0625rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 9999px;
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}

/* ============================================
   CLICKABLE ROWS
   ============================================ */
.data-table tr.clickable-row { cursor: pointer; transition: background 0.1s; }
.data-table tr.clickable-row:hover td { background: hsl(var(--accent)); }
.data-table tr.clickable-row:focus-visible { outline: 2px solid hsl(var(--ring)); outline-offset: -2px; }

/* ============================================
   KANBAN STATUS DOT
   ============================================ */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.status-dot-backlog { background: hsl(var(--muted-foreground)); }
.status-dot-todo { background: hsl(217 91% 60%); }
.status-dot-in_progress { background: hsl(38 92% 50%); }
.status-dot-in_review { background: hsl(263 70% 50%); }
.status-dot-done { background: hsl(var(--primary)); }
.status-dot-cancelled { background: hsl(var(--destructive)); }

/* ============================================
   KEYBOARD SHORTCUT HINT
   ============================================ */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.25rem;
  min-width: 1.25rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
  font-family: inherit;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kanban-column { min-width: 16rem; }
  .page-content { padding: 1rem; }
  .sheet-content { width: 100vw; }
  .modal-content { margin: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 1rem; }
  .toast { width: calc(100vw - 2rem); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
