/* ==========================================================================
   Agenda PM — application stylesheet (docs/SPEC.md §9.5)
   Single stylesheet. Tokens on :root, dark mode via [data-theme="dark"] and
   prefers-color-scheme. 14px base, 8px spacing scale, system font stack.
   View modules may append their own sections at the end of this file.
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f5f7;
  --bg-elev: #ffffff;
  --bg-muted: #eceef2;
  --fg: #1b1f27;
  --fg-muted: #5b6472;
  --border: #dde1e7;
  --border-strong: #c5cbd4;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-fg: #ffffff;
  --primary-soft: color-mix(in srgb, var(--primary) 12%, transparent);
  --danger: #dc2626;
  --danger-fg: #ffffff;
  --warning: #d97706;
  --success: #16a34a;
  --info: #0284c7;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.18), 0 2px 8px rgba(16, 24, 40, 0.08);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--primary) 35%, transparent);

  --prio-1: #dc2626;
  --prio-2: #f97316;
  --prio-3: #3b82f6;
  --prio-4: #64748b;
  /* readable text variants of the priority colors (darkened for light theme) */
  --prio-1-fg: color-mix(in srgb, var(--prio-1) 85%, black);
  --prio-2-fg: color-mix(in srgb, var(--prio-2) 65%, black);
  --prio-3-fg: color-mix(in srgb, var(--prio-3) 80%, black);
  --prio-4-fg: color-mix(in srgb, var(--prio-4) 85%, black);

  --status-todo: #64748b;
  --status-in_progress: #2563eb;
  --status-waiting: #d97706;
  --status-done: #16a34a;
  --status-cancelled: #9ca3af;
  --status-active: #2563eb;
  --status-on_hold: #d97706;
  --status-completed: #16a34a;
  --status-archived: #9ca3af;
  --status-fg-mix: black;
  --status-fg-amount: 78%;

  --sidebar-w: 236px;
  --sidebar-w-collapsed: 64px;
  --header-h: 56px;
  --tabbar-h: 58px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #111318;
    --bg-elev: #1a1d24;
    --bg-muted: #232833;
    --fg: #e7e9ee;
    --fg-muted: #9ba4b5;
    --border: #2b303b;
    --border-strong: #3a4150;
    --primary: #818cf8;
    --primary-hover: #a5b4fc;
    --primary-fg: #0f1117;
    --danger: #f87171;
    --danger-fg: #0f1117;
    --warning: #fbbf24;
    --success: #4ade80;
    --info: #38bdf8;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
    --prio-1-fg: color-mix(in srgb, var(--prio-1) 70%, white);
    --prio-2-fg: color-mix(in srgb, var(--prio-2) 75%, white);
    --prio-3-fg: color-mix(in srgb, var(--prio-3) 70%, white);
    --prio-4-fg: color-mix(in srgb, var(--prio-4) 55%, white);
    --status-fg-mix: white;
    --status-fg-amount: 65%;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #111318;
  --bg-elev: #1a1d24;
  --bg-muted: #232833;
  --fg: #e7e9ee;
  --fg-muted: #9ba4b5;
  --border: #2b303b;
  --border-strong: #3a4150;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --primary-fg: #0f1117;
  --danger: #f87171;
  --danger-fg: #0f1117;
  --warning: #fbbf24;
  --success: #4ade80;
  --info: #38bdf8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --prio-1-fg: color-mix(in srgb, var(--prio-1) 70%, white);
  --prio-2-fg: color-mix(in srgb, var(--prio-2) 75%, white);
  --prio-3-fg: color-mix(in srgb, var(--prio-3) 70%, white);
  --prio-4-fg: color-mix(in srgb, var(--prio-4) 55%, white);
  --status-fg-mix: white;
  --status-fg-amount: 65%;
  color-scheme: dark;
}

/* ---------- base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-2);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

p {
  margin: 0 0 var(--space-3);
}

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

a:hover {
  text-decoration: underline;
}

code,
kbd {
  font-family: var(--font-mono);
  font-size: 12px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-muted);
  text-align: center;
  line-height: 1.5;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-4) 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

::placeholder {
  color: var(--fg-muted);
  opacity: 0.8;
}

img,
svg {
  vertical-align: middle;
}

svg.icon,
.icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- utilities ---------- */
/* The hidden attribute always wins over utility display rules (.btn, .row, .field, ...). */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--fg-muted);
}

.small {
  font-size: 12px;
}

.mono {
  font-family: var(--font-mono);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.row.between {
  justify-content: space-between;
}

.row.end {
  justify-content: flex-end;
}

.row.nowrap {
  flex-wrap: nowrap;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stack.tight {
  gap: var(--space-2);
}

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

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.mt-2 {
  margin-top: var(--space-2);
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-2 {
  margin-bottom: var(--space-2);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.danger-text {
  color: var(--danger);
}

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

.warning-text {
  color: var(--warning);
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.skip-link:focus {
  top: var(--space-2);
}

/* ---------- layout ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  transition: grid-template-columns 0.15s ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--header-h);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--primary-fg);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.sidebar-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2);
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-muted);
  color: var(--fg);
  text-decoration: none;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-item .nav-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item .nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-item .nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item kbd {
  font-size: 10px;
  opacity: 0.7;
}

.sidebar-footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border);
}

.sidebar-toggle {
  width: 100%;
  justify-content: flex-start;
  color: var(--fg-muted);
}

.sidebar-toggle .nav-label {
  white-space: nowrap;
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-item kbd,
body.sidebar-collapsed .sidebar-toggle .nav-label {
  display: none;
}

body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar-toggle {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--header-h);
  padding: 0 var(--space-4);
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
}

.header-search {
  position: relative;
  flex: 1 1 320px;
  max-width: 460px;
  min-width: 0;
}

.header-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  display: inline-flex;
}

.header-search .search-icon svg {
  width: 16px;
  height: 16px;
}

/* More specific than the later `.input` rule so the icon never overlaps the placeholder. */
.header-search .search-input {
  width: 100%;
  padding-left: 34px;
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.search-group-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.search-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px;
  cursor: pointer;
  color: var(--fg);
}

.search-item[aria-selected='true'],
.search-item:hover {
  background: var(--bg-muted);
}

.search-item .search-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-item .search-item-sub {
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.search-empty {
  padding: var(--space-3);
  color: var(--fg-muted);
}

.quick-add {
  display: flex;
  gap: var(--space-2);
  flex: 1 1 320px;
  max-width: 520px;
  min-width: 0;
}

.quick-add .input {
  flex: 1;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.user-menu-wrap {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
}

.user-menu-btn:hover {
  background: var(--bg-muted);
}

.user-menu {
  right: 0;
  left: auto;
  min-width: 220px;
  top: calc(100% + 6px);
}

.user-menu .menu-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.user-menu .menu-header .name {
  font-weight: 600;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--fg);
  border-radius: 0;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--bg-muted);
  box-shadow: none;
}

.menu-item.danger {
  color: var(--danger);
}

main.view {
  flex: 1 1 auto;
  padding: var(--space-5) var(--space-5) var(--space-6);
  min-width: 0;
}

main.view:focus {
  box-shadow: none;
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.view-header h1 {
  margin: 0;
}

.view-error {
  padding: var(--space-5);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--fg);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  background: var(--bg-muted);
  text-decoration: none;
}

.btn:disabled,
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-fg);
}

.btn-danger:hover {
  filter: brightness(0.95);
  background: var(--danger);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--fg-muted);
}

.btn-ghost:hover {
  background: var(--bg-muted);
  color: var(--fg);
}

.btn-ghost.danger-text:hover {
  color: var(--danger);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: var(--danger);
  background: transparent;
}

.btn-outline-danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.btn-sm {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 13px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

.btn-icon {
  padding: 6px;
  width: 34px;
}

.btn-icon.btn-sm {
  width: 28px;
  padding: 3px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
  margin-left: -1px;
}

.btn-group .btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
  margin-left: 0;
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-group .btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
  position: relative;
  z-index: 1;
}

.btn .spinner {
  width: 14px;
  height: 14px;
}

/* ---------- inputs ---------- */
.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--fg);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--bg-muted);
  opacity: 0.7;
}

.input.is-invalid,
.select.is-invalid,
.textarea.is-invalid {
  border-color: var(--danger);
}

.input.input-sm,
.select.select-sm {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 13px;
}

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

.select {
  appearance: none;
  padding-right: 30px;
  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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.select[multiple] {
  background-image: none;
  padding-right: 10px;
}

input[type='checkbox'],
input[type='radio'] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

input[type='color'] {
  width: 40px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

input[type='date'],
input[type='time'],
input[type='datetime-local'] {
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}

.field .hint {
  font-size: 12px;
  color: var(--fg-muted);
}

.field .field-error {
  font-size: 12px;
  color: var(--danger);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.form-error {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 13px;
}

.form-error:empty {
  display: none;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .select,
.filter-bar .input {
  width: auto;
  min-width: 120px;
}

/* ---------- cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-4);
}

.card.clickable {
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.card.clickable:hover {
  border-color: var(--border-strong);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.card-header h2,
.card-header h3 {
  margin: 0;
}

.card-title {
  font-weight: 600;
}

.tile {
  padding: var(--space-3) var(--space-4);
}

.tile .tile-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.tile .tile-label {
  font-size: 12px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.section {
  margin-bottom: var(--space-5);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.section-title h2,
.section-title h3 {
  margin: 0;
}

.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

/* ---------- chips, badges, avatars ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--fg-muted);
  font-size: 12px;
  line-height: 18px;
  white-space: nowrap;
}

.chip svg {
  width: 12px;
  height: 12px;
}

.chip .chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.chip-category {
  border-color: color-mix(in srgb, var(--chip-color, var(--primary)) 40%, transparent);
  background: color-mix(in srgb, var(--chip-color, var(--primary)) 12%, transparent);
  color: var(--fg);
}

.chip-category .dot {
  background: var(--chip-color, var(--primary));
}

.chip-tag {
  background: color-mix(in srgb, var(--chip-color, var(--fg-muted)) 14%, transparent);
  border-color: color-mix(in srgb, var(--chip-color, var(--fg-muted)) 35%, transparent);
  color: var(--fg);
}

.chip-tag .dot {
  background: var(--chip-color, var(--fg-muted));
}

.chip.overdue {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  font-weight: 600;
}

.chip.blocked {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}

.chip .chip-remove {
  display: inline-flex;
  padding: 0;
  margin: 0 -4px 0 0;
  border: 0;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  border-radius: 50%;
}

.chip .chip-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 16px;
  white-space: nowrap;
  background: var(--bg-muted);
  color: var(--fg-muted);
}

.badge svg {
  width: 11px;
  height: 11px;
}

.badge.prio-1 {
  background: color-mix(in srgb, var(--prio-1) 15%, transparent);
  color: var(--prio-1-fg);
}

.badge.prio-2 {
  background: color-mix(in srgb, var(--prio-2) 16%, transparent);
  color: var(--prio-2-fg);
}

.badge.prio-3 {
  background: color-mix(in srgb, var(--prio-3) 15%, transparent);
  color: var(--prio-3-fg);
}

.badge.prio-4 {
  background: color-mix(in srgb, var(--prio-4) 15%, transparent);
  color: var(--prio-4-fg);
}

.badge.status-todo {
  background: color-mix(in srgb, var(--status-todo) 14%, transparent);
  color: color-mix(in srgb, var(--status-todo) var(--status-fg-amount), var(--status-fg-mix));
}

.badge.status-in_progress,
.badge.status-active {
  background: color-mix(in srgb, var(--status-in_progress) 14%, transparent);
  color: color-mix(in srgb, var(--status-in_progress) var(--status-fg-amount), var(--status-fg-mix));
}

.badge.status-waiting,
.badge.status-on_hold {
  background: color-mix(in srgb, var(--status-waiting) 16%, transparent);
  color: color-mix(in srgb, var(--status-waiting) var(--status-fg-amount), var(--status-fg-mix));
}

.badge.status-done,
.badge.status-completed {
  background: color-mix(in srgb, var(--status-done) 14%, transparent);
  color: color-mix(in srgb, var(--status-done) var(--status-fg-amount), var(--status-fg-mix));
}

.badge.status-cancelled,
.badge.status-archived {
  background: color-mix(in srgb, var(--status-cancelled) 18%, transparent);
  color: color-mix(in srgb, var(--status-cancelled) var(--status-fg-amount), var(--status-fg-mix));
}

.badge.danger {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.badge.warning {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}

.badge.success {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.badge.count {
  border-radius: 999px;
  min-width: 20px;
  justify-content: center;
}

.prio-1 .prio-text,
.text-prio-1 {
  color: var(--prio-1-fg);
}

.text-prio-2 {
  color: var(--prio-2-fg);
}

.text-prio-3 {
  color: var(--prio-3-fg);
}

.text-prio-4 {
  color: var(--prio-4-fg);
}

.prio-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--prio-3);
}

.prio-dot.prio-1 {
  background: var(--prio-1);
}

.prio-dot.prio-2 {
  background: var(--prio-2);
}

.prio-dot.prio-4 {
  background: var(--prio-4);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--avatar-bg, var(--bg-muted));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

.avatar.avatar-sm {
  width: 20px;
  height: 20px;
  font-size: 9px;
}

.avatar.avatar-lg {
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}

.progress > .bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

.progress > .bar.success {
  background: var(--success);
}

.progress > .bar.danger {
  background: var(--danger);
}

/* ---------- task card ---------- */
.task-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 10px 12px 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 4px solid var(--prio-3);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.task-card:hover {
  box-shadow: var(--shadow-lg);
}

.task-card:focus-visible {
  box-shadow: var(--focus-ring);
}

.task-card.prio-1 {
  border-left-color: var(--prio-1);
}

.task-card.prio-2 {
  border-left-color: var(--prio-2);
}

.task-card.prio-3 {
  border-left-color: var(--prio-3);
}

.task-card.prio-4 {
  border-left-color: var(--prio-4);
}

.task-card.is-done .task-card-title,
.task-card.is-cancelled .task-card-title {
  text-decoration: line-through;
  color: var(--fg-muted);
}

.task-card.is-done,
.task-card.is-cancelled {
  opacity: 0.75;
}

.task-card.is-blocked {
  background: color-mix(in srgb, var(--warning) 5%, var(--bg-elev));
}

.task-card.dragging {
  opacity: 0.5;
}

.task-card .task-check {
  display: inline-flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
}

.task-card .task-card-main {
  flex: 1;
  min-width: 0;
}

.task-card .task-card-title {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-weight: 500;
  text-align: left;
  line-height: 1.35;
  word-wrap: break-word;
}

.task-card .task-card-title:hover {
  color: var(--primary);
}

.task-card .task-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 6px;
}

.task-card.compact {
  padding: 6px 10px;
  box-shadow: none;
}

.task-card.compact .task-card-meta {
  margin-top: 2px;
}

.task-card .task-card-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card .task-card-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ---------- dropdown ---------- */
.dropdown {
  position: absolute;
  z-index: 40;
  min-width: 180px;
  padding: 4px 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.dropdown[hidden] {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover,
.dropdown-item[aria-selected='true'],
.dropdown-item.active {
  background: var(--bg-muted);
}

.dropdown-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

/* ---------- table ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  background: var(--bg-muted);
  white-space: nowrap;
}

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

.table tbody tr:hover td {
  background: color-mix(in srgb, var(--bg-muted) 60%, transparent);
}

.table tr.selected td {
  background: var(--primary-soft);
}

.table td.num,
.table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- empty state, loading ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--fg-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-elev) 60%, transparent);
}

.empty-state .empty-icon {
  display: inline-flex;
  padding: 12px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--fg-muted);
}

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

.empty-state .empty-title {
  font-weight: 600;
  color: var(--fg);
}

.empty-state .empty-hint {
  max-width: 420px;
  margin: 0;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  color: var(--fg-muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-elev) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius-sm);
  min-height: 14px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
}

.tab {
  padding: 8px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
}

.tab:hover {
  color: var(--fg);
}

.tab.active,
.tab[aria-selected='true'] {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ---------- modal ---------- */
body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh var(--space-4) var(--space-4);
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(2px);
  animation: fade-in 0.12s ease;
  overflow-y: auto;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: rise 0.14s ease;
}

.modal.modal-sm {
  max-width: 420px;
}

.modal.modal-lg {
  max-width: 760px;
}

.modal.modal-xl {
  max-width: 1040px;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  flex: 1;
  margin: 0;
  font-size: 16px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-body {
  padding: var(--space-4);
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}

.modal-footer .footer-left {
  margin-right: auto;
  display: flex;
  gap: var(--space-2);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ---------- task editor (inside modal) ---------- */
.task-editor {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-5);
}

.task-editor .editor-main,
.task-editor .editor-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.task-editor .editor-side {
  padding: var(--space-3);
  background: var(--bg-muted);
  border-radius: var(--radius);
  align-self: start;
}

.task-editor .title-input {
  font-size: 17px;
  font-weight: 600;
  min-height: 40px;
}

.editor-section {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
}

.editor-section > .section-title h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.editor-section .inline-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

.editor-section .inline-error:empty {
  display: none;
}

.checklist-item,
.dep-item,
.subtask-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}

.checklist-item:hover,
.dep-item:hover,
.subtask-item:hover {
  background: var(--bg-muted);
}

.checklist-item .item-title {
  flex: 1;
  min-width: 0;
}

.checklist-item.done .item-title {
  text-decoration: line-through;
  color: var(--fg-muted);
}

.dep-item .item-title,
.subtask-item .item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dep-item a,
.subtask-item a {
  color: var(--fg);
}

.dep-item a:hover,
.subtask-item a:hover {
  color: var(--primary);
}

.add-inline {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.add-inline .input {
  flex: 1;
}

.search-picker {
  position: relative;
}

.search-picker .dropdown {
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
}

.chip-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  position: relative;
}

.chip-input:focus-within {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

.chip-input input {
  flex: 1;
  min-width: 100px;
  border: 0;
  background: transparent;
  padding: 2px 4px;
}

.chip-input input:focus {
  outline: none;
  box-shadow: none;
}

.comment {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child {
  border-bottom: 0;
}

.comment .comment-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--fg-muted);
}

.comment .comment-head .author {
  font-weight: 600;
  color: var(--fg);
}

.comment .comment-body {
  margin-top: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.activity-list {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 0;
  list-style: none;
  margin: 0;
}

.activity-list li {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.activity-list .who {
  color: var(--fg);
  font-weight: 500;
}

details.collapsible > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 13px;
}

details.collapsible > summary::-webkit-details-marker {
  display: none;
}

details.collapsible > summary .chev {
  display: inline-flex;
  transition: transform 0.15s ease;
}

details.collapsible[open] > summary .chev {
  transform: rotate(180deg);
}

.recurrence-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.recurrence-editor .weekdays {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.recurrence-editor .weekday {
  min-width: 34px;
  padding: 3px 6px;
  font-size: 12px;
}

.recurrence-editor .weekday.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.recurrence-summary {
  font-size: 12px;
  color: var(--fg-muted);
}

.schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.due-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-2);
}

.shortcut-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  align-items: center;
  margin: 0;
}

.shortcut-list dt {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.shortcut-list dd {
  margin: 0;
}

/* ---------- toast ---------- */
.toast-container {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-left-color: var(--info);
  background: var(--bg-elev);
  color: var(--fg);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: rise 0.15s ease;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast .toast-message {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

.toast .toast-action {
  color: var(--primary);
  font-weight: 600;
  padding: 2px 6px;
}

.toast .toast-close {
  padding: 2px;
  color: var(--fg-muted);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* ---------- kanban ---------- */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: var(--space-3);
  overflow-x: auto;
  padding-bottom: var(--space-3);
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  min-height: 200px;
  max-height: calc(100vh - var(--header-h) - 140px);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.column .column-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: inherit;
  border-radius: var(--radius) var(--radius) 0 0;
}

.column .column-header .count {
  margin-left: auto;
}

.column .column-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  overflow-y: auto;
  min-height: 60px;
}

.column.drag-over {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: var(--primary-soft);
}

.column .column-footer {
  padding: var(--space-2);
  border-top: 1px solid var(--border);
}

.swimlane {
  margin-bottom: var(--space-4);
}

.swimlane-title {
  font-weight: 600;
  margin-bottom: var(--space-2);
}

/* ---------- calendar (FullCalendar theme integration) ---------- */
.fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--bg-elev);
  --fc-neutral-bg-color: var(--bg-muted);
  --fc-neutral-text-color: var(--fg-muted);
  --fc-today-bg-color: color-mix(in srgb, var(--primary) 9%, transparent);
  --fc-now-indicator-color: var(--danger);
  --fc-highlight-color: color-mix(in srgb, var(--primary) 18%, transparent);
  --fc-non-business-color: rgba(0, 0, 0, 0.035);
  --fc-bg-event-opacity: 0.08;
  --fc-event-bg-color: var(--primary);
  --fc-event-border-color: var(--primary);
  --fc-event-text-color: #fff;
  --fc-event-selected-overlay-color: rgba(0, 0, 0, 0.15);
  --fc-more-link-bg-color: var(--bg-muted);
  --fc-more-link-text-color: var(--fg);
  --fc-list-event-hover-bg-color: var(--bg-muted);
  --fc-list-event-dot-width: 8px;
  --fc-button-bg-color: var(--bg-elev);
  --fc-button-border-color: var(--border-strong);
  --fc-button-text-color: var(--fg);
  --fc-button-hover-bg-color: var(--bg-muted);
  --fc-button-hover-border-color: var(--border-strong);
  --fc-button-active-bg-color: var(--primary);
  --fc-button-active-border-color: var(--primary);
  --fc-small-font-size: 12px;
  font-size: 13px;
  color: var(--fg);
}

:root[data-theme='dark'] .fc {
  --fc-non-business-color: rgba(255, 255, 255, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .fc {
    --fc-non-business-color: rgba(255, 255, 255, 0.04);
  }
}

.calendar-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: var(--space-3);
  gap: var(--space-2);
  flex-wrap: wrap;
}

.fc .fc-toolbar-title {
  font-size: 18px;
  font-weight: 600;
}

.fc .fc-button {
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  text-transform: capitalize;
  box-shadow: none;
}

.fc .fc-button:focus,
.fc .fc-button-primary:not(:disabled):focus {
  box-shadow: var(--focus-ring);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  color: var(--primary-fg);
}

.fc .fc-button-group > .fc-button {
  border-radius: 0;
}

.fc .fc-button-group > .fc-button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.fc .fc-button-group > .fc-button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.fc a:not([href]) {
  color: inherit;
}

.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-list-day-text,
.fc .fc-list-day-side-text {
  color: var(--fg);
  text-decoration: none;
}

.fc .fc-col-header-cell-cushion {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--fg-muted);
  padding: 6px 4px;
}

.fc .fc-day-today .fc-daygrid-day-number {
  font-weight: 700;
  color: var(--primary);
}

.fc .fc-timegrid-slot-label-cushion,
.fc .fc-timegrid-axis-cushion {
  font-size: 11px;
  color: var(--fg-muted);
}

.fc .fc-event {
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
  padding: 1px 2px;
}

.fc .fc-daygrid-event {
  padding: 1px 5px;
}

.fc .fc-event.is-done {
  opacity: 0.55;
}

.fc .fc-event.is-done .fc-event-title {
  text-decoration: line-through;
}

.fc .fc-event.is-blocked {
  border-style: dashed;
}

.fc .fc-event.is-overdue {
  box-shadow: inset 0 0 0 1px var(--danger);
}

.fc .fc-event.type-due {
  font-style: italic;
}

.fc .fc-list {
  border-radius: var(--radius);
}

.fc .fc-list-event:hover td {
  background: var(--bg-muted);
}

.fc .fc-popover {
  background: var(--bg-elev);
  border-color: var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
}

.fc .fc-popover-header {
  background: var(--bg-muted);
}

.fc-h-event .fc-event-main,
.fc-v-event .fc-event-main {
  color: inherit;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: var(--space-4);
  align-items: start;
}

.unscheduled-panel {
  position: sticky;
  top: calc(var(--header-h) + var(--space-4));
  max-height: calc(100vh - var(--header-h) - 2 * var(--space-4));
  overflow-y: auto;
}

/* ---------- misc components ---------- */
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}

.kv dt {
  color: var(--fg-muted);
}

.kv dd {
  margin: 0;
}

.pill-nav {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--bg-muted);
  border-radius: var(--radius);
}

.pill-nav .btn {
  border: 0;
  background: transparent;
  min-height: 28px;
}

.pill-nav .btn.active {
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  color: var(--fg);
}

.bulk-bar {
  position: sticky;
  bottom: var(--space-3);
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elev);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--fg-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.bar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
}

.bar-row .bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
}

.bar-row .bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.confidence {
  display: inline-block;
  width: 60px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-muted);
  overflow: hidden;
  vertical-align: middle;
}

.confidence > span {
  display: block;
  height: 100%;
  background: var(--success);
}

.drop-zone {
  padding: var(--space-5);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-elev);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.graph-node {
  cursor: pointer;
}

.graph-node rect {
  fill: var(--bg-elev);
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.graph-node text {
  fill: var(--fg);
  font-size: 12px;
  font-family: var(--font);
}

.graph-edge {
  stroke: var(--border-strong);
  fill: none;
  stroke-width: 1.5;
}

.graph-edge.critical {
  stroke: var(--danger);
  stroke-width: 2.5;
}

/* ---------- auth pages ---------- */
body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-4);
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--info) 14%, transparent), transparent 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-6) var(--space-5);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.auth-brand .brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.auth-brand .brand-mark svg {
  width: 22px;
  height: 22px;
}

.auth-card h1 {
  margin: 0;
  font-size: 20px;
}

.auth-card .auth-sub {
  color: var(--fg-muted);
  margin: 0 0 var(--space-4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.auth-form .input {
  min-height: 40px;
}

.auth-form .btn {
  min-height: 40px;
  margin-top: var(--space-1);
}

.auth-error {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 13px;
}

.auth-error[hidden] {
  display: none;
}

.auth-footer {
  margin-top: var(--space-4);
  text-align: center;
  font-size: 12px;
  color: var(--fg-muted);
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  /* The title/description column stays first on narrow screens: the side panel (project, status,
     dates, repeat…) is ~850px tall and would push the autofocused title below the fold. */
  .task-editor {
    grid-template-columns: 1fr;
  }

  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .unscheduled-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  /* Focus/scrollIntoView must not land controls under the fixed bottom tab bar. */
  html {
    scroll-padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  }

  .app-shell,
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: var(--tabbar-h);
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--border);
    z-index: 30;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    gap: 0;
    padding: 4px 2px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .nav-item {
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    font-size: 10px;
    min-width: 44px;
    text-align: center;
  }

  .nav-item .nav-label {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .nav-item kbd {
    display: none;
  }

  body.sidebar-collapsed .nav-label {
    display: block;
  }

  .app-main {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .app-header {
    height: auto;
    min-height: var(--header-h);
    flex-wrap: wrap;
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .header-search {
    flex: 1 1 100%;
    max-width: none;
    order: 3;
  }

  .quick-add {
    flex: 1 1 60%;
    max-width: none;
    order: 1;
  }

  .quick-add .btn span {
    display: none;
  }

  .header-actions {
    order: 2;
  }

  .user-menu-btn .user-name,
  .user-menu-btn .chev {
    display: none;
  }

  main.view {
    padding: var(--space-4) var(--space-3) var(--space-5);
  }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
  }

  .modal,
  .modal.modal-sm,
  .modal.modal-lg,
  .modal.modal-xl {
    max-width: none;
    max-height: none;
    min-height: 100%;
    border-radius: 0;
    border: 0;
  }

  .modal.modal-sm {
    min-height: 0;
    margin: auto var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }

  .toast-container {
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(var(--tabbar-h) + var(--space-3));
    max-width: none;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .board {
    grid-auto-columns: minmax(82vw, 1fr);
  }

  .schedule-grid,
  .due-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 80px 1fr auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- print ---------- */
@media print {
  @page {
    margin: 14mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12px;
  }

  .sidebar,
  .app-header,
  .toast-container,
  #modal-root,
  .no-print,
  .skip-link,
  .filter-bar,
  .bulk-bar {
    display: none !important;
  }

  .app-shell {
    display: block;
    min-height: 0;
  }

  .app-main {
    min-height: 0;
    padding: 0;
  }

  main.view {
    padding: 0;
    overflow: visible;
  }

  .card,
  .task-card,
  .table-wrap {
    box-shadow: none !important;
    border-color: #bbb !important;
    break-inside: avoid;
  }

  .task-card {
    cursor: default;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  .agenda-print h1 {
    font-size: 20px;
  }

  .agenda-print .section {
    break-inside: avoid;
    margin-bottom: 10mm;
  }

  .agenda-print .print-meta {
    color: #444;
  }

  .badge,
  .chip {
    border: 1px solid #999 !important;
    background: none !important;
    color: #000 !important;
  }
}

/* ===== view: calendar ===== */
.cal-view .cal-header-actions {
  justify-content: flex-end;
}

.cal-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

.cal-status .spinner {
  width: 14px;
  height: 14px;
}

.cal-status[hidden] {
  display: none;
}

.cal-colorby .btn.active {
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.cal-panel-toggle .badge {
  margin-left: 2px;
}

.cal-filters .cal-filter-field {
  display: inline-flex;
}

.cal-filters .cal-filter-field[hidden] {
  display: none;
}

.cal-filters .checkbox {
  padding: 4px 6px;
  color: var(--fg-muted);
}

.calendar-layout.panel-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.calendar-layout .unscheduled-panel[hidden] {
  display: none;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: var(--space-3);
  font-size: 12px;
  color: var(--fg-muted);
}

.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-legend-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.cal-legend-dot.dashed {
  width: 8px;
  height: 8px;
  border: 2px dashed var(--fg-muted);
  background: transparent;
}

.cal-legend-dot.outline {
  width: 8px;
  height: 8px;
  border: 2px solid var(--danger);
  background: transparent;
}

.cal-ev {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  line-height: 1.3;
}

.cal-ev-time {
  flex: none;
  font-weight: 600;
  opacity: 0.9;
}

.cal-ev-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-ev-dot.prio-dot {
  flex: none;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.85);
}

.cal-ev-icon {
  display: inline-flex;
  flex: none;
}

.cal-ev-icon svg {
  width: 12px;
  height: 12px;
}

.fc .fc-timegrid-event .cal-ev {
  flex-wrap: wrap;
  align-items: flex-start;
  max-height: 100%;
  overflow: hidden;
}

.fc .fc-timegrid-event .cal-ev-title {
  white-space: normal;
  flex-basis: 100%;
}

/* renderEventContent() returns custom domNodes, so FullCalendar's own title clipping frame is not
   used: clip here so a short event's wrapped text never spills over the rows and events below it. */
.fc .fc-timegrid-event .fc-event-main {
  height: 100%;
  overflow: hidden;
}

/* Events shorter than ~30 minutes keep a single clipped line (the full text is in the tooltip). */
.fc .fc-timegrid-event-short .cal-ev {
  flex-wrap: nowrap;
  align-items: center;
}

.fc .fc-timegrid-event-short .cal-ev-title {
  flex-basis: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc .fc-list-event .cal-ev-dot {
  display: none;
}

.fc .fc-list-event .cal-ev-title {
  white-space: normal;
}

.fc .fc-event.type-due .cal-ev-dot {
  display: none;
}

.fc .fc-bg-event .fc-event-title {
  font-size: 11px;
  font-style: italic;
  opacity: 0.8;
}

/* Agenda-range labels would sit under the day numbers (month) or on top of each other when
   several ranges overlap (week/day); the legend, tooltip and click still name the agenda item. */
.fc .fc-bg-event .fc-event-title {
  display: none;
}

.fc .fc-highlight {
  border-radius: 4px;
}

.fc .fc-event-mirror,
.fc .fc-event-dragging {
  box-shadow: var(--shadow-lg);
}

/* The today cell keeps a visible ring above agenda-range background events (which are painted over
   the cell background) in both themes. */
.fc .fc-daygrid-day.fc-day-today {
  background: var(--fc-today-bg-color);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 65%, transparent);
}

.fc .fc-timegrid-col.fc-day-today {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 45%, transparent);
}

.unscheduled-panel .card-header h2 {
  font-size: 15px;
}

.unscheduled-panel .card-header h2 .badge {
  margin-left: 4px;
}

.unscheduled-hint {
  margin: -4px 0 var(--space-2);
}

.unscheduled-list {
  margin-top: var(--space-2);
  gap: 6px;
}

.unscheduled-list .task-card {
  cursor: grab;
  touch-action: pan-y;
}

.unscheduled-list .task-card:active {
  cursor: grabbing;
}

.task-card.fc-event-dragging,
.fc-event.fc-event-mirror .task-card {
  opacity: 0.85;
}

@media (max-width: 720px) {
  .fc .fc-toolbar-title {
    font-size: 15px;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    justify-content: space-between;
  }

  .calendar-wrap {
    padding: var(--space-2);
  }

  .cal-legend {
    font-size: 11px;
    gap: 2px 10px;
  }

  .cal-view .cal-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ===== view: dependencies ===== */
.dep-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-4);
  align-items: start;
  margin-bottom: var(--space-5);
}

.dep-graph-wrap {
  position: relative;
  min-width: 0;
}

.dep-canvas {
  position: relative;
  height: 520px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
}

.dep-canvas:focus-within {
  box-shadow: var(--focus-ring);
}

.dep-canvas .empty-state,
.dep-canvas .loading {
  height: 100%;
  border: 0;
}

.dep-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
  user-select: none;
}

.dep-canvas.is-panning .dep-svg {
  cursor: grabbing;
}

.dep-zoom {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.dep-zoom[hidden] {
  display: none;
}

.dep-zoom .btn {
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.dep-arrow {
  fill: var(--border-strong);
}

.dep-arrow.critical {
  fill: var(--danger);
}

.graph-node rect.node-box {
  transition: stroke 0.12s ease, stroke-width 0.12s ease;
}

.graph-node:hover rect.node-box,
.graph-node:focus rect.node-box,
.graph-node:focus-visible rect.node-box {
  stroke: var(--primary);
  stroke-width: 2.5;
}

.graph-node:focus {
  outline: none;
}

.graph-node.critical rect.node-box {
  stroke: var(--danger);
  stroke-width: 2.5;
}

.graph-node.is-blocked rect.node-box {
  stroke-dasharray: 6 3;
}

.graph-node.external {
  opacity: 0.6;
}

.graph-node.is-cyclic rect.node-box {
  stroke: var(--warning);
}

.graph-node.status-done text,
.graph-node.status-cancelled text {
  fill: var(--fg-muted);
}

.graph-node.status-done .node-title,
.graph-node.status-cancelled .node-title {
  text-decoration: line-through;
}

.graph-node .node-title {
  font-weight: 600;
}

.graph-node .node-meta {
  fill: var(--fg-muted);
  font-size: 10.5px;
}

.graph-node .node-flag {
  font-size: 11px;
}

.graph-node .node-prio {
  fill: var(--prio-3);
}

.graph-node .node-prio.prio-1 {
  fill: var(--prio-1);
}

.graph-node .node-prio.prio-2 {
  fill: var(--prio-2);
}

.graph-node .node-prio.prio-4 {
  fill: var(--prio-4);
}

.graph-edge {
  transition: stroke 0.12s ease;
}

.dep-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
}

.dep-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dep-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--status-todo);
}

.dep-legend-swatch.dashed {
  border: 2px dashed var(--border-strong);
  background: transparent;
  width: 8px;
  height: 8px;
}

.dep-legend-line {
  width: 18px;
  height: 0;
  border-top: 3px solid var(--danger);
}

.dep-side .card-header h2 {
  font-size: 15px;
}

.dep-path-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dep-path-item {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.dep-path-step {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dep-path-link {
  font-weight: 600;
}

.dep-path-total {
  margin: var(--space-2) 0 0;
}

.dep-blocked-table .prio-dot {
  flex: none;
}

.dep-blockers {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dep-blockers li {
  gap: 6px;
}

.dep-remove {
  min-height: 24px;
  padding: 0 4px;
}

.dep-form {
  margin-bottom: var(--space-5);
}

.dep-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: start;
}

.dep-form-arrow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-top: 30px;
  font-size: 12px;
  white-space: nowrap;
}

.dep-form-submit {
  padding-top: 22px;
}

.dep-form .form-error {
  margin-top: var(--space-3);
}

.task-picker-input {
  position: relative;
}

.task-picker-input .input {
  padding-right: 34px;
}

.task-picker-input .picker-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 26px;
}

.task-picker-input .picker-clear[hidden] {
  display: none;
}

.task-picker .dropdown {
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 280px;
  overflow-y: auto;
}

.task-picker .picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-picker .picker-project {
  max-width: 40%;
}

.task-picker .picker-chosen {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.task-picker .picker-chosen[hidden] {
  display: none;
}

@media (max-width: 1000px) {
  .dep-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .dep-canvas {
    height: 60vh;
    min-height: 320px;
  }

  .dep-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dep-form-arrow,
  .dep-form-submit {
    padding-top: 0;
  }
}

@media (max-width: 720px) {
  .dep-filters .dep-legend {
    flex-basis: 100%;
  }

  .dep-blocked-table th:nth-child(3),
  .dep-blocked-table td:nth-child(3) {
    display: none;
  }
}

/* ===== view: shared (tasks / board / projects) ===== */
/* elements these views toggle with the `hidden` property must win over utility display rules */
.tasks-view [hidden],
.board-view [hidden],
.projects-view [hidden],
.project-detail [hidden],
.agenda-view [hidden] {
  display: none !important;
}

.chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 2px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chip-btn:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

.chip-btn[aria-pressed='true'] {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.chip-btn.prio-1[aria-pressed='true'] {
  background: color-mix(in srgb, var(--prio-1) 15%, transparent);
  border-color: var(--prio-1);
  color: var(--prio-1-fg);
}

.chip-btn.prio-2[aria-pressed='true'] {
  background: color-mix(in srgb, var(--prio-2) 16%, transparent);
  border-color: var(--prio-2);
  color: var(--prio-2-fg);
}

.chip-btn.prio-3[aria-pressed='true'] {
  background: color-mix(in srgb, var(--prio-3) 15%, transparent);
  border-color: var(--prio-3);
  color: var(--prio-3-fg);
}

.chip-btn.prio-4[aria-pressed='true'] {
  background: color-mix(in srgb, var(--prio-4) 15%, transparent);
  border-color: var(--prio-4);
  color: var(--prio-4-fg);
}

.chip-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.drag-handle {
  color: var(--fg-muted);
  cursor: grab;
  touch-action: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.drop-before {
  box-shadow: 0 -3px 0 0 var(--primary) !important;
}

.drop-after {
  box-shadow: 0 3px 0 0 var(--primary) !important;
}

.link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--primary);
  text-decoration: underline;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-muted);
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover {
  color: var(--primary);
}

.prewrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}

/* ===== view: tasks ===== */
.tasks-view .tasks-count {
  font-size: 14px;
}

.tasks-filters {
  flex-direction: column;
  align-items: stretch;
}

.tasks-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.tasks-filters .tasks-search {
  flex: 1 1 220px;
  min-width: 160px;
}

.tasks-bulk .select,
.tasks-bulk .input {
  width: auto;
  min-width: 130px;
}

.tasks-bulk .bulk-shift {
  width: 72px;
  min-width: 0;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-row {
  display: grid;
  grid-template-columns: 28px 28px minmax(160px, 1fr) auto 34px;
  align-items: center;
  gap: 0 var(--space-2);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--prio-3);
  border-radius: var(--radius);
  background: var(--bg-elev);
  min-height: 42px;
}

.task-row.prio-1 {
  border-left-color: var(--prio-1);
}

.task-row.prio-2 {
  border-left-color: var(--prio-2);
}

.task-row.prio-4 {
  border-left-color: var(--prio-4);
}

.task-row.selected {
  background: var(--primary-soft);
  border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.task-row.is-done .task-title {
  text-decoration: line-through;
  color: var(--fg-muted);
}

.task-row.is-done {
  opacity: 0.75;
}

.task-row.is-blocked {
  background: color-mix(in srgb, var(--warning) 5%, var(--bg-elev));
}

.task-row.dragging {
  opacity: 0.5;
}

.task-row-head {
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
  background: var(--bg-muted);
  border-left-color: transparent;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.task-cell {
  min-width: 0;
}

.task-cell.cell-select,
.task-cell.cell-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.task-cell.cell-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-title {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-weight: 500;
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.task-title:hover {
  color: var(--primary);
}

.task-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}

/* secondary columns: fixed widths keep them aligned across rows */
.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.task-meta .cell-project {
  width: 150px;
}

.task-meta .cell-category {
  width: 130px;
}

.task-meta .cell-priority {
  width: 92px;
}

.task-meta .cell-due {
  width: 118px;
}

.task-meta .cell-assignee {
  width: 36px;
  display: flex;
  justify-content: center;
}

.task-cell.cell-project .chip,
.task-cell.cell-category .chip {
  max-width: 100%;
}

.task-due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.task-due svg {
  width: 12px;
  height: 12px;
}

.task-due.overdue {
  color: var(--danger);
  font-weight: 600;
}

.task-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-1);
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.task-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 1100px) {
  .task-meta .cell-project {
    width: 120px;
  }

  .task-meta .cell-category {
    width: 110px;
  }
}

@media (max-width: 900px) {
  .task-row {
    grid-template-columns: 28px 28px minmax(0, 1fr) auto;
    grid-template-areas:
      'select check main handle'
      'select check meta handle';
    row-gap: 4px;
  }

  .task-row-head {
    display: none;
  }

  .task-cell.cell-select {
    grid-area: select;
  }

  .task-cell.cell-check {
    grid-area: check;
  }

  .task-cell.cell-main {
    grid-area: main;
  }

  .task-cell.cell-handle {
    grid-area: handle;
  }

  .task-meta {
    grid-area: meta;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .task-meta .task-cell {
    width: auto;
  }

  .task-meta .task-cell:empty {
    display: none;
  }
}

.tasks-filters .filters-toggle {
  display: none;
}

@media (max-width: 720px) {
  .tasks-view .view-header .row:last-child {
    width: 100%;
  }

  .tasks-view .view-header .row:last-child .btn {
    flex: 1 1 auto;
  }

  .tasks-filters .filters-toggle {
    display: inline-flex;
  }

  .tasks-filters:not(.expanded) .tasks-filter-row.collapsible {
    display: none;
  }

  .tasks-filters .tasks-search {
    flex: 1 1 100%;
  }
}

/* ===== view: board ===== */
.board-view .board-summary {
  font-size: 14px;
}

.board-body {
  min-width: 0;
}

/* four columns fit a laptop-width main area; phones fall back to the wide scrolling columns */
.board-view .board {
  grid-auto-columns: minmax(228px, 1fr);
}

@media (max-width: 720px) {
  .board-view .board {
    grid-auto-columns: minmax(82vw, 1fr);
  }
}

.board .column {
  min-width: 0;
}

.board .column-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board .column-done .column-header {
  color: var(--status-done);
}

.board .column-in_progress .column-header {
  color: var(--status-in_progress);
}

.board .column-waiting .column-header {
  color: var(--status-waiting);
}

.board .column-body > .task-card {
  cursor: grab;
}

.board .column-body > .task-card:active {
  cursor: grabbing;
}

.board .task-card .task-card-actions {
  align-items: center;
}

.board .task-card .drag-handle {
  display: inline-flex;
  padding: 2px;
}

/* The "Move…" select lives under the card body (not beside the title) and is taken out of the flow
   until the card is hovered/focused, so a hidden control never reserves width from the title. */
.board .task-card .board-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.board .task-card .board-move {
  display: none;
  width: auto;
  min-width: 0;
  min-height: 24px;
  padding: 0 4px;
  font-size: 11px;
}

.board .task-card:hover .board-move,
.board .task-card:focus-within .board-move,
.board .task-card .board-move:focus {
  display: inline-block;
}

.column-empty {
  padding: var(--space-4) var(--space-3);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 12px;
  text-align: center;
}

.column-tail:empty {
  display: none;
}

.column-tail {
  display: flex;
  justify-content: center;
  padding-top: var(--space-1);
}

.drop-indicator {
  height: 3px;
  margin: -2px 4px;
  border-radius: 2px;
  background: var(--primary);
}

.board-quick-add {
  display: flex;
  gap: var(--space-1);
  margin: 0;
}

.board-quick-add .input {
  flex: 1 1 auto;
  min-width: 0;
}

.board-filters .checkbox {
  margin-left: auto;
}

.swimlane .board {
  padding-bottom: var(--space-2);
}

.swimlane .column {
  min-height: 120px;
  max-height: none;
}

.swimlane-title a {
  color: inherit;
  text-decoration: none;
}

.swimlane-title a:hover {
  color: var(--primary);
}

@media (max-width: 720px) {
  .board .column {
    max-height: none;
  }

  .board .task-card .board-move {
    display: inline-block;
  }

  .board-filters .checkbox {
    margin-left: 0;
  }
}

@media (hover: none) {
  .board .task-card .board-move {
    display: inline-block;
  }
}

/* ===== view: projects ===== */
.project-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  height: 100%;
  cursor: pointer;
  border-top: 3px solid var(--project-color, var(--border));
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
}

.project-card.dragging {
  opacity: 0.5;
}

.project-card.status-completed,
.project-card.status-archived {
  opacity: 0.8;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

.project-card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.project-card-title a {
  color: var(--fg);
  text-decoration: none;
}

.project-card-title a:hover {
  color: var(--primary);
}

.project-card-tools {
  flex-shrink: 0;
}

.project-card-desc {
  margin: 0;
  font-size: 13px;
}

.project-card-progress {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-card-progress .overdue-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
}

.project-card-progress .overdue-count svg {
  width: 13px;
  height: 13px;
}

.badge.standing {
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info);
}

.project-detail .project-title {
  overflow-wrap: anywhere;
}

.project-detail .project-actions {
  align-items: flex-start;
}

.project-detail-grid {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

.project-detail .section-h {
  margin: 0 0 var(--space-2);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.project-tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
}

.tile.tile-danger .tile-value {
  color: var(--danger);
}

.project-detail .progress-wrap {
  padding: 0 2px;
}

.project-add-task {
  margin: 0 0 var(--space-3);
  flex-wrap: wrap;
}

.task-status-group {
  margin-bottom: var(--space-4);
}

.task-group-title {
  margin: 0 0 var(--space-2);
  font-size: 13px;
}

.dep-row {
  flex-wrap: wrap;
}

.dep-row .dep-blockers .chip {
  text-decoration: none;
}

.dep-row .dep-blockers .chip:hover {
  color: var(--primary);
}

@media (max-width: 1000px) {
  .project-detail-grid {
    grid-template-columns: 1fr;
  }

  .project-tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .project-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-detail .project-actions .btn {
    flex: 1 1 auto;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

/* printable meeting agenda */
.agenda-view {
  max-width: 900px;
  margin: 0 auto;
}

.agenda-toolbar {
  margin-bottom: var(--space-4);
}

.print-page {
  padding: var(--space-6);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--fg);
}

.agenda-print .agenda-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.agenda-print h1 {
  margin: 4px 0 6px;
  font-size: 26px;
  line-height: 1.2;
}

.agenda-print .agenda-standing {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
}

.agenda-print .print-meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--fg-muted);
}

.agenda-print .agenda-description {
  margin-top: var(--space-3);
  font-size: 14px;
}

.agenda-print .agenda-head {
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 2px solid var(--fg);
}

.agenda-print .agenda-section h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.agenda-print .agenda-count {
  font-weight: 400;
  color: var(--fg-muted);
}

.agenda-print .agenda-hint {
  margin-bottom: var(--space-2);
}

.agenda-items {
  margin: 0;
  padding-left: 26px;
}

.agenda-item {
  padding: 6px 0 8px;
  border-bottom: 1px solid var(--border);
  break-inside: avoid;
}

.agenda-item:last-child {
  border-bottom: 0;
}

.agenda-item-title {
  font-weight: 600;
}

.agenda-print .agenda-item-meta {
  margin: 2px 0 6px;
}

.notes-lines {
  height: calc(var(--lines, 2) * 22px);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 21px, var(--border-strong) 21px, var(--border-strong) 22px);
}

.agenda-empty {
  font-style: italic;
  color: var(--fg-muted);
}

.agenda-print .agenda-foot {
  margin-top: var(--space-5);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  text-align: center;
}

@media (max-width: 720px) {
  .print-page {
    padding: var(--space-4);
  }
}

@media print {
  .agenda-view {
    max-width: none;
  }

  .print-page {
    padding: 0;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    background: #fff;
    color: #000;
  }

  .agenda-print .agenda-head {
    border-bottom-color: #000;
  }

  .agenda-print .print-meta,
  .agenda-print .agenda-kicker,
  .agenda-print .agenda-count,
  .agenda-empty {
    color: #444;
  }

  .agenda-item {
    border-bottom-color: #ccc;
  }

  .notes-lines {
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 21px, #999 21px, #999 22px);
  }
}

/* ===== view: dashboard ===== */
/* elements these views toggle with the `hidden` property must win over utility display rules */
.dashboard-view [hidden],
.import-view [hidden],
.settings-view [hidden] {
  display: none !important;
}

.dash-subtitle {
  margin-top: 2px;
}

.dash-quick-add {
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.dash-quick-row .input {
  flex: 1 1 auto;
  min-width: 0;
}

.dash-quick-hint {
  margin-top: 6px;
  line-height: 1.6;
}

.dash-quick-hint code,
.settings-syntax code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--bg-muted);
}

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.dash-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, transform 0.12s ease;
}

.dash-tile:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.dash-tile:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.dash-tile .tile-icon {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--fg-muted);
  opacity: 0.7;
}

.dash-tile.tile-danger .tile-value {
  color: var(--danger);
}

.dash-tile.tile-danger.is-zero .tile-value,
.dash-tile.tile-success .tile-value {
  color: var(--success);
}

.dash-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--space-4);
  align-items: start;
}

.dash-section .section-title {
  margin-bottom: var(--space-3);
}

.dash-section .section-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.dash-section.is-danger .section-title h2 {
  color: var(--danger);
}

.dash-empty {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.dash-blocked-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-blockers {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 0 var(--space-2) 0 var(--space-3);
  color: var(--fg-muted);
}

.dash-blocker-link {
  color: var(--fg);
}

.dash-day-group .divider-label {
  margin-bottom: var(--space-2);
}

.dash-more {
  align-self: flex-start;
  margin-top: var(--space-2);
}

.dash-collapsible > summary > a {
  margin-left: auto;
}

.dash-sub {
  margin-bottom: var(--space-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.dash-workload .bar-row {
  grid-template-columns: 96px 1fr auto;
}

.bar-label {
  color: inherit;
  text-decoration: none;
}

a.bar-label:hover {
  color: var(--primary);
  text-decoration: underline;
}

.bar-count {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dash-project {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

.dash-project:hover {
  border-color: var(--primary);
}

.dash-project-title {
  font-weight: 500;
}

.dash-project .nowrap {
  white-space: nowrap;
}

.dash-activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: 13px;
  line-height: 1.4;
}

.dash-activity-text {
  color: var(--fg);
  text-decoration: none;
}

a.dash-activity-text:hover {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .dash-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .dash-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-view .view-header > .row {
    width: 100%;
    justify-content: space-between;
  }

  .dash-workload .bar-row {
    grid-template-columns: 80px 1fr auto;
  }
}

/* ===== view: import ===== */
.import-steps {
  display: flex;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.import-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}

.import-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-muted);
  font-size: 12px;
  font-weight: 600;
}

.import-step.active {
  color: var(--fg);
  font-weight: 600;
}

.import-step.active .import-step-num {
  background: var(--primary);
  color: var(--primary-fg);
}

.import-step.done .import-step-num {
  background: var(--success);
  color: #fff;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-4);
  align-items: start;
}

.import-drop {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
}

.import-drop.drag-over {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.import-drop .hint {
  margin: 0;
}

.import-text {
  min-height: 260px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.import-file-label,
.settings-view label.btn {
  position: relative;
  overflow: hidden;
}

.import-file-label input[type='file'],
.settings-view label.btn input[type='file'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.import-file-label:focus-within,
.settings-view label.btn:focus-within {
  box-shadow: var(--focus-ring);
}

.import-engines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2);
}

.import-engine {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

.import-engine:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.import-engine.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.import-engine input {
  margin: 3px 0 0;
}

.import-engine-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.import-engine-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.import-engine .hint {
  font-size: 12px;
  color: var(--fg-muted);
}

.import-explainer h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
}

.import-explainer-list {
  margin: 0;
  font-size: 13px;
}

.import-explainer-list dt {
  margin-top: var(--space-2);
  font-weight: 600;
}

.import-explainer-list dd {
  margin: 2px 0 0;
  color: var(--fg-muted);
}

.import-warnings {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  list-style: none;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
  font-size: 13px;
}

.import-warnings li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

/* Review of an already committed transcript: everything starts unchecked, created items are locked. */
.import-committed-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  font-size: 13px;
}

.import-committed-note svg.icon {
  flex: none;
  margin-top: 2px;
  color: var(--warning);
}

.import-item.is-created {
  border-left: 3px solid var(--success);
}

.import-item.is-created.is-off .import-title {
  text-decoration: none;
}

.import-ai-summary {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: 13px;
}

.import-bulk .select {
  width: auto;
  min-width: 150px;
}

.import-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.import-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--prio-3);
}

.import-item[data-kind='agenda'] {
  border-left-color: var(--primary);
}

.import-item[data-kind='decision'],
.import-item[data-kind='note'] {
  border-left-color: var(--fg-muted);
}

.import-item.is-off {
  opacity: 0.6;
}

.import-item.is-off .import-title {
  text-decoration: line-through;
}

.import-item-head {
  display: grid;
  grid-template-columns: auto 130px minmax(0, 1fr) 120px;
  gap: var(--space-2);
  align-items: center;
}

.import-check {
  display: inline-flex;
  padding: 4px;
}

.import-check input {
  width: 18px;
  height: 18px;
}

.import-item-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-2) var(--space-3);
}

.import-due .input {
  min-width: 0;
}

.import-due input[type='time'] {
  max-width: 110px;
}

.import-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.import-conf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.import-source {
  padding-top: var(--space-2);
  border-top: 1px dashed var(--border);
}

.import-excerpt {
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.import-source-toggle svg {
  transition: transform 0.15s ease;
}

.import-source-toggle[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.import-priority.prio-1 {
  color: var(--prio-1-fg);
}

.import-priority.prio-2 {
  color: var(--prio-2-fg);
}

.import-priority.prio-4 {
  color: var(--prio-4-fg);
}

.import-transcript {
  max-height: 70vh;
  overflow: auto;
}

.import-lines {
  margin: 0;
  padding: 0 0 0 3.5em;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

.import-lines li {
  padding: 0 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.import-lines li::marker {
  color: var(--fg-muted);
}

.import-lines li.is-focus {
  border-radius: 4px;
  background: color-mix(in srgb, var(--warning) 25%, transparent);
}

.import-done-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.import-done-icon {
  display: inline-flex;
  padding: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}

.import-done-icon svg {
  width: 24px;
  height: 24px;
}

.import-created-project {
  color: inherit;
  text-decoration: none;
}

.import-created-project:hover {
  border-color: var(--primary);
}

.import-table .import-row-title {
  font-weight: 500;
}

@media (max-width: 1000px) {
  .import-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .import-view .view-header {
    flex-direction: column;
    align-items: stretch;
  }

  .import-steps {
    justify-content: space-between;
    gap: var(--space-2);
  }

  .import-step-label {
    display: none;
  }

  .import-step.active .import-step-label {
    display: inline;
  }

  .import-item-head {
    display: flex;
    flex-wrap: wrap;
  }

  .import-item-head .import-check {
    order: 1;
  }

  .import-item-head .import-title {
    order: 2;
    flex: 1 1 60%;
  }

  .import-item-head .import-kind {
    order: 3;
    flex: 1 1 45%;
  }

  .import-item-head .import-priority {
    order: 4;
    flex: 1 1 45%;
  }

  .import-action-label {
    display: none;
  }

  .import-review-actions,
  .import-review-actions > .row {
    width: 100%;
  }

  .import-bulk .select {
    flex: 1 1 100%;
  }
}

/* ===== view: settings ===== */
.settings-tabs .tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.settings-panel {
  max-width: 1100px;
}

.settings-card-title {
  margin: 0;
  font-size: 15px;
}

.settings-add-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) auto minmax(0, 3fr);
  gap: var(--space-3);
  align-items: start;
}

.settings-add-row.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.settings-color {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  cursor: pointer;
}

.settings-inline {
  width: 100%;
  min-width: 120px;
}

.settings-col-order {
  width: 84px;
}

.settings-table td {
  vertical-align: middle;
}

.users-table tr.is-inactive td {
  opacity: 0.6;
}

.settings-session.is-current {
  border-color: var(--success);
}

.settings-copy-row .input {
  flex: 1 1 auto;
  min-width: 0;
}

.settings-steps,
.settings-syntax {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding-left: 1.2em;
  font-size: 13px;
}

.settings-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.settings-tag-row {
  justify-content: space-between;
}

.settings-shortcuts {
  margin: 0;
}

@media (max-width: 720px) {
  .settings-add-row,
  .settings-add-row.cols-4 {
    grid-template-columns: 1fr;
  }

  .settings-instructions {
    grid-template-columns: 1fr;
  }

  .settings-copy-row {
    flex-wrap: wrap;
  }
}
