:root {
  color-scheme: dark;
  --brand: #ef5f35;
  --brand-2: #ff8f5c;
  --brand-soft: rgba(239, 95, 53, .16);

  --ink: #f3f2f0;
  --muted: #97979e;
  --line: rgba(255, 255, 255, .09);

  --canvas: #09090b;
  --card: #1a1a1f;
  --card-2: #25252c;

  --green: #37d399;
  --green-soft: rgba(55, 211, 153, .16);
  --amber: #f6b93b;
  --amber-soft: rgba(246, 185, 59, .16);
  --red: #f2685f;
  --red-soft: rgba(242, 104, 95, .16);
  --violet: #b18cf5;
  --violet-soft: rgba(177, 140, 245, .16);

  --shadow-sm: 0 0 0 1px rgba(255, 255, 255, .05);
  --shadow: 0 0 0 1px rgba(255, 255, 255, .09), 0 8px 24px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .1), 0 24px 60px -12px rgba(0, 0, 0, .6), 0 8px 20px -4px rgba(0, 0, 0, .4);
  --glow: 0 0 0 1px rgba(255, 255, 255, .06) inset;
  --radius: 20px;
}

/* Light theme — an explicit, sticky per-device choice (see the topbar
   toggle / applyStoredTheme in app.js), not something that follows the OS.
   The sidebar, splash screen and login/password screens deliberately stay
   on the dark palette regardless (see the matching overrides further
   down) — a fixed brand frame around a workspace that adapts. */
:root[data-theme="light"] {
  color-scheme: light;
  --brand: #ef5f35;
  --brand-2: #ff8f5c;
  --brand-soft: rgba(239, 95, 53, .12);

  --ink: #1c1a17;
  --muted: #6e6a63;
  --line: rgba(28, 24, 18, .1);

  --canvas: #f6f4f1;
  --card: #ffffff;
  --card-2: #eeece7;

  --green: #17835b;
  --green-soft: rgba(23, 131, 91, .12);
  --amber: #8a5f04;
  --amber-soft: rgba(138, 95, 4, .12);
  --red: #c43f31;
  --red-soft: rgba(196, 63, 49, .1);
  --violet: #7150c9;
  --violet-soft: rgba(113, 80, 201, .12);

  --shadow-sm: 0 0 0 1px rgba(28, 24, 18, .06);
  --shadow: 0 0 0 1px rgba(28, 24, 18, .08), 0 8px 24px -8px rgba(28, 24, 18, .16);
  --shadow-lg: 0 0 0 1px rgba(28, 24, 18, .08), 0 24px 60px -12px rgba(28, 24, 18, .22), 0 8px 20px -4px rgba(28, 24, 18, .12);
  --glow: 0 0 0 1px rgba(28, 24, 18, .04) inset;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 100% -8%, rgba(239, 95, 53, .05), transparent 60%),
    radial-gradient(900px 500px at -6% 0%, rgba(255, 143, 92, .04), transparent 55%),
    var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon { display: block; }

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

/* The "skeleton" of the interface — headings, nav, tabs, badges, kicker
   labels — isn't editable text, so it shouldn't invite a text cursor or
   selection highlight on click the way real content (descriptions, chat,
   timeline entries) does. Scoped to structural chrome only. */
h1, h2, h3, .eyebrow, .nav-item, .tab, .badge, .kanban-head, .page-head, .panel-head,
.task-row .task-main strong, .task-row .task-main small, .kanban-card strong, .kanban-card small {
  -webkit-user-select: none; user-select: none;
}
/* Modal headers double as the entity's own name (a task/раздел/project
   title) — real content someone needs to select and copy, not chrome. */
.modal header h2 { -webkit-user-select: text; user-select: text; }
.task-row[data-action], .kanban-card[data-action] { cursor: pointer; }
button, select { cursor: pointer; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }

.sidebar {
  /* Always dark, regardless of the workspace theme toggle — a fixed
     brand frame, same reasoning as #splash/.auth-screen below. */
  --canvas: #09090b;
  --card: #1a1a1f;
  --card-2: #25252c;
  --ink: #f3f2f0;
  --muted: #97979e;
  --line: rgba(255, 255, 255, .09);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 34px 24px 26px;
  color: #b9b9c0;
  background: var(--canvas);
  border-right: 1px solid var(--line);
}
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.6); }

.brand { display: flex; align-items: center; gap: 16px; color: #fff; }
.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(155deg, var(--brand) 0%, var(--brand-2) 100%);
  box-shadow: 0 8px 20px -4px rgba(239, 95, 53, .55), var(--glow);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand strong { font-size: 26px; letter-spacing: .1em; }
.brand-subtitle { margin: 18px 0 42px 64px; color: #75757c; line-height: 1.45; font-size: 12.5px; }

.nav-list { display: grid; gap: 4px; }
.nav-item {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 0 15px;
  border: 0;
  border-radius: 13px;
  color: #9a9aa3;
  background: transparent;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  text-align: left;
  font-size: 16px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(1px); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(239, 95, 53, .22), rgba(239, 95, 53, .05));
  box-shadow: inset 3px 0 var(--brand), var(--glow);
}
.nav-item.active .nav-icon { color: #fff; }
.nav-icon { display: flex; color: #83838c; transition: color .15s ease; }
.nav-count { font-style: normal; color: #86868f; font-size: 12.5px; font-weight: 700; }
.side-footer { margin-top: auto; display: grid; gap: 16px; }
.logout-button { display: flex; align-items: center; gap: 9px; border: 0; background: none; color: #86868f; text-align: left; font-size: 12.5px; font-weight: 650; transition: color .15s ease; }
.logout-button:hover { color: #fff; }
.side-footer small { color: #55555c; letter-spacing: .04em; }

.workspace { min-width: 0; padding: 32px 42px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.topbar h1, .page-head h1 { margin: 0; font-size: 34px; line-height: 1.08; letter-spacing: -.035em; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; min-width: 0; }
.top-actions > * { flex-shrink: 0; }
.check-control, .mode-select, .bell-wrap, .profile-box { white-space: nowrap; }

.global-search-box { position: relative; flex-shrink: 1; min-width: 120px; }
.global-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.global-search-input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.global-search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search-dropdown { position: absolute; top: calc(100% + 10px); left: 0; z-index: 50; width: 320px; max-height: 400px; padding: 10px; overflow-y: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-lg); }
.search-group { margin-bottom: 8px; }
.search-group small { display: block; margin: 4px 8px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.search-result { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; text-align: left; background: none; transition: background .12s ease; }
.search-result:hover { background: var(--card-2); }
.search-result strong { display: block; font-size: 13px; }
.search-result small { color: var(--muted); font-size: 11px; }

.bell-wrap { position: relative; }
.bell-button {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 46px;
  min-width: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease, color .15s ease;
}
.bell-button:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.bell-badge { position: absolute; top: 5px; right: 5px; display: grid; min-width: 16px; height: 16px; place-items: center; border-radius: 999px; padding: 0 3px; color: #fff; background: var(--red); font-size: 10px; font-weight: 800; box-shadow: 0 0 0 2px var(--card); }
.notifications-dropdown { width: 340px; padding: 6px; }
.notification-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 10px; border: 0; border-radius: 10px; text-align: left; background: none; transition: background .12s ease; }
.notification-item:hover { background: var(--card-2); }
.notification-item.unread { background: var(--brand-soft); }
.notification-item span { flex: 1; font-size: 13px; }
.notification-item small { flex-shrink: 0; color: var(--muted); font-size: 11px; }

.impersonate-wrap { position: relative; }
.icon-only-button {
  display: grid; place-items: center; min-height: 46px; min-width: 46px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--card);
  color: var(--muted); box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease, color .15s ease;
}
.icon-only-button:hover { color: var(--ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.impersonate-dropdown { width: 300px; padding: 6px; right: 0; left: auto; }
.impersonate-hint { margin: 4px 8px 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.impersonate-banner {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  min-height: 46px; padding: 5px 15px; border: 1px solid rgba(177, 140, 245, .4);
  border-radius: 13px; background: var(--violet-soft); color: var(--violet);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.impersonate-banner b { font-size: 11px; text-decoration: underline; }

.check-control, .mode-select, .profile-select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}
.check-control { padding: 0 16px; font-weight: 700; }
.check-control:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.check-control.active { color: var(--green); border-color: rgba(55, 211, 153, .4); background: var(--green-soft); }
.check-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent); }
.mode-select { padding: 0 38px 0 14px; font-weight: 650; }
.profile-box { position: relative; border: 0; background: none; padding: 0; text-align: left; transition: transform .15s ease; }
.profile-box:hover { transform: translateY(-1px); }
.profile-initials {
  position: absolute;
  left: 7px;
  top: 7px;
  z-index: 1;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(155deg, var(--brand) 0%, var(--brand-2) 100%);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 10px -2px rgba(239, 95, 53, .45);
}
.profile-select { min-width: 236px; padding: 0 36px 0 50px; font-weight: 700; }
.profile-name { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px; min-height: 46px; padding: 5px 16px 5px 50px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); box-shadow: var(--shadow-sm); }
.profile-name strong { font-size: 13px; font-weight: 700; line-height: 1.2; }
.profile-name small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; line-height: 1.2; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head p { margin: 8px 0 0; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 10px; }
.button, .primary, .secondary, .ghost, .danger {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 750;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.primary { color: #fff; background: linear-gradient(155deg, var(--brand) 0%, var(--brand-2) 130%); box-shadow: 0 10px 22px -6px rgba(239, 95, 53, .45); }
.primary:hover { box-shadow: 0 14px 28px -6px rgba(239, 95, 53, .55); transform: translateY(-1px); }
.primary:active { transform: translateY(0); }
.secondary { color: var(--brand-2); border-color: rgba(239, 95, 53, .35); background: var(--brand-soft); }
.secondary:hover { border-color: rgba(239, 95, 53, .55); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.ghost { border-color: var(--line); background: var(--card); }
.ghost:hover { border-color: rgba(255,255,255,.2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.danger { color: var(--red); border-color: rgba(242, 104, 95, .4); background: var(--red-soft); }
.danger:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); transition: border-color .15s ease, transform .15s ease; }
.icon-button:hover { border-color: rgba(255,255,255,.2); transform: translateY(-1px); }
.text-button { padding: 0; border: 0; color: var(--brand); background: none; font-weight: 750; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.metric {
  position: relative;
  min-height: 126px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  text-align: left;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
button.metric:hover { border-color: rgba(255,255,255,.22); transform: translateY(-2px); box-shadow: var(--shadow); }
.metric::after { content: ""; position: absolute; right: -20px; bottom: -35px; width: 104px; height: 104px; border-radius: 50%; opacity: .28; background: radial-gradient(circle at 35% 35%, currentColor, transparent 70%); }
.metric p { margin: 0 0 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; font-size: 34px; line-height: 1; letter-spacing: -.02em; }
.metric span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.metric.stable { color: var(--green); }
.metric.attention { color: var(--amber); }
.metric.urgent, .metric.blocked { color: var(--red); }
.metric.active { outline: 3px solid rgba(239, 95, 53, .18); border-color: var(--brand); }

.overview-grid { display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,.92fr); gap: 18px; margin-bottom: 18px; }
.overview-grid .panel { display: flex; flex-direction: column; }
.overview-grid .panel-head { flex: 0 0 auto; }
.overview-grid .panel > .task-list,
.overview-grid .panel > .attention-list { flex: 1; }
.overview-grid .panel > .empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: 120px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease;
}
.panel-pad { padding: 24px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.panel-head p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.task-list {
  display: grid;
  min-width: 0;
  container-type: inline-size;
}
.task-row {
  position: relative;
  display: grid;
  grid-template-columns: 10px minmax(160px,1fr) minmax(0,auto);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.task-row:first-child { border-top: 0; }
.task-row.subtask { margin-left: 30px; padding-left: 12px; border-left: 2px solid var(--line); }
.task-row.subtask::before { content: "↳"; position: absolute; left: -23px; color: var(--muted); }
.task-row.draggable { cursor: grab; }
.task-row.draggable:active { cursor: grabbing; }
.task-row.dragging { opacity: .4; }
.task-row.drop-hover { outline: 2px dashed var(--brand); outline-offset: -2px; border-radius: 8px; background: var(--card-2); }
.stage-tasks.drop-hover { outline: 2px dashed var(--brand); outline-offset: -4px; border-radius: 12px; }
.drop-hint { padding: 14px 0; color: var(--muted); font-size: 12px; text-align: left; }
.task-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.task-dot.Creative { background: var(--violet); }
.task-dot.BTL { background: var(--amber); }
.task-dot.Contractor { background: #2dd4bf; }
.task-main { min-width: 0; }
.task-main strong { display: block; min-width: 0; overflow-wrap: break-word; font-size: 14px; line-height: 1.35; }
.task-context { color: var(--muted); font-weight: 500; }
.task-main small { display: block; margin-top: 5px; color: var(--muted); overflow-wrap: break-word; font-size: 11px; line-height: 1.4; }
.task-main em { display: block; margin-top: 5px; color: var(--red); overflow-wrap: break-word; font-size: 11px; line-height: 1.4; font-style: normal; font-weight: 700; }
.task-controls { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.task-actions { display: flex; min-width: 0; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.task-actions:empty { display: none; }
.task-status-select { width: 138px; min-height: 36px; max-width: 100%; padding: 0 28px 0 10px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; background: var(--card); color: var(--ink); font-size: 12px; }
/* Carries the same signal the separate status badge used to — a task row
   showing both a read-only badge AND this same-value select was showing
   the status twice for no reason, just adding a row's worth of width. */
.task-status-select.green { border-left-color: var(--green); }
.task-status-select.amber { border-left-color: var(--amber); }
.task-status-select.red { border-left-color: var(--red); }
.task-status-select.blue { border-left-color: var(--brand); }
.task-status-select.violet { border-left-color: var(--violet); }
.task-row.priority-urgent { margin: 4px 0; padding-left: 12px; padding-right: 10px; border: 1px solid rgba(242, 104, 95, .35); border-radius: 12px; background: rgba(242, 104, 95, .08); }
.task-row.overdue { box-shadow: inset 4px 0 var(--red); }
.risk-button { min-height: 32px; padding: 0 9px; border: 0; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 11px; font-weight: 750; }
.mini-action { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: 11px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.green { color: var(--green); background: var(--green-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.blue { color: var(--brand); background: var(--brand-soft); }
.badge.gray { color: var(--muted); background: rgba(255,255,255,.08); }
.badge.violet { color: var(--violet); background: var(--violet-soft); }

.attention-list { display: grid; gap: 10px; }
.attention-item {
  display: grid;
  grid-template-columns: 7px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  text-align: left;
}
.attention-item:hover { border-color: rgba(255,255,255,.2); }
.attention-item > i { width: 7px; height: 36px; border-radius: 8px; background: var(--amber); }
.attention-item.urgent > i { background: var(--red); }
.attention-item strong { display: block; font-size: 13px; }
.attention-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }

.mini-projects { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.mini-project {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: left;
}
.mini-project:hover { border-color: rgba(255,255,255,.24); box-shadow: var(--shadow); }
.mini-project small { color: var(--brand); font-size: 10px; font-weight: 800; }
.mini-project strong { margin: 8px 0 auto; font-size: 13px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.search { flex: 1; min-height: 44px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.filter-select { min-height: 44px; padding: 0 34px 0 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.project-section { margin-top: 20px; }
.project-section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 14px; }
.project-section-title span { color: var(--muted); font-size: 11px; font-weight: 500; }
.client-link { margin-left: auto; font-size: 12px; }
.project-table { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--card); }
.project-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(220px,1.4fr) minmax(170px,.8fr) 140px 120px 32px;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 18px;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--card);
  text-align: left;
}
.project-row:first-child { border-top: 0; }
.project-row:hover { background: var(--card-2); }
.project-row strong { font-size: 14px; }
.project-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.project-row .owner { color: var(--muted); font-size: 12px; }
.project-row .deadline { color: var(--muted); font-size: 12px; }
.project-row .arrow { color: var(--brand); font-size: 18px; }
.show-all { display: block; margin: 18px auto 0; border: 0; color: var(--brand); background: none; font-weight: 750; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

.project-head { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.project-head small { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.project-head h1 { margin: 5px 0 7px; font-size: 36px; letter-spacing: -.04em; }
.project-head p { margin: 0; color: var(--muted); }
.project-head-actions { display: flex; align-items: center; gap: 10px; }
.back-button { margin: 0 0 20px; padding: 0; border: 0; color: var(--brand); background: none; font-weight: 750; }
.summary-note { margin: 0 0 20px; color: var(--muted); line-height: 1.6; }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.meta-grid span { color: var(--muted); font-size: 12px; }
.meta-grid b { display: block; margin-bottom: 5px; color: var(--ink); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.folder-link { display: flex; justify-content: space-between; width: 100%; margin-top: 20px; padding: 13px 15px; border: 1px dashed rgba(239, 95, 53, .35); border-radius: 12px; color: var(--brand); background: var(--card-2); text-decoration: none; font-size: 12px; font-weight: 750; }

.project-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(360px,.85fr); gap: 18px; align-items: start; }
.project-grid .timeline-panel { grid-column: 1 / -1; }
.checklist { display: grid; gap: 12px; }
.stage-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.stage-card.problem { border-color: rgba(246, 185, 59, .4); }
.stage-card.urgent { border-color: rgba(242, 104, 95, .4); box-shadow: inset 4px 0 var(--red); }
.stage-line { display: grid; grid-template-columns: 34px minmax(0,1fr) 145px auto; align-items: center; gap: 12px; padding: 14px; }
.stage-number { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.stage-main { border: 0; background: transparent; text-align: left; }
.stage-main strong { display: block; font-size: 14px; }
.stage-main small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.stage-main em { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-style: normal; }
.stage-tools { display: flex; gap: 4px; }
.stage-tasks { padding: 0 14px 12px 46px; background: var(--card-2); border-top: 1px solid var(--line); }
.add-in-stage { margin: 11px 0 3px; border: 0; color: var(--brand); background: none; font-size: 11px; font-weight: 750; }
.stage-doc-link { display: inline-block; margin: 11px 12px 3px 0; font-size: 11px; }

@container (max-width: 820px) {
  .task-row {
    grid-template-columns: 10px minmax(0,1fr);
    align-items: start;
    gap: 10px 12px;
    min-height: 0;
    padding-top: 15px;
    padding-bottom: 15px;
  }
  .task-dot { margin-top: 5px; }
  .task-main { grid-column: 2; }
  .task-controls {
    grid-column: 2;
    width: 100%;
    justify-content: flex-start;
  }
  .task-actions { justify-content: flex-start; }
}

@container (max-width: 520px) {
  .task-controls { align-items: stretch; }
  .task-status-select { flex: 1 1 150px; width: auto; }
  .task-actions { flex: 1 1 100%; }
}

.timeline-preview { width: 100%; padding: 2px 0 0; border: 0; background: transparent; text-align: left; }
.timeline-vertical { position: relative; display: grid; gap: 18px; margin-left: 4px; }
.timeline-vertical::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline-item { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 14px; }
.timeline-item i { z-index: 1; width: 16px; height: 16px; border: 4px solid var(--card); border-radius: 50%; background: var(--brand); }
.timeline-item strong { display: block; font-size: 12px; }
.timeline-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.timeline-open { display: block; margin: 18px 0 0 30px; color: var(--brand); font-size: 11px; font-weight: 750; }
.timeline-full { overflow-x: auto; padding: 44px 34px 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.timeline-track { position: relative; display: flex; gap: 28px; min-width: max-content; padding-top: 30px; }
.timeline-track::before { content: ""; position: absolute; left: 0; right: 0; top: 14px; height: 3px; border-radius: 2px; background: var(--line); }
.timeline-event { position: relative; width: 240px; min-height: 160px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.timeline-event::before { content: ""; position: absolute; left: 25px; top: -23px; width: 14px; height: 14px; border: 4px solid var(--card); border-radius: 50%; background: var(--brand); }
.timeline-event strong { font-size: 13px; }
.timeline-event p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.timeline-event small { color: var(--muted); font-size: 10px; }

.tabs { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 12px; font-weight: 700; }
.tab.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.tab-plus { width: 38px; padding: 0; color: var(--brand); font-size: 18px; }
.tab-remove { display: inline-block; margin-left: 8px; opacity: 0.55; font-weight: 900; }
.tab-remove:hover { opacity: 1; }
.kanban-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(220px,1fr)); gap: 12px; align-items: start; overflow-x: auto; }
.kanban-column { min-height: 480px; padding: 12px; border-radius: 16px; }
.kanban-column.new { background: rgba(255,255,255,.03); }
.kanban-column.working { background: rgba(239, 95, 53, .05); }
.kanban-column.revisions { background: var(--violet-soft); }
.kanban-column.review { background: rgba(246, 185, 59, .06); }
.kanban-column.done { background: rgba(55, 211, 153, .06); }
.kanban-column.blocked { background: rgba(242, 104, 95, .06); }
.kanban-head { display: flex; justify-content: space-between; margin-bottom: 12px; padding: 0 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.kanban-card { margin-bottom: 9px; padding: 13px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: var(--card); box-shadow: none; }
.kanban-card.dragging { opacity: .45; }
.kanban-card.urgent { border-color: rgba(242, 104, 95, .45); box-shadow: inset 3px 0 var(--red); }
.kanban-card strong { display: block; font-size: 12px; line-height: 1.4; }
.kanban-card small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.kanban-card footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; }
.kanban-card-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.kanban-card-thumb { display: block; width: 100%; height: 84px; object-fit: contain; border-radius: 8px; margin-bottom: 9px; background: var(--card-2); }

.department-block { margin-bottom: 20px; }
.department-title { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.workload-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; }
.employee-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; min-height: 78px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; }
.employee-card:hover { border-color: rgba(255,255,255,.24); box-shadow: var(--shadow); }
.employee-avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-size: 11px; font-weight: 800; }
.employee-card strong { display: block; font-size: 12px; }
.employee-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.load-risk { padding: 5px 8px; border-radius: 8px; color: var(--green); background: var(--green-soft); font-size: 10px; font-style: normal; font-weight: 750; }
.load-risk.hot { color: var(--red); background: var(--red-soft); }
.employee-detail { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.employee-detail h3 { margin: 0 0 12px; font-size: 14px; }
.employee-detail button, .employee-detail p { width: 100%; margin: 0 0 7px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); text-align: left; font-size: 11px; }

.contractor-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.contractor-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); }
.contractor-card strong { display: block; }
.contractor-card small { display: block; margin: 7px 0 15px; color: var(--muted); }

.modal-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 30px; background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.modal { width: min(720px, calc(100vw - 60px)); max-height: calc(100vh - 60px); overflow: auto; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow-lg); }
.modal.wide { width: min(920px, calc(100vw - 60px)); }
.modal header { position: sticky; top: 0; z-index: 1; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 24px 26px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.modal header h2 { margin: 0; font-size: 23px; }
.modal header button { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--card-2); color: var(--ink); font-size: 20px; }
.modal-body { padding: 22px 26px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card-2); color: var(--ink); font-weight: 500; }
.field textarea { min-height: 86px; resize: vertical; }
.field small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); color: var(--ink); font-weight: 600; font-size: 12px; cursor: pointer; width: auto; min-height: 0; }
.checkbox-pill input { width: auto; min-height: 0; }
.modal footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 17px 26px 24px; }

/* task view (read-only) */
.task-view-badges { display: flex; gap: 8px; margin-bottom: 20px; }
.task-view-grid { margin-bottom: 20px; grid-template-columns: repeat(3, minmax(0,1fr)); }
.task-view-blocked { margin-bottom: 18px; padding: 13px 15px; border: 1px dashed rgba(242, 104, 95, .4); border-radius: 12px; background: var(--red-soft); }
.task-view-blocked b { display: block; margin-bottom: 5px; color: var(--red); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.task-view-blocked p { margin: 0; font-size: 13px; }
.task-view-description { padding-top: 16px; border-top: 1px solid var(--line); }

/* rich-text editor (task/subtask description) */
.rte { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card-2); }
.rte-toolbar { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--card); }
.rte-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 7px; background: none; color: var(--ink); font-size: 13px; cursor: pointer; }
.rte-btn:hover { background: var(--card-2); border-color: var(--line); }
.rte-file-btn { cursor: pointer; }
.rte-body { min-height: 110px; max-height: 320px; padding: 11px 13px; overflow-y: auto; outline: none; }
.rte-content { font-size: 13.5px; line-height: 1.55; }
.rte-content p { margin: 0 0 8px; }
.rte-content ul, .rte-content ol { margin: 0 0 8px; padding-left: 22px; }
.rte-content img { max-width: 100%; border-radius: 8px; display: block; margin: 6px 0; }
.rte-content table { border-collapse: collapse; margin: 6px 0 10px; width: 100%; }
.rte-content td, .rte-content th { border: 1px solid var(--line); padding: 6px 9px; font-size: 12.5px; }
.contractor-task-description { padding: 12px; border-radius: 10px; background: var(--card-2); margin: 8px 0; }
.task-timeline { padding: 20px 26px 4px; border-top: 1px solid var(--line); }
.task-timeline .tl-head { margin-bottom: 14px; }
.task-timeline h3 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.feedback-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; padding: 12px; border: 1px solid var(--violet-soft); border-radius: 12px; background: var(--violet-soft); }
.feedback-form input, .feedback-form textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--ink); font: inherit; }
.feedback-form textarea { min-height: 52px; resize: vertical; }
.feedback-form button { align-self: flex-end; }
.task-timeline .tl { position: relative; max-height: 260px; margin: 0; padding-left: 20px; overflow-y: auto; }
.task-timeline .tl::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.task-timeline .tlrow { position: relative; padding-bottom: 16px; }
.task-timeline .tlrow::before { content: ""; position: absolute; left: -20px; top: 3px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--card); }
.task-timeline .tldate { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.tl-scope { padding: 1px 7px; border-radius: 999px; background: var(--card-2); color: var(--brand-2); font-weight: 700; }
.task-timeline .tlbody { font-size: 13px; line-height: 1.4; }
.task-timeline .tlquote { margin-top: 5px; padding: 8px 11px; border-radius: 9px; background: var(--card-2); color: var(--muted); font-size: 12.5px; font-style: italic; }

.comment-thread { padding: 0 26px 24px; border-top: 1px solid var(--line); }
.comment-thread h3 { margin: 18px 0 12px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.comment-list { display: grid; gap: 10px; max-height: 220px; margin-bottom: 12px; overflow-y: auto; }
.comment { padding: 10px 12px; border-radius: 11px; background: var(--card-2); }
.comment strong { margin-right: 8px; font-size: 12px; }
.comment span { color: var(--muted); font-size: 11px; }
.comment p { margin: 4px 0 0; font-size: 13px; line-height: 1.4; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; min-height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card-2); color: var(--ink); }

.call-log { display: grid; gap: 12px; }
.call-entry { padding: 14px; border-radius: 12px; background: var(--card-2); }
.call-entry header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.call-entry header span { color: var(--muted); }
.call-entry p { margin: 4px 0 0; font-size: 13px; line-height: 1.5; }
.call-actions { color: var(--muted); }
.call-meta { color: var(--muted); font-size: 12px !important; }
.call-checklist { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.call-checklist li label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.call-checklist input[type="checkbox"] { margin-top: 3px; }
.call-checklist .done { color: var(--muted); text-decoration: line-through; }
.link-display { display: flex; align-items: center; gap: 10px; }
.link-display a { flex: 1; padding: 12px; overflow: hidden; border: 1px dashed rgba(255,255,255,.2); border-radius: 10px; color: var(--brand); text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.contractor-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; }
.contractor-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 11px; font-weight: 700; }
.contractor-chip button { border: 0; color: var(--red); background: none; }
.warning-box { margin: 12px 0; padding: 12px 14px; border-radius: 11px; color: var(--amber); background: var(--amber-soft); font-size: 11px; line-height: 1.5; }

.project-chat-log { display: grid; gap: 10px; max-height: 320px; margin-bottom: 14px; overflow-y: auto; }
.chat-msg { padding: 10px 12px; border-radius: 11px; background: var(--card-2); }
.chat-msg header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 12px; }
.chat-msg header strong { font-size: 12.5px; }
.chat-msg header span { color: var(--muted); flex-shrink: 0; }
.chat-msg p { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: break-word; }
.chat-msg header .chat-reply-btn { margin-left: auto; width: auto; height: auto; min-height: 0; padding: 2px 8px; border: 1px solid var(--line); border-radius: 8px; background: none; color: var(--muted); font-size: 10.5px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.chat-msg header .chat-reply-btn:hover { color: var(--ink); border-color: var(--muted); }
.chat-quote { padding: 6px 10px; margin-bottom: 6px; border-left: 3px solid var(--brand); border-radius: 6px; background: var(--card); font-size: 11.5px; }
.chat-quote strong { margin-right: 6px; }
.chat-quote span { color: var(--muted); }
.chat-reply-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; margin-bottom: 8px; border-radius: 10px; background: var(--card-2); border-left: 3px solid var(--brand); font-size: 12px; }
.chat-reply-banner strong { margin: 0 4px; }
.chat-reply-banner .icon-button { flex-shrink: 0; }
.mention { color: var(--brand); font-weight: 700; }
.task-tag { color: var(--violet); font-weight: 700; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-wrap { position: relative; flex: 1; min-width: 0; }
.chat-input-wrap textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--card-2); color: var(--ink); font-family: inherit; font-size: 13.5px; resize: vertical; }
.chat-suggest { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 10; width: 260px; max-height: 220px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-3); box-shadow: var(--shadow-lg); }
.chat-suggest-item { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; text-align: left; background: none; color: var(--ink); font-size: 12.5px; }
.chat-suggest-item:hover { background: var(--card-2); }
.chat-composer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chat-composer-actions input[type="date"] { min-height: 42px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); color: var(--ink); }
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 60; padding: 13px 18px; border-radius: 12px; color: var(--canvas); background: var(--ink); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; }

.auth-screen {
  /* Always dark — same fixed-brand reasoning as .sidebar; nobody's set a
     workspace preference yet at the login/change-password screen. */
  --canvas: #09090b;
  --card: #1a1a1f;
  --card-2: #25252c;
  --ink: #f3f2f0;
  --muted: #97979e;
  --line: rgba(255, 255, 255, .09);
  display: grid; place-items: center; min-height: 100vh; padding: 24px; background: var(--canvas);
}
.auth-card { width: 420px; max-width: 100%; padding: 32px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.auth-card .brand { margin-bottom: 4px; }
.auth-card h1 { margin: 22px 0 16px; font-size: 24px; }
.auth-card .form-grid { grid-template-columns: 1fr; gap: 12px; }
.auth-card .text-button { display: block; margin-top: 16px; text-align: center; }
.auth-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-size: 12px; font-weight: 700; }
.auth-note { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.5; }
.credential-box { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 12px 14px; border-radius: 11px; background: var(--brand-soft); }
.credential-box span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.credential-box strong { font-size: 15px; letter-spacing: .01em; }

.admin-table { display: grid; gap: 10px; }
.admin-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 13px; }
.admin-row span { flex: 1; min-width: 200px; }
.admin-row strong { display: block; font-size: 14px; font-weight: 700; }
.admin-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.admin-row select { min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-size: 12px; }
.contact-role-input { flex: 0 1 220px; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-size: 12px; }
.admin-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--muted); }
.activity-time { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.danger-zone { border: 1px solid rgba(242, 104, 95, .35); }
.danger-zone p { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }

/* --- splash / intro ------------------------------------------------- */
#splash {
  /* Always dark — same fixed-brand reasoning as .sidebar/.auth-screen. */
  --canvas: #09090b;
  --card: #1a1a1f;
  --card-2: #25252c;
  --ink: #f3f2f0;
  --muted: #97979e;
  --line: rgba(255, 255, 255, .09);
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(600px 380px at 50% 30%, rgba(239, 95, 53, .30), transparent 65%),
    radial-gradient(700px 420px at 80% 80%, rgba(255, 143, 92, .18), transparent 60%),
    linear-gradient(180deg, var(--card-2) 0%, var(--canvas) 100%);
  transition: opacity .5s ease, visibility .5s ease;
}
#splash.splash-hide { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-flash {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255,255,255,.95), rgba(255,180,140,.35) 42%, transparent 72%);
  animation: flash-strike .9s ease-out both;
  pointer-events: none;
}
.splash-mark {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(155deg, var(--brand) 0%, var(--brand-2) 130%);
  box-shadow: 0 20px 50px -10px rgba(239, 95, 53, .6), var(--glow);
  color: #fff;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -.02em;
  animation: splash-pop .7s cubic-bezier(.2,.9,.25,1.2) .15s both;
}
.splash-word {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .38em;
  padding-left: .38em;
  opacity: 0;
  animation: splash-word-in .6s ease .45s both;
}
@keyframes splash-pop {
  0% { opacity: 0; transform: scale(.4) rotate(-8deg); }
  60% { opacity: 1; transform: scale(1.06) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes splash-word-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: .85; transform: translateY(0); }
}
@keyframes flash-strike {
  0% { opacity: 0; }
  6% { opacity: .95; }
  11% { opacity: .12; }
  16% { opacity: .75; }
  24% { opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .splash-mark, .splash-word { animation: none; opacity: 1; }
  .splash-flash { animation: none; opacity: 0; }
  #splash { transition: none; }
}

@media (max-width: 1250px) {
  .workspace { padding-left: 28px; padding-right: 28px; }
  .mini-projects { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .workload-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* --- mobile ------------------------------------------------------------
   Below 860px the sidebar becomes a slide-in drawer (toggled by a button
   in the topbar) instead of a permanent column, and every multi-column
   layout collapses to one column. */
@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 280px;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-toggle { display: inline-flex; }

  .workspace { padding: 20px 16px 40px; }
  .topbar { flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
  .topbar h1, .page-head h1 { font-size: 24px; }
  /* The topbar's job on a phone is "search, notice something, know who I
     am" — everything else (workplace select, the full "Check-in"/"На
     работе" label) either moves to a compact icon or relocates to the
     Профиль page (see renderProfile), so this doesn't turn into a wall
     of full-width pills stacked one per row. */
  .top-actions { flex-wrap: wrap; width: 100%; gap: 8px; align-items: center; }
  .global-search-box { flex: 1 1 100%; order: 3; }
  .top-actions .check-control, .icon-only-button, .bell-button { min-height: 40px; min-width: 40px; padding: 0; }
  .top-actions .check-control { display: inline-flex; align-items: center; justify-content: center; }
  .top-actions .check-control .check-dot { margin-right: 0; }
  .top-actions .check-label, .top-actions .mode-select { display: none; }
  .profile-box { flex: 1 1 auto; min-width: 0; }
  .profile-name small { display: none; }
  .profile-name strong { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .impersonate-banner span { display: none; }
  .impersonate-banner { min-height: 40px; padding: 0 12px; }

  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .mini-projects { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .workload-grid { grid-template-columns: 1fr; }
  .employee-detail { grid-template-columns: 1fr; }
  .contractor-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }

  .project-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
  }
  .project-row .owner, .project-row .deadline { flex: 0 0 auto; }
  .project-row .arrow { margin-left: auto; }

  .stage-line { grid-template-columns: 30px minmax(0,1fr); grid-template-rows: auto auto; row-gap: 8px; }
  .stage-line .task-status-select { grid-column: 2; }
  .stage-tools { grid-column: 2; }
  .icon-button { width: 34px; height: 34px; }
  .task-status-select { width: auto; min-width: 108px; }
  .task-row { grid-template-columns: 10px minmax(0,1fr); grid-template-rows: auto auto; row-gap: 8px; }
  .task-controls { grid-column: 2; justify-content: flex-start; }

  .modal-backdrop { padding: 12px; }
  .modal, .modal.wide { width: 100%; }
  .modal-body, .modal header, .modal footer { padding-left: 18px; padding-right: 18px; }

  .chat-composer { flex-wrap: wrap; }
  .chat-input-wrap { flex: 1 1 100%; }
  .chat-composer-actions { width: 100%; justify-content: flex-end; }

  .contractor-header { padding: 16px 18px; flex-wrap: wrap; gap: 10px; }
  .contractor-body { padding: 24px 16px 48px; }

  .page-head, .project-head { flex-wrap: wrap; }
  .toolbar { flex-wrap: wrap; }

  .kanban { grid-auto-columns: 78vw; grid-template-columns: none; grid-auto-flow: column; }
}

/* --- contractor portal ----------------------------------------------- */
.contractor-shell { min-height: 100vh; }
.contractor-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 32px; border-bottom: 1px solid var(--line); }
.contractor-header-actions { display: flex; align-items: center; gap: 18px; }
.contractor-name { font-size: 13px; font-weight: 700; color: var(--muted); }
.contractor-body { max-width: 760px; margin: 0 auto; padding: 32px 24px 60px; }
.contractor-body h1 { margin: 0 0 24px; font-size: 26px; letter-spacing: -.02em; }
.contractor-project-group { margin-bottom: 24px; }
.contractor-project-group h2 { margin: 0 0 10px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.contractor-task-list { display: grid; gap: 10px; }
.contractor-task { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 14px 16px; }
.contractor-task-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 0; background: none; padding: 0; text-align: left; color: var(--ink); }
.contractor-task-title { font-size: 14px; font-weight: 700; }
.contractor-task-meta { display: flex; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.contractor-task-description { margin: 12px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }
.contractor-task.expanded { border-color: rgba(255,255,255,.2); }
.contractor-task .task-status-select { margin-top: 12px; }
