/* TaskMaster - dark desktop dashboard theme. */

:root {
  --bg: #101214;
  --bg-sidebar: #151719;
  --bg-elevated: #1a1d20;
  --bg-elevated-2: #23272b;
  --bg-hover: #262b2f;
  --bg-inset: #131618;
  --border: #30353a;
  --border-subtle: #262a2e;
  --border-highlight: rgba(255, 255, 255, 0.04);
  --text: #f1f3f1;
  --text-muted: #a0a9ad;
  --text-faint: #757f83;
  --accent: #bce784;
  --accent-light: #cdeba0;
  --accent-dim: rgba(188, 231, 132, 0.16);
  --accent-glow: rgba(188, 231, 132, 0.28);
  --accent-contrast: #15210d;
  --tag-bg: #30363a;
  --tag-text: #c5cdd0;
  --sidenav-active-bg: #263024;
  --avatar-bg: #3a4136;
  --avatar-text: #dceacb;
  --avatar2-bg: #3b334d;
  --avatar2-text: #d9c4fa;
  --avatar3-bg: #2b4249;
  --avatar3-text: #b7e1e9;
  --panel-gradient-start: #202428;
  --danger: #f1b5a0;
  --danger-dim: rgba(241, 181, 160, 0.16);
  --success: #98d9bd;
  --success-dim: rgba(152, 217, 189, 0.16);
  --review: #d4b9f4;
  --review-dim: rgba(212, 185, 244, 0.16);
  --cyan: #7dd3fc;
  --cyan-dim: rgba(125, 211, 252, 0.14);
  --font-brand: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, Arial, sans-serif;
  --radius: 16px;
  --radius-sm: 9px;
  --ease-fluid: cubic-bezier(0.22, 1, 0.36, 1);

  /* Layered shadows: stacked passes at increasing blur/opacity read as real depth,
     not a single flat drop-shadow. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3), 0 10px 24px -8px rgba(0, 0, 0, 0.55), 0 24px 48px -16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.35), 0 16px 36px -10px rgba(0, 0, 0, 0.6), 0 32px 64px -20px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 8px 24px -6px var(--accent-glow);

  --body-gradient:
    radial-gradient(1100px 520px at 12% -8%, rgba(188, 231, 132, 0.06), transparent 60%),
    radial-gradient(900px 480px at 88% 0%, rgba(157, 124, 240, 0.07), transparent 55%),
    linear-gradient(180deg, #0d0f11 0%, #101214 40%, #111315 100%);
}

/* ---- Light theme ---- */
:root[data-theme="light"] {
  --bg: #f4f5f6;
  --bg-sidebar: #ffffff;
  --bg-elevated: #ffffff;
  --bg-elevated-2: #ffffff;
  --bg-hover: #eef0f1;
  --bg-inset: #f0f1f2;
  --border: #dde0e3;
  --border-subtle: #e9ebed;
  --border-highlight: rgba(255, 255, 255, 0.9);
  --text: #1a1c1f;
  --text-muted: #5c6066;
  --text-faint: #8a8f96;
  --accent: #5c8a00;
  --accent-light: #7ab300;
  --accent-dim: #e7f2c9;
  --accent-glow: rgba(92, 138, 0, 0.22);
  --accent-contrast: #ffffff;
  --tag-bg: #eef0f1;
  --tag-text: #5c6066;
  --sidenav-active-bg: var(--accent-dim);
  --avatar-bg: var(--accent-dim);
  --avatar-text: var(--accent);
  --avatar2-bg: #ede5fc;
  --avatar2-text: #7c4fe0;
  --avatar3-bg: #dff3fc;
  --avatar3-text: #0284c7;
  --panel-gradient-start: #ffffff;
  --danger: #d92c54;
  --danger-dim: #fde3ea;
  --success: #12946a;
  --success-dim: #d7f5e9;
  --review: #7c4fe0;
  --review-dim: #ede5fc;
  --cyan: #0284c7;
  --cyan-dim: #dff3fc;

  --shadow-sm: 0 1px 2px rgba(30, 41, 71, 0.06), 0 2px 6px -2px rgba(30, 41, 71, 0.08);
  --shadow-md: 0 2px 4px rgba(30, 41, 71, 0.05), 0 10px 24px -8px rgba(30, 41, 71, 0.14), 0 24px 48px -16px rgba(30, 41, 71, 0.1);
  --shadow-lg: 0 4px 8px rgba(30, 41, 71, 0.06), 0 16px 36px -10px rgba(30, 41, 71, 0.16), 0 32px 64px -20px rgba(30, 41, 71, 0.12);
  --shadow-glow: 0 8px 24px -6px rgba(92, 138, 0, 0.3);

  --body-gradient: linear-gradient(180deg, #fbfbfc 0%, #f4f5f6 55%, #f0f1f2 100%);
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  margin: 0;
  padding: 0;
  line-height: 1.55;
  background-color: var(--bg);
  background-image: var(--body-gradient);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color 0.4s ease;
}

/* ---- Elegant page-load motion ---- */
@keyframes tm-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes tm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes tm-pop-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes tm-spin {
  to { transform: rotate(360deg); }
}

/* Loading state any submit button gets swapped into (see form-loading.js)
   while its request is in flight -- a spinning ring replaces the label so a
   click always gives visible feedback, especially as an installed PWA with
   no browser loading bar. */
.btn-loading { opacity: 0.85; cursor: default; display: inline-flex; align-items: center; justify-content: center; }
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tm-spin 0.6s linear infinite;
}

/* Top progress bar for plain link navigation (see page-loading.js) -- the
   button spinner above only covers form submits, so a link like "Социални
   мрежи" gave zero feedback while its page loaded. */
#page-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
}
#page-loading-bar.page-loading-bar-active {
  width: 70%;
  opacity: 1;
  transition: width 8s cubic-bezier(0.1, 0.5, 0.1, 1), opacity 0.2s ease;
}

body.page-enter main { animation: tm-fade-up 0.7s var(--ease-fluid) both; }

.card-grid li {
  animation: tm-fade-up 0.65s var(--ease-fluid) both;
}
.card-grid li:nth-child(1) { animation-delay: 0.04s; }
.card-grid li:nth-child(2) { animation-delay: 0.11s; }
.card-grid li:nth-child(3) { animation-delay: 0.18s; }
.card-grid li:nth-child(4) { animation-delay: 0.25s; }
.card-grid li:nth-child(5) { animation-delay: 0.32s; }
.card-grid li:nth-child(n+6) { animation-delay: 0.38s; }

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

h1, h2, h3 { color: var(--text); font-weight: 600; margin: 0 0 0.5rem; }
h1 { font-size: 29px; line-height: 1.2; letter-spacing: -1.1px; margin: 0 0 12px; }
h2 { font-size: 16px; letter-spacing: -0.2px; margin: 2rem 0 0.85rem; }
h3 { font-size: 14px; margin: 1.5rem 0 0.6rem; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
  margin-right: 0.4em;
  flex-shrink: 0;
}

/* ---- App shell: sidebar + topbar ---- */
.shell-app {
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 26px 15px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.6px;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-dot { color: var(--accent); }
.brand .mark {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}
.brand .mark .icon { margin: 0; width: 15px; height: 15px; }

.sidenav { display: grid; gap: 5px; }
.sidenav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 11px;
  border-radius: var(--radius-sm);
  transition: color 0.18s var(--ease-fluid), background 0.18s var(--ease-fluid);
}
.sidenav a .icon { color: var(--text-faint); transition: color 0.18s var(--ease-fluid); margin: 0; }
.sidenav a:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.sidenav a.active { color: var(--accent); background: var(--sidenav-active-bg); box-shadow: inset 2px 0 var(--accent); }
.sidenav a.active .icon { color: var(--accent); }

.nav-badge {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 2px 8px var(--accent-glow);
  flex-shrink: 0;
  animation: tm-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.nav-badge-requests {
  background: #f59e0b;
  color: #1a1408;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

.nav-badge-conversations {
  background: var(--review);
  color: #24143a;
  box-shadow: 0 2px 8px rgba(212, 185, 244, 0.35);
}

:root[data-theme="light"] .nav-badge-requests {
  background: #d97706;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}
:root[data-theme="light"] .nav-badge-conversations {
  background: #9333ea;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.25);
}

@keyframes tm-pop-in {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.sidebar-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
}
.sidebar-person:hover { background: var(--bg-hover); text-decoration: none; }
.sidebar-person.active { background: var(--sidenav-active-bg); box-shadow: inset 2px 0 var(--accent); }
.sidebar-person.active .small { color: var(--accent); }
.sidebar-person .small { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.sidebar-person .avatar {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.shell-main { min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}
.topbar-brand {
  display: none;
  font-family: var(--font-brand);
  font-weight: 700;
  color: var(--text);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

/* Hamburger toggle: hidden on desktop (the sidebar shows inline there), shown
   only under the mobile breakpoint below where the sidebar becomes an
   off-canvas drawer. Two icons stacked in the same button; only one is
   visible at a time based on aria-expanded, so no JS-driven class swap is
   needed for it. */
button.nav-toggle { display: none; }
.nav-overlay { display: none; }
.icon-menu-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu-close { display: block; }
.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: default;
  transition: background 0.35s var(--ease-fluid), color 0.35s var(--ease-fluid), transform 0.25s var(--ease-fluid);
}
a.icon-btn, button.icon-btn { cursor: pointer; }
button.icon-btn { border: none; background: none; padding: 0; margin: 0; font: inherit; }
.icon-btn .icon { margin: 0; width: 1.15em; height: 1.15em; }
a.icon-btn:hover, button.icon-btn:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
a.icon-btn.active { background: var(--accent-dim); color: var(--accent); }
a.icon-btn:active, button.icon-btn:active { transform: scale(0.92); }

/* Theme toggle: show only the icon matching the mode you'd switch TO */
.icon-theme-light { display: none; }
:root[data-theme="light"] .icon-theme-dark { display: none; }
:root[data-theme="light"] .icon-theme-light { display: block; }

#notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tm-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ---- Layout ---- */
main {
  padding: 30px 28px 24px;
}

p { color: var(--text); }
p.muted, .muted { color: var(--text-muted); font-size: 0.88rem; }
p.form-error { color: var(--danger); }
p.form-success { color: var(--success); }

/* Card grid: responsive, fills desktop width instead of a single narrow column.
   Scoped to the explicit .card-grid class only -- a blind "main > ul" structural
   selector used to also catch unrelated lists (e.g. .note-list) that are direct
   children of <main>, silently forcing their <li>s into a stretched flex-column
   layout that broke their own, unrelated styling. */
.card-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}

/* Panel look lifted directly from the approved design concept: a 145deg
   graphite gradient, hairline border and a soft drop shadow with a faint
   inset top highlight -- reused for every card/panel surface in the app. */
.card-grid li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  transition: border-color 0.3s var(--ease-fluid), transform 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid);
}
/* Every card follows the same internal rhythm regardless of markup order:
   an optional small label on top, the title, then all status/priority/type
   tags grouped into one row -- so short and long titles produce identically
   shaped cards instead of tags drifting to wherever the title's wrap ended.
   These are explicit classes (not :first-child/DOM-order tricks) so the
   label can be placed above the title in the markup. */
.card-label {
  margin: 0;
  font-size: 0.78rem;
}
.card-title {
  font-weight: 600;
  line-height: 1.35;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.card-grid li:hover {
  border-color: var(--text-faint);
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.03);
}

/* Unread notifications get a brighter title and an accent-tinted avatar so
   the list reads at a glance -- the small "ново" tag alone wasn't a strong
   enough cue. Read ones stay at the row's normal (muted) tasklink color. */
.notif-unread .tasklink { color: var(--accent); font-weight: 600; }
.notif-unread .avatar { background: var(--accent-dim); color: var(--accent); }

/* Task-request cards. An explicit class, not a "main > div > div" structural
   selector -- that blind selector used to also catch unrelated divs nested
   two levels under <main> (e.g. .filter-bar inside .toolbar, .invoice-actions
   inside .invoice-toolbar, .yt-stat-card inside .yt-stats), silently forcing
   them into a column layout and stacking their contents vertically. */
.request-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
}
.request-card > * { margin: 0; }

.note-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.note-list li {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
}

/* Groups search + filters into one visible surface, set off from both the
   page heading above and the results below -- instead of controls floating
   directly on the page background with only margin between them. */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--bg-sidebar);
  border: none;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}
.toolbar .search-bar,
.toolbar .filter-bar { margin: 0; }

/* Groups a dashboard block (heading + its card list) so consecutive blocks
   read as separate sections instead of one undifferentiated scroll. */
.dashboard-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}
.dashboard-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

/* Dashboard counters: real numbers computed from the viewer's own data
   (see index.php), not decorative placeholders. */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.75rem;
  list-style: none;
  padding: 0;
}
.stat {
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  padding: 1.05rem 1.1rem;
}
.stat-label { margin: 0; font-size: 0.78rem; color: var(--text-muted); }
.stat-value { font-size: 1.8rem; font-weight: 550; letter-spacing: -0.03em; margin: 0.3rem 0; color: var(--text); }
.stat-value.accent { color: var(--accent); }
.stat-hint { margin: 0; font-size: 0.78rem; color: var(--text-muted); }

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

.dashboard-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .dashboard-cols { grid-template-columns: 1fr; }
}

/* Dashboard Review and Request Card Accents */
.card-grid li.dashboard-review-card {
  border-color: rgba(212, 185, 244, 0.35);
  border-left: 4px solid var(--review);
  background: linear-gradient(145deg, rgba(212, 185, 244, 0.08) 0%, var(--bg-elevated) 65%);
}
.card-grid li.dashboard-review-card:hover {
  border-color: var(--review);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 14px rgba(212, 185, 244, 0.25);
}
.dashboard-review-card .stacked-link-title {
  color: var(--review);
}

.card-grid li.dashboard-request-card {
  border-color: rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.07) 0%, var(--bg-elevated) 65%);
}
.card-grid li.dashboard-request-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 14px rgba(245, 158, 11, 0.25);
}
.dashboard-request-card .stacked-link-title {
  color: #fbbf24;
}

:root[data-theme="light"] .card-grid li.dashboard-review-card {
  border-color: #e9d5ff;
  border-left: 4px solid #9333ea;
  background: linear-gradient(145deg, #faf5ff 0%, #ffffff 80%);
}
:root[data-theme="light"] .card-grid li.dashboard-review-card:hover {
  border-color: #c084fc;
  box-shadow: 0 10px 24px -4px rgba(147, 51, 234, 0.18);
}
:root[data-theme="light"] .dashboard-review-card .stacked-link-title {
  color: #7c4fe0;
}

:root[data-theme="light"] .card-grid li.dashboard-request-card {
  border-color: #fde68a;
  border-left: 4px solid #d97706;
  background: linear-gradient(145deg, #fffbeb 0%, #ffffff 80%);
}
:root[data-theme="light"] .card-grid li.dashboard-request-card:hover {
  border-color: #f59e0b;
  box-shadow: 0 10px 24px -4px rgba(217, 119, 6, 0.18);
}
:root[data-theme="light"] .dashboard-request-card .stacked-link-title {
  color: #b45309;
}

/* Dashboard Conversations Widget */
.dashboard-conversations-section {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.dashboard-threads-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.dashboard-thread-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s var(--ease-fluid), border-color 0.2s var(--ease-fluid), background 0.2s var(--ease-fluid), box-shadow 0.2s var(--ease-fluid);
}
.dashboard-thread-row:hover {
  text-decoration: none;
  background: var(--bg-hover);
  border-color: var(--review);
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.dashboard-thread-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--review-dim);
  color: var(--review);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dashboard-thread-icon .icon {
  margin: 0;
  width: 17px;
  height: 17px;
}
.dashboard-thread-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dashboard-thread-top {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.dashboard-thread-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-thread-badge {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.dashboard-thread-badge.task {
  background: var(--accent-dim);
  color: var(--accent);
}
.dashboard-thread-badge.request {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}
.dashboard-thread-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dashboard-thread-preview {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.dashboard-thread-arrow {
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s var(--ease-fluid), color 0.2s var(--ease-fluid);
}
.dashboard-thread-arrow .icon {
  margin: 0;
  width: 15px;
  height: 15px;
}
.dashboard-thread-row:hover .dashboard-thread-arrow {
  color: var(--review);
  transform: translateX(2px);
}
.dashboard-threads-empty {
  padding: 1.5rem;
  text-align: center;
}
:root[data-theme="light"] .dashboard-threads-container {
  background: #f8fafc;
  border-color: var(--border);
}
:root[data-theme="light"] .dashboard-thread-row {
  background: #ffffff;
  border-color: #e2e8f0;
}
:root[data-theme="light"] .dashboard-thread-row:hover {
  background: #ffffff;
  border-color: var(--review);
  box-shadow: 0 4px 12px rgba(124, 79, 224, 0.12);
}
:root[data-theme="light"] .dashboard-thread-badge.request {
  background: #fef3c7;
  color: #b45309;
}

/* Compact filter select in headers */
.compact-select {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.compact-select:hover {
  border-color: var(--text-faint);
}
.compact-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
:root[data-theme="light"] .compact-select {
  background: #ffffff;
  border-color: var(--border);
}

/* Project filter select in tasks toolbar */
.toolbar-project-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-subtle);
  flex-wrap: wrap;
}
.toolbar-project-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}
.toolbar-project-label .icon {
  margin: 0;
  width: 15px;
  height: 15px;
}
.toolbar-project-select {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
  min-width: 220px;
  max-width: 100%;
  transition: border-color 0.2s var(--ease-fluid), box-shadow 0.2s var(--ease-fluid);
}
.toolbar-project-select:hover {
  border-color: var(--text-faint);
}
.toolbar-project-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
:root[data-theme="light"] .toolbar-project-select {
  background: #ffffff;
  border-color: var(--border);
}

/* Project cards: a logo initial, active/archived tag, a progress track of
   completed vs. total tasks, and a full-width action button -- matching the
   design concept's project panel exactly. */
.project-card { padding: 18px; text-align: left; position: relative; }
.project-card .sectionhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.projectlogo {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--avatar-bg);
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--avatar-text);
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.project-card h3 { min-height: 2.5em; margin: 0 0 0.3rem; }
.project-track {
  height: 4px;
  border-radius: 5px;
  background: var(--bg-hover);
  margin: 15px 0 8px;
  overflow: hidden;
}
.project-track span { display: block; height: 100%; background: var(--accent); }
.project-card .btn-link { margin-top: 16px; width: 100%; justify-content: center; font-size: 0.78rem; }

/* ---- Generic panel primitives (project.php et al.) ---- */
.panel {
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
}
.panel-pad { padding: 20px; }
.sectionhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 17px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
}
.quad-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 17px;
  margin-bottom: 24px;
}
/* Stacked stat panels on social.php (byday/funnel/versions charts) sit one
   after another with nothing but this margin between them -- the .cols and
   .quad-charts grids already carry their own gap/margin-bottom, so this only
   targets the standalone panels between/around them (child combinator keeps
   it off panels nested inside those grids). */
.social-network-section > section.panel-pad { margin-bottom: 24px; }
.meta-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.row { display: flex; gap: 12px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; padding-bottom: 0; }
.row:first-child { padding-top: 0; }
.grow { flex: 1; min-width: 0; }

.detailgrid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(200px, 0.8fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 820px) {
  .detailgrid { grid-template-columns: 1fr; }
}
.formrow { display: grid; gap: 7px; margin-bottom: 17px; }
.formrow label,
.formrow > span:first-child { font-size: 12px; color: var(--text-muted); }
.formrow select,
.formrow input { margin-top: 0; }
.soft { padding: 15px; background: var(--bg-inset); border-radius: 10px; font-size: 0.82rem; color: var(--text-muted); }
.back { margin-bottom: 20px; font-size: 12px; }
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border: 1px dashed var(--text-faint);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---- Kanban board (tasks.php) ---- */
.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 13px;
  align-items: start;
}
.lane {
  background: var(--bg-sidebar);
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
}
.lanehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2px 0 15px;
  font-size: 12px;
  color: var(--text-muted);
}
.kanban-card {
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  transition: transform 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid);
}
.kanban-card:last-child { margin-bottom: 0; }
.kanban-card:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28); }
.kanban-card .small { font-size: 11px; color: var(--text-muted); }
.tasklink {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  margin: 8px 0 15px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.tasklink:hover { color: var(--accent); text-decoration: none; }
.taskmeta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.taskfoot {
  border-top: 1px solid var(--border);
  padding-top: 11px;
  margin-top: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 11px;
}
.taskfoot .icon { width: 13px; height: 13px; margin: 0 0.3em 0 0; }
.btn-card-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  line-height: 1.3;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-card-open:hover {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-card-open:active {
  transform: translateY(0);
}
@media (max-width: 768px) {
  .btn-card-open {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }
}

/* Kanban card status-based colored borders and accents */
.kanban-card[data-status="To Do"],
.kanban-card[data-status="to-do"],
.kanban-card[data-status="todo"] {
  border-color: rgba(148, 163, 184, 0.28);
  border-left: 4px solid #64748b;
}

.kanban-card[data-status="In Progress"],
.kanban-card[data-status="in-progress"] {
  border-color: rgba(188, 231, 132, 0.35);
  border-left: 4px solid var(--accent);
  background: linear-gradient(145deg, rgba(188, 231, 132, 0.05) 0%, var(--bg-elevated) 65%);
}

.kanban-card[data-status="In Review"],
.kanban-card[data-status="in-review"] {
  border-color: rgba(212, 185, 244, 0.35);
  border-left: 4px solid var(--review);
  background: linear-gradient(145deg, rgba(212, 185, 244, 0.05) 0%, var(--bg-elevated) 65%);
}

.kanban-card[data-status="Done"],
.kanban-card[data-status="done"] {
  border-color: rgba(152, 217, 189, 0.35);
  border-left: 4px solid var(--success);
  background: linear-gradient(145deg, rgba(152, 217, 189, 0.05) 0%, var(--bg-elevated) 65%);
}

.kanban-card[data-status="To Do"]:hover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 12px rgba(100, 116, 139, 0.18);
}
.kanban-card[data-status="In Progress"]:hover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 14px var(--accent-glow);
}
.kanban-card[data-status="In Review"]:hover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 14px rgba(212, 185, 244, 0.25);
}
.kanban-card[data-status="Done"]:hover {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 0 14px rgba(152, 217, 189, 0.25);
}

:root[data-theme="light"] .kanban-card[data-status="To Do"],
:root[data-theme="light"] .kanban-card[data-status="to-do"] {
  border-color: #cbd5e1;
  border-left: 4px solid #64748b;
}
:root[data-theme="light"] .kanban-card[data-status="In Progress"],
:root[data-theme="light"] .kanban-card[data-status="in-progress"] {
  border-color: #d9f99d;
  border-left: 4px solid #65a30d;
  background: #fbfdf7;
}
:root[data-theme="light"] .kanban-card[data-status="In Review"],
:root[data-theme="light"] .kanban-card[data-status="in-review"] {
  border-color: #e9d5ff;
  border-left: 4px solid #9333ea;
  background: #faf5ff;
}
:root[data-theme="light"] .kanban-card[data-status="Done"],
:root[data-theme="light"] .kanban-card[data-status="done"] {
  border-color: #bbf7d0;
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
}

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

/* ---- Conversations inbox + chat (conversations.php) ---- */
.inbox {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(0, 1.6fr);
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  min-height: 460px;
}
.conversations-list { border-right: 1px solid var(--border); padding: 12px; overflow-y: auto; }
.conversation-item {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
  padding: 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.conversation-item:hover { background: var(--bg-hover); text-decoration: none; }
.conversation-item.selected { background: var(--sidenav-active-bg); border-color: var(--border); }
.conversation-item strong { display: block; font-size: 0.88rem; }
.chat-panel { padding: 24px; min-width: 0; }
.chat-panel form { background: none; border: none; box-shadow: none; padding: 0; margin: 0; max-width: none; }
.chat-log { margin: 20px 0; }
.bubble {
  background: var(--bg-elevated-2);
  border-radius: 0 13px 13px 13px;
  padding: 13px 15px;
  margin: 14px 25px 8px 0;
  max-width: 80%;
}
.bubble.mine { background: var(--sidenav-active-bg); border-radius: 13px 0 13px 13px; margin: 16px 0 8px auto; }
.bubble.private { background: #3b3326; color: #ead7a9; }
.bubble-meta { font-size: 10px; color: var(--text-muted); }
.bubble.mine + .bubble-meta { text-align: right; }
@media (max-width: 820px) {
  .inbox { grid-template-columns: 1fr; }
  .conversations-list { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ---- List table (clients.php) ---- */
.listhead, .listrow {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.listhead { color: var(--text-muted); font-size: 11px; }
.listrow:last-child { border-bottom: 0; }
.person { display: flex; gap: 10px; align-items: center; min-width: 0; }
.person-text { min-width: 0; }
.person-text .small { display: block; color: var(--text-muted); font-size: 0.78rem; }
.inlineactions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.avatar {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar.av2 { background: var(--avatar2-bg); color: var(--avatar2-text); }
.avatar.av3 { background: var(--avatar3-bg); color: var(--avatar3-text); }
@media (max-width: 720px) {
  .listhead { display: none; }
  .listrow { grid-template-columns: 1fr; gap: 0.4rem; padding: 1rem 0; }
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  max-width: 480px;
}
.search-bar input[type="search"] { margin: 0; }
.search-bar button { margin: 0; white-space: nowrap; }

/* Filter pills (tasks.php) */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.social-sort-label { font-size: 0.82rem; margin-right: 0.2rem; }
/* "Segmented control" look from the design concept: a transparent-background
   row of quiet buttons, with the active one picking up a tinted fill instead
   of the whole row looking like boxed pills. */
.filter-pill {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  transition: color 0.2s var(--ease-fluid), background 0.2s var(--ease-fluid), border-color 0.2s var(--ease-fluid);
}
.filter-pill:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.filter-pill.active { color: var(--accent); background: #31372e; border-color: #48543c; }
.filter-pill:active { transform: translateY(0); }

/* Project filters read as a different kind of filter from status filters --
   a thin rule (not a boxed container) plus a distinct shape/color, rather
   than pill-shaped + accent-green for both. */
.filter-bar-projects {
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.85rem;
}
.filter-bar-projects .filter-pill.active { background: var(--review-dim); border-color: transparent; color: var(--review); }

/* Status filter pills: colored to match the same status badges on task cards */
.filter-pill.status-to-do.active { background: var(--bg-hover); color: var(--text); border-color: transparent; }
.filter-pill.status-in-progress.active { background: #31372e; color: var(--accent); border-color: #48543c; }
.filter-pill.status-in-review.active { background: var(--review-dim); color: var(--review); border-color: transparent; }
.filter-pill.status-done.active { background: var(--success-dim); color: var(--success); border-color: transparent; }

/* ---- Forms ---- */
form {
  margin: 1rem 0;
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  max-width: 480px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
}

label {
  display: block;
  margin: 0.7rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

input, textarea, select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  background: var(--bg-inset);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  margin-top: 0.35rem;
  width: 100%;
  transition: border-color 0.35s var(--ease-fluid), box-shadow 0.35s var(--ease-fluid);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
textarea { min-height: 5rem; resize: vertical; }
input[type="checkbox"] { width: auto; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.35rem 0;
}
.checkbox-row input[type="checkbox"] { margin: 0; }
.checkbox-row input[type="radio"] { margin: 0; width: auto; }
.radio-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* Toggle switch: for on/off settings (e.g. "send an email notification"),
   as opposed to .checkbox-row which is for genuine multi-select lists. */
.switch {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text);
  padding: 0.35rem 0;
  cursor: pointer;
}
.switch input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.switch-track {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 21px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.25s var(--ease-fluid), border-color 0.25s var(--ease-fluid);
}
.switch-track::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 17px;
  height: 17px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: transform 0.25s var(--ease-fluid), background 0.25s var(--ease-fluid);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(17px); background: var(--accent-contrast); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tag-style multi-select: chips + input, dropdown opens on focus, closes on blur */
.project-picker {
  position: relative;
  margin-top: 0.35rem;
}
.project-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.project-picker-chips:empty { margin-bottom: 0; }

.project-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.35rem 0.2rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
}
.project-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: none;
  color: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: background 0.15s ease;
}
.project-chip-remove:hover { background: rgba(255, 255, 255, 0.15); }

.project-picker-input { margin: 0; }

.project-picker-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.3rem;
}
.project-picker-option {
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.project-picker-option:hover { background: var(--bg-hover); }
.project-picker-empty {
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}

button, input[type="submit"] {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.6rem;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.25);
  transition: filter 0.18s var(--ease-fluid), transform 0.18s var(--ease-fluid), box-shadow 0.18s var(--ease-fluid);
}
button:hover, input[type="submit"]:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}
button:active, input[type="submit"]:active { transform: translateY(0); }
button:focus-visible, input[type="submit"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:disabled, input[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: none !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary {
  background: var(--bg-elevated-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.btn-secondary:hover { color: var(--danger); background: #30363a; filter: none; box-shadow: none; transform: translateY(-1px); }

.btn-danger {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: none;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  filter: none;
  transform: translateY(-1px);
}
:root[data-theme="light"] .btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
:root[data-theme="light"] .btn-danger:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-danger.small, .btn-secondary.small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4;
}
.btn-danger.block {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.55rem 1rem;
}

form.inline-action-form,
.inline-action-form {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  display: inline-block !important;
}
form.inline-action-form button,
.inline-action-form button {
  margin: 0 !important;
}

.inline-form {
  display: inline-block;
  margin: 0.4rem 0 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: none;
}
.inline-form button { margin-top: 0; }

.quick-links {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}
.quick-links a {
  display: flex;
  align-items: center;
  color: var(--text);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.18s var(--ease-fluid), transform 0.18s var(--ease-fluid);
}
.quick-links a:hover {
  text-decoration: none;
  background: #30363a;
  transform: translateY(-1px);
}

.page-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-heading-row h1 { margin: 0; }
/* Docks the row's action button to the right even when there is no heading
   text before it (most pages dropped their nav-duplicate <h1>) -- scoped to
   buttons/links specifically so a lone <h3> (e.g. "Последни видеа") doesn't
   also get shoved to the right by this. */
.page-heading-row > button:last-child,
.page-heading-row > a.btn-link:last-child,
.page-heading-row > form:last-child { margin-left: auto; }

.quick-create-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  max-width: none;
}
.quick-create-form select {
  width: auto;
  margin: 0;
  min-width: 180px;
}
.quick-create-form button { margin: 0; }

.btn-link {
  display: flex;
  align-items: center;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3), inset 0 1px rgba(255, 255, 255, 0.25);
  transition: filter 0.18s var(--ease-fluid), transform 0.18s var(--ease-fluid);
}
.btn-link .icon { margin-right: 0.35em; }
.btn-link:hover { text-decoration: none; filter: brightness(1.07); transform: translateY(-1px); }

.contact-links {
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0;
}
.contact-links .icon-btn { width: 30px; height: 30px; background: var(--bg-inset); border: 1px solid var(--border-subtle); }
.contact-links a[href^="tel:"]:hover { color: var(--accent); background: var(--bg-hover); }
.contact-links a[href^="https://wa.me"]:hover { color: #25d366; background: var(--bg-hover); }
.contact-links a[href^="viber:"]:hover { color: #7360f2; background: var(--bg-hover); }

.edit-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted) !important;
  vertical-align: middle;
  margin-left: 0.5rem;
}
.edit-link:hover { color: var(--accent) !important; }
button.edit-link {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-family: inherit;
}
button.edit-link:hover { transform: none; box-shadow: none; filter: none; }

/* A card whose whole area is one link (dashboard's review-task / pending-request lists):
   the project name stays visually distinct (muted) from the title (accent), even
   though both sit inside the same anchor. */
.stacked-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  color: inherit;
  text-decoration: none;
}
.stacked-link:hover { text-decoration: none; }
.stacked-link .muted { color: var(--text-muted); }
.stacked-link-title { color: var(--accent); font-weight: 500; }
.stacked-link:hover .stacked-link-title { text-decoration: underline; }

/* ---- Media thumbnails (attached files) ---- */
.media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.media-grid li {
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
}
.media-thumb {
  display: block;
  width: 108px;
  height: 108px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease-fluid), box-shadow 0.35s var(--ease-fluid), border-color 0.35s var(--ease-fluid);
}
.media-thumb:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}
.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-preview {
  margin: 0.4rem 0 0.75rem;
}
.file-preview:empty { display: none; margin: 0; }
.file-preview img,
.file-preview video {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  object-fit: cover;
}

/* ---- Status / priority / visibility pills ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.7rem;
  line-height: 1.4;
  font-weight: 600;
  padding: 0.28rem 0.5rem;
  border-radius: 5px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border: none;
  white-space: nowrap;
  transition: background 0.3s var(--ease-fluid), color 0.3s var(--ease-fluid);
  animation: tm-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.status-to-do { color: var(--text-muted); }
.status-in-progress { color: var(--accent); background: var(--accent-dim); border-color: transparent; }
.status-in-review { color: var(--review); background: var(--review-dim); border-color: transparent; }
.status-done { color: var(--success); background: var(--success-dim); border-color: transparent; }
.status-reopened { color: var(--danger); background: var(--danger-dim); border-color: transparent; }
.status-active { color: var(--success); background: var(--success-dim); border-color: transparent; }
.status-archived { color: var(--text-faint); }
.status-pending { color: var(--accent); background: var(--accent-dim); border-color: transparent; }
.status-paid { color: var(--success); background: var(--success-dim); border-color: transparent; }
.status-draft, .status-sent { color: var(--text-muted); }
.status-converted { color: var(--success); background: var(--success-dim); border-color: transparent; }
.status-rejected { color: var(--danger); background: var(--danger-dim); border-color: transparent; }

.priority-low { color: var(--text-muted); }
.priority-medium { color: var(--cyan); background: var(--cyan-dim); border-color: transparent; }
.priority-high { color: var(--danger); background: var(--danger-dim); border-color: transparent; }

.type-bug { color: var(--danger); background: var(--danger-dim); border-color: transparent; }
.type-feature { color: var(--review); background: var(--review-dim); border-color: transparent; }

.visibility-internal { color: var(--danger); background: var(--danger-dim); border-color: transparent; }
.visibility-shared { color: var(--text-muted); }

/* Exact pill colors from the approved dark design concept -- kept separate
   from the --review/--success/--danger tokens above (used for borders,
   focus glows, etc.) since those need to stay usable as translucent tints,
   while these four pill categories have specific solid pairs to match. */
:root:not([data-theme="light"]) .status-in-progress { color: #c6e99e; background: #35432a; }
:root:not([data-theme="light"]) .status-in-review { color: #d4b9f4; background: #393047; }
:root:not([data-theme="light"]) .status-done,
:root:not([data-theme="light"]) .status-active,
:root:not([data-theme="light"]) .status-converted,
:root:not([data-theme="light"]) .status-paid { color: #98d9bd; background: #233f37; }
:root:not([data-theme="light"]) .priority-high,
:root:not([data-theme="light"]) .status-reopened,
:root:not([data-theme="light"]) .status-rejected,
:root:not([data-theme="light"]) .type-bug,
:root:not([data-theme="light"]) .visibility-internal { color: #f1b5a0; background: #482f2a; }

/* ---- Auth pages (login) ---- */
body.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card {
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  animation: tm-fade-up 0.75s var(--ease-fluid) both;
}
.auth-card h1 { margin-top: 0; font-family: var(--font-brand); }
.auth-card form { border: none; background: none; padding: 0; margin: 0.5rem 0 0; max-width: none; }

/* ---- Modals ---- */
dialog.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.02);
  width: min(440px, 92vw);
  color: var(--text);
  animation: tm-modal-in 0.35s var(--ease-fluid) both;
}
dialog.modal::backdrop {
  background: rgba(4, 5, 6, 0.6);
  backdrop-filter: blur(3px);
  animation: tm-fade-in 0.3s ease both;
}
:root[data-theme="light"] dialog.modal::backdrop { background: rgba(26, 31, 20, 0.35); }
@keyframes tm-modal-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
dialog.modal .modal-body { padding: 1.5rem 1.75rem 1.75rem; }
dialog.modal form {
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: none;
}
dialog.modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0 1.75rem;
}
dialog.modal .modal-header h2 { margin: 0; color: var(--text); }
dialog.modal .modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  margin: 0;
  box-shadow: none;
  transition: background 0.25s var(--ease-fluid), color 0.25s var(--ease-fluid);
}
dialog.modal .modal-close .icon { width: 16px; height: 16px; margin: 0; }
dialog.modal .modal-close:hover { background: var(--bg-hover); color: var(--text); transform: none; box-shadow: none; filter: none; }

dialog.lightbox-modal {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 4vh 4vw;
  box-sizing: border-box;
}
dialog.lightbox-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
dialog.lightbox-modal .modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}
.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: 2;
  transition: background 0.25s var(--ease-fluid), transform 0.25s var(--ease-fluid);
}
.lightbox-nav:hover { background: var(--bg-hover); transform: translateY(-50%); }
.lightbox-nav:active { transform: translateY(-50%) scale(0.92); }
.lightbox-nav.lightbox-prev { left: 1rem; }
.lightbox-nav.lightbox-next { right: 1rem; }
.lightbox-nav .icon { width: 20px; height: 20px; margin: 0; }
.lightbox-body {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.lightbox-body:empty { display: none; }
.lightbox-body img,
.lightbox-body video {
  display: block;
  max-width: 92vw;
  max-height: 92vh;
  animation: tm-lightbox-fade 0.3s var(--ease-fluid) both;
}
@keyframes tm-lightbox-fade {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ---- Invoice document ---- */
.invoice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.invoice-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.invoice-actions form { margin: 0; }
.invoice-document {
  background: linear-gradient(160deg, var(--bg-elevated-2) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border-subtle);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.75rem;
}
.invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}
.invoice-head h1 { margin: 0 0 0.35rem; font-size: 1.4rem; }
.invoice-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.invoice-party h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.invoice-party p { margin: 0.15rem 0; }
.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
}
.invoice-items-table th,
.invoice-items-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.invoice-items-table th { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.invoice-items-table td:nth-child(2),
.invoice-items-table td:nth-child(3),
.invoice-items-table td:nth-child(4) { text-align: right; }
.invoice-items-table td:last-child form { margin: 0; }
.invoice-totals {
  margin-left: auto;
  width: fit-content;
  text-align: right;
}
.invoice-totals p { margin: 0.25rem 0; }
.invoice-total-line { font-size: 1.15rem; padding-top: 0.5rem; border-top: 1px solid var(--border-subtle); }

/* ---- Social dashboard (shared by the YouTube and Instagram sections) ---- */
.social-network-section + .social-network-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: 2rem;
  padding-top: 0.5rem;
}
.social-settings-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

/* Real data tables (external stats tabs) -- multi-column, unlike the
   3-column .listhead/.listrow grid used elsewhere. */
.stats-table { width: 100%; border-collapse: collapse; margin: 0.75rem 0 1.5rem; }
.stats-table th, .stats-table td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.stats-table th { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stats-table td:not(:first-child) { text-align: right; }
.stats-table th:not(:first-child) { text-align: right; }
.muted-sub { color: var(--review, #d4b9f4); font-size: 0.78rem; }

[data-testid="tracks-stats-table"] th svg { vertical-align: middle; }
[data-testid="tracks-stats-table"] th .col-label { margin-left: 0.35rem; }
@media (max-width: 640px) {
  [data-testid="tracks-stats-table"] th .col-label { display: none; }
}
[data-testid="tracks-stats-table"] td:first-child,
[data-testid="tracks-stats-table"] th:first-child { text-align: left; white-space: normal; }
[data-testid="tracks-stats-table"] td:not(:first-child),
[data-testid="tracks-stats-table"] th:not(:first-child) { text-align: right; width: 1%; white-space: nowrap; }

/* Chart canvases (external stats tabs) */
.chart-box { position: relative; height: 220px; margin-top: 0.75rem; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 150px; }

/* Per-single version cards (stats.php Music tab) -- native <details> so the
   latest single can start open and the rest collapsed; external-stats-charts.js
   animates .version-card-body's height on toggle since <details> itself has
   no transition hook. */
.version-card { margin-bottom: 12px; overflow: hidden; }
.version-card summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}
.version-card summary::-webkit-details-marker { display: none; }
.version-card summary .icon { transition: transform 0.18s ease; flex-shrink: 0; }
.version-card[open] summary .icon { transform: rotate(90deg); }
.version-card-body { overflow: hidden; transition: height 0.22s ease; }
.version-card-body .stats-table { margin: 0 20px 18px; width: calc(100% - 40px); }
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.social-settings-row form { margin: 0; }

.social-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.social-stat-card {
  position: relative;
  overflow: hidden;
  padding: 1.05rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  animation: tm-fade-up 0.6s var(--ease-fluid) both;
}
.social-stat-icon {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  width: 22px;
  height: 22px;
  opacity: 0.5;
  color: var(--text-muted);
}
.social-stat-label { margin: 0; color: var(--text-muted); font-size: 0.78rem; }
.social-stat-value { font-size: 1.8rem; font-weight: 550; letter-spacing: -0.03em; margin: 0.3rem 0; color: var(--text); }
.social-stat-trends {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.social-stat-trends span { display: flex; align-items: center; gap: 0.35em; }

.social-trend { display: inline-flex; align-items: center; gap: 0.25em; font-weight: 600; }
.social-trend .icon { width: 14px; height: 14px; margin: 0; }
.social-trend-up { color: var(--success); }
.social-trend-down { color: var(--danger); }

/* Post feed: a vertical list of compact rows (small thumb + title/metrics),
   exactly as in the approved design concept -- not an image gallery grid. */
.feed {
  display: grid;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 18px 0 1.75rem;
}
.feed li { animation: tm-fade-up 0.5s var(--ease-fluid) both; }
.feeditem {
  display: flex;
  align-items: stretch;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(145deg, var(--panel-gradient-start) 0%, var(--bg-elevated) 65%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.02);
  transition: transform 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid), border-color 0.3s var(--ease-fluid);
}
.feeditem:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), inset 0 1px rgba(255, 255, 255, 0.03);
  border-color: var(--text-faint);
}
.reel {
  width: 120px;
  min-height: 100%;
  background: linear-gradient(145deg, #414b3c, #272d28) center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
}
.reel .icon { margin: 0; width: 28px; height: 28px; }
.feeditem .grow { min-width: 0; flex: 1; padding: 15px 17px; }
@media (max-width: 480px) {
  .reel { width: 84px; }
}
.social-media-title {
  margin: 6px 0 0;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feedmetrics {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}
.feedmetrics span { display: flex; align-items: center; gap: 0.3em; }
.feedmetrics .icon { width: 14px; height: 14px; margin: 0; }
.metric-delta {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
  line-height: 1.2;
}

@media (max-width: 720px) {
  .social-stats { grid-template-columns: 1fr; }
  .feeditem { flex-wrap: wrap; }
}

@media print {
  .no-print, .sidebar, .topbar, .nav-overlay, .invoice-toolbar, dialog { display: none !important; }
  body {
    background-color: #fff !important;
    background-image: none !important;
    color: #000 !important;
  }
  .invoice-document,
  .invoice-document > div,
  .invoice-head,
  .invoice-party,
  .invoice-totals {
    background: none !important;
    box-shadow: none !important;
    border-color: #ccc !important;
  }
  .invoice-document { border: none !important; padding: 0 !important; }
  .invoice-document h1, .invoice-document h2, .invoice-document h3,
  .invoice-document strong { color: #000 !important; }
  .invoice-party p, .invoice-totals p, .invoice-head p, .muted { color: #444 !important; }
  .invoice-items-table th, .invoice-items-table td { border-color: #ccc !important; color: #000 !important; }
  .tag { border: 1px solid #999 !important; background: none !important; color: #000 !important; }
  main { padding: 0 !important; }
}

@media (max-width: 720px) {
  .invoice-parties { grid-template-columns: 1fr; }
  .invoice-document { padding: 1.25rem; }
  .invoice-items-table { display: block; overflow-x: auto; }

  .shell-app { display: block; }
  .topbar { padding: 0.75rem 1rem; gap: 0.6rem; }
  .topbar-brand { display: block; font-size: 1rem; }
  button.nav-toggle { display: flex; position: relative; z-index: 41; }

  /* Off-canvas drawer: the sidebar slides in from the left over the full
     viewport height instead of taking up permanent width on small screens. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: auto;
    width: min(78vw, 300px);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-fluid);
    z-index: 40;
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidenav a { padding: 0.6rem 0.75rem; font-size: 0.95rem; }

  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 39;
  }
  .nav-overlay.nav-overlay-open { display: block; }

  body.nav-lock-scroll { overflow: hidden; }
  main { padding: 1.25rem; }
  .card-grid { grid-template-columns: 1fr; }

  .page-heading-row { align-items: stretch; margin-bottom: 1.25rem; }
  .page-heading-row h1 { margin: 0.5rem 0 0.75rem; }
  .quick-create-form { flex-wrap: wrap; gap: 0.6rem; }
  .quick-create-form select { min-width: 0; flex: 1 1 100%; }
  .quick-create-form button { flex: 1 1 100%; justify-content: center; margin-top: 0; }
  .btn-link { justify-content: center; }

  form { max-width: none; }
  .project-picker-input, input, textarea, select { font-size: 16px; } /* avoid iOS auto-zoom on focus */

  h1 { font-size: 1.35rem; }
  main > .filter-bar:first-of-type { margin-top: 0.25rem; }
  .filter-bar { margin-bottom: 1rem; }
}

/* ==========================================================================
   Kanban Drag & Drop Enhancements
   ========================================================================== */
.kanban-card[draggable="true"] {
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.kanban-card[draggable="true"]:active {
  cursor: grabbing;
}
.kanban-card[draggable="true"] a {
  -webkit-user-drag: none;
  user-drag: none;
}
.kanban-card.dragging {
  opacity: 0.35;
  transform: scale(0.97);
  border: 1px dashed var(--accent);
}
.kanban-placeholder {
  min-height: 70px;
  background: var(--accent-dim);
  border: 2px dashed var(--accent);
  border-radius: var(--tm-radius);
  margin-bottom: 12px;
  pointer-events: none;
  box-sizing: border-box;
  transition: min-height 0.15s ease;
}
.lane {
  transition: border-color 0.2s ease, background 0.2s ease;
}
.lane.drag-over {
  border-color: var(--accent) !important;
  background: var(--accent-dim) !important;
}
.touch-drag-clone {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  opacity: 0.95;
  transform: scale(1.03) rotate(1deg);
  box-shadow: var(--shadow-lg), 0 0 20px var(--accent-glow) !important;
  border-color: var(--accent) !important;
}

/* Checklist Badge on Kanban Cards */
.kanban-checklist-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}
.kanban-checklist-badge.complete {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(188, 231, 132, 0.3);
}

/* ==========================================================================
   Task Checklists / Subtasks UI
   ========================================================================== */
.checklist-progress-container {
  margin: 10px 0 16px;
}
.checklist-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.checklist-progress-track {
  height: 6px;
  background: var(--bg-inset);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.checklist-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  width: 0%;
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}
.checklist-item:hover {
  border-color: var(--border);
  background: var(--bg-hover);
}
.checklist-item.is-completed {
  opacity: 0.6;
}
.checklist-item.is-completed .checklist-title {
  text-decoration: line-through;
  color: var(--text-faint);
}
.checklist-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.checklist-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: var(--bg-elevated);
  cursor: pointer;
  position: relative;
  display: inline-grid;
  place-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin: 0;
}
.checklist-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checklist-checkbox:checked::before {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 2px solid var(--accent-contrast);
  border-bottom: 2px solid var(--accent-contrast);
  transform: rotate(-45deg) translate(1px, -1px);
}
.checklist-title {
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
  transition: color 0.15s ease;
}
.checklist-delete {
  background: none;
  border: none;
  padding: 4px;
  color: var(--text-faint);
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.checklist-item:hover .checklist-delete {
  opacity: 1;
}
.checklist-delete:hover {
  color: var(--danger);
}
.checklist-add-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.checklist-add-form input {
  flex: 1;
  font-size: 0.9rem;
  padding: 7px 12px;
}
.checklist-add-form button {
  padding: 7px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Template picker dropdown */
.checklist-template-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.checklist-template-bar select {
  font-size: 0.85rem;
  padding: 4px 10px;
  flex: 1;
}

/* Toast notifications */
.tm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated-2);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 99999;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.tm-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.tm-toast-error {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes tm-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.icon-btn.rotating svg {
  animation: tm-spin 0.6s linear infinite;
}

/* Social media Growth Charts */
.growth-chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.growth-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.growth-chart-header h3 {
  margin: 0;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.growth-chart-container {
  position: relative;
  height: 240px;
  width: 100%;
}

/* ==========================================================================
   Print & PDF Stylesheet
   ========================================================================== */
@media print {
  @page {
    margin: 15mm;
    size: auto;
  }
  html, body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
  }
  .topbar, .sidebar, .invoice-toolbar, .nav-overlay, .modal, .lightbox-modal, #tm-toast, .no-print,
  button, input[type="submit"], .btn-link, .btn-secondary {
    display: none !important;
  }
  .shell, .shell-main, main {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    background: transparent !important;
  }
  .invoice-document {
    background: #ffffff !important;
    color: #111111 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  .invoice-head h1 {
    color: #000000 !important;
    font-size: 18pt !important;
  }
  .invoice-parties {
    display: flex !important;
    justify-content: space-between !important;
    margin: 20px 0 !important;
    border-top: 1px solid #ddd !important;
    border-bottom: 1px solid #ddd !important;
    padding: 15px 0 !important;
  }
  .invoice-party {
    width: 48% !important;
  }
  .invoice-party h3 {
    color: #000000 !important;
    font-size: 12pt !important;
    margin-bottom: 8px !important;
  }
  .invoice-items-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 15px !important;
  }
  .invoice-items-table th, .invoice-items-table td {
    border: 1px solid #e0e0e0 !important;
    color: #000000 !important;
    padding: 8px 10px !important;
  }
  .invoice-items-table th {
    background: #f8f8f8 !important;
    font-weight: bold !important;
  }
  .invoice-totals {
    margin-top: 20px !important;
    text-align: right !important;
    font-size: 11pt !important;
  }
  .invoice-total-line {
    font-size: 14pt !important;
    color: #000000 !important;
    border-top: 2px solid #000000 !important;
    padding-top: 8px !important;
  }
  .tag {
    border: 1px solid #999 !important;
    color: #000000 !important;
    background: #f0f0f0 !important;
  }
  .muted {
    color: #666666 !important;
  }
}


