/* =========================================================
   НАРЯД — диспетчерская заданий
   Тёмный сине-графитовый интерфейс, сигнальный янтарь.
   Холодные цвета = стадия работы, тёплые = важность.
   ========================================================= */

:root {
  --bg:          #080B11;
  --bg-soft:     #0C121B;
  --surface:     #111925;
  --surface-2:   #17222F;
  --surface-3:   #1E2B3B;
  --line:        #223040;
  --line-soft:   #1A2532;
  --line-strong: #2E4054;

  --text:  #E9F0F8;
  --dim:   #94A6BC;
  --faint: #64768D;

  --amber:  #FFB020;
  --amber-d:#8A5F14;
  --coral:  #FF6B5A;
  --mint:   #3FDD9C;
  --sky:    #62A0FF;
  --slate:  #7C8CA8;

  --st-new:     var(--slate);
  --st-in-work: var(--sky);
  --st-ready:   var(--mint);

  --p1: rgba(255, 176, 32, .40);
  --p2: rgba(255, 176, 32, .58);
  --p3: rgba(255, 176, 32, .76);
  --p4: #FFB020;
  --p5: #FF6B5A;

  --display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --body:    'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', 'Cascadia Mono', Consolas, monospace;

  --r-sm: 7px;
  --r:    10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .8);
  --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, .85);

  --rail: 236px;
  --ease: cubic-bezier(.32, .72, .35, 1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

#root { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 400 14.5px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(255, 176, 32, .07), transparent 65%),
    radial-gradient(760px 480px at 88% 4%, rgba(98, 160, 255, .06), transparent 62%),
    linear-gradient(180deg, #0A0F17, var(--bg) 60%);
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.015em;
  margin: 0;
}

a { color: inherit; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 3px solid transparent;
  background-clip: padding-box;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--mono); }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- загрузочная заставка ---------------- */

.boot {
  height: 100%;
  display: grid;
  place-items: center;
}
.boot-mark { display: flex; gap: 7px; align-items: flex-end; height: 40px; }
.boot-bar {
  width: 7px;
  border-radius: 4px;
  background: var(--amber);
  animation: bootPulse 1.1s var(--ease) infinite;
}
.boot-bar:nth-child(2) { background: var(--sky);  animation-delay: .13s; }
.boot-bar:nth-child(3) { background: var(--mint); animation-delay: .26s; }
@keyframes bootPulse {
  0%, 100% { height: 12px; opacity: .35; }
  50%      { height: 36px; opacity: 1; }
}

/* ---------------- вход ---------------- */

.login {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.login-brand {
  position: relative;
  overflow: hidden;
  padding: clamp(32px, 5vw, 64px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(620px 420px at 20% 20%, rgba(255, 176, 32, .12), transparent 70%),
    linear-gradient(160deg, #0E1621, #080B11);
}

.login-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(600px 480px at 25% 35%, #000 10%, transparent 80%);
  opacity: .8;
  pointer-events: none;
}

.wordmark {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .18em;
  font-size: 15px;
}
.wordmark-bars { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.wordmark-bars i { width: 4px; border-radius: 2px; display: block; }
.wordmark-bars i:nth-child(1) { height: 20px; background: var(--amber); }
.wordmark-bars i:nth-child(2) { height: 14px; background: var(--sky); }
.wordmark-bars i:nth-child(3) { height: 8px;  background: var(--mint); }

.login-pitch { position: relative; z-index: 1; max-width: 520px; }
.login-pitch h1 {
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.02;
  letter-spacing: -.03em;
  margin-bottom: 20px;
}
.login-pitch h1 em {
  font-style: normal;
  color: var(--amber);
}
.login-pitch p {
  color: var(--dim);
  font-size: 16px;
  max-width: 44ch;
  margin: 0;
}

.login-legend {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.login-legend span { display: inline-flex; align-items: center; gap: 8px; }
.login-legend i {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .05);
}

.login-form-side {
  display: grid;
  place-items: center;
  padding: 32px;
  overflow: auto;
}
.login-card { width: min(390px, 100%); }
.login-card h2 { font-size: 26px; margin-bottom: 6px; }
.login-card .sub { color: var(--dim); margin: 0 0 28px; font-size: 14px; }

.login-hint {
  margin-top: 22px;
  padding: 13px 15px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.6;
}
.login-hint b { color: var(--dim); font-family: var(--mono); font-weight: 500; }

/* ---------------- поля и кнопки ---------------- */

.field { display: block; margin-bottom: 16px; }
.field > .label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 7px;
}
.field .help { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); }

.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 11px 13px;
  color: var(--text);
  transition: border-color .16s, background .16s, box-shadow .16s;
}
.input::placeholder, .textarea::placeholder { color: #4E5F75; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--amber);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, .12);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%2394A6BC' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
.select option { background: var(--surface-2); }
input[type="date"].input::-webkit-calendar-picker-indicator {
  filter: invert(.7) sepia(.4) saturate(3) hue-rotate(3deg);
  cursor: pointer;
}

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-bd: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s var(--ease), background .16s, border-color .16s, opacity .16s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary {
  --btn-bg: var(--amber);
  --btn-fg: #1A1204;
  --btn-bd: #FFC24E;
  font-weight: 600;
}
.btn-primary:hover { --btn-bg: #FFC24E; --btn-bd: #FFD37A; }

.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; color: var(--dim); }
.btn-ghost:hover { --btn-bg: var(--surface-2); color: var(--text); border-color: var(--line); }

.btn-danger { --btn-bg: transparent; --btn-bd: rgba(255, 107, 90, .35); color: var(--coral); }
.btn-danger:hover { --btn-bg: rgba(255, 107, 90, .12); --btn-bd: var(--coral); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 17px; height: 17px; }

.form-error {
  background: rgba(255, 107, 90, .1);
  border: 1px solid rgba(255, 107, 90, .3);
  color: #FFB3A8;
  border-radius: var(--r);
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ---------------- каркас приложения ---------------- */

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: var(--rail) 1fr;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px 14px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(17, 25, 37, .9), rgba(10, 15, 23, .9));
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 20px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.rail-brand .name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .08em;
  line-height: 1;
  white-space: nowrap;
}
.rail-brand .tag {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--faint);
  margin-top: 4px;
}

.rail-section {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #45566B;
  padding: 16px 10px 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r);
  color: var(--dim);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(255, 176, 32, .16), rgba(255, 176, 32, .03));
  border-color: rgba(255, 176, 32, .22);
  color: var(--text);
}
.nav-item.is-active svg { color: var(--amber); opacity: 1; }
.nav-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  background: var(--surface-3);
  border-radius: 99px;
  padding: 1px 8px;
}
.nav-item.is-active .nav-count { background: rgba(255, 176, 32, .18); color: var(--amber); }
.nav-count.is-alert { background: rgba(255, 107, 90, .16); color: var(--coral); }

.rail-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft); }

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px;
  border-radius: var(--r);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: background .15s, border-color .15s;
}
.me:hover { background: var(--surface-2); border-color: var(--line); }
.me .meta { min-width: 0; }
.me .who {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me .role {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ---------------- рабочая область ---------------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.topbar h1 { font-size: 21px; }
.topbar .crumb {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 3px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }

.search {
  position: relative;
  width: min(300px, 34vw);
}
.search svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--faint);
  pointer-events: none;
}
.search .input { padding-left: 34px; padding-block: 9px; }

.view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 22px 26px 40px;
}
.view.view-board { padding-bottom: 22px; display: flex; flex-direction: column; }

/* ---------------- сводка ---------------- */

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
  flex: none;
}
.stat {
  position: relative;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.stat .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}
.stat .v {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 600;
  line-height: 1.15;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat .n { font-size: 12px; color: var(--dim); }
.stat.is-alert { border-color: rgba(255, 107, 90, .3); }
.stat.is-alert .v { color: var(--coral); }
.stat.is-hot .v { color: var(--amber); }
.stat.is-done .v { color: var(--mint); }

/* ---------------- доска ---------------- */

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(17, 25, 37, .75), rgba(12, 18, 27, .45));
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  transition: border-color .18s, background .18s;
}
.col.is-over {
  border-color: rgba(255, 176, 32, .5);
  background: linear-gradient(180deg, rgba(255, 176, 32, .07), rgba(12, 18, 27, .5));
}

.col-head { padding: 14px 15px 0; flex: none; }
.col-title { display: flex; align-items: center; gap: 9px; }
.col-title h2 {
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-family: var(--mono);
  font-weight: 500;
  color: var(--dim);
}
.lamp {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent);
  flex: none;
}
.col-n {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.col-head .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.col-head .icon-btn svg { width: 15px; height: 15px; }

/* фирменная деталь: шкала загрузки — по сегменту на задание, цвет = важность */
.gauge {
  display: flex;
  gap: 2px;
  height: 3px;
  margin: 11px 0 3px;
  border-radius: 2px;
  overflow: hidden;
}
.gauge i {
  flex: 1 1 0;
  min-width: 2px;
  background: var(--c, var(--line));
  border-radius: 2px;
  animation: gaugeIn .4s var(--ease) backwards;
}
.gauge.is-empty { background: var(--line-soft); }
@keyframes gaugeIn { from { transform: scaleY(.2); opacity: 0; } }

.col-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 11px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.col-empty {
  margin: auto 0;
  padding: 26px 14px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: var(--r);
}

.drop-line {
  height: 2px;
  margin: -5px 2px;
  border-radius: 2px;
  background: var(--amber);
  box-shadow: 0 0 12px rgba(255, 176, 32, .6);
}

/* ---------------- карточка задания ---------------- */

.card {
  position: relative;
  padding: 12px 13px 11px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .14s var(--ease), border-color .16s, background .16s, box-shadow .16s;
  animation: cardIn .26s var(--ease) backwards;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }

.card::before {
  content: '';
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--c);
}
.card:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
}
.card.is-dragging { opacity: .35; }
.card.is-ghost {
  transform: rotate(1.2deg);
  box-shadow: var(--shadow-3);
}
.card.is-done { opacity: .74; }
.card.is-done .card-title { color: var(--dim); }

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.card-id { letter-spacing: .04em; }
.card-title {
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: 0;
  margin-bottom: 9px;
  overflow-wrap: anywhere;
}

.due {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.due.is-soon { color: var(--amber); }
.due.is-late { color: var(--coral); }
.due svg { width: 12px; height: 12px; }

.stars {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  line-height: 1;
}
.stars svg { width: 13px; height: 13px; }
.stars .on { color: var(--c); }
.stars .off { color: rgba(255, 255, 255, .13); }

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
}
.card-foot .who {
  font-size: 12.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-foot .none { color: var(--faint); font-style: italic; }
.card-meta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}
.card-meta svg { width: 13px; height: 13px; }

/* ---------------- аватар ---------------- */

.av {
  --size: 26px;
  width: var(--size);
  height: var(--size);
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: calc(var(--size) * .38);
  font-weight: 500;
  letter-spacing: .02em;
  color: #0B0F16;
  background: hsl(var(--h) 62% 62%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
  user-select: none;
}
.av-lg { --size: 40px; }
.av-xl { --size: 52px; }
.av.is-off { background: var(--surface-3); color: var(--faint); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------- бейджи ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  border: 1px solid color-mix(in srgb, var(--c) 34%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--c);
  white-space: nowrap;
}
.badge-owner { --c: var(--amber); }
.badge-admin { --c: var(--sky); }
.badge-user  { --c: var(--slate); }
.badge-off   { --c: var(--faint); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { border-color: var(--line-strong); color: var(--text); }
.pill.is-on {
  background: color-mix(in srgb, var(--c, var(--amber)) 14%, transparent);
  border-color: color-mix(in srgb, var(--c, var(--amber)) 40%, transparent);
  color: var(--c, var(--amber));
}

/* ---------------- фильтры ---------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.filters .sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 3px;
}
.filters .select { width: auto; padding-block: 7px; font-size: 13px; }

/* ---------------- таблица заданий ---------------- */

.table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tbl thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  text-align: left;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl tbody tr {
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .13s;
}
.tbl tbody tr:last-child { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td { padding: 11px 14px; vertical-align: middle; }
.tbl td.t-id { font-family: var(--mono); color: var(--faint); font-size: 12px; width: 1%; }
.tbl td.t-title { font-weight: 500; min-width: 260px; }
.tbl td.t-title .desc {
  display: block;
  font-weight: 400;
  color: var(--faint);
  font-size: 12.5px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52ch;
}
.tbl td.t-who { white-space: nowrap; }
.tbl .who-cell { display: inline-flex; align-items: center; gap: 8px; }
.tbl td.t-due { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.tbl td.t-act { width: 1%; white-space: nowrap; text-align: right; }

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c);
  white-space: nowrap;
}

.empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--faint);
}
.empty h3 { font-size: 17px; color: var(--dim); margin-bottom: 7px; }
.empty p { margin: 0 0 18px; font-size: 13.5px; }

/* ---------------- сотрудники ---------------- */

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.person {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  transition: border-color .16s, background .16s;
}
.person:hover { border-color: var(--line); background: var(--surface-2); }
.person.is-off { opacity: .62; }
.person-top { display: flex; align-items: center; gap: 12px; }
.person-top .meta { min-width: 0; flex: 1; }
.person-top .nm {
  font-family: var(--display);
  font-weight: 600;
  font-size: 15.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-top .lg {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
}
.person-pos { font-size: 12.5px; color: var(--dim); margin-top: 2px; }

.person-load { display: flex; gap: 7px; }
.load-cell {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}
.load-cell .k {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.load-cell .v {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  color: var(--c);
  font-variant-numeric: tabular-nums;
}
.person-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; }

.workload { display: flex; flex-direction: column; gap: 9px; }
.wl-row { display: grid; grid-template-columns: 170px 1fr 44px; align-items: center; gap: 12px; }
.wl-row .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line-soft); }
.wl-bar i { display: block; background: var(--c); transition: width .4s var(--ease); }
.wl-row .n { font-family: var(--mono); font-size: 12.5px; color: var(--dim); text-align: right; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  padding: 18px;
}
.panel > h3 {
  font-size: 12px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 15px;
}

.cols-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 16px; align-items: start; }

/* ---------------- модальные окна ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 7, 11, .72);
  backdrop-filter: blur(5px);
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  animation: pop .2s var(--ease);
}
.modal-lg { width: min(840px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  flex: none;
}
.modal-head .crumb {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 4px;
}
.modal-head h2 { font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.modal-head .icon-btn { margin-left: auto; flex: none; }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: rgba(8, 11, 17, .5);
  flex: none;
}
.modal-foot .spacer { margin-left: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* оценка важности */
.rating { display: flex; align-items: center; gap: 10px; }
.rating-stars { display: inline-flex; gap: 3px; }
.rating-stars button {
  padding: 3px;
  background: none;
  border: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, .15);
  line-height: 0;
  border-radius: 4px;
  transition: transform .12s var(--ease), color .12s;
}
.rating-stars button svg { width: 23px; height: 23px; }
.rating-stars button:hover { transform: scale(1.16); }
.rating-stars button.on { color: var(--c); }
.rating-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--dim);
}

/* детали задания */
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  margin-bottom: 18px;
}
.detail-meta .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.detail-meta .v { font-size: 13.5px; display: flex; align-items: center; gap: 7px; }

.detail-desc {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--dim);
  line-height: 1.65;
  margin-bottom: 20px;
}
.detail-desc.is-empty { color: var(--faint); font-style: italic; }

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 12px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.status-switch { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }

.comments { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.comment { display: flex; gap: 10px; }
.comment .bubble {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 9px 12px;
}
.comment .bubble .top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 4px;
}
.comment .bubble .nm { font-size: 13px; font-weight: 500; }
.comment .bubble .ts { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.comment .bubble .txt { font-size: 13.5px; color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; }

.comment-form { display: flex; gap: 9px; align-items: flex-start; }
.comment-form .textarea { min-height: 44px; padding: 10px 12px; }

.history { display: flex; flex-direction: column; gap: 2px; }
.hist {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--dim);
  border-bottom: 1px dashed var(--line-soft);
}
.hist:last-child { border-bottom: 0; }
.hist .ts {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-left: auto;
  white-space: nowrap;
}
.hist b { color: var(--text); font-weight: 500; }

/* ---------------- уведомления ---------------- */

#toasts {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 380px;
  padding: 11px 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c, var(--mint));
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  animation: toastIn .22s var(--ease);
}
.toast.is-out { animation: toastOut .2s var(--ease) forwards; }
.toast-err { --c: var(--coral); }
.toast-ok  { --c: var(--mint); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* ---------------- адаптив ---------------- */

@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; overflow: visible; }
  .col { min-height: 240px; }
  .col-body { overflow: visible; }
  .view.view-board { overflow: auto; }
  .cols-2 { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

@media (max-width: 820px) {
  :root { --rail: 0px; }
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; height: auto; min-height: 100%; }
  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .rail-brand, .rail-section { display: none; }
  .rail-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .nav-item { padding: 8px 11px; white-space: nowrap; }
  .me .meta { display: none; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .search { width: 100%; order: 3; }
  .view { padding: 16px 16px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .wl-row { grid-template-columns: 110px 1fr 38px; }
  .modal { max-height: 92vh; }
}

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