:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --ink: #1c1b1a;
  --muted: #8c867e;
  --line: #e7e3dd;
  --accent: #7c5cff;
  --light: #1aa179;
  --okay: #4666d6;
  --heavy: #e8830c;
  --over: #e5484d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 27, 26, 0.05), 0 8px 24px rgba(28, 27, 26, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Hanken Grotesk', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); }
input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--surface);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 14px; font-weight: 600;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { opacity: 0.9; }
.btn.danger { color: var(--over); border-color: #f3cfcf; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Login ---------- */
.login-wrap { display: grid; place-items: center; height: 100vh; padding: 20px; }
.login-card { width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 2px; font-size: 22px; }
.login-card .sub { color: var(--muted); margin-bottom: 20px; }
.brand-dot { display: inline-block; width: 11px; height: 11px; border-radius: 4px; background: var(--accent); margin-right: 8px; }
.demo-accounts { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; }
.demo-accounts .lbl { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }
.error-msg { color: var(--over); font-size: 13px; margin-top: 8px; min-height: 18px; }
.or-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 4px 0 14px; }
.or-divider::before, .or-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-switch { text-align: center; font-size: 13px; color: var(--muted); margin-top: 14px; }
.auth-switch a { font-weight: 600; }
.login-logo { margin-bottom: 18px; }
.login-logo .logo-img { height: 40px; }
/* ---------- Header notifications bell ---------- */
.bell-wrap { position: relative; }
.bell-badge { background: var(--over); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; margin-left: 2px; }
.bell-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 60vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 40; }
.bell-head { padding: 12px 14px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.bell-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--surface-2); }
.bell-row:last-of-type { border-bottom: none; }
.bell-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell-due { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.bell-empty { padding: 20px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.bell-foot { width: 100%; border: none; border-top: 1px solid var(--line); background: var(--surface-2); padding: 11px; font-weight: 600; font-size: 13px; color: var(--accent); cursor: pointer; position: sticky; bottom: 0; }
.bell-foot:hover { background: #f6f3ff; }

.verify-banner { display: flex; align-items: center; gap: 12px; padding: 9px 24px; background: #fcf2e3; border-bottom: 1px solid #f1ddb8; color: #8a5a12; font-size: 13px; font-weight: 600; }
.verify-banner .btn { margin-left: auto; }
.banner-x { border: none; background: transparent; font-size: 18px; color: #8a5a12; cursor: pointer; line-height: 1; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.sidebar .logo { font-weight: 800; font-size: 18px; padding: 6px 8px 16px; }
.logo-img { display: block; max-width: 100%; height: auto; max-height: 40px; object-fit: contain; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px; color: #4c473f; font-weight: 600; border: none; background: transparent; width: 100%; text-align: left; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--ink); color: #fff; }
.nav-item .ic { width: 18px; text-align: center; opacity: 0.85; }
.nav-item .badge { margin-left: auto; background: var(--over); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar h2 { margin: 0; font-size: 18px; }
.topbar .spacer { flex: 1; }
.content { padding: 24px; overflow-y: auto; flex: 1; }

.avatar { width: 28px; height: 28px; border-radius: 8px; color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; flex: none; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.role-tag { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } .cols-3 { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .k-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .k-value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.kpi .k-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 26px 0 12px; }

.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; }
.split-bar { height: 8px; border-radius: 999px; overflow: hidden; display: flex; background: var(--line); }
.split-bar > span { height: 100%; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.muted { color: var(--muted); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }

/* ---------- Board ---------- */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 10px; }
.column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); width: 270px; flex: none; padding: 10px; }
.column .col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 700; }
.column .col-head .count { color: var(--muted); font-weight: 600; }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin-bottom: 9px; cursor: pointer; }
.task-card:hover { border-color: var(--accent); }
.task-card .tc-title { font-weight: 600; margin: 6px 0; }
.task-card .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.proj-tag { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; color: #fff; }
.tc-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 12px; }
.avatars { display: flex; }
.avatars .avatar { width: 22px; height: 22px; font-size: 9px; margin-left: -5px; border: 2px solid var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }
.add-task { width: 100%; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 9px; padding: 8px; font-weight: 600; }
.add-task:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(28, 27, 26, 0.4); display: grid; place-items: center; padding: 24px; z-index: 50; }
.modal { background: var(--surface); border-radius: 16px; width: 640px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.modal .m-body { padding: 20px; }
.modal .m-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; position: sticky; bottom: 0; background: var(--surface); }
.icon-btn { border: none; background: transparent; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.ms-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--surface-2); }
.ms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.ms-field { display: flex; flex-direction: column; gap: 3px; margin: 0; }
.ms-field > span { font-size: 11px; color: var(--muted); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.check input { width: auto; }

/* ---------- Toast ---------- */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; }
.toast-msg { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); animation: pop 0.18s ease; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.heat { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.timeline-bucket { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: none; background: var(--surface); padding: 7px 14px; font-weight: 600; }
.seg button.on { background: var(--ink); color: #fff; }
.toggle { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #d4d0c9; border: none; transition: background 0.15s; flex: none; cursor: pointer; }
.toggle.on { background: var(--accent); }
.toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.toggle.on::after { left: 22px; }

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-pill { display: flex; align-items: center; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; height: 36px; }
.filter-pill > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.filter-pill select { border: none; background: none; width: auto; font-weight: 600; padding: 0 4px; height: 34px; }
.filter-pill select:focus { outline: none; }

/* ---------- Board drag-and-drop ---------- */
.col-drop { min-height: 24px; border-radius: 9px; transition: background 0.12s, outline-color 0.12s; outline: 2px dashed transparent; outline-offset: -2px; }
.col-drop.drop-over { background: #ece6fc; outline-color: #b7a6f5; }
.task-card { transition: box-shadow 0.12s, transform 0.12s, opacity 0.12s; }
.task-card[draggable='true'] { cursor: grab; }
.task-card.dragging { opacity: 0.45; transform: rotate(1.5deg) scale(1.02); box-shadow: var(--shadow); cursor: grabbing; }
@keyframes settle { from { transform: scale(1.04); box-shadow: 0 8px 20px rgba(124, 92, 255, 0.25); } to { transform: scale(1); box-shadow: none; } }
.task-card.moving { animation: settle 0.22s ease; }

/* ---------- Timeline (2-D) ---------- */
.tl-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.tl-col { width: 212px; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.tl-head { padding: 11px 13px; border-bottom: 1px solid var(--surface-2); }
.tl-body { padding: 10px 11px; display: flex; flex-direction: column; gap: 7px; min-height: 64px; }
.tl-item { border-radius: 7px; padding: 8px 9px; }
.tl-markers { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tl-marker { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Settings: reminder rules ---------- */
.rule-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: 11px; flex-wrap: wrap; }
.rule-row .seg button { font-size: 12px; padding: 5px 11px; }
.rule-del { margin-left: auto; width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; color: #b0aaa1; cursor: pointer; }
.rule-del:hover { background: #fdecec; color: var(--over); }
.add-rule-btn { border: 1px dashed #cdbef5; background: none; border-radius: 10px; padding: 10px; font-size: 12.5px; font-weight: 700; color: var(--accent); cursor: pointer; }
.add-rule-btn:hover { background: #f6f3ff; }
.sched-row { display: flex; align-items: center; gap: 11px; padding: 13px 22px; border-bottom: 1px solid var(--surface-2); }
.sched-row:last-child { border-bottom: none; }
