/* =================================================================
   Ddrafts — Design Team Management Platform
   Dark enterprise dashboard · Phase 1
   ================================================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* Surfaces */
  --bg:            #0c0f16;
  --bg-2:          #11151f;
  --surface:       #161b27;
  --surface-2:     #1b2230;
  --surface-3:     #212a3a;
  --line:          #28313f;
  --line-soft:     #1f2733;

  /* Text */
  --tx:            #e7ecf5;
  --tx-2:          #9aa6bd;
  --tx-3:          #687387;

  /* Brand accent (indigo) — overridden per-workspace via JS */
  --accent:        #7c83ff;
  --accent-2:      #a78bfa;
  --accent-soft:   rgba(124, 131, 255, 0.14);
  --accent-line:   rgba(124, 131, 255, 0.38);

  /* Status tokens (spec) */
  --st-idea:       #f4c343;
  --st-progress:   #5b9bff;
  --st-approval:   #a473ff;
  --st-approved:   #46d18b;
  --st-scheduled:  #3ec5c9;
  --st-completed:  #7e8aa3;

  /* Feedback */
  --danger:        #ff6b6b;
  --warn:          #ffb454;

  /* Geometry */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 22px;

  /* Type */
  --display: "Space Grotesk", system-ui, sans-serif;
  --body:    "Inter", system-ui, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;

  --shadow:   0 8px 30px rgba(0,0,0,.45);
  --shadow-sm:0 2px 10px rgba(0,0,0,.35);

  --sidebar-w: 256px;
  --rail-w:    320px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  background: var(--bg);
  color: var(--tx);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05" 1, "ss01" 1;
}
h1,h2,h3,h4 { font-family: var(--display); font-weight: 600; margin: 0; letter-spacing: -.01em; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: #303b4f; }

/* =================================================================
   App layout
   ================================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}
.app.sidebar-collapsed { grid-template-columns: 72px minmax(0,1fr); }

/* =================================================================
   Sidebar
   ================================================================= */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 18px;
  overflow-y: auto;
  min-width: 0;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.brandmark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  box-shadow: 0 4px 16px var(--accent-soft);
}
.brandmark__glyph { font-family: var(--display); font-weight: 700; font-size: 20px; color: #0c0f16; }
.brandmark__text { display: flex; flex-direction: column; line-height: 1.15; }
.brandmark__text strong { font-family: var(--display); font-size: 16px; }
.brandmark__text span { font-size: 11px; color: var(--tx-3); letter-spacing: .04em; text-transform: uppercase; }
.sidebar__collapse { margin-left: auto; }

.sidebar__section { display: flex; flex-direction: column; gap: 6px; }
.sidebar__label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--tx-3); font-weight: 600;
}
.sidebar__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line-soft); }

/* Workspace list */
.ws-list { display: flex; flex-direction: column; gap: 2px; }
.ws-item {
  display: flex; align-items: center; gap: 0; position: relative;
  padding: 0; border-radius: var(--r-sm);
  border: 1px solid transparent; color: var(--tx-2); background: none;
  transition: background .14s, color .14s, border-color .14s;
}
.ws-item__main {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  padding: 8px; background: none; border: none; color: inherit; text-align: left; border-radius: var(--r-sm);
}
.ws-item__gear { opacity: 0; width: 28px; height: 28px; flex: none; margin-right: 4px; }
.ws-item:hover .ws-item__gear { opacity: 1; }
.ws-item:hover { background: var(--surface); color: var(--tx); }
.ws-item.is-active { background: var(--surface-2); color: var(--tx); border-color: var(--line); }
.ws-item.is-active .ws-item__dot { box-shadow: 0 0 0 3px var(--accent-soft); }
.ws-item__dot { width: 22px; height: 22px; border-radius: 7px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-family: var(--display); color: #0c0f16; background-size: cover; background-position: center; }
.ws-item__name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Workspace sub-nav (calendar + tasks under active workspace) */
.ws-sub {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 0 6px 32px; animation: fade .15s;
}
.nav__item--sub { font-size: 12.5px; padding: 7px 10px; gap: 9px; }
.nav__item--sub svg { width: 16px; height: 16px; flex: none; }
.sidebar__section--grow { flex: 1; overflow-y: auto; min-height: 0; }

/* workspace context menu */
.ws-ctx {
  position: absolute; top: 100%; left: 8px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--shadow); min-width: 170px; overflow: hidden; animation: pop .14s ease;
}
.ws-ctx__item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--tx); font-size: 12.5px; padding: 10px 14px; }
.ws-ctx__item:hover { background: var(--accent-soft); color: #cdd2ff; }
.ws-ctx__danger:hover { background: rgba(255,107,107,.12); color: var(--danger); }

/* Nav */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm);
  background: none; border: none; color: var(--tx-2);
  font-size: 13.5px; font-weight: 500; width: 100%; text-align: left;
  transition: background .14s, color .14s;
}
.nav__item svg { flex: none; opacity: .85; }
.nav__item:hover { background: var(--surface); color: var(--tx); }
.nav__item.is-active { background: var(--accent-soft); color: #cdd2ff; }
.nav__item.is-active svg { opacity: 1; color: var(--accent); }
.nav__item .badge {
  margin-left: auto; background: var(--surface-3); color: var(--tx-2);
  font-size: 11px; font-family: var(--mono); padding: 1px 7px; border-radius: 99px; min-width: 20px; text-align: center;
}

/* Collapsed sidebar */
.app.sidebar-collapsed .brandmark__text,
.app.sidebar-collapsed .sidebar__label span,
.app.sidebar-collapsed .ws-item__name,
.app.sidebar-collapsed .nav__item span:not(.badge) { display: none; }
.app.sidebar-collapsed .ws-item__gear { display: none; }
.app.sidebar-collapsed .brandmark { display: none; }
.app.sidebar-collapsed .sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.sidebar-collapsed .sidebar__collapse { margin-left: 0; }
.app.sidebar-collapsed .sidebar__label { justify-content: center; }
.app.sidebar-collapsed .sidebar__label .icon-btn { display: none; }
.app.sidebar-collapsed .nav__item { justify-content: center; }
.app.sidebar-collapsed .sidebar__collapse svg { transform: rotate(180deg); }
.app.sidebar-collapsed .ws-item { justify-content: center; }
.app.sidebar-collapsed .nav__item .badge { display: none; }

/* =================================================================
   Main column
   ================================================================= */
.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; height: 62px; flex: none;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(12,15,22,.7); backdrop-filter: blur(8px);
}
.topbar__menu { display: none; }
.topbar__crumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.crumb__ws { font-family: var(--display); font-weight: 600; color: var(--tx); white-space: nowrap; }
.crumb__sep { color: var(--tx-3); }
.crumb__view { color: var(--tx-2); white-space: nowrap; }
.topbar__spacer { flex: 1; }

.month-nav { display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; }
.month-nav__label { background: none; border: none; color: var(--tx); font-family: var(--display); font-weight: 600; font-size: 13px; padding: 5px 12px; border-radius: 6px; min-width: 132px; }
.month-nav__label:hover { background: var(--surface-2); }

.role-sim {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--accent-line);
  border-radius: var(--r-sm); padding: 4px 10px 4px 11px;
}
.role-sim__dot { width: 8px; height: 8px; border-radius: 99px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.role-sim select {
  background: none; border: none; color: var(--tx); font-family: var(--body);
  font-size: 13px; font-weight: 500; outline: none; padding-right: 2px;
}
.role-sim select option { background: var(--surface-2); color: var(--tx); }

.me {
  display: flex; align-items: center; gap: 9px; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 4px 9px 4px 5px; color: var(--tx); transition: border-color .14s, background .14s;
}
.me:hover { background: var(--surface-2); border-color: var(--accent-line); }
.me__text { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.me__text strong { font-size: 12.5px; }
.me__text span { font-size: 10.5px; color: var(--tx-2); }
.me__chev { color: var(--tx-3); }

.acct-menu {
  position: fixed; top: 58px; right: 22px; z-index: 90;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); min-width: 250px; overflow: hidden; animation: pop .16s ease;
}
.acct-menu__head { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
.acct-menu__item { display: block; width: 100%; text-align: left; background: none; border: none; color: var(--tx); font-size: 13px; padding: 12px 14px; }
.acct-menu__item:hover { background: var(--accent-soft); color: #cdd2ff; }
.acct-menu__danger:hover { background: rgba(255,107,107,.12); color: var(--danger); }
.acct-menu__note { padding: 12px 14px; font-size: 12px; color: var(--tx-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 12px; color: #0c0f16;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--tx); font-size: 13px; font-weight: 600;
  transition: background .14s, border-color .14s, transform .08s, opacity .14s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(140deg, var(--accent), var(--accent-2)); border-color: transparent; color: #0c0f16; }
.btn--primary:hover { filter: brightness(1.06); background: linear-gradient(140deg, var(--accent), var(--accent-2)); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--danger); border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.08); }
.btn--danger:hover { background: rgba(255,107,107,.15); }
.btn[disabled], .btn.is-disabled { opacity: .4; pointer-events: none; }

.icon-btn {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: none; color: var(--tx-2);
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--tx); }

/* =================================================================
   Workspace banner
   ================================================================= */
.ws-banner { position: relative; flex: none; }
.ws-banner__cover {
  height: 96px; background-size: cover; background-position: center;
  background-color: var(--surface-2);
}
.ws-banner__cover::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 96px; background: linear-gradient(180deg, rgba(12,15,22,.1), var(--bg)); }
.ws-banner__inner {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 0 24px 16px; margin-top: -28px;
}
.ws-banner__logo {
  width: 60px; height: 60px; border-radius: 16px; flex: none;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 24px; color: #0c0f16;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border: 3px solid var(--bg); box-shadow: var(--shadow-sm);
}
.ws-banner__meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ws-banner__meta h1 { font-size: 22px; }
.ws-banner__sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drive-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 11px; font-size: 12px; color: var(--tx-2); font-weight: 500;
}
.drive-pill:hover { color: var(--tx); border-color: var(--accent-line); }
.ws-banner__id { font-family: var(--mono); font-size: 11px; color: var(--tx-3); }

.status-legend { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; }
.legend-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--tx-2); }
.legend-chip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* =================================================================
   View container
   ================================================================= */
.view { flex: 1; overflow-y: auto; padding: 8px 24px 32px; outline: none; }

/* ---------- Calendar ---------- */
.cal__weekday-row {
  display: grid; grid-template-columns: 30px repeat(7, minmax(0,1fr));
  gap: 8px; padding: 4px 0 8px; background: transparent;
}
.cal__weekday { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-3); font-weight: 600; padding-left: 4px; }
.cal__weekday:first-child { grid-column: 1; }

/* Month accordion */
.month { margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--bg-2); }
.month__head {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px; cursor: pointer; user-select: none;
  background: var(--surface); border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 6;
}
.month__chev { transition: transform .2s; color: var(--tx-2); display: grid; place-items: center; }
.month.is-collapsed .month__chev { transform: rotate(-90deg); }
.month.is-collapsed .month__head { border-bottom-color: transparent; }
.month__title { font-family: var(--display); font-weight: 600; font-size: 15px; }
.month__count { margin-left: auto; font-size: 11.5px; font-family: var(--mono); color: var(--tx-2); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.month__body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s ease; }
.month.is-collapsed .month__body { grid-template-rows: 0fr; }
.month__inner { overflow: hidden; padding: 10px 12px 12px; min-height: 0; }

.cal__controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 2px 8px; }
.cal__controls-hint { font-size: 12px; color: var(--tx-3); }

.week { margin-bottom: 8px; border: 1px solid var(--line-soft); border-radius: var(--r); overflow: hidden; background: var(--bg-2); }
.week__head {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; background: var(--surface); cursor: pointer;
  border-bottom: 1px solid var(--line-soft); user-select: none;
}
.week__chev { transition: transform .2s; color: var(--tx-2); display: grid; place-items: center; }
.week.is-collapsed .week__chev { transform: rotate(-90deg); }
.week__title { font-family: var(--display); font-weight: 600; font-size: 13px; }
.week__range { font-size: 11.5px; color: var(--tx-3); }
.week__count { margin-left: auto; font-size: 11px; font-family: var(--mono); color: var(--tx-2); background: var(--surface-2); padding: 2px 8px; border-radius: 99px; }

.week__grid {
  display: grid; grid-template-columns: 30px repeat(7, minmax(0,1fr)); gap: 8px;
  padding: 8px; transition: max-height .28s ease, opacity .2s, padding .2s;
  max-height: 1600px; overflow: hidden;
}
.week.is-collapsed .week__grid { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }

.week__num { grid-column: 1; display: flex; align-items: flex-start; justify-content: center; padding-top: 6px; font-family: var(--mono); font-size: 10px; color: var(--tx-3); }

.day {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  min-height: 116px; padding: 7px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .14s;
}
.day.is-out { opacity: .42; }
.day.is-past-day { border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.075); }
.day.is-past-day .day__num { color: var(--danger); }
.day.is-today { border-color: rgba(244,195,67,.75); background: rgba(244,195,67,.10); box-shadow: inset 0 0 0 1px rgba(244,195,67,.22); }
.day.is-droptarget { border-color: var(--accent); background: var(--accent-soft); }
.day__head { display: flex; align-items: center; justify-content: space-between; }
.day__num { font-size: 12px; font-weight: 600; color: var(--tx-2); }
.day.is-today .day__num { color: var(--st-idea); }
.day__add { opacity: 0; width: 22px; height: 22px; }
.day:hover .day__add { opacity: 1; }
.day__cards { display: flex; flex-direction: column; gap: 5px; }

/* Calendar card */

.day.is-past-day .card { border-color: rgba(255,107,107,.35); background: rgba(255,107,107,.08); }
.day.is-today .card { border-color: rgba(244,195,67,.45); background: rgba(244,195,67,.10); }

.card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-left: 3px solid var(--st-idea); border-radius: 7px;
  padding: 7px 8px; cursor: pointer; transition: transform .08s, border-color .14s, background .14s;
}
.card:hover { background: var(--surface-3); }
.card:active { transform: scale(.985); }
.card__top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.card__plat { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex: none; color: #fff; }
.card__plat svg { width: 11px; height: 11px; }
.card__time { font-family: var(--mono); font-size: 10px; color: var(--tx-3); margin-left: auto; }
.card__title { font-size: 12px; font-weight: 600; line-height: 1.3; color: var(--tx); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__foot { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.card__type { font-size: 10px; color: var(--tx-2); background: var(--bg-2); padding: 1px 6px; border-radius: 99px; }
.card__avatars { display: flex; margin-left: auto; }
.card__avatars .mini { width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: 9px; font-weight: 700; font-family: var(--display); color: #0c0f16; margin-left: -5px; border: 1.5px solid var(--surface-2); }
.card__avatars .mini:first-child { margin-left: 0; }
.card.client-view { cursor: default; border-left-color: var(--accent); }

/* Status helpers */
.st-idea       { --sc: var(--st-idea); }
.st-in_progress{ --sc: var(--st-progress); }
.st-waiting_approval { --sc: var(--st-approval); }
.st-approved   { --sc: var(--st-approved); }
.st-scheduled  { --sc: var(--st-scheduled); }
.st-completed  { --sc: var(--st-completed); }
.card.st-idea { border-left-color: var(--st-idea); }
.card.st-in_progress { border-left-color: var(--st-progress); }
.card.st-waiting_approval { border-left-color: var(--st-approval); }
.card.st-approved { border-left-color: var(--st-approved); }
.card.st-scheduled { border-left-color: var(--st-scheduled); }
.card.st-completed { border-left-color: var(--st-completed); }

.status-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 99px; color: var(--sc, var(--tx-2));
  background: color-mix(in srgb, var(--sc, var(--tx-3)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc, var(--tx-3)) 30%, transparent);
}
.status-tag i { width: 7px; height: 7px; border-radius: 99px; background: currentColor; }

/* ---------- Tasks list view ---------- */
.section-head { display: flex; align-items: center; gap: 12px; padding: 14px 2px 12px; }
.section-head h2 { font-size: 18px; }
.section-head p { color: var(--tx-2); font-size: 13px; margin: 0; }
.section-head .spacer { flex: 1; }

.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.task-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; transition: border-color .14s;
}
.task-card:hover { border-color: var(--line); }
.task-card__head { display: flex; align-items: flex-start; gap: 10px; }
.task-card__title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.task-card__meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--tx-2); }
.task-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
.task-card__refs { display: flex; flex-wrap: wrap; gap: 6px; }
.ref-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--tx-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 9px; }
.ref-chip:hover { color: var(--tx); border-color: var(--accent-line); }
.task-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

/* ---------- Team view ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 12px; }
.member {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; display: flex; align-items: center; gap: 12px;
}
.member__av { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: #0c0f16; }
.member__name { font-weight: 600; font-size: 14px; }
.member__role { font-size: 12px; color: var(--tx-2); }
.role-pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; margin-left: auto; }

/* ---------- Integrations / Settings ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; margin-bottom: 14px; }
.panel h3 { font-size: 15px; margin-bottom: 4px; }
.panel p.muted { color: var(--tx-2); font-size: 13px; margin: 0 0 14px; }
.kv { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv__k { font-size: 13px; color: var(--tx-2); }
.kv__v { font-size: 13px; font-weight: 500; }
.switch { width: 40px; height: 23px; border-radius: 99px; background: var(--surface-3); position: relative; border: none; transition: background .16s; }
.switch::after { content:""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 99px; background: #fff; transition: left .16s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 20px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--tx-2); }

/* Status editor */
.st-editor { display: flex; flex-direction: column; gap: 7px; }
.st-editor__row { display: flex; align-items: center; gap: 8px; }

/* Client link row */
.client-link-row { display: flex; gap: 8px; align-items: center; }

/* Client-link mode (shared URL, minimal chrome) */
body.client-link .sidebar { display: none !important; }
body.client-link .app { grid-template-columns: minmax(0,1fr) !important; }
body.client-link .topbar__menu { display: none !important; }
body.client-link #primaryAction { display: none !important; }
body.client-link .me { display: none !important; }
body.client-link .month-nav { margin-left: auto; }

/* ---------- Empty / locked states ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 80px 20px; color: var(--tx-2);
}
.empty svg { color: var(--tx-3); opacity: .6; }
.empty h3 { font-size: 16px; color: var(--tx); }
.empty p { max-width: 360px; font-size: 13px; }
.locked-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn); background: rgba(255,180,84,.1); border: 1px solid rgba(255,180,84,.25); border-radius: 99px; padding: 4px 11px; }

/* =================================================================
   Activity rail
   ================================================================= */
.rail { background: var(--bg-2); border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; overflow: hidden; }
.rail__head { display: flex; align-items: flex-start; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line-soft); }
.rail__head h2 { font-size: 14px; }
.rail__head p { font-size: 11.5px; color: var(--tx-3); margin: 2px 0 0; }
.rail__head .icon-btn { margin-left: auto; }
.rail__feed { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.log {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 11px; display: flex; gap: 10px; animation: logIn .3s ease;
  border-left: 3px solid var(--accent);
}
@keyframes logIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.log.is-discord { border-left-color: #5865F2; }
.log.is-drive   { border-left-color: #46d18b; }
.log.is-sla     { border-left-color: var(--warn); }
.log__icon { width: 26px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center; background: var(--surface-2); }
.log__icon svg { width: 15px; height: 15px; }
.log__body { min-width: 0; flex: 1; }
.log__title { font-size: 12.5px; font-weight: 600; }
.log__msg { font-size: 11.5px; color: var(--tx-2); line-height: 1.4; word-wrap: break-word; }
.log__msg code { font-family: var(--mono); font-size: 10.5px; color: var(--accent-2); }
.log__time { font-size: 10px; color: var(--tx-3); font-family: var(--mono); margin-top: 4px; }

/* =================================================================
   Modal
   ================================================================= */
.modal-root { position: fixed; inset: 0; display: none; z-index: 100; }
.modal-root.open { display: block; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(6,8,12,.66); backdrop-filter: blur(3px); animation: fade .18s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; margin: 6vh auto 0; width: min(560px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: var(--shadow); max-height: 88vh; overflow: hidden; display: flex; flex-direction: column;
  animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal.modal--wide { width: min(680px, calc(100% - 32px)); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.modal__head h2 { font-size: 17px; }
.modal__head .sub { font-size: 12.5px; color: var(--tx-2); }
.modal__head .icon-btn { margin-left: auto; }
.modal__body { padding: 18px 20px; overflow-y: auto; }
.modal__foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--line-soft); }

/* Forms */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12.5px; font-weight: 600; color: var(--tx-2); margin-bottom: 6px; }
.field .hint { font-size: 11.5px; color: var(--tx-3); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--tx); font-family: var(--body); font-size: 13.5px; padding: 10px 12px; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: vertical; min-height: 72px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.chip-select { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-opt {
  font-size: 12.5px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--tx-2); transition: all .14s;
}
.chip-opt:hover { border-color: var(--accent-line); color: var(--tx); }
.chip-opt.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: #cdd2ff; }

.assignee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 8px; }
.assignee-opt { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2); transition: all .14s; text-align: left; }
.assignee-opt:hover { border-color: var(--accent-line); }
.assignee-opt.is-on { background: var(--accent-soft); border-color: var(--accent-line); }
.assignee-opt .mini { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 10px; font-weight: 700; font-family: var(--display); color: #0c0f16; flex: none; }
.assignee-opt small { font-size: 11px; color: var(--tx-3); display: block; }

.ref-builder { display: flex; gap: 8px; margin-bottom: 8px; }
.ref-builder .input { flex: 1; }
.ref-list { display: flex; flex-direction: column; gap: 6px; }
.ref-list__item { display: flex; align-items: center; gap: 9px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; font-size: 12.5px; }
.ref-list__item .x { margin-left: auto; color: var(--tx-3); }
.ref-list__item .x:hover { color: var(--danger); }

/* Task detail */
.detail-block { margin-bottom: 16px; }
.detail-block h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--tx-3); margin-bottom: 8px; font-family: var(--body); font-weight: 700; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-meta .cell { background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: 9px 11px; }
.detail-meta .cell label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--tx-3); display: block; margin-bottom: 3px; }
.detail-meta .cell .v { font-size: 13px; font-weight: 500; }
.status-flow { display: flex; flex-wrap: wrap; gap: 7px; }

/* Image pickers (logo + cover) */
.img-pick {
  position: relative; border: 1px solid var(--line); background: var(--surface-2);
  background-size: cover; background-position: center; cursor: pointer; overflow: hidden;
  display: grid; place-items: center; color: #fff; padding: 0; transition: border-color .14s;
}
.img-pick:hover { border-color: var(--accent-line); }
.img-pick--cover { width: 100%; height: 92px; border-radius: var(--r); }
.img-pick--logo { width: 68px; height: 68px; border-radius: 16px; flex: none; }
.img-pick__letter { font-family: var(--display); font-weight: 700; font-size: 24px; color: #0c0f16; }
.img-pick__edit {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 5px;
  font-size: 11px; font-weight: 600; text-align: center; color: #fff;
  background: rgba(8,10,16,.6); opacity: 0; transition: opacity .14s;
}
.img-pick:hover .img-pick__edit { opacity: 1; }
.img-pick--logo .img-pick__edit { padding: 3px; font-size: 9.5px; }

.upload-zone {
  border: 1.5px dashed var(--line); border-radius: var(--r); padding: 18px; text-align: center;
  color: var(--tx-2); font-size: 12.5px; transition: border-color .14s, background .14s; cursor: pointer;
}
.upload-zone:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--tx); }
.asset-row { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.asset-row svg { color: var(--st-approved); flex: none; }
.asset-row a { font-size: 12px; color: var(--accent-2); font-family: var(--mono); word-break: break-all; }

/* =================================================================
   Toasts
   ================================================================= */
.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 16px; font-size: 13px; display: flex; align-items: center; gap: 9px;
  box-shadow: var(--shadow); animation: toastIn .25s ease;
}
.toast.is-ok { border-left: 3px solid var(--st-approved); }
.toast.is-warn { border-left: 3px solid var(--warn); }
.toast.is-err { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* =================================================================
   Responsive
   ================================================================= */
@media (max-width: 1180px) {
  .app { grid-template-columns: var(--sidebar-w) minmax(0,1fr); }
  .rail { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 80;
    transform: translateX(-100%); transition: transform .24s;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .topbar__menu { display: grid; }
  .month-nav__label { min-width: 88px; }
  .me__text, .me__chev { display: none; }
  .status-legend { display: none; }
  .cal__weekday-row, .week__grid { grid-template-columns: repeat(7, minmax(64px,1fr)); }
  .week__num { display: none; }
  .cal__weekday-row > span:first-child { display: none; }
  .view { padding: 8px 12px 28px; overflow-x: auto; }
  .field-row, .detail-meta { grid-template-columns: 1fr; }
}

/* =================================================================
   Login screen
   ================================================================= */
.login-screen {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: var(--bg);
  padding: 20px;
}
.login-screen.is-hidden { display: none; }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 32px 28px; width: min(400px, 100%);
  box-shadow: var(--shadow); text-align: center;
}
.login-card .field { text-align: left; }

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

/* Focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Client idea/message button */
.client-idea-btn{
  display:inline-flex;align-items:center;gap:8px;
  height:38px;padding:0 13px;border-radius:10px;
  border:1px solid var(--accent-line);
  background:var(--accent-soft);color:var(--tx);
  font-size:13px;font-weight:700;
}
.client-idea-btn:hover{background:var(--surface-2);color:#fff}
.client-idea-btn__icon{display:grid;place-items:center;color:var(--accent)}
.client-link-row .btn[title]{min-width:40px;justify-content:center;font-size:17px}
@media(max-width:700px){.client-idea-btn__text{display:none}.client-idea-btn{width:38px;padding:0;justify-content:center}}

/* Client/internal task description text */
.detail-text{
  background:var(--bg-2);
  border:1px solid var(--line-soft);
  border-radius:var(--r-sm);
  padding:11px 12px;
  color:var(--tx-2);
  font-size:13px;
  line-height:1.65;
  white-space:pre-wrap;
}


/* Clean login screen */
.login-card--clean { padding-top: 34px; }
.login-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  background: transparent;
  border: 0;
  color: var(--tx-2);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.login-link:hover { color: var(--tx); text-decoration: underline; }

/* Assignment + workflow refinements */
.deadline-chip {
  border: 1px solid rgba(255,180,84,.45);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
}
.deadline-chip.has-deadline {
  color: #ffd08a;
  background: rgba(255,180,84,.12);
}
.deadline-chip.no-deadline {
  color: var(--tx-3);
  background: rgba(126,138,163,.08);
  border-color: rgba(126,138,163,.28);
}
.flow-chip {
  border: 1px solid color-mix(in srgb, var(--flow), transparent 55%);
  background: color-mix(in srgb, var(--flow), transparent 86%);
  color: var(--tx);
  border-radius: 999px;
  padding: 3px 8px;
  font-weight: 800;
}
.task-card__meta .deadline-chip,
.task-card__meta .flow-chip {
  font-size: 12px;
}
.assignee-grid {
  max-height: 360px;
  overflow: auto;
}


/* === Home/dashboard + simplified navigation update === */
.sidebar__brand{cursor:pointer;}
.sidebar__section:has(#globalNav){display:none!important;}
.sidebar__foot{display:block!important;margin-top:auto;}
#sidebarSettingsBtn{background:var(--surface);border:1px solid var(--line);color:var(--tx);}
#sidebarSettingsBtn:hover{background:var(--surface-2);border-color:var(--accent-line);}
.home-dash{padding:4px 2px 40px;display:flex;flex-direction:column;gap:18px;}
.home-hero{padding:8px 2px 2px;}
.home-panel{margin:0;}
.home-panel__head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:14px;}
.home-client-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px;}
.home-client{display:flex;align-items:center;gap:12px;width:100%;text-align:left;border:1px solid var(--line);background:var(--surface);color:var(--tx);border-radius:var(--r);padding:14px;transition:.16s;}
.home-client:hover{transform:translateY(-2px);border-color:var(--accent-line);background:var(--surface-2);}
.home-client__logo{width:44px;height:44px;border-radius:12px;display:grid;place-items:center;flex:none;font-weight:800;font-family:var(--display);color:#0c0f16;}
.home-client__body{display:flex;flex-direction:column;gap:3px;min-width:0;}
.home-client__body strong{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.home-client__body span{font-size:12px;color:var(--tx-2);}
.home-client__go{margin-left:auto;font-size:12px;color:var(--accent-2);font-weight:700;}
.modal--xl{width:min(1180px,calc(100vw - 34px));max-height:90vh;display:flex;flex-direction:column;}
.global-settings-body{overflow:auto;}
.settings-tabs{display:flex;gap:8px;flex-wrap:wrap;}
.settings-tabs .chip-opt{padding:8px 14px;}

@media(max-width:720px){
  .home-client-grid{grid-template-columns:1fr;}
  .modal--xl{width:calc(100vw - 18px);max-height:94vh;}
}


/* Home dashboard team cards polish */
.home-team-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:12px;
}
.home-member{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px;
  border:1px solid var(--line);
  background:linear-gradient(180deg,var(--surface),rgba(22,27,39,.72));
  border-radius:16px;
  min-height:82px;
  overflow:hidden;
}
.home-member__av{
  width:46px!important;
  height:46px!important;
  min-width:46px!important;
  border-radius:14px!important;
  display:grid;
  place-items:center;
  font-size:13px!important;
  font-weight:800;
  line-height:1;
  overflow:hidden;
}
.home-member__body{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:7px;
  min-width:0;
}
.home-member__name{
  max-width:100%;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-size:14px;
  font-weight:700;
}
.home-member__role{
  display:inline-flex;
  align-items:center;
  max-width:100%;
  min-height:24px;
  padding:4px 10px;
  border:1px solid transparent;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  line-height:1.15;
  white-space:nowrap;
}
.home-member .role-pill{display:none!important;}

/* Global content channels / social logos */
.card__plat-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
.card__plat.has-logo{background:transparent!important;border:1px solid var(--line);overflow:hidden;padding:0;width:24px;height:24px}
.card__plat-img{width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit}
.channels-settings .section-head{margin-bottom:14px}
.channel-list{display:flex;flex-direction:column;gap:10px;margin-top:14px}
.channel-row{display:grid;grid-template-columns:56px minmax(160px,1fr) minmax(280px,2fr) 70px 34px;gap:10px;align-items:start;padding:12px;border:1px solid var(--line);background:var(--surface);border-radius:var(--r)}
.channel-preview{height:64px;display:flex;align-items:center;justify-content:center;background:var(--surface-2);border:1px solid var(--line-soft);border-radius:12px}
.channel-preview .card__plat,.channel-preview .card__plat.has-logo{width:34px;height:34px;font-size:12px}
.channel-row .field{margin:0}
.channel-row .field label{font-size:11px;color:var(--tx-3)}
.channel-add .field-row{align-items:flex-start}
.tag--with-icon{display:inline-flex;align-items:center;gap:7px;padding-left:7px}
.tag--with-icon .card__plat,.tag--with-icon .card__plat.has-logo{width:20px;height:20px;font-size:10px}
@media(max-width:900px){.channel-row{grid-template-columns:48px 1fr}.channel-row .icon-btn{justify-self:end}.channel-add .field-row{display:flex;flex-direction:column}.channel-add .field{width:100%}}


.channel-savebar{position:sticky;bottom:-18px;display:flex;justify-content:flex-end;gap:10px;padding:14px 0 0;margin-top:12px;background:linear-gradient(180deg,rgba(22,27,39,0),var(--surface) 35%)}
.channel-row .card__plat-img{width:100%;height:100%;object-fit:contain;display:block}


/* channel logo fallbacks */

.card__plat { position: relative; overflow: hidden; }
.card__plat.has-logo { background: var(--surface-3) !important; }
.card__plat-img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: inherit; }
.card__plat-fallback { display: none; font-size: 9px; font-weight: 800; line-height: 1; }
.card__plat.logo-load-failed .card__plat-fallback { display: grid; place-items: center; width: 100%; height: 100%; }
.card__plat.logo-load-failed { background: var(--surface-3) !important; color: var(--tx); }
