:root {
  --bg: #faf9f8; --surface: #fff; --text: #201f1e; --muted: #707070; --line: #ebe9e7;
  --accent: #4f52b2; --accent-soft: #eeeefa; --green: #2f855a; --red: #c4314b; --blue: #0f6cbd;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-size: 17px; font-weight: 600; padding: 0 10px 18px; display: flex; gap: 8px; align-items: center; }
.brand i { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.nav a, .nav .nav-h { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: #444; }
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 18px; }
.sidebar .me { margin-top: 24px; padding: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.sidebar .me button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
main { padding: 28px 36px; min-width: 0; }

/* buttons & inputs */
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid var(--line); }
.btn.sm { padding: 3px 10px; font-size: 13px; }
input[type=text], input[type=search], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
.messages { margin-bottom: 14px; }
.msg { padding: 9px 14px; border-radius: 8px; background: var(--accent-soft); margin-bottom: 6px; }
.msg.error { background: #fdeaee; color: var(--red); }
.muted { color: var(--muted); }

/* hub */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; }
.page-head h1 { font-size: 24px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); transition: transform .12s; display: block; }
a.card:hover { transform: translateY(-2px); }
.card .emoji { font-size: 22px; }
.card h3 { margin: 8px 0 2px; font-size: 15px; }
.bar { height: 5px; background: var(--line); border-radius: 5px; overflow: hidden; margin-top: 12px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.new-plan { background: var(--surface); border: 1px dashed #d0cecb; border-radius: var(--radius); padding: 16px; margin-top: 26px; display: grid; grid-template-columns: 70px 1fr 140px auto; gap: 10px; align-items: end; }

/* plan header */
.plan-head h1 { font-size: 22px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 16px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; }
.toolbar .chk { display: flex; gap: 5px; align-items: center; margin: 0; font-size: 13px; }

/* board */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.col { flex: 0 0 290px; background: #f3f2f1; border-radius: var(--radius); padding: 10px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 8px; font-weight: 600; }
.col-head .count { color: var(--muted); font-weight: 400; margin-left: 6px; }
.col-head details { position: relative; }
.col-head summary { cursor: pointer; list-style: none; color: var(--muted); padding: 0 6px; }
.col-head summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; top: 24px; z-index: 5; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 8px; padding: 10px; width: 210px; display: grid; gap: 6px; }
.drop { min-height: 30px; display: grid; gap: 8px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer; position: relative; }
.task:hover { border-color: #cfcdcb; }
.task.dragging { opacity: .4; }
.drop.over { background: rgba(79,82,178,.07); border-radius: 8px; }
.task .t-title { display: flex; gap: 8px; align-items: flex-start; }
.task.done .t-title span { text-decoration: line-through; color: var(--muted); }
.circle { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #b5b3b1; background: none; cursor: pointer; margin-top: 2px; padding: 0; color: #fff; font-size: 11px; line-height: 15px; }
.circle:hover { border-color: var(--green); }
.circle.on { background: var(--green); border-color: var(--green); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); align-items: center; }
.chip { padding: 1px 8px; border-radius: 10px; background: #f3f2f1; }
.chip.late { background: #fdeaee; color: var(--red); }
.chip.p1 { color: var(--red); } .chip.p3 { color: #ca5010; }
.dots { display: flex; gap: 3px; margin-bottom: 6px; }
.dots i { height: 6px; width: 26px; border-radius: 4px; }
.lbl { color: #fff; padding: 0 8px; border-radius: 10px; font-size: 11px; }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; display: inline-grid; place-items: center; text-transform: uppercase; margin-left: -4px; border: 2px solid #fff; }
.avatars { margin-left: auto; display: flex; padding-left: 4px; }
.add-task { margin-top: 8px; }
.add-task input { border-style: dashed; background: transparent; }
.add-col { flex: 0 0 240px; }

/* grid */
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th a:hover { color: var(--accent); }
td { padding: 9px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover { background: var(--bg); }

/* schedule */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { padding: 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: center; }
.cal .day { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.cal .day:nth-child(7n+7) { border-right: 0; }
.cal .day.out { background: var(--bg); color: #aaa; }
.cal .num { font-size: 12px; margin-bottom: 4px; display: inline-block; }
.cal .today .num { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; }
.cal .pill { display: block; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal .pill.done { background: #e6f4ec; color: var(--green); text-decoration: line-through; }
.cal .pill.late { background: #fdeaee; color: var(--red); }
.month-nav { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.month-nav h2 { min-width: 160px; text-align: center; font-size: 16px; }

/* charts */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat b { font-size: 26px; font-weight: 600; display: block; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { font-size: 14px; margin-bottom: 14px; }
.donut { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 14px; position: relative; }
.donut::after { content: ""; position: absolute; inset: 28px; background: var(--surface); border-radius: 50%; }
.legend { display: grid; gap: 4px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.legend div { display: flex; justify-content: space-between; }
.hbar { display: grid; grid-template-columns: 90px 1fr 24px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.hbar .track { background: var(--line); height: 8px; border-radius: 5px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

/* my tasks */
.group { margin-bottom: 22px; }
.group h3 { font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.group .list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:last-child { border: 0; }
.item:hover { background: var(--bg); }
.item .grow { flex: 1; }
.item.done .grow b { text-decoration: line-through; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

/* settings */
.settings { max-width: 640px; display: grid; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row form { margin: 0; }

/* modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(32,31,30,.4); }
.modal { padding: 24px; max-height: 88vh; overflow-y: auto; }
.modal .title { font-size: 18px; font-weight: 600; border: 0; padding: 4px 0; margin-bottom: 12px; }
.modal .title:focus { box-shadow: none; border-bottom: 1px solid var(--accent); border-radius: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.checks label { display: inline-flex; gap: 5px; color: var(--text); font-size: 13px; }
.field { margin-bottom: 14px; }
.ck { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.ck input[type=text] { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 2px; }
.ck .x { background: none; border: 0; color: var(--muted); cursor: pointer; }
.modal-foot { display: flex; justify-content: space-between; margin-top: 18px; }
.comments { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; }
.comment { margin-bottom: 10px; }
.comment small { color: var(--muted); }
.errorlist { color: var(--red); list-style: none; margin: 2px 0; padding: 0; font-size: 12px; }

/* auth */
.auth { max-width: 360px; margin: 10vh auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; box-shadow: var(--shadow); }
.auth h1 { margin-bottom: 18px; font-size: 22px; }
.auth p { margin: 0 0 12px; }
.auth .helptext, .auth ul { font-size: 12px; color: var(--muted); }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  main { padding: 18px; }
  .new-plan { grid-template-columns: 1fr; }
}

/* notifications, attachments */
.badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; }
a.item.seen { opacity: .6; }
.item .ico { font-size: 18px; }
.unread { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.att { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.att .ico { width: 44px; text-align: center; font-size: 22px; }
.att .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.att .x { background: none; border: 0; color: var(--muted); cursor: pointer; }
