:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --panel-2: #f8f8f6;
  --text: #181a19;
  --muted: #787c78;
  --line: #e7e8e4;
  --accent: #202220;
  --danger: #b93c31;
  --warn: #a16a00;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1320px; margin: 0 auto; min-height: 100vh; padding: 22px; }
.topbar { height: 78px; display: flex; justify-content: space-between; align-items: center; padding: 0 4px 18px; }
.topbar h1 { margin: 2px 0 0; font-size: 30px; letter-spacing: -1px; }
.eyebrow { font-size: 10px; letter-spacing: .18em; font-weight: 800; color: var(--muted); }
.icon-button { border: 0; background: var(--text); color: white; width: 42px; height: 42px; border-radius: 14px; font-size: 24px; }
.layout { display: grid; grid-template-columns: 350px 1fr; min-height: calc(100vh - 122px); background: var(--panel); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 12px 34px rgba(30,30,25,.05); }
.sidebar { background: var(--panel-2); border-right: 1px solid var(--line); padding: 16px; overflow: auto; }
.search-wrap input { width: 100%; border: 1px solid var(--line); background: white; border-radius: 13px; padding: 12px 13px; outline: none; }
.filters { display: flex; gap: 6px; margin: 12px 0 16px; }
.filter { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 10px; font-size: 12px; text-align: left; }
.filter.active { color: var(--text); background: #ecece8; font-weight: 700; }
.filter span { float: right; }
.project-list { display: flex; flex-direction: column; gap: 7px; }
.project-card { border: 1px solid transparent; background: transparent; padding: 13px; border-radius: 15px; text-align: left; transition: .15s ease; }
.project-card:hover { background: white; border-color: var(--line); }
.project-card.active { background: white; border-color: #d9dad5; box-shadow: 0 4px 13px rgba(20,20,20,.04); }
.project-title { font-weight: 720; line-height: 1.25; margin-bottom: 8px; }
.project-meta { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.badge-danger { color: var(--danger); font-weight: 700; }
.content { min-width: 0; overflow: auto; }
.empty-state { min-height: 100%; display: grid; place-content: center; text-align: center; padding: 40px; color: var(--muted); }
.empty-state h2 { margin: 16px 0 5px; color: var(--text); }
.empty-state p { max-width: 440px; line-height: 1.5; }
.empty-icon { margin: auto; width: 54px; height: 54px; display: grid; place-content: center; border-radius: 17px; background: var(--text); color: white; font-size: 24px; }
.project-view { padding: 28px 30px 80px; }
.project-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 22px; }
.project-head h2 { margin: 0 0 8px; font-size: 28px; letter-spacing: -.7px; }
.project-sub { color: var(--muted); font-size: 13px; }
.primary, .secondary, .ghost { border: 0; border-radius: 12px; padding: 10px 14px; }
.primary { background: var(--text); color: white; font-weight: 700; }
.secondary { background: #eeeeea; color: var(--text); }
.ghost { background: transparent; color: var(--muted); font-size: 22px; padding: 3px 7px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: #fbfbfa; }
.stat strong { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--muted); }
.task-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 10px; }
.task-toolbar h3 { margin: 0; font-size: 16px; }
.task-list { border-top: 1px solid var(--line); }
.task { display: grid; grid-template-columns: 38px 1fr auto; align-items: start; gap: 10px; padding: 15px 4px; border-bottom: 1px solid var(--line); }
.check { appearance: none; width: 22px; height: 22px; border: 1.5px solid #b8bbb7; border-radius: 7px; margin-top: 1px; position: relative; }
.check:checked { background: var(--text); border-color: var(--text); }
.check:checked::after { content: '✓'; color: white; position: absolute; inset: 0; display: grid; place-content: center; font-size: 13px; }
.task-title { font-weight: 650; line-height: 1.35; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-info { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; color: var(--muted); }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 3px 7px; background: #fafaf8; }
.pill.high { color: var(--danger); }
.pill.overdue { color: var(--danger); border-color: #efd2ce; background: #fff7f6; }
.status-select { border: 0; background: #f0f0ed; border-radius: 10px; padding: 7px; font-size: 12px; color: var(--muted); }
.pin-preview { margin-top: 28px; background: #f7f7f4; border: 1px solid var(--line); border-radius: 16px; padding: 15px; }
.pin-preview .pin-label { font-size: 10px; color: var(--muted); font-weight: 800; letter-spacing: .12em; margin-bottom: 9px; }
.pin-preview pre { white-space: pre-wrap; margin: 0; font-family: inherit; font-size: 12px; line-height: 1.55; }
.modal { border: 0; border-radius: 20px; width: min(500px, calc(100vw - 28px)); padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.22); }
.modal::backdrop { background: rgba(20,20,18,.35); backdrop-filter: blur(3px); }
.modal form { padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { margin: 0; font-size: 20px; }
.modal label { display: block; font-size: 12px; font-weight: 700; margin: 13px 0; }
.modal input, .modal select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin-top: 6px; outline: none; background: white; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: #1d1f1d; color: white; padding: 10px 14px; border-radius: 11px; pointer-events: none; transition: .2s; font-size: 13px; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.connection { display:inline-flex; gap:6px; align-items:center; margin-left:8px; }
.dot { width:7px; height:7px; border-radius:50%; background:#a8aaa7; }.dot.on{background:#318b50}
@media (max-width: 800px) {
  .app-shell { padding: 0; }
  .topbar { padding: 16px 18px; height: 74px; }
  .layout { display: block; border: 0; border-radius: 0; min-height: calc(100vh - 74px); }
  .sidebar { border: 0; padding: 12px; }
  .content { display: none; }
  body.project-open .sidebar { display: none; }
  body.project-open .content { display: block; }
  .project-view { padding: 20px 16px 60px; }
  .project-head h2 { font-size: 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
}
.history-panel { margin-top: 30px; }
.history-list { border: 1px solid var(--line); border-radius: 14px; background: #fbfbfa; overflow: hidden; }
.history-row { display: grid; grid-template-columns: 100px 1fr; gap: 12px; padding: 11px 13px; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.45; }
.history-row:last-child { border-bottom: 0; }
.history-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-task { color: var(--muted); }
.history-change { margin-top: 3px; color: var(--muted); }
.history-empty { padding: 18px; color: var(--muted); font-size: 12px; }
@media (max-width: 800px) { .history-row { grid-template-columns: 82px 1fr; } }
