:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #202331;
  --muted: #74798a;
  --line: #e6e9f1;
  --accent: #ee4b5f;
  --accent-strong: #d8344a;
  --soft: #f9dfe4;
  --green: #19a974;
  --yellow: #f2b84b;
  --shadow: 0 16px 50px rgba(26, 31, 54, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  display: grid;
  grid-template-columns: 300px 1fr;
}
body.login-mode .sidebar,
body.login-mode .tabs,
body.login-mode .top-actions { display: none; }
body.login-mode { grid-template-columns: 1fr; }

button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 13px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
}
button:hover { box-shadow: inset 0 0 0 1px #cbd0dc; }
input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}
textarea { min-height: 130px; resize: vertical; }

.sidebar {
  height: 100vh;
  position: sticky;
  top: 0;
  background: #222637;
  color: white;
  padding: 22px 16px;
  overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.brand span { display: block; color: #aeb4c5; font-size: 12px; margin-top: 2px; }
.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #ff8a58);
  display: grid;
  place-items: center;
  font-weight: 800;
}
.mobile-toggle { display: none; }
.project-search input { width: 100%; background: #2e3347; color: white; border-color: #3d435a; }
.projects { margin-top: 16px; display: grid; gap: 5px; }
.project-item {
  width: 100%;
  text-align: left;
  color: #eef1f8;
  background: transparent;
  box-shadow: none;
  padding: 10px 11px;
  border-radius: 10px;
}
.project-item:hover, .project-item.active { background: #30364b; box-shadow: none; }
.project-item small { color: #aeb4c5; float: right; }

.shell { min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.topbar h1 { margin: 4px 0 0; font-size: clamp(25px, 3vw, 38px); letter-spacing: -0.04em; }
.eyebrow { color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.top-actions input { width: min(360px, 38vw); }
.user-badge { color: var(--muted); font-size: 13px; white-space: nowrap; align-self: center; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab.active { background: var(--accent); color: white; box-shadow: none; }

.content.empty {
  min-height: 360px;
  background: var(--panel);
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; }
.primary { background: var(--accent); color: white; box-shadow: none; }
.danger { color: var(--accent-strong); }

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(290px, 340px);
  gap: 14px;
  overflow-x: auto;
  min-height: calc(100vh - 190px);
  padding-bottom: 18px;
}
.column {
  background: #e9edf5;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 205px);
}
.column-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.column-header h2 { margin: 0; font-size: 15px; }
.list-title-input {
  min-width: 0;
  width: 100%;
  border: 0;
  padding: 5px 6px;
  background: transparent;
  font-weight: 800;
  border-radius: 7px;
}
.list-title-input:focus { background: white; box-shadow: inset 0 0 0 1px var(--line); }
.count { color: var(--muted); font-size: 12px; background: #fff; padding: 3px 7px; border-radius: 999px; }
.cards { display: grid; gap: 9px; overflow: auto; padding-right: 2px; min-height: 80px; }
.card {
  background: var(--panel);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 4px 18px rgba(34, 38, 55, 0.08);
  border: 1px solid transparent;
  cursor: grab;
}
.card:hover { border-color: #ccd3e2; }
.card-title { font-weight: 700; line-height: 1.3; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { background: #f1f3f8; border-radius: 999px; padding: 2px 7px; }
.badge.due { background: var(--soft); color: var(--accent-strong); }
.badge.done { background: #dcf7ec; color: #087a51; }
.label-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.label-dot { height: 7px; min-width: 28px; border-radius: 99px; background: var(--accent); }
.chips { margin: 0 0 9px; }
.label-chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--label) 18%, white);
  color: color-mix(in srgb, var(--label) 72%, #111827);
  font-size: 11px;
  font-weight: 700;
}
.card-footer { display: flex; justify-content: flex-end; margin-top: 10px; }
.avatars { display: flex; flex-direction: row-reverse; }
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #30364b;
  color: white;
  font-size: 10px;
  font-weight: 800;
  border: 2px solid white;
  margin-left: -6px;
}

.table-wrap, .panel {
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: #fafbfe; }
tr:hover td { background: #fafbff; }
.link { color: var(--accent-strong); cursor: pointer; font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--panel); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 13px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.bar { height: 9px; border-radius: 99px; background: #edf0f6; overflow: hidden; margin: 7px 0 12px; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff9a6c); }

.chat-layout { display: grid; grid-template-columns: 320px 1fr; gap: 14px; min-height: 580px; }
.channel-list, .messages { background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: auto; }
.channel-list button { width: 100%; text-align: left; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--line); }
.message { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.message small { color: var(--muted); display: block; margin-bottom: 5px; }

.task-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.28);
  padding: 0;
}
.task-dialog::backdrop { background: rgba(20, 24, 36, 0.45); }
.dialog-form { margin: 0; padding: 22px; position: relative; }
.close { position: absolute; top: 14px; right: 14px; font-size: 22px; width: 38px; height: 38px; padding: 0; }
.task-grid { display: grid; grid-template-columns: 1fr 280px; gap: 20px; }
.task-grid h2 { margin: 0 44px 12px 0; font-size: 27px; letter-spacing: -0.03em; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.comment-box { display: grid; gap: 8px; margin-top: 16px; }
.comments { margin-top: 14px; display: grid; gap: 8px; }
.comment { background: #f6f8fc; border-radius: 12px; padding: 10px; white-space: pre-wrap; }
.raw { white-space: pre-wrap; background: #171b26; color: #dbe2f1; border-radius: 14px; padding: 14px; overflow: auto; max-height: 70vh; }
.login-content { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}
.login-card h1 { margin: 0; }
.login-card p { margin: 0; color: var(--muted); }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.login-card .mark { color: white; }
.login-card small { color: var(--accent-strong); min-height: 18px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-grid .wide { grid-column: 1 / -1; }
.list-settings { display: grid; gap: 8px; margin-bottom: 12px; }
.list-setting-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.muted { color: var(--muted); }
.toggle { display: flex; gap: 8px; align-items: center; margin: 10px 0; color: var(--ink); }
.toggle input { width: 16px; height: 16px; }
.checklist-list, .file-list, .relation-list { display: grid; gap: 7px; margin: 8px 0 12px; }
.check-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: start;
  padding: 7px 8px;
  background: #f6f8fc;
  border-radius: 10px;
  font-size: 13px;
}
.check-item input { width: 15px; height: 15px; margin-top: 2px; }
.add-inline { display: grid; grid-template-columns: 1fr 38px; gap: 6px; margin-bottom: 14px; }
.add-inline button { padding: 0; }
.file-list a, .file-list span, .relation-list button {
  display: block;
  text-align: left;
  color: var(--ink);
  text-decoration: none;
  background: #f6f8fc;
  border-radius: 10px;
  padding: 8px 9px;
  box-shadow: none;
  font-size: 13px;
}
.file-list a:hover, .relation-list button:hover { color: var(--accent-strong); }
.activity-mini p { margin: 8px 0; padding: 8px; background: #f6f8fc; border-radius: 10px; }
.activity-mini small { display: block; color: var(--muted); margin-bottom: 3px; }
.timer-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  background: #fff7f8;
  border: 1px solid var(--soft);
  border-radius: 12px;
  padding: 9px;
  margin-bottom: 12px;
}
.timer-box small { grid-column: 1 / -1; color: var(--muted); }
.timer-box button:disabled { opacity: .45; cursor: not-allowed; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(210px, 1fr));
  gap: 12px;
  overflow-x: auto;
}
.timeline-day {
  min-height: 520px;
  background: #e9edf5;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.timeline-day h2 { margin: 0 0 5px; font-size: 13px; color: var(--muted); }
.activity-feed { max-width: 980px; }
.activity-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--soft);
}
.activity-item small { color: var(--muted); display: block; margin-bottom: 3px; }
.activity-item strong { display: block; }
.activity-item p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; max-height: 45vh; }
  .shell { padding: 16px; }
  .topbar { flex-direction: column; }
  .top-actions { width: 100%; }
  .top-actions input { width: 100%; }
  .split, .chat-layout, .task-grid { grid-template-columns: 1fr; }
  .timeline-grid { grid-template-columns: repeat(7, minmax(240px, 82vw)); }
  .board { grid-auto-columns: minmax(260px, 86vw); }
}
