/**
 * SaaS-grade polish layered on the built TaskCore UI (Tailwind + CSS variables).
 */

/* Hide React header strip: “N tasks due today” + task chips + Tasks link (bundle component Gw). */
[data-taskcore-header] div[role='status'][aria-live='polite'][class*='from-amber-500'] {
  display: none !important;
}

/* —— Shell banner host (demo + stacked notices from shell-enhancements.js) —— */
#tc-shell-banner-host {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10050;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}

.tc-shell-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  padding: 0.55rem max(0.75rem, env(safe-area-inset-right)) 0.55rem max(0.75rem, env(safe-area-inset-left));
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #0f172a;
  background: linear-gradient(90deg, #fde68a, #fcd34d);
  border-bottom: 1px solid rgba(180, 83, 9, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tc-shell-banner--multi {
  justify-content: flex-start;
}

.tc-shell-banner__icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.tc-shell-banner__text {
  flex: 1 1 12rem;
  min-width: 0;
}

.tc-shell-banner__muted {
  font-weight: 500;
  color: rgba(15, 23, 42, 0.82);
}

.tc-shell-banner__summary {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 600;
}

.tc-shell-banner__btns {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.tc-shell-banner__btns .tc-shell-banner__btn {
  margin-left: 0;
}

.tc-shell-banner__btn {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  min-height: 2.25rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(15, 23, 42, 0.22);
  background: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.8125rem;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.tc-shell-banner__btn:hover {
  background: #fffbeb;
  border-color: rgba(15, 23, 42, 0.35);
}

.tc-shell-banner__btn--sm {
  margin-left: 0;
  padding: 0.35rem 0.65rem;
  min-height: 2rem;
  font-size: 0.75rem;
}

.tc-shell-banner__caret {
  font-size: 0.65rem;
  opacity: 0.85;
}

.tc-shell-banner__dropdown {
  max-height: min(70vh, 22rem);
  overflow-y: auto;
  border-bottom: 1px solid rgba(180, 83, 9, 0.35);
  background: #fffbeb;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.tc-shell-banner__drop-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem max(0.75rem, env(safe-area-inset-right)) 0.75rem max(0.75rem, env(safe-area-inset-left));
  border-top: 1px solid rgba(180, 83, 9, 0.2);
}

.tc-shell-banner__drop-row:first-child {
  border-top: none;
}

.tc-shell-banner__drop-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #0f172a;
}

.tc-shell-banner__drop-badge,
.tc-shell-banner__text .tc-shell-banner__drop-badge {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent, #22c55e);
}

.tc-shell-banner__drop-body {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: rgba(15, 23, 42, 0.75);
}

/* —— Elevation & motion —— */
.shadow-card,
[class*='shadow-card'] {
  border-radius: var(--tc-radius-md, 14px) !important;
  transition: box-shadow var(--tc-duration, 200ms) var(--tc-ease, ease),
    transform var(--tc-duration, 200ms) var(--tc-ease, ease),
    border-color var(--tc-duration, 200ms) var(--tc-ease, ease);
}

.shadow-card:hover,
[class*='shadow-card']:hover {
  box-shadow: var(
    --shadow-card-hover,
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 12px 48px color-mix(in srgb, var(--accent) 14%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent)
  ) !important;
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .shadow-card:hover,
  [class*='shadow-card']:hover {
    transform: none;
  }
}

/* —— Sidebar: icon wells + active pill —— */
nav a[href],
nav a[role='link'] {
  border-radius: var(--tc-radius-sm, 10px);
  transition: background var(--tc-duration) var(--tc-ease), color var(--tc-duration) var(--tc-ease),
    box-shadow var(--tc-duration) var(--tc-ease);
}

nav a[aria-current='page'],
nav a[aria-current='true'] {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 22%, transparent),
    color-mix(in srgb, var(--accent) 8%, transparent)
  ) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent),
    0 0 24px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* Injected group labels */
.tc-sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.35rem;
  margin-top: 0.35rem;
  opacity: 0.85;
}

.tc-sidebar-group-label:first-child {
  margin-top: 0;
}

/* Shell-injected nav section titles (Core / Workspace / System) — hide in collapsed rail */
@media (min-width: 1024px) {
  #app-sidebar[class*='4.25rem'] #sidebar-nav .tc-sidebar-group-label {
    display: none !important;
  }
}

/* Slightly narrower left rail than bundle defaults (w-56 ≈ 14rem, collapsed 4.25rem) */
@media (min-width: 1024px) {
  #app-sidebar.w-56 {
    width: 13rem !important;
    min-width: 13rem !important;
    max-width: 13rem !important;
  }
  #app-sidebar[class*='4.25rem'] {
    width: 4rem !important;
    min-width: 4rem !important;
    max-width: 4rem !important;
  }
}

/* Sidebar footer: smaller Lightwater mark + About (i) control */
#app-sidebar > div:last-child .rounded-full {
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem;
  min-height: 2.5rem;
}
@media (min-width: 1024px) {
  #app-sidebar.w-56 > div:last-child .rounded-full {
    width: 2.85rem !important;
    height: 2.85rem !important;
  }
}

.tc-sidebar-about-host {
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
}
@media (min-width: 1024px) {
  #app-sidebar.w-56 .tc-sidebar-about-host {
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 0.4rem 0.55rem;
  }
}
.tc-sidebar-about-inner {
  flex: 1;
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.tc-sidebar-about-trigger {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  margin-bottom: 0.1rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--sidebar-border, var(--border)) 90%, transparent);
  background: color-mix(in srgb, var(--bg-card) 75%, transparent);
  color: var(--sidebar-link, var(--text-muted));
  font-size: 0.78rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1;
  cursor: pointer;
  transition:
    background var(--tc-duration) var(--tc-ease),
    color var(--tc-duration) var(--tc-ease),
    border-color var(--tc-duration) var(--tc-ease);
}
.tc-sidebar-about-trigger:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.tc-sidebar-about-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tc-sidebar-about-trigger__glyph {
  transform: translateY(0.5px);
}

/* About modal (<dialog>) */
.tc-about-dialog {
  padding: 0;
  border: none;
  background: transparent;
  max-width: calc(100vw - 2rem);
  width: min(26rem, 100vw - 2rem);
}
.tc-about-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}
.tc-about-dialog__card {
  position: relative;
  padding: 1.35rem 1.35rem 1.15rem;
  border-radius: var(--tc-radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: var(--bg-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  color: var(--text);
}
.tc-about-dialog__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--tc-radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.tc-about-dialog__close:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--bg-elevated) 80%, transparent);
}
.tc-about-dialog__title {
  margin: 0 1.5rem 0.35rem 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.tc-about-dialog__lead {
  margin: 0 0 0.85rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.tc-about-dialog__meta {
  margin: 0 0 0.85rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.8125rem;
}
.tc-about-dialog__dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}
.tc-about-dialog__dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.tc-about-dialog__credit {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.tc-about-dialog__hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.tc-about-dialog__inline-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tc-about-dialog__inline-link:hover {
  opacity: 0.9;
}

/* —— Dashboard: sit shell content higher in the scroll area —— */
#root main:has(#tc-today-focus),
#root main:has(#tc-dashboard-hero) {
  padding-top: 0.5rem !important;
}

@media (min-width: 1024px) {
  #root main:has(#tc-today-focus),
  #root main:has(#tc-dashboard-hero) {
    padding-top: 0.65rem !important;
  }
}

/* —— Dashboard hero (shell-enhancements.js) —— */
#tc-dashboard-hero.tc-hero {
  margin-bottom: var(--tc-density-gap, 1rem);
  padding: var(--tc-density-pad, 1.1rem);
  border-radius: var(--tc-radius-lg, 16px);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--bg-card) 92%, var(--accent) 8%) 0%,
    color-mix(in srgb, var(--bg-elevated) 95%, #000 5%) 100%
  );
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.tc-hero__grid {
  display: grid;
  gap: 1rem;
  align-items: center;
}
@media (min-width: 960px) {
  .tc-hero__grid {
    grid-template-columns: 1fr auto;
  }
}

.tc-hero__title {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tc-hero__sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.tc-hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.75rem;
}
.tc-hero__stat {
  min-width: 6.5rem;
}
.tc-hero__stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.tc-hero__stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.tc-hero__ring {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--tc-pct, 0) * 1%), rgba(148, 163, 184, 0.2) 0);
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 28%, transparent);
}
.tc-hero__ring::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--bg-card);
}
.tc-hero__ring span {
  position: relative;
  z-index: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.tc-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  position: relative;
  z-index: 2;
}
.tc-hero__actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--tc-radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration: none;
  transition: background var(--tc-duration) var(--tc-ease);
}
.tc-hero__actions a:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

/* —— Activity feed panel —— */
#tc-activity-feed.tc-activity {
  margin-bottom: var(--tc-density-gap, 1rem);
  padding: var(--tc-density-pad, 1rem);
  border-radius: var(--tc-radius-md);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.18));
  background: color-mix(in srgb, var(--bg-card) 96%, transparent);
}
.tc-activity h3 {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tc-activity ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tc-activity li {
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border, #334155) 70%, transparent);
  font-size: 0.8125rem;
  color: var(--text);
}
.tc-activity li:last-child {
  border-bottom: none;
}
.tc-activity time {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* —— Priority hints (existing rows) —— */
.table-scroll tbody tr {
  transition: background var(--tc-duration) var(--tc-ease);
}
.table-scroll tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* —— Header: notification bell + search kbd —— */
[data-taskcore-header] .tc-header-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--tc-radius-sm);
  border: 1px solid var(--header-ui-border, var(--border));
  background: color-mix(in srgb, var(--header-ui-bg, var(--bg-card)) 88%, transparent);
  color: var(--header-fg, var(--text));
  cursor: pointer;
  transition: box-shadow var(--tc-duration) var(--tc-ease), border-color var(--tc-duration) var(--tc-ease);
}
[data-taskcore-header] .tc-header-bell:hover {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
[data-taskcore-header] .tc-header-bell__ic {
  display: inline-flex;
  pointer-events: none;
}
[data-taskcore-header] .tc-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
  background: #ef4444;
  color: #fff;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--header-ui-bg, var(--bg-card)) 92%, transparent);
  pointer-events: none;
}

.tc-notif-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: min(92vw, 320px);
  max-width: min(96vw, 380px);
  max-height: min(70vh, 22rem);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  z-index: 220;
  overflow: hidden;
}

/* display:flex above wins over the [hidden] attribute — force closed state */
.tc-notif-panel[hidden],
.tc-notif-wrap .tc-notif-panel[hidden='true'] {
  display: none !important;
  pointer-events: none;
  visibility: hidden;
}
.tc-notif-panel__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  flex-shrink: 0;
}
.tc-notif-panel__title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}
.tc-notif-panel__readall {
  flex-shrink: 0;
  padding: 0.25rem 0.45rem;
  font-size: 0.7rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid var(--header-ui-border, var(--border));
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  color: var(--accent);
  cursor: pointer;
}
.tc-notif-panel__readall:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.tc-notif-panel__readall:disabled {
  opacity: 0.45;
  cursor: default;
}
.tc-notif-panel__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: auto;
  scrollbar-color: auto;
}
.tc-notif-panel__empty {
  padding: 0.85rem 0.9rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-muted);
}
.tc-notif-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background var(--tc-duration) var(--tc-ease);
}
.tc-notif-row:last-child {
  border-bottom: none;
}
.tc-notif-row:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.tc-notif-row--read {
  opacity: 0.72;
}
.tc-notif-row__kind {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
}
.tc-notif-row__title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.tc-notif-row__time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Search field: single pill; shortcut sits inside on the right */
[data-taskcore-header] .tc-header-search-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: center;
  box-sizing: border-box;
}

[data-taskcore-header] .tc-header-search-wrap input[type='search'],
[data-taskcore-header] .tc-header-search-wrap input[placeholder*='Search' i],
[data-taskcore-header] .tc-header-search-wrap input[placeholder*='search' i] {
  width: 100%;
  min-width: 0;
  height: 2.5rem;
  /* Room for leading search icon (bundle) + ⌘K chip on the right */
  padding: 0 3.5rem 0 2.6rem;
  box-sizing: border-box;
  font-size: 0.875rem;
  line-height: 1.2;
}

[data-taskcore-header] .tc-search-kbd {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.32rem;
  border-radius: 5px;
  border: 1px solid var(--header-ui-border, var(--border));
  background: color-mix(in srgb, var(--header-ui-bg, var(--bg-card)) 75%, transparent);
  color: var(--header-fg-muted, var(--text-muted));
  opacity: 0.92;
  pointer-events: none;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 639px) {
  [data-taskcore-header] .tc-header-search-wrap input[type='search'],
  [data-taskcore-header] .tc-header-search-wrap input[placeholder*='Search' i],
  [data-taskcore-header] .tc-header-search-wrap input[placeholder*='search' i] {
    height: 2.65rem;
    padding: 0 3.25rem 0 2.45rem;
    font-size: 0.8125rem;
  }

  [data-taskcore-header] .tc-search-kbd {
    font-size: 8px;
    padding: 0.1rem 0.28rem;
    right: 5px;
  }
}

/* —— Toast host —— */
#tc-toast-root {
  position: fixed;
  z-index: 9999;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.tc-toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: min(92vw, 360px);
  padding: 0.65rem 0.85rem;
  border-radius: var(--tc-radius-sm);
  font-size: 0.8125rem;
  background: color-mix(in srgb, var(--bg-elevated) 95%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  color: var(--text);
  animation: tc-toast-in 0.22s var(--tc-ease) both;
}
.tc-toast[data-tone='success'] {
  border-color: rgba(52, 211, 153, 0.45);
}
.tc-toast[data-tone='error'] {
  border-color: rgba(248, 113, 113, 0.5);
}

.tc-toast.tc-toast--dismissible {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding-right: 0.5rem;
}
.tc-toast__body {
  flex: 1;
  min-width: 0;
}
.tc-toast__title {
  font-weight: 600;
  margin: 0 0 0.2rem;
  font-size: 0.8125rem;
  color: var(--text);
}
.tc-toast__text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--text-muted);
  word-break: break-word;
  white-space: pre-line;
}
.tc-toast__close {
  flex-shrink: 0;
  margin: -0.15rem -0.1rem 0 0;
  padding: 0.25rem;
  line-height: 1;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}
.tc-toast__close:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--bg-elevated) 60%, transparent);
}
.tc-toast__close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@keyframes tc-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Settings: full backup / restore (LWSAdmin) —— */
.tc-backup-panel {
  margin-top: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--tc-radius-md);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--bg-card) 92%, transparent);
  box-shadow: var(--shadow-card);
}
.tc-backup-panel__title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.tc-backup-panel__lead {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tc-backup-panel__section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border, rgba(148, 163, 184, 0.15));
}
.tc-backup-panel__h {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tc-backup-panel__muted {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.tc-backup-panel__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.tc-backup-file {
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.tc-backup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--tc-radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tc-backup-btn:hover:not(:disabled) {
  background: var(--bg-card);
}
.tc-backup-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tc-backup-btn--primary {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}
.tc-backup-btn--danger {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

/* —— TaskCore System Protection / tar backups table —— */
.tc-sys-protection__header {
  margin-bottom: 1rem;
}
.tc-sys-protection__title {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.tc-sys-protection__sub {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tc-sys-backup-card {
  border-radius: var(--tc-radius-lg);
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.15));
  box-shadow: var(--shadow-card);
}
.tc-sys-backup-card__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.tc-sys-backup-busy {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.tc-sys-backup-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tc-sys-spin 0.75s linear infinite;
}
@keyframes tc-sys-spin {
  to {
    transform: rotate(360deg);
  }
}
.tc-sys-backup-table {
  display: block;
  overflow-x: auto;
  margin-top: 0.25rem;
}
.tc-sys-backup-table__row {
  display: grid;
  grid-template-columns:
    minmax(100px, 1.5fr) minmax(96px, 1fr) minmax(52px, 0.5fr) minmax(88px, 0.75fr) minmax(180px, 1.5fr);
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.5rem 0.35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--border, rgba(148, 163, 184, 0.15)) 80%, transparent);
  font-size: 0.8125rem;
  color: var(--text);
}
.tc-sys-backup-table__row--head {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.2));
}
.tc-sys-backup-table__cell--name {
  word-break: break-all;
}
.tc-sys-backup-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}
.tc-sys-backup-table__actions .tc-backup-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
}
.tc-sys-backup-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tc-sys-backup-badge--sync {
  background: color-mix(in srgb, #22c55e 18%, transparent);
  color: #bbf7d0;
  border: 1px solid color-mix(in srgb, #22c55e 45%, transparent);
}
.tc-sys-backup-badge--local {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text-muted);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.2));
}
.tc-sys-backup-table__empty {
  padding: 0.75rem 0.35rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.tc-client-mgmt-card {
  margin-top: 1rem;
}
.tc-client-mgmt-table .tc-client-mgmt-table__head,
.tc-client-mgmt-table .tc-client-mgmt-table__row {
  grid-template-columns: minmax(80px, 1.2fr) minmax(48px, 0.35fr) minmax(72px, 0.65fr) minmax(200px, 1.4fr);
}

.tc-restore-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.tc-restore-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.tc-restore-modal__card {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  padding: 1.25rem 1.5rem;
  border-radius: var(--tc-radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.tc-restore-modal__title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.tc-restore-modal__body {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tc-restore-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* —— Typography / theme panel (typography-panel.js) —— */
.tc-typography-panel {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--tc-radius-lg, 1rem);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  box-shadow: var(--shadow-card);
  max-width: 42rem;
}
.tc-typography-panel__title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.tc-typography-panel__lead {
  margin: 0 0 1rem;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tc-typography-panel__grid {
  display: grid;
  gap: 0.85rem 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .tc-typography-panel__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.tc-typography-panel__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.tc-typography-panel__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tc-typography-panel__select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--tc-radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}
.tc-typography-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.tc-typography-panel__save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.45rem 1.1rem;
  border-radius: var(--tc-radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
}
.tc-typography-panel__save:hover {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}
.tc-typography-panel__hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* —— Workspaces admin (workspaces-admin.js) —— */
.tc-ws-admin {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--tc-radius-lg, 1rem);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  box-shadow: var(--shadow-card);
  max-width: min(100%, 56rem);
}
.tc-ws-admin__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.tc-ws-admin__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.tc-ws-admin__err {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: #b91c1c;
}
.tc-ws-admin__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tc-ws-admin__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.tc-ws-admin__th {
  text-align: left;
  padding: 0.5rem 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tc-ws-admin__th--actions {
  text-align: right;
}
.tc-ws-admin__td {
  padding: 0.55rem 0.65rem;
  vertical-align: middle;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  color: var(--text);
}
.tc-ws-admin__td--actions {
  text-align: right;
  white-space: nowrap;
}
.tc-ws-admin__swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  vertical-align: middle;
}
.tc-ws-admin__code {
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.tc-ws-admin__muted {
  color: var(--text-muted);
}
.tc-ws-admin__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 0.65rem;
  margin-left: 0.35rem;
  border-radius: var(--tc-radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 0.75rem;
  cursor: pointer;
}
.tc-ws-admin__btn:first-child {
  margin-left: 0;
}
.tc-ws-admin__btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elevated));
}
.tc-ws-admin__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tc-ws-admin__btn--primary {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  font-weight: 600;
}
.tc-ws-admin__btn--danger {
  border-color: color-mix(in srgb, #dc2626 35%, transparent);
  color: #fecaca;
  background: color-mix(in srgb, #dc2626 18%, transparent);
}
.tc-ws-admin__btn--danger:hover:not(:disabled) {
  background: color-mix(in srgb, #dc2626 28%, transparent);
}
.tc-ws-admin-modal {
  position: fixed;
  inset: 0;
  z-index: 10060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.tc-ws-admin-modal[hidden] {
  display: none !important;
}
.tc-ws-admin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.tc-ws-admin-modal__card {
  position: relative;
  z-index: 1;
  width: min(100%, 24rem);
  max-height: min(90vh, 32rem);
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  border-radius: var(--tc-radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.tc-ws-admin-modal__title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.tc-ws-admin-modal__body {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tc-ws-admin-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.tc-ws-admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.tc-ws-admin-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.tc-ws-admin-form__label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tc-ws-admin-form__input,
.tc-ws-admin-form__textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.25rem;
  padding: 0.4rem 0.55rem;
  border-radius: var(--tc-radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
}
.tc-ws-admin-form__input--color {
  min-height: 2.75rem;
  padding: 0.2rem;
  cursor: pointer;
}
.tc-ws-admin-form__textarea {
  min-height: 4rem;
  resize: vertical;
}

/* —— Mobile: hero CTAs full width, touch-sized —— */
@media (max-width: 639.98px) {
  .tc-hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .tc-hero__actions a {
    width: 100%;
    justify-content: center;
    min-height: 44px;
    padding: 0.65rem 1rem;
  }
  .tc-backup-panel {
    padding: 1rem 1rem;
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
  }
  .tc-backup-panel__row {
    flex-direction: column;
    align-items: stretch;
  }
  .tc-backup-btn {
    width: 100%;
    min-height: 44px;
  }
}

/* —— App popovers / dialogs above shell-injected UI (banner z-10050, nav backdrop z-10025) ——
   Default Tailwind z-50 (~50) sits below those layers, so clicks hit the wrong surface and
   controls (e.g. “Edit details” in a task popover) appear broken. */
body [data-radix-popper-content-wrapper],
body [data-radix-popover-content],
body [data-radix-dropdown-menu-content],
body [data-radix-select-content],
body [data-radix-hover-card-content],
body [data-radix-context-menu-content],
body [data-radix-select-viewport],
body [data-slot='popover-content'],
body [data-slot='dropdown-menu-content'] {
  z-index: 10160 !important;
}

body [data-radix-dialog-overlay] {
  z-index: 10150 !important;
}
body [data-radix-dialog-content],
body [role='dialog'][data-state='open'] {
  z-index: 10160 !important;
}

body [data-vaul-overlay],
body [data-vaul-drawer-wrapper] {
  z-index: 10155 !important;
}
