*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-soft: #f1f3f9;
  --bg-hover: #eef0f7;
  --border: #e3e6ef;
  --border-strong: #cdd2e0;
  --text: #0f1729;
  --text-mid: #4c5670;
  --text-dim: #8b94ab;
  --brand: #5b5bf5;
  --brand-hover: #4a4ae8;
  --brand-soft: #ececfe;
  --brand-text: #4340d6;
  --green: #0d9f6e;
  --green-soft: #dcfaef;
  --amber: #d97706;
  --amber-soft: #fdf0dc;
  --red: #dc3545;
  --red-soft: #fde8ea;
  --blue: #0284c7;
  --blue-soft: #e0f2fe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, .05);
  --shadow: 0 2px 8px rgba(15, 23, 41, .06), 0 1px 2px rgba(15, 23, 41, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 41, .10), 0 2px 8px rgba(15, 23, 41, .05);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --sidebar: 248px;
  --header-h: 60px;
}

:root[data-theme="dark"] {
  --bg: #0b0f1a;
  --bg-elev: #141a29;
  --bg-soft: #1a2133;
  --bg-hover: #212a3f;
  --border: #263049;
  --border-strong: #36425f;
  --text: #eef1f8;
  --text-mid: #a4aec6;
  --text-dim: #6b768f;
  --brand: #7b7bff;
  --brand-hover: #8f8fff;
  --brand-soft: #1f2246;
  --brand-text: #a5a5ff;
  --green: #34d399;
  --green-soft: #0d2b23;
  --amber: #fbbf24;
  --amber-soft: #2e2312;
  --red: #f87171;
  --red-soft: #33191d;
  --blue: #38bdf8;
  --blue-soft: #0c2839;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}

a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }

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

* { -webkit-tap-highlight-color: transparent; }
a, button, .btn, .task, .check, .nav a, .tabs a, .stat, .icon-btn, .chan, .file-btn, .ta-expand {
  touch-action: manipulation;
}

@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .18s ease both; }
::view-transition-new(root) { animation: vt-in .26s cubic-bezier(.2, .9, .3, 1) both; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@supports not (view-transition-name: none) {
  @media (prefers-reduced-motion: no-preference) {
    .content-narrow, .content-wide,
    .content > .stats, .content > .toolbar, .content > .task-list, .content > .card, .content > .empty {
      animation: rise .34s cubic-bezier(.2, .9, .3, 1) both;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(91, 91, 245, .16), transparent 60%),
    radial-gradient(800px 500px at 105% 110%, rgba(168, 85, 247, .14), transparent 55%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}

.auth-logo {
  width: 52px; height: 52px;
  border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 8px 22px rgba(99, 102, 241, .35);
  margin-bottom: 20px;
}
.auth-logo svg { width: 27px; height: 27px; stroke: #fff; }

.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 26px; }

.demo-hint {
  margin-top: 22px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.demo-hint b { color: var(--text-mid); font-weight: 600; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 7px;
}

.input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-elev);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-dim); }
.input:hover { border-color: var(--border-strong); }
.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-soft);
}
textarea.input { resize: vertical; min-height: 78px; line-height: 1.6; }

.ta-wrap { position: relative; }
.ta-wrap textarea { padding-right: 46px; }
.ta-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .13s, color .13s, border-color .13s;
}
.ta-expand:hover { background: var(--bg-hover); color: var(--brand-text); border-color: var(--border-strong); }
.ta-expand svg { width: 15px; height: 15px; }

.editor-modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, .62);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
}
.editor-modal.open { display: grid; }
.editor-box {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(780px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: drop .2s cubic-bezier(.2, .9, .3, 1);
}
.editor-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.editor-head h3 { font-size: 15px; }
.editor-box textarea {
  flex: 1;
  min-height: 44vh;
  border: 0;
  outline: none;
  resize: none;
  padding: 18px 20px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.7;
}
.editor-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
select.input { cursor: pointer; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 17px;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(91, 91, 245, .3);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: 0 4px 16px rgba(91, 91, 245, .42); }

.btn-ghost {
  background: var(--bg-elev);
  border-color: var(--border);
  color: var(--text-mid);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text); }

.btn-danger { background: transparent; border-color: var(--border); color: var(--red); }
.btn-danger:hover:not(:disabled) { background: var(--red-soft); border-color: var(--red); }

.btn-block { width: 100%; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 7px; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  box-shadow: 0 4px 12px rgba(99, 102, 241, .32);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; stroke: #fff; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  padding: 14px 10px 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  font-weight: 500;
  font-size: 14px;
  transition: background .13s, color .13s;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand-text); font-weight: 600; }
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-count {
  margin-left: auto;
  background: var(--bg-soft);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
}
.nav a.on .nav-count { background: var(--brand); color: #fff; }

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

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
}
.me:hover { background: var(--bg-hover); text-decoration: none; }
.me.on-me { background: var(--brand-soft); }
.me-info { min-width: 0; flex: 1; }
.me-name { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 11.5px; color: var(--text-dim); }

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

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elev) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 18px; }
.spacer { flex: 1; }

.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  cursor: pointer;
  position: relative;
  transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.dot {
  position: absolute;
  top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 800;
  display: grid; place-items: center;
  border: 2px solid var(--bg-elev);
  animation: pop .25s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.content { padding: 24px 26px 60px; flex: 1; }
.content-narrow { max-width: 880px; margin: 0 auto; width: 100%; }
.content-wide { max-width: 1280px; margin: 0 auto; width: 100%; }

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.form-grid .card { margin-bottom: 0; }
.form-col { display: flex; flex-direction: column; gap: 16px; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }

.burger { display: none; }

.av {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  flex-shrink: 0;
  letter-spacing: -.01em;
  user-select: none;
}
.av-sm { width: 26px; height: 26px; font-size: 11px; }
.av-lg { width: 42px; height: 42px; font-size: 16px; }
.av-xl { width: 96px; height: 96px; font-size: 34px; }

.color-picker { display: flex; flex-wrap: wrap; gap: 9px; }
.color-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25);
  transition: transform .12s;
}
.color-dot:hover { transform: scale(1.12); }
.color-dot input { position: absolute; opacity: 0; pointer-events: none; }
.color-dot svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3.5; opacity: 0; transition: opacity .12s; }
.color-dot input:checked ~ svg { opacity: 1; }
.color-dot:has(input:checked) { transform: scale(1.12); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), 0 0 0 3px var(--brand); }
.av-img { overflow: hidden; background: var(--bg-soft); }
.av-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 13px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stat-ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
}
.stat-ico svg { width: 15px; height: 15px; }
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-dim); }
.stat-num { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }

.i-todo { background: var(--bg-soft); color: var(--text-mid); }
.i-doing { background: var(--blue-soft); color: var(--blue); }
.i-done { background: var(--green-soft); color: var(--green); }
.i-late { background: var(--red-soft); color: var(--red); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search {
  position: relative;
  flex: 1;
  min-width: 170px;
  max-width: 340px;
}
.search svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 8px 30px 8px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-elev);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input::placeholder { color: var(--text-dim); }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--bg-soft);
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
}
.search-clear:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }

.tabs {
  display: flex;
  gap: 3px;
  background: var(--bg-soft);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.tabs a {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-mid);
  transition: background .13s, color .13s;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow-sm); }

.task-list { display: flex; flex-direction: column; gap: 10px; }

.task {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .14s, box-shadow .14s, border-color .14s;
}
.task:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.task.p-urgent { border-left-color: var(--red); }
.task.p-high { border-left-color: var(--amber); }
.task.p-normal { border-left-color: var(--blue); }
.task.p-low { border-left-color: var(--border-strong); }
.task.is-done { opacity: .62; }
.task.is-done .task-title { text-decoration: line-through; color: var(--text-dim); }

.task-body { flex: 1; min-width: 0; }
.task-title {
  font-weight: 650;
  font-size: 15px;
  color: var(--text);
  display: block;
  margin-bottom: 5px;
  letter-spacing: -.01em;
}
a.task-title:hover { color: var(--brand-text); text-decoration: none; }

.task-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-dim);
}
.task-meta .sep { opacity: .4; }

.progress-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 92px;
}
.bar {
  flex: 1;
  height: 5px;
  background: var(--bg-soft);
  border-radius: 4px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #a855f7);
  border-radius: 4px;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
.bar.full > i { background: linear-gradient(90deg, var(--green), #34d399); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.b-todo { background: var(--bg-soft); color: var(--text-mid); }
.b-doing { background: var(--blue-soft); color: var(--blue); }
.b-done { background: var(--green-soft); color: var(--green); }
.b-cancelled { background: var(--bg-soft); color: var(--text-dim); text-decoration: line-through; }
.b-overdue { background: var(--red-soft); color: var(--red); }
.b-soon { background: var(--amber-soft); color: var(--amber); }
.b-normal { background: var(--bg-soft); color: var(--text-dim); }
.b-urgent { background: var(--red-soft); color: var(--red); }
.b-high { background: var(--amber-soft); color: var(--amber); }
.b-low { background: var(--bg-soft); color: var(--text-dim); }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; }
.card-head > svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-dim); }
.card-body { padding: 19px; }
.card-body.tight { padding: 10px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .13s;
  user-select: none;
}
.check:hover { background: var(--bg-hover); }
.check input { position: absolute; opacity: 0; pointer-events: none; }

.box {
  width: 20px; height: 20px;
  margin-top: 1px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: background .18s, border-color .18s, transform .18s;
}
.box svg {
  width: 12px; height: 12px;
  stroke: #fff;
  stroke-width: 3.5;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  transition: stroke-dashoffset .25s ease .05s;
}
.check input:checked + .box {
  background: var(--green);
  border-color: var(--green);
  animation: tick .32s cubic-bezier(.34, 1.56, .64, 1);
}
.check input:checked + .box svg { stroke-dashoffset: 0; }
@keyframes tick {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.check-text { flex: 1; font-size: 14.5px; line-height: 1.5; }
.check input:checked ~ .check-text { color: var(--text-dim); text-decoration: line-through; }
.check-pick input:checked ~ .check-text { color: var(--text); text-decoration: none; font-weight: 600; }
.check-who { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

.cmt { display: flex; gap: 11px; padding: 13px 0; }
.cmt + .cmt { border-top: 1px solid var(--border); }
.cmt-main { flex: 1; min-width: 0; }
.cmt-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.cmt-name { font-weight: 650; font-size: 13.5px; }
.cmt-time { font-size: 11.5px; color: var(--text-dim); }
.cmt-body {
  font-size: 14.5px;
  color: var(--text-mid);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.attach-img {
  width: 110px; height: 110px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform .15s, box-shadow .15s;
}
.attach-img:hover { transform: scale(1.04); box-shadow: var(--shadow); }
.attach-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
}
.attach-file:hover { background: var(--bg-hover); text-decoration: none; }
.attach-file svg { width: 15px; height: 15px; }

.composer {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 11px;
  background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-soft); }
.composer textarea {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  resize: vertical;
  min-height: 54px;
  font-size: 14.5px;
  line-height: 1.6;
}
.composer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 7px;
  background: var(--bg-soft);
  color: var(--text-mid);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .13s;
}
.file-btn:hover { background: var(--bg-hover); color: var(--text); }
.file-btn svg { width: 15px; height: 15px; }
.file-btn input { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  background: var(--brand-soft);
  color: var(--brand-text);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  max-width: 190px;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 50%;
  opacity: .65;
}
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, .1); }

.chan {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 11px;
  background: var(--bg-elev);
  transition: border-color .15s, box-shadow .15s;
}
.chan:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.chan.linked { border-color: color-mix(in srgb, var(--green) 42%, var(--border)); }

.chan-ico {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.chan-ico svg { width: 21px; height: 21px; }
.c-mail { background: var(--blue-soft); color: var(--blue); }
.c-tg { background: #e3f2fd; color: #0088cc; }
:root[data-theme="dark"] .c-tg { background: #0c2839; color: #38bdf8; }
.c-push { background: var(--brand-soft); color: var(--brand-text); }

.chan-main { flex: 1; min-width: 0; }
.chan-name { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14.5px; }
.chan-desc { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; overflow-wrap: anywhere; }

.tg-guide {
  margin: -4px 0 11px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.tg-guide-head { font-size: 13px; font-weight: 600; color: var(--text-mid); margin-bottom: 8px; }
.tg-steps { margin: 0 0 10px; padding-left: 20px; font-size: 13.5px; color: var(--text-mid); line-height: 1.7; }
.copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
}
.copy-box code {
  flex: 1;
  font-family: "SF Mono", Consolas, Menlo, monospace;
  font-size: 13px;
  color: var(--brand-text);
  overflow-x: auto;
  white-space: nowrap;
}

.pill {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.pill-on { background: var(--green-soft); color: var(--green); }
.pill-off { background: var(--bg-soft); color: var(--text-dim); }
.pill-req { background: var(--amber-soft); color: var(--amber); }

.noti-panel {
  position: fixed;
  top: 68px;
  right: 20px;
  width: min(376px, calc(100vw - 32px));
  max-height: 72vh;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: drop .18s cubic-bezier(.2, .9, .3, 1);
}
.noti-panel.open { display: flex; }
@keyframes drop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.noti-head {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.noti-head h3 { font-size: 14.5px; }
.noti-list { overflow-y: auto; }
.noti {
  display: block;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .13s;
}
.noti:hover { background: var(--bg-hover); text-decoration: none; }
.noti.new { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.noti-t { font-weight: 650; font-size: 13.5px; color: var(--text); margin-bottom: 2px; }
.noti-b { font-size: 12.5px; color: var(--text-mid); line-height: 1.5; }
.noti-w { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-dim);
}
.empty svg { width: 44px; height: 44px; opacity: .35; margin-bottom: 14px; }
.empty h3 { color: var(--text-mid); font-size: 15px; margin-bottom: 5px; }
.empty p { font-size: 13.5px; }

.alert {
  padding: 11px 15px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 15px;
  border: 1px solid transparent;
}
.a-error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.a-ok { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.a-info { background: var(--blue-soft); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }

.toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 17px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 600;
  animation: slide .28s cubic-bezier(.2, .9, .3, 1);
  max-width: 340px;
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.out { animation: slideout .22s ease forwards; }
@keyframes slide { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes slideout { to { opacity: 0; transform: translateX(30px); } }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, .88);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  place-items: center;
  padding: 32px;
  cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
}

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--bg-hover); }

.u-cell { display: flex; align-items: center; gap: 10px; }
.u-name { font-weight: 600; }
.u-mail { font-size: 12px; color: var(--text-dim); }

.day-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.day-chip { cursor: pointer; user-select: none; }
.day-chip input { position: absolute; opacity: 0; pointer-events: none; }
.day-chip span {
  display: grid;
  place-items: center;
  min-width: 42px;
  padding: 8px 6px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--bg-elev);
  transition: all .13s;
}
.day-chip input:checked ~ span {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-text);
}

.ann-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 12px;
  border-radius: var(--r-sm);
}
.ann-item + .ann-item { border-top: 1px solid var(--border); }
.ann-item.ann-off { opacity: .6; }
.ann-main { flex: 1; min-width: 0; }
.ann-title { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ann-body { font-size: 13.5px; color: var(--text-mid); line-height: 1.55; margin-bottom: 7px; overflow-wrap: anywhere; }
.ann-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12.5px; }
.ann-actions { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }

.sched-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.sched-nav { display: flex; align-items: center; gap: 6px; }
.sched-date-main { font-size: 17px; font-weight: 700; letter-spacing: -.01em; min-width: 210px; text-align: center; }
.sched-quick { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sched-quick .btn.on { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }

.sched-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-items: start;
}
.sched-person .card-head { gap: 9px; }
.sched-person .card-body.tight { padding: 8px; display: flex; flex-direction: column; gap: 6px; }

.sched-task {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border-left: 3px solid var(--border);
  background: var(--bg-soft);
  transition: background .13s, transform .13s;
}
.sched-task:hover { background: var(--bg-hover); text-decoration: none; transform: translateX(2px); }
.sched-task.p-urgent { border-left-color: var(--red); }
.sched-task.p-high { border-left-color: var(--amber); }
.sched-task.p-normal { border-left-color: var(--blue); }
.sched-task.p-low { border-left-color: var(--border-strong); }
.sched-task-title { display: block; font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.sched-task-meta { display: flex; flex-wrap: wrap; gap: 6px; }

.desc-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: 14.5px;
  color: var(--text-mid);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 16px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 13px;
}
.back:hover { color: var(--text); text-decoration: none; }
.back svg { width: 15px; height: 15px; }

.muted { color: var(--text-dim); font-size: 13px; }
.hidden { display: none !important; }

@media (max-width: 860px) {
  .burger { display: grid; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.2, .9, .3, 1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: none; }
  .scrim {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 15, .5);
    z-index: 65;
    display: none;
  }
  .scrim.open { display: block; }
  .topbar { padding: 0 14px; }
  .topbar h1 { font-size: 16px; }
  .content { padding: 16px 14px 80px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 23px; }
  .form-grid { grid-template-columns: 1fr; }
  .noti-panel { top: 62px; right: 10px; left: 10px; width: auto; }
  .row { flex-direction: column; }
  .toasts { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  .task { padding: 13px 14px; }
  .hide-sm { display: none !important; }
}
