:root {
  --ink: #17231c;
  --muted: #5c6b61;
  --line: #d5ddd6;
  --paper: #f3efe4;
  --card: #fffdf8;
  --side: #1b2a22;
  --side-2: #24352b;
  --accent: #c45c26;
  --accent-2: #2f6f4e;
  --danger: #9b2c2c;
  --ok: #2f6f4e;
  --warn: #9a6700;
  --shadow: 0 10px 30px rgba(23, 35, 28, 0.08);
  --radius: 14px;
  --font: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(1200px 400px at 10% -10%, rgba(196, 92, 38, 0.08), transparent 50%),
    linear-gradient(#f3efe4, #ebe6d8);
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--side) 0%, #121c17 100%);
  color: #e8efe9;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
.mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.04em;
}
.brand h1 { font-size: 16px; margin: 0; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 12px; color: #9fb0a6; }

nav { display: flex; flex-direction: column; gap: 4px; }
nav a {
  color: #c5d4cb;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
nav a:hover, nav a.active { background: var(--side-2); color: #fff; }
nav a.active { box-shadow: inset 3px 0 0 var(--accent); }

.side-user {
  margin-top: auto;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  font-size: 13px;
}
.side-user strong { display: block; }
.side-user span { color: #9fb0a6; }
.side-user .out { display: inline-block; margin-top: 8px; color: #f0c7b0; }

.content { padding: 28px 36px 48px; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 22px;
}
.topbar h2 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.topbar .sub { color: var(--muted); margin-top: 4px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 10px; padding: 10px 14px;
  font: inherit; font-weight: 650; cursor: pointer;
  background: var(--ink); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn.accent { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 13px; }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 32px; font-weight: 750; margin-top: 6px; letter-spacing: -0.04em; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
tr:hover td { background: #faf7ef; }

.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 650;
  background: #e7eee9; color: var(--accent-2);
}
.badge.warn { background: #f8e7c5; color: #7a4e00; }
.badge.danger { background: #f6d6d6; color: var(--danger); }
.badge.neutral { background: #eceae3; color: var(--muted); }

.flash { list-style: none; padding: 0; margin: 0 0 16px; }
.flash li { padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; }
.flash .success { background: #def3e6; }
.flash .error { background: #f8d7d7; }
.flash .warning { background: #f8e7c5; }
.flash .info { background: #e4eef8; }

.form { max-width: 720px; display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); font: inherit; background: #fff;
}
.field textarea { min-height: 90px; resize: vertical; }
.field .error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select {
  padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: #fff;
}

.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.muted { color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card { width: min(420px, 100%); }
.login-card h2 { margin: 0 0 6px; }
.login-card .sub { margin-bottom: 18px; }

.report-block { margin-top: 22px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 140px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: #eceae3; border-radius: 99px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--accent-2); }

.empty { padding: 28px; text-align: center; color: var(--muted); }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .side-user { margin-top: 0; width: 100%; }
  .stats, .split, .row-2 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}

/* --- task manager additions --- */
.badge.priority-critical { background: #f6d6d6; color: var(--danger); }
.badge.priority-high { background: #f8e7c5; color: #7a4e00; }
.badge.priority-medium { background: #e4eef8; color: #2c5a86; }
.badge.priority-low { background: #eceae3; color: var(--muted); }

.badge.status-new { background: #eceae3; color: var(--muted); }
.badge.status-in_progress { background: #e4eef8; color: #2c5a86; }
.badge.status-pending_approval { background: #f8e7c5; color: #7a4e00; }
.badge.status-approved { background: #d5ede8; color: #1f7a6c; }
.badge.status-revision { background: #f6d6d6; color: var(--danger); }
.badge.status-done { background: #def3e6; color: var(--accent-2); }
.badge.status-postponed { background: #eceae3; color: var(--muted); }
.badge.status-cancelled { background: #f0f0f0; color: #999; }

.overdue { color: var(--danger); font-weight: 700; }

.bucket-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.bucket h3 { margin: 0 0 10px; font-size: 15px; }
.task-mini { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.task-mini:last-child { border-bottom: none; }

.tag-pill { display: inline-block; background: #eceae3; color: var(--muted); border-radius: 999px; padding: 2px 8px; font-size: 12px; margin-right: 4px; }

.comment { border-bottom: 1px solid var(--line); padding: 12px 0; }
.comment:last-child { border-bottom: none; }
.comment .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.comment .body p { margin: 0 0 8px; }
.comment .body ul { margin: 0 0 8px; padding-left: 20px; }
.mention { background: #e4eef8; color: #2c5a86; border-radius: 4px; padding: 0 3px; font-weight: 650; }

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checklist li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }

.history-list { list-style: none; padding: 0; margin: 0; font-size: 13px; display: grid; gap: 8px; }
.history-list li { border-bottom: 1px solid var(--line); padding-bottom: 8px; }

.attachment-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.attachment-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.tree-item { margin-left: calc(var(--depth, 0) * 20px); }

.notif-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notif-item.unread { font-weight: 650; }
.notif-item:last-child { border-bottom: none; }

.upload-field { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; background: #fff; }

.task-picker { position: relative; }
.task-picker-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font: inherit; background: #fff; }
.task-picker-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 260px; overflow-y: auto;
}
.task-picker-item { padding: 8px 12px; font-size: 13px; cursor: pointer; }
.task-picker-item:hover { background: #f3efe4; }
.task-picker-item + .task-picker-item { border-top: 1px solid var(--line); }

.board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; }
.board-col {
  flex: 0 0 264px; border-radius: var(--radius); padding: 12px;
  border: 1px solid var(--line); border-top: 6px solid var(--muted);
  box-shadow: var(--shadow);
}
.board-col h3 { margin: 0 0 10px; font-size: 14px; }
.board-col-body { min-height: 40px; }
.board-col.status-new { border-top-color: #9a9a90; background: #eeece6; }
.board-col.status-in_progress { border-top-color: #2c5a86; background: #e7edf3; }
.board-col.status-pending_approval { border-top-color: #b07a00; background: #f6ecd8; }
.board-col.status-approved { border-top-color: #1f7a6c; background: #dcede9; }
.board-col.status-revision { border-top-color: #9b2c2c; background: #f4e2e2; }
.board-col.status-done { border-top-color: #2f6f4e; background: #e4ede7; }
.board-col.status-postponed { border-top-color: #a9a69a; background: #ece9e0; }
.board-col.status-cancelled { border-top-color: #8c8c86; background: #e6e6e1; }
.board-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); font-size: 13px; color: var(--ink);
  border-left: 3px solid var(--muted);
}
.board-card.priority-critical { border-left-color: var(--danger); }
.board-card.priority-high { border-left-color: #9a6700; }
.board-card.priority-medium { border-left-color: #2c5a86; }
.board-card.priority-low { border-left-color: var(--muted); }
.board-card-title { font-weight: 650; margin-bottom: 6px; }
.board-card-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.board-card-assignee { margin-top: 4px; color: var(--muted); font-size: 12px; }

.settings-group { margin-bottom: 18px; }
.settings-group h4 { margin: 0 0 8px; font-size: 14px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }

.matrix-table th, .matrix-table td { text-align: center; }
.matrix-table td:first-child, .matrix-table th:first-child { text-align: left; }

/* --- gantt --- */
.gantt-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; }
.gantt-legend-item { display: flex; align-items: center; gap: 6px; }
.gantt-legend-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.gantt-legend-swatch.status-new { background: #9a9a90; }
.gantt-legend-swatch.status-in_progress { background: #2c5a86; }
.gantt-legend-swatch.status-pending_approval { background: #b07a00; }
.gantt-legend-swatch.status-approved { background: #1f7a6c; }
.gantt-legend-swatch.status-revision { background: #9b2c2c; }
.gantt-legend-swatch.status-done { background: #2f6f4e; }
.gantt-legend-swatch.status-postponed { background: #b6b3a6; }
.gantt-legend-swatch.status-cancelled { background: #d8d6cc; }

.gantt-chart { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.gantt-months { position: relative; height: 26px; border-bottom: 1px solid var(--line); background: #faf7ef; }
.gantt-months-track { position: absolute; left: 220px; right: 0; top: 0; bottom: 0; }
.gantt-month-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: 11px; color: var(--muted); padding: 5px 0 0 4px; white-space: nowrap; }

.gantt-row { position: relative; height: 34px; border-bottom: 1px solid var(--line); }
.gantt-row:last-child { border-bottom: none; }
.gantt-row-label { position: absolute; left: 0; top: 0; bottom: 0; width: 220px; padding: 7px 10px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--card); border-right: 1px solid var(--line); z-index: 2; }
.gantt-track { position: absolute; left: 220px; right: 0; top: 0; bottom: 0; }

.gantt-bar {
  position: absolute; top: 6px; height: 20px; border-radius: 5px;
  min-width: 6px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.gantt-bar.status-new { background: #9a9a90; }
.gantt-bar.status-in_progress { background: #2c5a86; }
.gantt-bar.status-pending_approval { background: #b07a00; }
.gantt-bar.status-approved { background: #1f7a6c; }
.gantt-bar.status-revision { background: #9b2c2c; }
.gantt-bar.status-done { background: #2f6f4e; }
.gantt-bar.status-postponed { background: #b6b3a6; }
.gantt-bar.status-cancelled { background: #d8d6cc; }
.gantt-bar.is-overdue { outline: 2px solid var(--danger); outline-offset: 1px; }

.gantt-today-wrap { position: absolute; left: 220px; right: 0; top: 0; bottom: 0; pointer-events: none; z-index: 3; }
.gantt-today { position: absolute; top: 26px; bottom: 0; width: 2px; background: var(--accent); }
.gantt-today-label { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--accent); font-weight: 650; white-space: nowrap; }

.gantt-grid { position: absolute; left: 220px; right: 0; top: 26px; bottom: 0; pointer-events: none; z-index: 1; }
.gantt-grid-line { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); }

.gantt-deps { position: absolute; left: 220px; top: 0; width: calc(100% - 220px); pointer-events: none; z-index: 2; overflow: visible; }
.gantt-dep-line { stroke-width: 1.5; fill: none; }
.gantt-dep-line.blocking { stroke: var(--danger); color: var(--danger); }
.gantt-dep-line.related { stroke: var(--muted); color: var(--muted); stroke-dasharray: 4 3; }

.gantt-legend-line { width: 20px; height: 2px; display: inline-block; background: var(--muted); }
.gantt-legend-line.blocking { background: var(--danger); }
.gantt-legend-line.related { background: var(--muted); border-top: 2px dashed var(--muted); height: 0; }

.gantt-scroll { overflow-x: auto; }
.gantt-inner { min-width: 900px; position: relative; }
