/* CraftiPanda Studio — modern dashboard look: cool airy canvas, white rounded
   cards, slim sidebar + clean topbar, Apple-style springy interactive buttons.
   Brand palette is unchanged; usage refined for depth, hierarchy and polish. */
:root {
  /* ---- Brand colours (unchanged) ---- */
  --bg: #f2f3f7;
  --card: #ffffff;
  --text: #191b21;
  --muted: #8a8f9e;
  --border: #e8e9ef;
  --ink: #161616;            /* black pills */
  --primary: #e8633c;        /* coral orange */
  --primary-soft: #fbe9e2;
  --primary-text: #ffffff;
  --accent: #e8262a;         /* record-dot red */
  --success: #1f9d55;
  --warn-bg: #fff3d6; --warn-text: #8a6100;
  --ok-bg: #e2f6e9; --ok-text: #176b3c;
  --danger: #d64545; --danger-bg: #fdecec; --danger-text: #a32f2f;
  --status-bg: #efeff4; --status-text: #4a4f66;
  --yt: #ff0033; --fb: #1877f2; --ig: #c13584; --tt: #00bcd4;

  /* ---- Refined surfaces & lines ---- */
  --surface-2: #f5f6fa;      /* subtle inset surface */
  --border-soft: #f0f1f6;    /* hairline */
  --nav-bg: rgba(255, 255, 255, .78);

  /* ---- Elevation tiers ---- */
  --shadow-sm: 0 1px 2px rgba(24, 26, 42, .05), 0 1px 1px rgba(24, 26, 42, .03);
  --shadow: 0 1px 2px rgba(24, 26, 42, .03), 0 12px 32px rgba(24, 26, 42, .06);
  --shadow-md: 0 2px 6px rgba(24, 26, 42, .04), 0 20px 44px rgba(24, 26, 42, .10);
  --shadow-lg: 0 14px 52px rgba(24, 26, 42, .16);

  /* ---- Motion & shape ---- */
  --ring: 0 0 0 3px rgba(232, 99, 60, .30);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);   /* playful overshoot for buttons */
  --dur: .18s;
  --radius: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --sidebar-w: 246px;
}
html[data-theme="dark"] {
  --bg: #0e1014;
  --card: #191c24;
  --text: #eceef4;
  --muted: #9aa2b8;
  --border: #2a2f3d;
  --ink: #ffffff;
  --primary-soft: #3a2417;
  --warn-bg: #383014; --warn-text: #ffd479;
  --ok-bg: #143420; --ok-text: #6fe09a;
  --danger-bg: #3a1b1b; --danger-text: #ff9d9d;
  --status-bg: #242a4a; --status-text: #aabaff;
  --surface-2: #20232c;
  --border-soft: #232733;
  --nav-bg: rgba(18, 20, 26, .72);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, .55);
  --shadow-lg: 0 16px 54px rgba(0, 0, 0, .62);
  --ring: 0 0 0 3px rgba(232, 99, 60, .42);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
  display: flex; min-height: 100vh;
}
.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
::selection { background: rgba(232, 99, 60, .22); color: var(--text); }

a { color: var(--primary); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { text-decoration: underline; }
h1 { font-size: 1.78rem; font-weight: 800; margin: .4rem 0 1.15rem; letter-spacing: -.025em; line-height: 1.18; }
h2 { font-size: 1.12rem; font-weight: 700; margin: 0 0 .85rem; letter-spacing: -.012em; }
h3 { font-size: .98rem; font-weight: 700; margin: 1rem 0 .4rem; letter-spacing: -.01em; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.15rem 0; }
code { background: var(--surface-2); padding: .12em .42em; border-radius: 6px; font-size: .88em; font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.mt { margin-top: 1.15rem; } .strike { text-decoration: line-through; }
.container { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.6rem 3rem; animation: pageRise .42s var(--ease-out) both; }
@media (max-width: 640px) { .container { padding: 1.1rem .9rem 2.4rem; } }
@keyframes pageRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Thin, calm scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ---- Icon system (one geometric stroke language everywhere in the chrome) ---- */
.si { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.9; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: -.22em; }
.side-link .si { opacity: .85; }
.side-link.active .si { opacity: 1; }

/* Emoji used inside page/card headings sit in a uniform soft chip so every
   heading across the app shares one symmetrical shape. */
.ico-chip { display: inline-flex; align-items: center; justify-content: center; width: 1.75em; height: 1.75em; font-size: .82em; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: .55em; vertical-align: -.42em; margin-right: .25em; flex: 0 0 auto; }
h1 .ico-chip { background: var(--primary-soft); border-color: transparent; border-radius: .5em; }

/* ---- Page rhythm: every page = title → one quiet subtitle → content ---- */
h1 + p.muted, .page-head + p.muted { font-size: .95rem; max-width: 72ch; line-height: 1.55; margin: -.5rem 0 1.35rem; }

/* Card titles get a hairline divider so each card reads as a complete block */
.card > h2:first-child, .card > h2:first-of-type { padding-bottom: .7rem; border-bottom: 1px solid var(--border-soft); margin-bottom: 1rem; }

/* ---- "Dive deeper" affordance: every clickable card grows an arrow on hover ---- */
a.card, a.stat, .card-link, a.sum-tile, .person-card, .board-card { position: relative; }
a.card::after, a.stat::after, .card-link::after, a.sum-tile::after, .person-card::after {
  content: "→"; position: absolute; right: .95rem; bottom: .8rem; z-index: 2;
  width: 1.7rem; height: 1.7rem; display: flex; align-items: center; justify-content: center;
  font-size: .95rem; font-weight: 800; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px;
  opacity: 0; transform: translateX(-6px) scale(.8);
  transition: opacity .18s var(--ease), transform .22s var(--spring);
  pointer-events: none;
}
a.card:hover::after, a.stat:hover::after, .card-link:hover::after, a.sum-tile:hover::after, .person-card:hover::after { opacity: 1; transform: none; }

/* ---- Sidebar ---- */
.sidebar {
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 120;
  background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1rem .8rem 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.08rem; color: var(--text); letter-spacing: -.025em; padding: .25rem .45rem .95rem; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 36px; width: 36px; object-fit: contain; background: #fff; border-radius: 11px; padding: 2px; box-shadow: var(--shadow-sm); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 800; padding: 1rem .65rem .35rem; }
.side-nav > .side-label:first-child { padding-top: .2rem; }
.side-link {
  display: flex; align-items: center; gap: .65rem;
  color: var(--muted); font-weight: 600; font-size: .93rem; padding: .52rem .65rem;
  border-radius: var(--radius-sm); white-space: nowrap; position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform .12s var(--spring);
}
.side-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.side-link:active { transform: scale(.97); }
.side-link.active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.side-link.active::before { content: ""; position: absolute; left: -0.8rem; top: 18%; bottom: 18%; width: 4px; border-radius: 0 4px 4px 0; background: var(--primary); }
.side-ico { width: 1.45rem; text-align: center; font-size: 1.02rem; flex: 0 0 auto; }
.side-group summary.side-link { cursor: pointer; list-style: none; }
.side-group summary.side-link::-webkit-details-marker { display: none; }
.side-group summary.side-link::after { content: "▾"; margin-left: auto; font-size: .7rem; color: var(--muted); transition: transform .2s var(--spring); }
.side-group[open] summary.side-link::after { transform: rotate(180deg); }
.side-sub { display: flex; flex-direction: column; gap: 2px; padding-left: .55rem; margin-top: 2px; animation: dropIn .18s var(--ease-out); }
.side-logout { margin-top: .8rem; padding: 0 .3rem; }
.side-logout .link-btn { width: 100%; text-align: left; font-weight: 600; }

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: .7rem;
  padding: .65rem 1.6rem; background: var(--nav-bg);
  border-bottom: 1px solid var(--border-soft);
  -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px);
}
.nav-search input { width: 230px; padding: .5rem 1rem .5rem 2.35rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8f9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat .85rem center / 15px; color: var(--text); margin-top: 0; transition: width .25s var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.nav-search input:focus { width: 300px; background-color: var(--card); }
.nav-count { display: inline-block; background: var(--accent); color: #fff; border-radius: 999px; font-size: .66rem; line-height: 1.4; padding: 0 .42rem; font-weight: 800; vertical-align: middle; margin-left: auto; box-shadow: 0 1px 3px rgba(232, 38, 42, .4); }
.side-link .nav-count, .side-link .chat-zero, .side-link #chatBadge { margin-left: auto; }
.nav-spacer { flex: 1; }
.nav-burger { display: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; width: 40px; height: 40px; align-items: center; justify-content: center; font-size: 1.1rem; cursor: pointer; transition: background var(--dur) var(--ease), transform .12s var(--spring); }
.nav-back { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 999px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background var(--dur) var(--ease), transform .18s var(--spring), box-shadow var(--dur) var(--ease); }
.nav-back:hover { background: var(--primary-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.nav-back:active { transform: scale(.88); }
.nav-burger:active { transform: scale(.88); }
.theme-toggle { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1rem; transition: background var(--dur) var(--ease), transform .18s var(--spring), box-shadow var(--dur) var(--ease); }
.theme-toggle:hover { background: var(--primary-soft); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.theme-toggle:active { transform: scale(.88) rotate(-14deg); }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: .42rem .7rem; border-radius: 999px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.link-btn:hover { color: var(--danger); background: var(--danger-bg); }
.inline-form { display: inline; }
.link-like { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; padding: .42rem .8rem; border-radius: 999px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.link-like:hover { background: var(--surface-2); color: var(--text); }
@keyframes dropIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
.bell { position: relative; font-size: 1.05rem; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; transition: background var(--dur) var(--ease), transform .18s var(--spring), box-shadow var(--dur) var(--ease); }
.bell:hover { background: var(--primary-soft); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.bell:active { transform: scale(.88); }
.bell-count { position: absolute; top: -4px; right: -5px; background: var(--accent); color: #fff; font-size: .66rem; font-weight: 800; border-radius: 999px; padding: 0 .35rem; min-width: 1.1rem; text-align: center; box-shadow: 0 1px 3px rgba(232, 38, 42, .45); }
.badge-dot { display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; vertical-align: super; }
.user-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .28rem .85rem .28rem .5rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: .92rem; transition: background var(--dur) var(--ease), transform .18s var(--spring), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.user-chip:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: var(--primary); }
.user-chip:active { transform: scale(.96); }
.user-chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.user-chip-av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #ef7048, var(--primary)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .88rem; flex: 0 0 auto; }
.user-chip .presence-dot { margin-right: -.15rem; }

@media (max-width: 900px) {
  .nav-burger { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100%; transform: translateX(-105%); transition: transform .28s var(--ease-out); box-shadow: none; }
  .sidebar.show { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(15, 17, 26, .45), var(--shadow-lg); }
  .topbar { padding: .55rem .9rem; }
  .nav-search { flex: 1; min-width: 0; }
  .nav-search input, .nav-search input:focus { width: 100%; }
  .nav-spacer { display: none; }
  .user-chip-name { display: none; }
  .user-chip { padding-right: .5rem; }
}

/* ---- Cards / layout ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.3rem 1.4rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.card h2 { display: flex; align-items: center; gap: .45rem; }
.card h2:first-child { margin-top: 0; }
.card-highlight { border-color: var(--primary); box-shadow: var(--shadow-md), 0 0 0 1px var(--primary) inset; }
.card-danger { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.boxed { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .85rem; background: var(--surface-2); }

/* ---- Stats ---- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 860px) { .stat-row { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
.stat { text-align: left; padding: 1.15rem 1.25rem; }
.tabnum { font-variant-numeric: tabular-nums; }
.stat-num { font-size: 2.05rem; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 600; margin-top: .15rem; }
.stat-danger .stat-num { color: var(--danger); }
.stat-hero { border-color: var(--primary); box-shadow: var(--shadow-md), 0 0 0 1px var(--primary) inset; }
.stat-hero .stat-num { color: var(--primary); }
a.stat-click { display: block; color: inherit; text-decoration: none; transition: transform .16s var(--ease-out), box-shadow .2s var(--ease), border-color .2s var(--ease); }
a.stat-click:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
a.stat-click:active { transform: translateY(-1px) scale(.99); }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .16rem .62rem; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 1.45; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--border); letter-spacing: .005em; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border-color: transparent; }
.badge-status { background: var(--status-bg); color: var(--status-text); border-color: transparent; }
.badge-format { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge-prio-low { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-prio-normal { background: var(--status-bg); color: var(--status-text); border-color: transparent; }
.badge-prio-high { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge-prio-urgent { background: var(--danger-bg); color: var(--danger-text); border-color: transparent; }
.badge-platform-youtube { background: var(--yt); color: #fff; border-color: transparent; }
.badge-platform-facebook { background: var(--fb); color: #fff; border-color: transparent; }
.badge-platform-instagram { background: var(--ig); color: #fff; border-color: transparent; }
.badge-platform-tiktok { background: var(--tt); color: #fff; border-color: transparent; }
.badge-pub-none { background: var(--surface-2); color: var(--muted); }
.badge-pub-planned { background: var(--status-bg); color: var(--status-text); border-color: transparent; }
.badge-pub-scheduled { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.badge-pub-uploaded { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.score-pill { background: var(--primary); color: #fff; padding: .16rem .68rem; border-radius: 999px; font-weight: 800; box-shadow: 0 2px 8px rgba(232, 99, 60, .3); }
.stars { color: #e8a913; letter-spacing: 1px; }

/* ---- Presence ---- */
.dot, .presence-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; background: var(--border); transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dot-green, .presence-dot[data-status="online"] { background: var(--success); box-shadow: 0 0 0 3px rgba(31, 157, 85, .22); }
.presence-dot[data-status="idle"] { background: #e8a913; box-shadow: 0 0 0 3px rgba(232, 169, 19, .2); }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; color: var(--text); }
input, select, textarea {
  width: 100%; padding: .68rem .9rem; margin-top: .25rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font: inherit; line-height: 1.4;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: var(--card); box-shadow: var(--ring); }
textarea { min-height: 6.5rem; resize: vertical; }
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%238b8f98' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .85rem center; background-size: 12px; padding-right: 2.3rem;
}
/* Restore native checkbox/radio rendering (the rule above sets appearance:none for
   text fields & selects) so the check mark shows and many can be ticked at once. */
input[type="checkbox"], input[type="radio"] { -webkit-appearance: auto; appearance: auto; width: 1.05rem; height: 1.05rem; accent-color: var(--primary); cursor: pointer; }
input[type="file"] { padding: .5rem .7rem; cursor: pointer; }
input[type="date"], input[type="datetime-local"], input[type="time"] { min-height: 2.65rem; }
.stack > * + * { margin-top: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: end; }
.form-row label { margin-bottom: 0; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-actions, .btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; align-items: center; }
.check-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .95rem; background: var(--surface-2); }
.check-group legend { font-weight: 700; font-size: .88rem; padding: 0 .35rem; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 500; margin: .3rem 0; cursor: pointer; }
.check input { width: auto; margin: 0; }
.check-row { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.note-form { display: flex; gap: .55rem; margin-bottom: 1rem; }
.note-form input { flex: 1; margin-top: 0; }
.filter-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filter-row input, .filter-row select { width: auto; margin-top: 0; flex: 1; min-width: 140px; }
.totp-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: block; margin: .6rem 0; border-radius: var(--radius-sm); background: #fff; padding: 8px; box-shadow: var(--shadow-sm); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.3rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font: inherit; font-weight: 650; font-size: .95rem; line-height: 1.2; text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--spring), box-shadow .22s var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
  -webkit-user-select: none; user-select: none;
}
.btn:hover { text-decoration: none; transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-md); border-color: var(--muted); }
.btn:active { transform: translateY(0) scale(.95); box-shadow: var(--shadow-sm); transition-duration: .08s; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[disabled], .btn.is-loading { opacity: .6; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); filter: saturate(.85); }
.btn-primary { background: linear-gradient(135deg, #ef7048, var(--primary) 52%, #d9542e); border-color: transparent; color: #fff; box-shadow: 0 2px 10px rgba(232, 99, 60, .32); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(232, 99, 60, .42); border-color: transparent; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn-dark:hover { border-color: var(--ink); }
.btn-success { background: var(--success); border-color: transparent; color: #fff; box-shadow: 0 2px 10px rgba(31, 157, 85, .3); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; box-shadow: 0 2px 10px rgba(214, 69, 69, .3); }
.btn-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn-text); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-secondary { background: var(--surface-2); }
.btn-big { font-size: 1.1rem; padding: .9rem 1.7rem; width: 100%; }
.btn-block { width: 100%; }
.btn-small { padding: .32rem .75rem; font-size: .84rem; border-radius: 999px; gap: .3rem; }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after { content: ""; position: absolute; width: 1.05em; height: 1.05em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .6s linear infinite; color: #fff; }

/* ---- Spinner / skeleton utilities ---- */
.spinner { display: inline-block; width: 1.2em; height: 1.2em; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; vertical-align: -.2em; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--radius-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.4s infinite; }
html[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
th, td { padding: .68rem .7rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
thead th { border-bottom: 1px solid var(--border); }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
table.compact th, table.compact td { padding: .38rem .55rem; }
.row-today { background: var(--status-bg); }
.row-muted { opacity: .55; }
table.matrix td.matrix-cell { min-width: 150px; }
table.matrix tbody tr:hover { background: transparent; }
.cell-menu summary { cursor: pointer; color: var(--primary); font-weight: 700; list-style: none; }
.cell-menu summary::-webkit-details-marker { display: none; }
.pub-assets summary { cursor: pointer; color: var(--primary); font-weight: 600; margin-top: .3rem; }
.pub-assets .stack > div { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.thumb-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.thumb-item { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.thumb-prev { width: 104px; height: 60px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border); cursor: pointer; display: block; transition: transform .16s var(--ease-out), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.thumb-prev:hover { border-color: var(--primary); transform: scale(1.04); box-shadow: var(--shadow); }
.thumb-dl { padding: .15rem .5rem; font-size: .78rem; }
.cell-menu .stack, .cell-menu form { margin-top: .5rem; }

/* ---- Lists ---- */
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 0; margin: 0; }
/* Every list item is a clean card-row (soft surface, rounded, spacing, hover) so all
   dashboard + page sections share one consistent card-based look. */
.row-line { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: .65rem .85rem; margin-bottom: .5rem;
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease), background .12s var(--ease); }
.row-line:hover { background: var(--card); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.row-line:last-child { margin-bottom: 0; }
.note-item { border-bottom: 1px solid var(--border-soft); padding: .55rem 0; }
.note-item:last-child { border-bottom: none; }
.log-list { max-height: 320px; overflow-y: auto; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.notif-unread { background: var(--primary-soft); border-radius: var(--radius-xs); padding: .55rem .65rem !important; }

/* ---- Kanban ---- */
.board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1.2rem; align-items: flex-start; }
.board-col { min-width: 240px; width: 240px; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; }
.board-col-title { margin: 0 0 .65rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: .4rem; }
.board-col-title .count { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 0 .5rem; font-size: .72rem; }
.board-col-cards { min-height: 40px; }
.board-col.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--primary-soft); }
.board-card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem; margin-bottom: .65rem; color: var(--text); cursor: grab; box-shadow: var(--shadow-sm); transition: transform .14s var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.board-card:hover { text-decoration: none; border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.board-card:active { cursor: grabbing; }
.board-card.dragging { opacity: .5; transform: rotate(1.5deg) scale(1.02); box-shadow: var(--shadow-lg); }
.board-card-title { font-weight: 700; margin-bottom: .35rem; line-height: 1.32; }
.board-card-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .3rem; }
.card-overdue { border-left: 4px solid var(--danger); }

/* ---- Calendar grid ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-head { font-size: .72rem; text-transform: uppercase; color: var(--muted); text-align: center; padding: .2rem 0; font-weight: 700; letter-spacing: .04em; }
.cal-cell { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-xs); min-height: 86px; padding: .3rem; font-size: .8rem; overflow: hidden; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.cal-cell:hover { border-color: var(--muted); box-shadow: var(--shadow-sm); }
.cal-empty { background: transparent; border: none; }
.cal-empty:hover { box-shadow: none; }
.cal-today { outline: 2px solid var(--primary); outline-offset: -1px; }
.cal-date { font-weight: 700; color: var(--muted); }
.cal-item { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; cursor: pointer; padding: 1px 4px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); }
.cal-done { opacity: .55; text-decoration: line-through; }
@media (max-width: 700px) { .cal-cell { min-height: 56px; } .cal-item { font-size: .58rem; } }

/* ---- Embeds / clips ---- */
.drive-embed { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #000; }
.drive-embed.tall { aspect-ratio: 16/10; }
/* Click-to-load Drive preview poster (a plain button styled as a media tile) */
.embed-lazy { display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  background-size: cover; background-position: center; background-repeat: no-repeat; position: relative; overflow: hidden; }
.embed-lazy::before { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.35); transition: background .15s var(--ease-out); }
.embed-lazy:hover::before { background: rgba(0,0,0,.18); }
.embed-play { position: relative; z-index: 1; color: #fff; font-weight: 600; background: rgba(0,0,0,.55);
  padding: .55rem 1rem; border-radius: 999px; box-shadow: var(--shadow); backdrop-filter: blur(2px); }
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filter-bar input[type=search], .filter-bar input[type=text] { flex: 1 1 200px; min-width: 150px; }
.filter-bar select { flex: 0 1 auto; }

/* ---- Team hub: per-person cards ---- */
/* 2-up grid of large square cards — the app-wide standard card arrangement */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(430px, 100%), 1fr)); gap: 1.1rem; }
.person-card { display: block; text-decoration: none; color: inherit; transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out); }
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.person-card.dim { opacity: .55; }
.person-head { display: flex; align-items: center; gap: .7rem; }
.person-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary, #f47b20); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; flex: 0 0 auto; }
.person-avatar.inline { width: 32px; height: 32px; font-size: .95rem; vertical-align: middle; }
.person-head > div:nth-child(2):not(.person-avatar) { flex: 1 1 auto; min-width: 0; }
/* Positional rule above breaks when a card has a leading control (e.g. the topic
   board's bulk-select checkbox) — it then targets the AVATAR and stretches it.
   These class-based rules are authoritative wherever the markup is explicit. */
.person-head > .person-avatar { flex: 0 0 auto; width: 42px; }
.person-head > .person-title { flex: 1 1 auto; min-width: 0; }
.donut { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.donut span { width: 40px; height: 40px; border-radius: 50%; background: var(--bg, #fff); display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; }
.person-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .8rem 0; }
.ptile { background: var(--bg-soft, #f5f5f7); border-radius: 10px; padding: .45rem .3rem; text-align: center; }
.ptile.warn { background: #fff3e0; } .ptile.danger { background: #fde8e8; } .ptile.ok { background: #e7f6ee; }
.pt-num { display: block; font-size: 1.15rem; font-weight: 700; line-height: 1.1; }
.pt-label { display: block; font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.person-bars { display: grid; gap: .45rem; }
.pbar-row { display: grid; grid-template-columns: 1fr 90px 34px; align-items: center; gap: .5rem; }
.pbar-row .progress { margin: 0; }
.progress-fill.alt { background: var(--accent, #e8262a); }
.stat-warn .stat-num { color: var(--primary, #f47b20); }
.stat-ok .stat-num { color: var(--success, #1f9d55); }
.text-danger { color: var(--accent, #e8262a); }

/* ---- Projects hub: one Team-style card holding every stage as a clickable tile ---- */
.proj-hub-tiles { grid-template-columns: repeat(4, 1fr); gap: .6rem; }
@media (max-width: 900px) { .proj-hub-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .proj-hub-tiles { grid-template-columns: repeat(2, 1fr); } }
a.ptile { position: relative; text-decoration: none; color: inherit; padding: .85rem .4rem .7rem; transition: transform .18s var(--spring), box-shadow .15s var(--ease), background .15s var(--ease); }
a.ptile:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm), 0 0 0 1px var(--primary) inset; background: var(--card); text-decoration: none; }
a.ptile:active { transform: scale(.96); }
.pt-ico { display: block; font-size: 1.05rem; margin-bottom: .15rem; }
.proj-hub-tiles .pt-num { font-size: 1.5rem; }
.pt-share { position: absolute; top: .4rem; right: .5rem; font-size: .62rem; font-weight: 800; color: var(--muted); background: var(--card); border-radius: 999px; padding: .02rem .35rem; }

/* Delivered videos: one labeled tile per format with persistent preview + download */
.fmt-list { display: grid; gap: .8rem; }
.fmt-card { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: .85rem .95rem; display: grid; gap: .6rem; }
.fmt-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.fmt-head strong { margin-right: .2rem; }

/* Project overview fact tiles: short text values instead of numbers */
.proj-facts { grid-template-columns: repeat(3, 1fr); gap: .55rem; }
@media (max-width: 620px) { .proj-facts { grid-template-columns: repeat(2, 1fr); } }
.pt-text { font-size: .92rem; line-height: 1.25; }
.pt-plats { display: flex; gap: .25rem; justify-content: center; flex-wrap: wrap; font-size: .8rem; }

/* Hub container body: nested cards sit inset on a soft surface, and lift back to
   white on hover — same parent→child language as the dashboard drill cards */
.hub-body { margin-top: 1.05rem; padding-top: 1.05rem; border-top: 1px solid var(--border-soft); }
/* Nested entries render as flat pastel tiles — the same visual language as the hub's
   stage tiles: soft tint by state, no border/shadow, springy lift on hover */
.hub-body .people-grid .card { background: var(--surface-2); border: none; box-shadow: none; border-radius: var(--radius-md); margin-bottom: 0; transition: transform .18s var(--spring), box-shadow .18s var(--ease), background .15s var(--ease); }
.hub-body .people-grid .card.tile-danger { background: var(--danger-bg); }
.hub-body .people-grid .card.tile-warn { background: var(--warn-bg); }
.hub-body .people-grid .card.tile-ok { background: var(--ok-bg); }
.hub-body .people-grid .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hub-body .people-grid .card .badge { background: var(--card); border-color: transparent; }
.hub-body .people-grid .card .badge-danger { background: var(--danger); color: #fff; }
.hub-body .people-grid .card .badge-warn { background: #e8a913; color: #fff; }
.hub-body .people-grid .card .badge-ok { background: var(--success); color: #fff; }
.hub-body .people-grid .card [class*="badge-platform-"] { color: #fff; }
.hub-body .people-grid .card .badge-platform-youtube { background: var(--yt); }
.hub-body .people-grid .card .badge-platform-facebook { background: var(--fb); }
.hub-body .people-grid .card .badge-platform-instagram { background: var(--ig); }
.hub-body .people-grid .card .badge-platform-tiktok { background: var(--tt); }
.hub-body .board-col { background: var(--card); }
.proj-hub > .person-head .inline-form { flex: 0 0 auto; }
.proj-hub > .person-head .inline-form input { margin-top: 0; width: auto; }

/* ---- Compact pipeline tiles (dashboard variant of the status cards) ---- */
.status-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: .8rem; margin-bottom: 1.35rem; }
.status-tile { display: flex; flex-direction: column; gap: .05rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: .8rem .95rem; color: inherit; box-shadow: var(--shadow-sm); transition: transform .18s var(--spring), box-shadow .18s var(--ease), border-color .18s var(--ease); }
.status-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
.status-tile:active { transform: scale(.97); }
.stt-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .2rem; }
.stt-ico { font-size: .98rem; }
.stt-pct { font-size: .68rem; font-weight: 800; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .05rem .45rem; }
.stt-count { font-size: 1.65rem; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stt-label { font-size: .68rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-tile.danger .stt-count { color: var(--danger); }
.status-tile.ok .stt-count { color: var(--success); }
.status-tile.warn .stt-count { color: var(--primary); }

/* ---- Dashboard zones: sub-headers, half-width lists, stacked columns ---- */
.sub-h { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin: 0 0 .55rem; }
.dash-list { display: grid; gap: .8rem; }
.dash-list .card { margin-bottom: 0; }
.dash-col { display: grid; gap: 1.25rem; align-content: start; }
.dash-col .card { margin-bottom: 0; }
.grid-2 > div > .sub-h { margin-top: .15rem; }
.grid-2 { row-gap: 1.5rem; }
.inv-grid-2 { grid-template-columns: repeat(2, 1fr); }

/* ---- Projects status summary cards (Team-card style) ---- */
.status-ico { font-size: 1.25rem; }
.status-ico.warn { background: var(--primary, #f47b20); }
.status-ico.danger { background: var(--accent, #e8262a); }
.status-ico.ok { background: var(--success, #1f9d55); }
.status-card.warn { border-left: 4px solid var(--primary, #f47b20); }
.status-card.danger { border-left: 4px solid var(--accent, #e8262a); }
.status-card.ok { border-left: 4px solid var(--success, #1f9d55); }
.status-card-foot { margin-top: .9rem; display: flex; align-items: baseline; gap: .5rem; }
.big-count { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.proj-card-head { min-width: 0; }
.proj-card-badges { margin: .7rem 0 0; }
.proj-card.is-overdue { border-left: 4px solid var(--accent, #e8262a); }
.mt-xs { margin-top: .15rem; }
.section-h { font-size: 1.12rem; font-weight: 700; margin: 1.4rem 0 .2rem; letter-spacing: -.012em; }
/* Per-account destination cards (Publishing) + login detail blocks */
.dest-list { display: grid; gap: .6rem; margin-top: .7rem; }
.dest-card { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: .75rem .85rem; display: grid; gap: .5rem; transition: border-color .12s var(--ease), box-shadow .12s var(--ease); }
.dest-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.dest-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dest-head strong { margin-right: auto; }
.dest-login { display: grid; gap: .2rem; }
.dest-login .muted { font-weight: 600; }

/* ---- Shared page summary tiles (Team-style stat strip atop the main pages) ---- */
.summary-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.sum-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: .15rem; text-decoration: none; color: inherit; transition: transform .12s var(--ease-out), box-shadow .12s var(--ease-out); }
a.sum-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.sum-tile .st-num { font-size: 1.7rem; font-weight: 800; line-height: 1.05; }
.sum-tile .st-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.sum-tile.warn { border-left: 4px solid var(--primary, #f47b20); }
.sum-tile.danger { border-left: 4px solid var(--accent, #e8262a); }
.sum-tile.danger .st-num { color: var(--accent, #e8262a); }
.sum-tile.ok { border-left: 4px solid var(--success, #1f9d55); }
.sum-tile.ok .st-num { color: var(--success, #1f9d55); }

/* Soft-card look for list items inside cards (Approvals / Upscale), with a gentle hover */
.note-item { background: var(--surface-2); border: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: .75rem .85rem; margin-bottom: .6rem; transition: box-shadow .12s var(--ease-out), border-color .12s var(--ease-out); }
.note-item:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.note-item:last-child { border-bottom: 1px solid var(--border-soft); }

/* ---- App-wide tactile polish: any clickable card/tile lifts on hover and presses on click,
   so every dashboard, page, project card, media item and list row feels part of one system ---- */
a.card, a.stat, .card-link {
  color: inherit; text-decoration: none;
  transition: transform .14s var(--ease-out), box-shadow .18s var(--ease), border-color .18s var(--ease);
}
a.card:hover, a.stat:hover, .card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
a.card:active, a.stat:active, .card-link:active { transform: translateY(0) scale(.995); box-shadow: var(--shadow-sm); }
.board-card:active { transform: translateY(0) scale(.99); box-shadow: var(--shadow-sm); }
.person-card:active, .sum-tile:active { transform: translateY(0) scale(.995); }
/* Clickable list rows / note items that wrap a link get a pointer + gentle press */
.row-line:active, .note-item:active { transform: scale(.997); }
/* Respect reduced-motion preferences across all the above */
@media (prefers-reduced-motion: reduce) {
  a.card, a.stat, .card-link, .board-card, .person-card, .sum-tile, .btn { transition: none; }
  a.card:hover, a.stat:hover, .card-link:hover, .board-card:hover, .person-card:hover { transform: none; }
}
.clip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 1100px) { .clip-grid { grid-template-columns: 1fr; } }
.clip-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .9rem; background: var(--surface-2); }
.clip-pinned { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.clip-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.clip-comment { padding: .3rem 0; border-top: 1px dashed var(--border); }

/* ---- Inventory / misc ---- */
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
@media (max-width: 700px) { .inv-grid { grid-template-columns: repeat(2, 1fr); } }
.inv-cell { text-align: center; padding: .9rem .4rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); transition: transform .14s var(--ease-out), box-shadow var(--dur) var(--ease); }
.inv-cell:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.inv-num { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.inv-platform { margin-bottom: .35rem; }
.template-chip { display: inline-flex; align-items: center; gap: .2rem; }

/* ---- Countdown timers ---- */
.cd { display: inline-flex; align-items: center; gap: .4rem; vertical-align: middle; }
.cd-ring { flex-shrink: 0; }
.cd-track { stroke: var(--border); }
.cd-bar { transition: stroke-dashoffset 1s linear, stroke .3s ease; }
.cd-label { font-size: .8rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd.green  .cd-bar { stroke: #1f9d55; } .cd.green  .cd-label { color: #1f9d55; }
.cd.orange .cd-bar { stroke: #e8a913; } .cd.orange .cd-label { color: #b07d00; }
.cd.red    .cd-bar { stroke: var(--danger); } .cd.red .cd-label { color: var(--danger); }
.cd.over   .cd-bar { stroke: var(--danger); } .cd.over .cd-label { color: var(--danger); }
.cd.blink  .cd-bar { stroke: var(--danger); } .cd.blink .cd-label { color: var(--danger); }
.cd.blink  { animation: cdblink 1s steps(1) infinite; }
@keyframes cdblink { 50% { opacity: .25; } }
.cd.paused .cd-bar { stroke: var(--muted); } .cd.paused .cd-label { color: var(--muted); }
.cd-big .cd-label { font-size: 1.05rem; }

/* Urgent-deadline chip in the notice bar */
.notice-deadline { gap: .55rem; }
.notice-deadline.cd-orange { background: var(--warn-bg); border-color: var(--warn-text); color: var(--warn-text); }
.notice-deadline.cd-red { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); }

/* ---- Daily goal card ---- */
.goal-card { border-color: var(--primary); box-shadow: var(--shadow-md), 0 0 0 1px var(--primary) inset; }
.goal-card.goal-met { border-color: var(--success); box-shadow: var(--shadow-md), 0 0 0 1px var(--success) inset; }
.goal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.goal-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin: .4rem 0 .6rem; }
.goal-big { font-size: 2.6rem; font-weight: 800; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.goal-big .muted { font-size: 1.4rem; }
.goal-progress { height: 16px; }

/* ---- Dashboard charts ---- */
.chart-box { position: relative; height: 260px; }
@media (max-width: 600px) { .chart-box { height: 220px; } }
/* Doughnut charts: fixed heights + a soft drop shadow so the ring reads with depth */
.chart-donut { height: 250px; }
.chart-donut-sm { height: 195px; }
.chart-donut canvas, .chart-donut-sm canvas { filter: drop-shadow(0 8px 14px rgba(24, 26, 42, .16)); }
html[data-theme="dark"] .chart-donut canvas, html[data-theme="dark"] .chart-donut-sm canvas { filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .5)); }

/* ---- Drill-down cards: one Team-style card per category; expands in place to
   nested category cards, which expand to item cards, which link to detail pages ---- */
details.drill { justify-content: flex-start; }
details.drill > summary { cursor: pointer; list-style: none; }
details.drill > summary::-webkit-details-marker { display: none; }
.drill-sum .person-tiles { margin: .9rem 0 0; }
.drill-chev { margin-left: .4rem; color: var(--muted); font-size: .85rem; transition: transform .25s var(--spring); flex: 0 0 auto; }
details.drill[open] > summary .drill-chev, details.sub-drill[open] > summary .drill-chev { transform: rotate(180deg); }
details.drill > summary:hover strong { color: var(--primary); }
.drill-body { margin-top: 1.05rem; padding-top: 1.05rem; border-top: 1px solid var(--border-soft); display: grid; gap: .8rem; animation: dropIn .2s var(--ease-out); }
.drill > summary .big-count { font-size: 1.8rem; }
.sub-drill { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: .8rem .95rem; transition: border-color .15s var(--ease); }
.sub-drill:hover { border-color: var(--border); }
.sub-drill > summary { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .95rem; cursor: pointer; list-style: none; }
.sub-drill > summary::-webkit-details-marker { display: none; }
.sub-drill[open] > summary { margin-bottom: .9rem; }
.count-pill { margin-left: auto; background: var(--card); border: 1px solid var(--border); border-radius: 999px; font-size: .78rem; font-weight: 800; padding: .05rem .6rem; font-variant-numeric: tabular-nums; }
.count-pill.danger { background: var(--danger-bg); color: var(--danger-text); border-color: transparent; }
.count-pill.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
/* Drill cards expand in place — no "navigate" arrow on hover */
details.drill::after { content: none !important; }

/* 2-up grid of large square category cards; the open card spans the full row */
.drill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; margin-bottom: 1.25rem; }
.drill-grid > details.drill { margin-bottom: 0; min-height: 170px; }
.drill-grid > details.drill:not([open]) { justify-content: center; }
.drill-grid > details.drill[open] { grid-column: 1 / -1; }
@media (max-width: 980px) { .drill-grid { grid-template-columns: 1fr; } .drill-grid > details.drill { min-height: 0; } }

/* Project cards share the Team-card anatomy — dark avatar distinguishes projects from people */
.proj-avatar { background: linear-gradient(135deg, #3d4250, #1c1f27); }
.person-card { min-height: 96px; display: flex; flex-direction: column; justify-content: center; gap: .15rem; }
.person-card .person-tiles, .person-card .person-bars { margin-bottom: 0; }
.pipe-zone > .card { margin-bottom: 0; }
.pipe-zone { margin-bottom: 1.35rem; align-items: stretch; }
.pipe-zone .status-tiles { margin-bottom: 0; }

/* ---- Inline media previews ---- */
.inline-preview { width: 100%; margin-top: .6rem; flex-basis: 100%; animation: fadeIn .25s var(--ease-out); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.preview-video { width: 100%; max-height: 62vh; border-radius: var(--radius-sm); background: #000; box-shadow: var(--shadow); }
.preview-img { max-width: 100%; max-height: 62vh; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; box-shadow: var(--shadow); }
.preview-frame { width: 100%; height: 72vh; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow); }

/* ---- Delivered-video platform player ---- */
.rv-delivery { display: grid; gap: .5rem; margin: .3rem 0 .2rem; }
.rv-player { width: 100%; min-height: 3rem; }
.rv-player .preview-video { max-height: 58vh; }
.rv-player .preview-frame { height: 58vh; }
.rv-plat-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.rv-plat-btn .badge { pointer-events: none; }

/* ---- Independent per-format delivery ---- */
.deliver-fmt { border: 1px solid var(--border-soft); border-radius: var(--radius-md); background: var(--surface-2); padding: .75rem .85rem; margin: .6rem 0; }
.deliver-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; margin-bottom: .4rem; }
.deliver-options { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: .6rem; }
.deliver-options .deliver-upload, .deliver-options .deliver-link { display: grid; gap: .4rem; }
.deliver-or { align-self: center; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.deliver-fmt label.small { display: grid; gap: .25rem; margin: 0; }
.deliver-details { margin-top: .8rem; }
.deliver-details summary { cursor: pointer; font-weight: 600; }
.send-back { margin-top: .8rem; border-top: 1px solid var(--border-soft); padding-top: .6rem; }
.send-back summary { cursor: pointer; font-weight: 600; color: var(--warn, #b26b00); }
.badge-seq { background: var(--accent); color: #fff; font-weight: 800; border-radius: 6px; padding: .1em .5em; font-size: .62em; vertical-align: middle; letter-spacing: .02em; }
.req-block { border: 1px solid var(--danger, #e8262a); background: color-mix(in srgb, var(--danger, #e8262a) 8%, transparent); border-radius: var(--radius-sm); padding: .6rem .8rem; margin: .6rem 0; }
.idea-list { display: grid; gap: .5rem; }
.idea-item { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: .6rem .75rem; background: var(--surface-2); cursor: pointer; }
.idea-item input[type=checkbox] { margin-top: .25rem; flex: none; }
.idea-item:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 640px) { .deliver-options { grid-template-columns: 1fr; } .deliver-or { justify-self: start; } }

/* ---- Notification bar ---- */
.notice-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.notice-chip {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1.05rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm);
  transition: transform .14s var(--ease-out), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.notice-chip:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.notice-live { background: var(--danger-bg); border-color: var(--danger); color: var(--danger-text); animation: pulse 1.6s infinite; }
.chat-zero { color: var(--success); font-size: .75rem; font-weight: 800; vertical-align: middle; }

/* ---- Flash / banner ---- */
.flash { padding: .85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-weight: 600; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: .5rem; animation: flashIn .3s var(--ease-out); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--danger-bg); color: var(--danger-text); }
.flash-warn { background: var(--warn-bg, #fff4e5); color: var(--warn-text, #7a4a00); border: 1px solid var(--warn-border, #f0c27a); }
.announcement-banner { background: linear-gradient(120deg, var(--primary-soft), var(--card)); border: 1px solid var(--primary); color: var(--text); border-radius: var(--radius); padding: .95rem 1.15rem; margin-bottom: 1.25rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; box-shadow: var(--shadow-sm); }

/* ---- Auth ---- */
.auth-wrap { display: flex; justify-content: center; padding-top: 7vh; }
.auth-card { width: 100%; max-width: 410px; padding: 2rem 1.9rem; box-shadow: var(--shadow-lg); }
.auth-logo { display: block; height: 88px; margin: 0 auto .6rem; background: #fff; border-radius: 20px; padding: 10px; box-shadow: var(--shadow); }
.branding-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.branding-preview { height: 80px; width: 80px; object-fit: contain; background: #fff; border-radius: 16px; padding: 8px; box-shadow: var(--shadow-sm); }
.auth-title { text-align: center; margin-bottom: .15rem; }
.login-admin-opts { text-align: left; }
.login-admin-opts summary { cursor: pointer; list-style: none; }
.login-admin-opts summary::-webkit-details-marker { display: none; }
.login-admin-opts[open] { background: var(--surface-2); border-radius: var(--radius-sm); padding: .65rem .8rem; }

/* ---- Progress / clock ---- */
.progress { height: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width .5s var(--ease-out); }
.clock-status { font-size: 1.15rem; font-weight: 700; }

/* ---- Team rows ---- */
.emp-row { border-bottom: 1px solid var(--border-soft); padding: .6rem 0; }
.emp-row summary { cursor: pointer; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; list-style: none; }
.emp-row summary::-webkit-details-marker { display: none; }
.emp-edit { padding: .85rem 0 .4rem; }
.emp-inactive summary { opacity: .55; }
.edit-hint { margin-left: auto; color: var(--primary); font-weight: 600; font-size: .82rem; white-space: nowrap; opacity: .8; }
.emp-row summary:hover .edit-hint { opacity: 1; text-decoration: underline; }
.emp-row[open] .edit-hint { opacity: .5; }

/* ---- Chat ---- */
.chat-layout { display: grid; grid-template-columns: 270px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .chat-layout { grid-template-columns: 1fr; } .chat-side { order: 2; } }
.chat-chan { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; border-radius: var(--radius-xs); color: var(--text); font-weight: 600; transition: background .12s var(--ease), color .12s var(--ease); }
.chat-chan.active, .chat-chan:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.unread-badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .42rem; font-weight: 800; }
/* DM rows in the channel sidebar: one tidy line — name grows + truncates, call button stays right */
.chat-side .row-line { flex-wrap: nowrap; padding: .4rem .55rem; }
.chat-side .row-line .inline-form { flex: 1 1 auto; min-width: 0; display: block; }
.chat-side .row-line .inline-form .link-btn { width: 100%; text-align: left; padding: .25rem .35rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-side .row-line .inline-form .link-btn:hover { color: var(--primary); background: var(--primary-soft); }
.chat-side .call-btn { flex: 0 0 auto; padding: .2rem .35rem; }
.chat-main { display: flex; flex-direction: column; min-height: 70vh; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chat-search { width: 180px; }
.chat-messages { flex: 1; overflow-y: auto; max-height: 56vh; padding: .5rem 0; display: flex; flex-direction: column; gap: .55rem; }
.chat-msg { max-width: 82%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: .55rem .8rem; box-shadow: var(--shadow-sm); animation: fadeIn .2s var(--ease-out); }
.chat-msg.mine { align-self: flex-end; background: var(--primary-soft); border-color: transparent; }
.chat-msg-body { white-space: pre-wrap; word-break: break-word; }
.chat-img { max-width: 240px; border-radius: var(--radius-xs); margin-top: .3rem; }
.chat-file { display: inline-block; margin-top: .3rem; padding: .4rem .7rem; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2, rgba(0,0,0,.04)); font-size: .85rem; text-decoration: none; }
.chat-file:hover { text-decoration: underline; }

/* ---- Dashboard cheers (celebration / encouragement) ---- */
.cheer-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.4); padding: 1rem; animation: flashIn .25s var(--ease-out); }
.cheer-overlay.cheer-hide { opacity: 0; transition: opacity .35s ease; }
.cheer-canvas { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cheer-cards { position: relative; display: flex; flex-direction: column; gap: 1rem; width: 100%; max-width: 420px; }
.cheer-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 1.7rem 1.4rem; text-align: center; animation: cheerPop .4s var(--ease-out); }
.cheer-card h2 { margin: .3rem 0 .5rem; }
.cheer-card.celebrate { border-top: 5px solid var(--ok-text, #2e7d32); }
.cheer-card.revise { border-top: 5px solid var(--warn-border, #f0c27a); }
.cheer-card.note { border-top: 5px solid var(--primary, #3ca0e8); }
.cheer-emoji { font-size: 3rem; line-height: 1; }
.cheer-emoji.cheer-sad { display: inline-block; animation: cheerShake .7s var(--ease-out); }
.cheer-encourage { font-weight: 700; margin-top: .6rem; }
.cheer-close { margin-top: .9rem; }
@keyframes cheerPop { from { transform: scale(.82); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes cheerShake { 0%,100%{transform:rotate(0)} 20%{transform:rotate(-9deg)} 40%{transform:rotate(8deg)} 60%{transform:rotate(-5deg)} 80%{transform:rotate(3deg)} }
@media (prefers-reduced-motion: reduce) { .cheer-card, .cheer-emoji.cheer-sad { animation: none; } }
.chat-embed { max-width: 340px; }
.chat-input { display: flex; gap: .5rem; margin-top: .6rem; align-items: center; }
.chat-input input { flex: 1; margin-top: 0; }
.attach-btn { cursor: pointer; font-size: 1.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .3rem .6rem; transition: background var(--dur) var(--ease), transform .08s var(--ease); }
.attach-btn:hover { background: var(--primary-soft); }
.attach-btn:active { transform: scale(.92); }
.attach-btn.recording { background: var(--danger-bg); border-color: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(214, 69, 69, .18); } }
.ticks { font-size: .75rem; color: var(--muted); margin-left: .4rem; letter-spacing: -1px; vertical-align: baseline; }
.ticks.read { color: var(--primary); }
.chat-audio { width: 260px; margin-top: .3rem; display: block; }
.chat-video { max-width: 300px; border-radius: var(--radius-sm); margin-top: .3rem; display: block; }
.typing { min-height: 1.2em; }

/* ---- Docs ---- */
.docs-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 860px) { .docs-layout { grid-template-columns: 1fr; } }
.docs-niche { margin-top: .6rem; text-transform: uppercase; font-size: .7rem !important; letter-spacing: .05em; }
.active-link { font-weight: 800; color: var(--primary); }
.docs-body { font-size: 1rem; }

/* ---- Meetings ---- */
.jitsi-frame { width: 100%; height: 70vh; border: none; border-radius: var(--radius-sm); background: #000; }
.meet-tools { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 .4rem; }
.meet-tool { font-size: .82rem; background: var(--surface-2, rgba(0,0,0,.04)); border: 1px solid var(--border-soft); border-radius: 999px; padding: .3rem .7rem; white-space: nowrap; }

/* ---- Heatmap ---- */
.heatmap { overflow-x: auto; }
.heat-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.heat-name { width: 70px; flex-shrink: 0; font-size: .78rem; font-weight: 700; }
.heat-cell { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---- Files ---- */
.file-name { word-break: break-all; max-width: 320px; display: inline-block; }
.file-thumb { height: 44px; width: 70px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--border); }
.content-preview { max-width: 100%; max-height: 60vh; border-radius: var(--radius-sm); border: 1px solid var(--border); }
video.drive-embed { object-fit: contain; }
.upload-form input[type=file] { background: var(--card); }
.upload-progress { margin-top: .6rem; display: flex; align-items: center; gap: .8rem; }
.upload-progress .progress { flex: 1; }

/* ---- Dashboard header (plain greeting row — no horizontal banner card) ---- */
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: .35rem 0 1.35rem; }
.dash-head-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* ---- Dashboard hero (greeting band) ---- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: 1.25rem 1.5rem; background: linear-gradient(120deg, var(--primary-soft) 0%, var(--card) 58%); border: 1px solid var(--border); }
.hero-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.hero-daycircle {
  width: 86px; height: 86px; border-radius: 50%; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; background: var(--card); box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}
.hero-datetext { line-height: 1.25; color: var(--muted); font-weight: 600; border-right: 1px solid var(--border); padding-right: 1.2rem; }
.hero-datetext strong { color: var(--text); font-size: 1.05rem; }
.hero-right { text-align: right; }
.hero-greet { font-size: 1.65rem; font-weight: 800; letter-spacing: -.03em; }
.hero-sub { font-size: 1rem; color: var(--muted); font-weight: 600; }
@media (max-width: 860px) { .hero { padding: 1.3rem 1.3rem; } .hero-right { text-align: left; } .hero-greet { font-size: 1.55rem; } }

/* ---- Touch refinements ---- */
@media (max-width: 640px) {
  h1 { font-size: 1.5rem; }
  .card { padding: 1.1rem 1.1rem; border-radius: var(--radius-md); }
  .btn { padding: .68rem 1.25rem; }
  .btn-small { padding: .4rem .8rem; }
}

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

/* ---- Delete-message button ---- */
.msg-del { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .82rem; opacity: .4; padding: 0 .15rem; vertical-align: baseline; transition: opacity .12s var(--ease), color .12s var(--ease); }
.chat-msg:hover .msg-del { opacity: 1; }
.msg-del:hover { color: var(--danger); }

/* ---- Reply ("quote") feature ---- */
.msg-reply { background: none; border: none; cursor: pointer; color: var(--muted); font-size: .82rem; opacity: .4; padding: 0 .15rem; vertical-align: baseline; transition: opacity .12s var(--ease), color .12s var(--ease); }
.chat-msg:hover .msg-reply { opacity: 1; }
.msg-reply:hover { color: var(--primary); }
/* The quoted message shown inside a reply */
.chat-reply-quote { display: flex; flex-direction: column; gap: .05rem; margin: .15rem 0 .35rem; padding: .3rem .55rem; cursor: pointer;
  border-left: 3px solid var(--primary); border-radius: 7px; background: rgba(127,127,127,.10); font-size: .82rem; line-height: 1.3; }
.chat-reply-quote strong { color: var(--primary); font-size: .78rem; }
.chat-reply-quote span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chat-msg.mine .chat-reply-quote { background: rgba(255,255,255,.18); }
/* The composer bar that shows what you're replying to */
.chat-reply-bar { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; padding: .45rem .7rem;
  border-left: 3px solid var(--primary); border-radius: 8px; background: var(--surface-2); }
.chat-reply-bar[hidden] { display: none; }
.chat-reply-bar .crb-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.chat-reply-bar .crb-snip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-reply-bar .crb-cancel { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 1rem; padding: 0 .2rem; }
.chat-reply-bar .crb-cancel:hover { color: var(--danger); }
/* Brief highlight when you jump to a quoted message */
.chat-msg.flash-hl { animation: chatFlash 1.6s var(--ease-out); }
@keyframes chatFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--ring, rgba(108,76,241,.5)); } 100% { box-shadow: var(--shadow-sm); } }

/* ---- Emoji reactions ---- */
.msg-react { background: none; border: none; cursor: pointer; font-size: .82rem; opacity: .35; padding: 0 .15rem; vertical-align: baseline; transition: opacity .12s var(--ease), transform .15s var(--spring); }
.chat-msg:hover .msg-react { opacity: 1; }
.msg-react:hover { transform: scale(1.25); }
.msg-reactions { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .35rem; }
.msg-reactions[hidden] { display: none; }
.react-chip {
  display: inline-flex; align-items: center; gap: .25rem; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  font-size: .8rem; font-weight: 700; padding: .08rem .55rem; color: var(--muted);
  transition: transform .18s var(--spring), border-color .12s var(--ease), background .12s var(--ease);
}
.react-chip:hover { transform: translateY(-1px) scale(1.06); border-color: var(--primary); }
.react-chip.mine { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.react-picker {
  position: absolute; z-index: 1300; display: flex; gap: .1rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow-lg); padding: .3rem .45rem; animation: dropIn .16s var(--ease-out);
}
.react-picker[hidden] { display: none; }
.react-picker button { background: none; border: none; cursor: pointer; font-size: 1.25rem; line-height: 1; padding: .2rem .28rem; border-radius: 10px; transition: transform .18s var(--spring), background .12s var(--ease); }
.react-picker button:hover { transform: scale(1.35) translateY(-2px); background: var(--surface-2); }
.chat-msg-body.big-emoji { font-size: 2.3rem; line-height: 1.15; }

/* ---- Demo-mode ribbon: persistent reminder that this is the isolated sandbox ---- */
.demo-ribbon {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap;
  margin: -1.5rem -1.6rem 1.3rem; padding: .6rem 1.1rem;
  background: repeating-linear-gradient(135deg, #e8a913 0 18px, #f0b93a 18px 36px);
  color: #3a2a00; font-weight: 700; font-size: .9rem; text-align: center;
  box-shadow: var(--shadow-sm);
}
.demo-ribbon strong { text-transform: uppercase; letter-spacing: .04em; }
.demo-ribbon .link-btn { color: #3a2a00; text-decoration: underline; font-weight: 800; padding: 0 .2rem; }
.demo-ribbon .link-btn:hover { background: rgba(0,0,0,.08); color: #000; }
@media (max-width: 640px) { .demo-ribbon { margin: -1.1rem -.9rem 1.1rem; font-size: .82rem; } }

/* ---- Topbar workspace switcher (admins only) ---- */
.ws-switch { position: relative; flex: 0 0 auto; }
.ws-switch > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem;
  padding: .4rem .8rem; border-radius: 999px; font-weight: 700; font-size: .88rem; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform .18s var(--spring); }
.ws-switch > summary::-webkit-details-marker { display: none; }
.ws-switch > summary:hover { border-color: var(--primary); transform: translateY(-1px); }
.ws-current.is-demo { background: repeating-linear-gradient(135deg, #f0b93a 0 10px, #e8a913 10px 20px); color: #3a2a00; border-color: transparent; }
.ws-caret { font-size: .7rem; opacity: .7; }
.ws-menu { position: absolute; top: 130%; right: 0; z-index: 300; min-width: 250px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: .45rem; display: flex; flex-direction: column; gap: .12rem; animation: dropIn .16s var(--ease-out); }
.ws-menu-head { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: .35rem .6rem .2rem; }
.ws-opt { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font: inherit; font-weight: 600;
  padding: .55rem .6rem; border-radius: var(--radius-xs); color: var(--text); transition: background .12s var(--ease); }
.ws-opt:hover { background: var(--surface-2); }
.ws-opt.on { background: var(--primary-soft); color: var(--primary); }
.ws-menu-foot { padding: .4rem .6rem 0; border-top: 1px solid var(--border-soft); margin-top: .2rem; line-height: 1.4; }
@media (max-width: 640px) { .ws-switch > summary span:not(.ws-caret) { display: none; } }

/* Workspace-choice popup: stacked full-width option buttons */
.mode-choices { display: grid; gap: .6rem; margin: 1.1rem 0 .3rem; }
.mode-choices .btn { justify-content: flex-start; }

/* ---- Blocking announcement modal: blurred backdrop, everything disabled until OK ---- */
.ann-overlay {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(15, 17, 26, .45);
  -webkit-backdrop-filter: blur(7px) saturate(120%); backdrop-filter: blur(7px) saturate(120%);
  animation: flashIn .25s var(--ease-out);
}
.ann-modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 2rem 1.9rem 1.4rem; width: 100%; max-width: 480px;
  text-align: center; animation: cheerPop .4s var(--ease-out);
}
.ann-ico { font-size: 3rem; line-height: 1; margin-bottom: .4rem; }
.ann-modal h2 { margin: 0 0 .15rem; }
.ann-body { text-align: left; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: .95rem 1.05rem; margin: 1rem 0 1.2rem; font-weight: 600; line-height: 1.55; max-height: 42vh; overflow-y: auto; }
.ann-foot { margin-top: .9rem; }
/* Announcement history cards */
.ann-hist-body { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-md); padding: .75rem .9rem; margin: .8rem 0 .7rem; font-weight: 600; line-height: 1.5; }
.ann-edit summary { list-style: none; display: inline-flex; cursor: pointer; }
.ann-edit summary::-webkit-details-marker { display: none; }
.ann-edit { display: inline-block; }
.ann-edit[open] { display: block; width: 100%; }
/* Announcement composer: message + audience multi-select */
.ann-post-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-top: .7rem; }
.ann-aud { flex: 1 1 280px; font-weight: 600; }
.ann-aud select { margin-top: .3rem; min-height: 9.5rem; }

/* ---- Timed confirmation modal ---- */
.tc-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 2000; animation: fadeIn .15s var(--ease-out); }
.tc-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 1.5rem 1.4rem; max-width: 400px; width: 90%; text-align: center; }
.tc-msg { font-weight: 600; line-height: 1.5; margin-bottom: 1.1rem; }
.tc-actions { display: flex; gap: .6rem; justify-content: center; }
.tc-ok:disabled { opacity: .6; cursor: not-allowed; }

/* ---- Voice call overlay ---- */
.call-overlay { position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 1000; }
.call-overlay[hidden] { display: none; }
.call-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; min-width: 230px; text-align: center; animation: dropIn .18s var(--ease-out); }
.call-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; }
.call-status { color: var(--muted); font-weight: 600; margin: .35rem 0 .7rem; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ---- Live meeting participant roster ---- */
.mtg-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .6rem; }
.mtg-att { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm, 12px); background: var(--card); }
.mtg-av { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .82rem; color: #fff; background: linear-gradient(135deg, var(--brand, #6c4cf1), #9b6cff); }
.mtg-att-meta { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1 1 auto; }
.mtg-att-meta strong { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Lightweight toast (ring accept/decline feedback for the host) ---- */
.cp-toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, 1.5rem); z-index: 1100;
  background: var(--card); color: var(--text, inherit); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: .7rem 1.1rem; font-weight: 600; opacity: 0; transition: opacity .3s var(--ease-out), transform .3s var(--ease-out); }
.cp-toast.in { opacity: 1; transform: translate(-50%, 0); }

/* ---- Print ---- */
@media print {
  .sidebar, .topbar, .no-print, .btn, form, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* v1.76.0 — indeterminate progress bar for background jobs (research / packages) */
.jobbar { height: 7px; background: var(--border); border-radius: 5px; overflow: hidden; margin: .35rem 0; }
.jobbar-fill { width: 34%; height: 100%; background: var(--primary, #f47b20); border-radius: 5px; animation: jobslide 1.3s ease-in-out infinite; }
@keyframes jobslide { 0% { margin-left: -34%; } 100% { margin-left: 100%; } }

/* v1.79.0 — active drill-down stat card on the team-member page */
a.stat-click.stat-active { border-color: var(--primary); box-shadow: var(--shadow-md), 0 0 0 1px var(--primary) inset; }

/* Skill ideas grouped into one collapsible card per channel (v2.12.0) */
.idea-channel { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); margin: .5rem 0; overflow: hidden; }
.idea-channel-head { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; padding: .65rem .8rem; cursor: pointer; user-select: none; }
.idea-channel-head:hover { background: var(--surface-3, rgba(0,0,0,.03)); }
.idea-channel-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.idea-channel-chev { font-size: .85rem; width: .9rem; display: inline-block; }
.idea-channel-body { padding: 0 .8rem .7rem; }
/* .idea-list sets display:grid, which beats the browser's [hidden] rule — so a
   collapsed body would still show. Force it closed. */
.idea-channel-body[hidden] { display: none; }
