/* ============================================
   Task Manager — Component Library
   Standalone styles for reusable UI components.
   Depends on core_tokens.css + tokens.css for design tokens.
   ============================================ */

/* --- Lucide Icon Defaults --- */

.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Button icon */
.btn-icon .lucide,
.btn .lucide {
  width: 15px;
  height: 15px;
}

/* Dropdown item icon */
.dropdown-item-icon .lucide {
  width: 15px;
  height: 15px;
}

/* Tab icon */
.tab-icon .lucide {
  width: 14px;
  height: 14px;
}

/* Alert icon */
.alert-icon .lucide {
  width: 18px;
  height: 18px;
}

/* Kanban card meta icon */
.meta-icon .lucide {
  width: 12px;
  height: 12px;
}

/* Table empty state icon */
.table-empty-icon .lucide {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

/* --- 1. Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font: var(--text-body-2r);
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}

.btn-xs { padding: 2px 8px; font: var(--text-micro-1); font-weight: 600; font-family: inherit; }
.btn-sm { padding: 4px 12px; font: var(--text-label-1); font-weight: 600; font-family: inherit; }
.btn-lg { padding: 10px 20px; font: var(--text-body-1r); font-weight: 600; font-family: inherit; }

/* Primary — accent filled */
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.btn-primary:hover { opacity: .85; }

/* Secondary — outlined */
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--surface-border);
}
.btn-secondary:hover { background: var(--accent-low); }

/* Ghost — no border */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

/* Danger — destructive actions */
.btn-danger {
  background: var(--brand-red);
  color: var(--text-on-color);
  border-color: var(--brand-red);
}
.btn-danger:hover { opacity: .85; }

/* Disabled */
.btn:disabled,
.btn.disabled {
  background: var(--disabled);
  color: var(--text-disabled);
  border-color: transparent;
  cursor: not-allowed;
  opacity: .6;
}

/* --- 2. Badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font: var(--text-micro-1);
  font-weight: 600;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* Light — subtle background */
.badge-success  { background: var(--surface-success); color: var(--text-success); }
.badge-warning  { background: var(--surface-caution); color: var(--text-caution); }
.badge-error    { background: var(--surface-error);   color: var(--text-error); }
.badge-info     { background: var(--surface-info);    color: var(--text-info); }
.badge-neutral  { background: var(--surface-emphasis); color: var(--text-secondary); }
.badge-accent   { background: var(--accent-low);      color: var(--accent-bold); }

/* Fill — solid background */
.badge-success-fill { background: var(--brand-green);    color: var(--text-on-color); }
.badge-warning-fill { background: var(--text-caution);   color: var(--text-on-color); }
.badge-error-fill   { background: var(--brand-red);      color: var(--text-on-color); }
.badge-info-fill    { background: var(--text-info);      color: var(--text-on-color); }
.badge-neutral-fill { background: var(--text-secondary); color: var(--text-on-color); }
.badge-accent-fill  { background: var(--accent);         color: var(--accent-text); }

/* --- 3. Form Inputs --- */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font: var(--text-label-1);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-hint {
  font: var(--text-micro-1);
  color: var(--text-tertiary);
}
.form-hint.error {
  color: var(--text-error);
}

.form-input,
.form-select,
.form-textarea {
  padding: 8px 12px;
  font: var(--text-body-2r);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-low);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

/* Error state */
.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: var(--text-error);
  box-shadow: 0 0 0 2px var(--surface-error);
}

.form-error {
  font: var(--text-label-1);
  color: var(--text-error);
  margin-top: 4px;
}

/* Disabled state */
.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background: var(--surface-emphasis);
  color: var(--text-disabled);
  cursor: not-allowed;
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-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 24 24' fill='none' stroke='%23949494' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

/* Checkbox */
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--text-body-2r);
  color: var(--text-primary);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  appearance: none;
  background: var(--surface);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent-bold);
}

/* Radio */
.form-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--text-body-2r);
  color: var(--text-primary);
  cursor: pointer;
}

.form-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-full);
  appearance: none;
  background: var(--surface);
  cursor: pointer;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}

.form-radio input[type="radio"]:checked {
  border-color: var(--accent-bold);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

/* Toggle / Switch */
.form-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: var(--text-body-2r);
  color: var(--text-primary);
  cursor: pointer;
}

.form-toggle input[type="checkbox"] {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  appearance: none;
  background: var(--surface-emphasis);
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
  position: relative;
}

.form-toggle input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: var(--surface);
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.form-toggle input[type="checkbox"]:checked {
  background: var(--accent);
}

.form-toggle input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

/* --- 4. Banner --- */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  font: var(--text-body-2r);
  border-radius: var(--radius);
}

.banner-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.banner-body {
  flex: 1;
  min-width: 0;
}

.banner-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.banner-msg {
  font: var(--text-label-1);
  opacity: .85;
}

.banner-success {
  background: var(--surface-success);
  color: var(--text-success);
}

.banner-warning {
  background: var(--surface-caution);
  color: var(--text-caution);
}

.banner-error {
  background: var(--surface-error);
  color: var(--text-error);
}

.banner-info {
  background: var(--surface-info);
  color: var(--text-info);
}

/* --- 5. Avatars --- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--surface-emphasis);
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-xs  { width: 20px; height: 20px; font-size: 11px; }
.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 18px; }

.avatar-accent {
  background: var(--accent-low);
  color: var(--text-primary);
}

/* Filled — solid accent bg + contrast text */
.avatar-fill {
  background: var(--accent);
  color: var(--accent-text);
}

/* Photo */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Icon */
.avatar svg {
  width: 50%;
  height: 50%;
}

/* Square rounded variant */
.avatar-square {
  border-radius: var(--radius);
}

/* --- 6. Tables --- */

.table-wrap {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font: var(--text-table-2r);
}

/* Header */
.table thead th {
  padding: 6px 6px;
  font: var(--text-micro-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-tertiary);
  background: var(--surface-emphasis);
  border-bottom: 1px solid var(--surface-border);
  text-align: left;
  white-space: nowrap;
}

/* Sortable header */
.table thead th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}

.table thead th.sortable:hover {
  color: var(--text-primary);
}

.table thead th.sortable .sort-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  color: var(--text-placeholder);
  margin-left: 2px;
  transition: color .15s;
}

.table thead th.sortable:hover .sort-icon {
  color: var(--text-tertiary);
}

.table thead th.sortable.sort-active .sort-icon {
  color: var(--accent-bold);
}

/* Body cells */
.table tbody td {
  padding: 8px 6px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--surface-border);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Row hover */
.table tbody tr:hover td {
  background: var(--surface-emphasis-low);
}

/* Selected row */
.table tbody tr.selected td {
  background: var(--accent-low);
}

/* Compact variant */
.table-compact thead th {
  padding: 6px 10px;
  font: var(--text-micro-1);
  font-weight: 600;
}

.table-compact tbody td {
  padding: 6px 10px;
  font: var(--text-table-3r);
}

/* Cell alignment */
.table .cell-right   { text-align: right; }
.table .cell-center  { text-align: center; }

/* Cell widths */
.table .cell-check   { width: 36px; text-align: center; }
.table .cell-action  { width: 48px; text-align: center; }
.table .cell-narrow  { width: 80px; }
.table .cell-date    { width: 100px; white-space: nowrap; }

/* Secondary text in cells */
.table .cell-sub {
  font: var(--text-micro-1);
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Inline flex cell (avatar + name, icon + text) */
.table .cell-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Meta cell (timestamps, muted text) */
.table .cell-meta {
  white-space: nowrap;
  color: var(--text-tertiary);
}

.table .cell-desc {
  color: var(--text-secondary);
}

/* Empty state (table alias → uses generic .empty-state) */
.table-empty,
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
}

.table-empty-icon,
.empty-state-icon {
  margin-bottom: 8px;
  opacity: .5;
  line-height: 1;
}

.table-empty-icon .lucide,
.empty-state-icon .lucide {
  width: 32px;
  height: 32px;
  stroke-width: 1.5;
}

.table-empty-title,
.empty-state-title {
  font: var(--text-body-1r);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.table-empty-msg,
.empty-state-msg {
  font: var(--text-label-1);
}

/* Table footer / pagination area */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font: var(--text-table-3r);
  color: var(--text-tertiary);
  border-top: 1px solid var(--surface-border);
  background: var(--surface-emphasis-low);
}

.table-footer-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-footer-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font: var(--text-table-3r);
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background .15s, color .15s;
  border: none;
  background: none;
}

.table-footer-page:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.table-footer-page.active {
  background: var(--accent);
  color: var(--text-primary);
  font-weight: 600;
}

/* --- 7. Modal / Dialog --- */

/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, visibility .2s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Modal container */
.modal {
  background: var(--modal);
  border: 1px solid var(--modal-border);
  border-radius: var(--radius);
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .12);
  transform: translateY(8px) scale(.98);
  transition: transform .2s;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

/* Size variants */
.modal-sm { max-width: 400px; }
.modal-md { max-width: 540px; }
.modal-lg { max-width: 720px; }

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  flex-shrink: 0;
}

.modal-title {
  font: var(--text-heading-2);
}

.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 16px;
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  transition: background .15s, color .15s;
}

.modal-close:hover {
  background: var(--modal-emphasis);
  color: var(--text-primary);
}

/* Body */
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  font: var(--text-paragraph-3);
  color: var(--text-secondary);
}

/* Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  flex-shrink: 0;
}
.modal-footer .btn           { min-width: 100px; }
.modal-footer .btn-secondary { border-color: var(--modal-border); }

/* For showcase — inline demo (not fixed position) */
.modal-demo {
  position: relative;
  background: var(--artboard);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-demo .modal-overlay {
  position: absolute;
  border-radius: var(--radius);
}

/* --- 8. Tabs --- */

.tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--surface-border);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font: var(--text-body-2r);
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  position: relative;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--surface-emphasis-low);
}

.tab.active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Tab icon */
.tab-icon {
  font-size: 14px;
}

/* Tab count badge */
.tab-count {
  font: var(--text-micro-1);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius);
  background: var(--surface-emphasis);
  color: var(--text-tertiary);
}

.tab.active .tab-count {
  background: var(--accent-low);
  color: var(--accent-bold);
}

/* Pill variant */
.tabs-pill {
  border-bottom: none;
  gap: 4px;
  background: var(--surface-emphasis-low);
  padding: 4px;
  border-radius: var(--radius-md);
  display: inline-flex;
}

.tabs-pill .tab {
  padding: 6px 14px;
  border-radius: var(--radius);
  font: var(--text-label-1);
  font-weight: 500;
}

.tabs-pill .tab:hover {
  background: var(--accent-low);
}

.tabs-pill .tab.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
  border: 1px solid var(--surface-border);
}

.tabs-pill .tab.active::after {
  display: none;
}

/* Tab panel */
.tab-panel {
  display: none;
  padding: 16px 0;
}

.tab-panel.active {
  display: block;
}

/* --- 9. Filter Chips --- */

.filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  font: var(--text-label-1);
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}

.filter-chip:hover {
  color: var(--text-primary);
  background: var(--surface-emphasis-low);
}

.filter-chip.active {
  color: var(--accent-bold);
  border-color: var(--accent);
}

/* --- (Legacy) Kanban Card --- */

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-col {
  min-width: 260px;
  max-width: 300px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

.kanban-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font: var(--text-label-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-secondary);
}

.kanban-col-count {
  font: var(--text-micro-1);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius);
  background: var(--surface-emphasis);
  color: var(--text-tertiary);
}

.kanban-col-add {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  transition: background .15s, color .15s;
}

.kanban-col-add:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.kanban-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 60px;
}

/* Card */
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: grab;
  transition: box-shadow .15s, border-color .15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.kanban-card-title {
  font: var(--text-body-2r);
  font-weight: 500;
  color: var(--text-primary);
}

.kanban-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kanban-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font: var(--text-micro-1);
  color: var(--text-tertiary);
}

.kanban-card-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* --- 10. Tooltip --- */


/* Tooltip container — any element with [data-tooltip] */
[data-tooltip] {
  position: relative;
  cursor: default;
}

/* Shared bubble */
[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 500;
  padding: 5px 10px;
  font: var(--text-micro-1);
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-on-color);
  background: var(--text-primary);
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}

/* Shared arrow */
[data-tooltip]::after {
  content: '';
  position: absolute;
  z-index: 500;
  border: 5px solid transparent;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s, transform .15s;
}

/* Default = top */
[data-tooltip]::before,
[data-tooltip][data-tip-pos="top"]::before {
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
}

[data-tooltip]::after,
[data-tooltip][data-tip-pos="top"]::after {
  bottom: calc(100% + -2px);
  left: 50%;
  transform: translateX(-50%);
  border-top-color: var(--text-primary);
}

/* Bottom */
[data-tooltip][data-tip-pos="bottom"]::before {
  top: calc(100% + 8px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip][data-tip-pos="bottom"]::after {
  top: calc(100% + -2px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: transparent;
  border-bottom-color: var(--text-primary);
}

/* Left */
[data-tooltip][data-tip-pos="left"]::before {
  right: calc(100% + 8px);
  bottom: auto;
  left: auto;
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}

[data-tooltip][data-tip-pos="left"]::after {
  right: calc(100% + -2px);
  bottom: auto;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-left-color: var(--text-primary);
}

/* Right */
[data-tooltip][data-tip-pos="right"]::before {
  left: calc(100% + 8px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

[data-tooltip][data-tip-pos="right"]::after {
  left: calc(100% + -2px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
  border-top-color: transparent;
  border-right-color: var(--text-primary);
}

/* Show on hover */
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* Position-specific hover transforms */
[data-tooltip][data-tip-pos="bottom"]:hover::before {
  transform: translateX(-50%) translateY(0);
}

[data-tooltip][data-tip-pos="left"]:hover::before {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip][data-tip-pos="right"]:hover::before {
  transform: translateY(-50%) translateX(0);
}

/* --- 11. Dropdown Menu --- */


.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 400;
  min-width: 180px;
  background: var(--popover);
  border: 1px solid var(--popover-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, visibility .15s, transform .15s;
}

.dropdown.open .dropdown-menu,
.dropdown-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Right-aligned */
.dropdown-menu-right {
  left: auto;
  right: 0;
}

/* Menu item */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font: var(--text-body-2r);
  font-family: inherit;
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .1s, color .1s;
  text-align: left;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: var(--accent-low);
}

.dropdown-item.active {
  background: var(--accent-low);
  color: var(--accent-bold);
}

/* Danger item */
.dropdown-item-danger {
  color: var(--text-error);
}

.dropdown-item-danger:hover {
  background: var(--surface-error);
}

/* Disabled */
.dropdown-item:disabled,
.dropdown-item.disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

.dropdown-item:disabled:hover,
.dropdown-item.disabled:hover {
  background: none;
}

/* Icon */
.dropdown-item-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Shortcut hint */
.dropdown-item-shortcut {
  font: var(--text-micro-1);
  color: var(--text-tertiary);
  margin-left: auto;
  padding-left: 16px;
}

/* Divider */
.dropdown-divider {
  height: 1px;
  background: var(--popover-border);
  margin: 4px 0;
}

/* Section header */
.dropdown-header {
  padding: 6px 10px 4px;
  font: var(--text-micro-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-tertiary);
}

/* For showcase — show menu inline without absolute positioning */
.dropdown-demo .dropdown-menu {
  position: static;
  opacity: 1;
  visibility: visible;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}


/* --- 12. Empty State --- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Size variants */
.empty-state-sm {
  padding: 24px 16px;
}

.empty-state-sm .empty-state-icon .lucide {
  width: 24px;
  height: 24px;
}

.empty-state-sm .empty-state-title {
  font: var(--text-body-2r);
  font-weight: 600;
}

.empty-state-sm .empty-state-msg {
  font: var(--text-micro-1);
}

.empty-state-lg {
  padding: 60px 24px;
}

.empty-state-lg .empty-state-icon .lucide {
  width: 48px;
  height: 48px;
  stroke-width: 1.2;
}

.empty-state-lg .empty-state-title {
  font: var(--text-heading-1);
  font-weight: 600;
}

.empty-state-lg .empty-state-msg {
  font: var(--text-body-2r);
}

/* --- 13. Datepicker --- */

/* Shared calendar */
.datepicker-calendar {
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 12px;
  user-select: none;
}

.datepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.datepicker-header-title {
  font: var(--text-body-2r);
  font-weight: 600;
  color: var(--text-primary);
}

.datepicker-nav {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .15s, color .15s;
}

.datepicker-nav:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.datepicker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.datepicker-weekday {
  font: var(--text-micro-1);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 4px 0;
}

.datepicker-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.datepicker-day {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font: var(--text-label-1);
  font-weight: 500;
  font-family: inherit;
  color: var(--text-primary);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .1s, color .1s;
}

.datepicker-day:hover {
  background: var(--accent-low);
}

.datepicker-day.today {
  background: var(--accent-low);
  color: var(--accent-bold);
  font-weight: 600;
}

.datepicker-day.selected {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

.datepicker-day.selected:hover {
  opacity: .85;
}

.datepicker-day.outside {
  color: var(--text-disabled);
}

.datepicker-day.outside:hover {
  background: var(--surface-emphasis-low);
}

.datepicker-day:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

.datepicker-day:disabled:hover {
  background: none;
}

/* Inline variant — no shadow */
.datepicker-inline .datepicker-calendar {
  box-shadow: none;
}

/* Dropdown variant */
.datepicker {
  position: relative;
  display: inline-flex;
}

.datepicker-input {
  padding: 8px 12px;
  padding-right: 36px;
  font: var(--text-body-2r);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  min-width: 160px;
}

.datepicker-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-low);
}

.datepicker-input-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  line-height: 1;
}

.datepicker-input-icon .lucide {
  width: 15px;
  height: 15px;
}

.datepicker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 400;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .15s, visibility .15s, transform .15s;
}

.datepicker-dropdown .datepicker-calendar {
  box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
}

.datepicker.open .datepicker-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Today button */
.datepicker-today {
  width: 100%;
  padding: 6px;
  margin-top: 8px;
  font: var(--text-micro-1);
  font-weight: 600;
  font-family: inherit;
  color: var(--accent-bold);
  background: none;
  border: none;
  border-top: 1px solid var(--surface-border);
  cursor: pointer;
  transition: color .15s;
  text-align: center;
  padding-top: 10px;
}

.datepicker-today:hover {
  color: var(--text-primary);
}

/* For showcase — inline demo */
.datepicker-demo .datepicker-dropdown {
  position: static;
  opacity: 1;
  visibility: visible;
  transform: none;
}


/* --- 14. Stepper Nav --- */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stepper-nav {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .15s, color .15s;
}

.stepper-nav:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.stepper-nav:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: .5;
}

.stepper-nav:disabled:hover {
  background: none;
}

.stepper-nav .lucide {
  width: 16px;
  height: 16px;
}

.stepper-label {
  font: var(--text-body-2r);
  font-weight: 600;
  color: var(--text-primary);
  min-width: 120px;
  text-align: center;
  user-select: none;
}

/* Size: small */
.stepper-sm .stepper-nav {
  width: 24px;
  height: 24px;
}

.stepper-sm .stepper-nav .lucide {
  width: 14px;
  height: 14px;
}

.stepper-sm .stepper-label {
  font: var(--text-label-1);
  font-weight: 600;
  min-width: 100px;
}

/* Size: large */
.stepper-lg .stepper-nav {
  width: 36px;
  height: 36px;
}

.stepper-lg .stepper-nav .lucide {
  width: 20px;
  height: 20px;
}

.stepper-lg .stepper-label {
  font: var(--text-paragraph-1);
  font-weight: 600;
  min-width: 150px;
}

/* Bordered variant */
.stepper-bordered {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 4px 8px;
  background: var(--surface);
}

/* Pill variant */
.stepper-pill {
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 4px 12px;
  background: var(--surface);
}


/* --- 15. Item List --- */

.item-list {
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

/* Row — two sections: left (flex:1) + right (flex-shrink) */
.item-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-border);
  transition: background .1s;
}

.item-list-row:last-child {
  border-bottom: none;
}

.item-list-row:hover {
  background: var(--surface-emphasis-low);
}

.item-list-row.selected {
  background: var(--accent-low);
}

/* Left section — icon + body, takes remaining space */
.item-list-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* Right section — meta, badges, action */
.item-list-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Icon */
.item-list-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--surface-emphasis);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.item-list-icon .lucide {
  width: 16px;
  height: 16px;
}

.item-list-icon-accent {
  background: var(--accent-low);
  color: var(--accent-bold);
}

/* Body */
.item-list-body {
  flex: 1;
  min-width: 0;
}

.item-list-title {
  font: var(--text-body-1r);
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-list-sub {
  font: var(--text-micro-1);
  color: var(--text-tertiary);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Meta */
.item-list-meta {
  font: var(--text-label-1);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Action — reveal on hover */
.item-list-action {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-tertiary);
  cursor: pointer;
  border: none;
  background: none;
  transition: background .15s, color .15s;
  opacity: 0;
}

.item-list-row:hover .item-list-action,
.item-list-action:focus {
  opacity: 1;
}

.item-list-action:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.item-list-action .lucide {
  width: 14px;
  height: 14px;
}

/* Compact variant */
.item-list-compact .item-list-row {
  padding: 6px 10px;
  gap: 10px;
}

.item-list-compact .item-list-icon {
  width: 24px;
  height: 24px;
}

.item-list-compact .item-list-icon .lucide {
  width: 13px;
  height: 13px;
}

.item-list-compact .item-list-title {
  font: var(--text-label-1);
  font-weight: 500;
}

.item-list-compact .item-list-sub {
  font: var(--text-micro-1);
}

.item-list-compact .item-list-meta {
  font: var(--text-micro-1);
}


/* --- 16. Segmented Control --- */

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.segmented-btn {
  padding: 4px 14px;
  font: var(--text-label-1);
  font-family: inherit;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.segmented-btn:hover {
  color: var(--text-primary);
}

.segmented-btn.active {
  color: var(--text-primary);
  background: var(--surface-emphasis);
  font-weight: 700;
}


/* --- 17. Task Status Chip --- */

.task-status-chip {
  font: var(--text-label-1);
  font-family: inherit;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 1px 8px;
  cursor: pointer;
  transition: opacity .15s;
}

.task-status-chip-lg {
  font: var(--text-body-1r);
  padding: 2px 10px;
}

.task-status-chip:hover { opacity: .8; }
.task-status-chip:disabled { cursor: not-allowed; opacity: .6; }

.task-status-chip[data-status="backlog"] {
  color: var(--text-secondary);
  background: var(--surface-emphasis);
  border-color: transparent;
}

.task-status-chip[data-status="design"] {
  color: var(--text-primary);
  background: var(--surface-info);
  border-color: transparent;
}

.task-status-chip[data-status="development"] {
  color: var(--text-primary);
  background: var(--surface-caution);
  border-color: transparent;
}

.task-status-chip[data-status="release"] {
  color: var(--text-primary);
  background: var(--surface-success);
  border-color: transparent;
}

.task-status-chip[data-status="freeze"] {
  color: var(--text-secondary);
  background: var(--surface-emphasis);
  border-color: var(--surface-border);
}

.task-status-chip[data-status="inactive"] {
  color: var(--text-placeholder);
  background: var(--surface-emphasis-low);
  border-color: transparent;
  font-style: italic;
}

.task-status-chip[data-status="todo"] {
  color: var(--text-primary);
  background: var(--surface-special);
  border-color: transparent;
}

.task-status-chip[data-status="todo-idle"] {
  color: var(--text-secondary);
  background: var(--surface-emphasis-low);
  border-color: transparent;
}


/* --- 18. Stat Counters --- */

.stat-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stat-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: outline .15s, opacity .15s;
}

.stat-counter-icon {
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

.stat-counter-label {
  font: var(--text-label-1);
  color: var(--text-tertiary);
  flex: 1;
}

.stat-counter-value {
  font: var(--text-body-1b);
  color: var(--text-primary);
  flex-shrink: 0;
}

/* Semantic backgrounds */
.stat-counter-design     { background: var(--surface-info); }
.stat-counter-dev        { background: var(--surface-caution); }
.stat-counter-backlog    { background: var(--surface-emphasis); }
.stat-counter-release    { background: var(--surface-success); }
.stat-counter-neutral    { background: var(--surface-emphasis-low); }

/* Active filter state */
.stat-counter-active {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.stat-counters:has(.stat-counter-active) .stat-counter:not(.stat-counter-active) {
  opacity: .5;
}


/* --- 19. Floating Tooltip --- */

.floating-tip {
  position: fixed;
  z-index: 9999;
  padding: 4px 10px;
  font: var(--text-label-1);
  font-weight: 500;
  color: var(--text-on-color);
  background: var(--text-primary);
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  transition: opacity .15s;
}


/* --- 20. Link Capsule --- */

.link-capsule {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-lg);
  background: var(--surface-emphasis-low);
  border: 1px solid var(--surface-border);
  font: var(--text-label-1);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.link-capsule:hover {
  background: var(--accent-low);
  color: var(--text-primary);
}

.link-capsule-emoji {
  font-size: 12px;
  line-height: 1;
}

.link-capsule-label {
  font-weight: 700;
}


/* --- 21. Todo Item --- */

.todo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
}

.todo-action {
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.todo-text {
  flex: 1;
  font: var(--text-body-1r);
  color: var(--text-primary);
  transition: color .15s;
}

.todo-item.done .todo-text {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.todo-owner {
  font: var(--text-label-1);
  color: var(--text-placeholder);
  display: inline-block;
  text-decoration: none !important;
}

.todo-delete {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s;
  user-select: none;
}

.todo-item:hover .todo-delete {
  opacity: .5;
}

.todo-delete:hover {
  opacity: 1 !important;
}

.todo-time {
  font: var(--text-label-1);
  color: var(--text-tertiary);
  flex-shrink: 0;
  white-space: nowrap;
}


/* --- Showcase Page Layout --- */

.showcase-page {
  padding: 32px;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.showcase-header {
  margin-bottom: 8px;
}

.showcase-header h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}

.showcase-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.showcase-section {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.showcase-section-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--surface-border);
}

.showcase-section-head h2 {
  font-size: 16px;
  font-weight: 700;
}

.showcase-section-head p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.showcase-row {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.showcase-row + .showcase-row {
  border-top: 1px solid var(--surface-border);
}

.showcase-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.showcase-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.showcase-code-wrap {
  display: flex;
  flex-direction: column;
}

.showcase-code-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.showcase-code-toggle:hover {
  color: var(--text-secondary);
  border-color: var(--text-tertiary);
  background: var(--surface-emphasis);
}

.showcase-code-toggle .toggle-arrow {
  display: inline-block;
  transition: transform .2s;
  font-size: 11px;
}

.showcase-code-wrap.open .showcase-code-toggle .toggle-arrow {
  transform: rotate(90deg);
}

.showcase-code {
  padding: 12px 16px;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--surface-emphasis);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  /* Collapsed by default */
  display: none;
  margin-top: 8px;
}

.showcase-code-wrap.open .showcase-code {
  display: block;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
