:root {
  --bg: #f4f5f7; --card: #fff; --line: #e3e5ea; --soft: #eef0f4; --text: #1f2430; --muted: #6b7280;
  --work: #2b4acb; --work-bg: #e9edff; --pers: #1a8a5a; --pers-bg: #e2f5ec;
  --bad: #c62828; --bad-bg: #fdecea; --bad-line: #f5c2c0; --hint-bg: #fff8e1; --hint-line: #f3dd94;
  --block: #eceef2;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171c; --card: #1e2128; --line: #2e323b; --soft: #272a32; --text: #e6e8ec; --muted: #9aa1ad;
    --work: #8aa2ff; --work-bg: #232c4d; --pers: #5fcf9c; --pers-bg: #1b3a2d;
    --bad: #ff8a80; --bad-bg: #3a2020; --bad-line: #5a2c2c; --hint-bg: #3a331c; --hint-line: #5a4e25; --block: #2a2d35;
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }

.logo { font-weight: 700; font-size: 20px; color: var(--work); }
.btn { padding: 10px 16px; border-radius: 8px; background: var(--work); color: #fff; font-weight: 600; white-space: nowrap; }
.btn.ghost { background: var(--soft); color: var(--text); }
.btn.danger { color: var(--bad); }
.icon { font-size: 18px; width: 38px; height: 38px; border-radius: 8px; }
.icon:hover { background: var(--soft); }
.muted { color: var(--muted); font-size: 14px; }
.err { color: var(--bad); min-height: 20px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 340px; display: grid; gap: 14px; }
.login-card input { padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }

.top { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; background: var(--soft); border-radius: 8px; padding: 3px; }
.tabs button { padding: 5px 12px; border-radius: 6px; color: var(--muted); }
.tabs .on { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px #0002; }
.datenav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.datenav button { padding: 6px 10px; border-radius: 6px; font-weight: 600; }
.datenav button:hover { background: var(--soft); }

.input { display: flex; gap: 8px; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.input input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.mic { width: 44px; height: 42px; border-radius: 50%; background: var(--work); color: #fff; font-size: 18px; flex: none; }
.mic.rec { background: var(--bad); animation: pulse 1s infinite; }
.mic.busy { opacity: .5; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.recbar { padding: 8px 20px; background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.recbar .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--bad); margin-right: 6px; }

.drafts { padding: 12px 20px; background: var(--hint-bg); border-bottom: 1px solid var(--hint-line); display: grid; gap: 10px; }
.drafts h4 { font-size: 14px; }
.draft { display: grid; grid-template-columns: 2fr 120px 170px 190px 90px 34px; gap: 8px; align-items: center; }
.draft input, .draft select, dialog input, dialog select { border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; background: var(--card); width: 100%; }
.draft .x { color: var(--muted); font-size: 18px; }
.draft-actions { display: flex; gap: 8px; }

.wrap { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 16px; padding: 16px 20px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
#list { padding: 4px 14px; }
.alert { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.okbox { background: var(--pers-bg); color: var(--pers); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }
.hint { background: var(--hint-bg); border: 1px solid var(--hint-line); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; }

.t { display: grid; grid-template-columns: 26px 54px 1fr auto; gap: 8px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--soft); }
.t:last-child { border: 0; }
.chk { width: 22px; height: 22px; border: 2px solid var(--line); border-radius: 6px; margin-top: 2px; }
.chk:hover { border-color: var(--pers); }
.t.done .chk { background: var(--pers); border-color: var(--pers); }
.t.done .ttl { text-decoration: line-through; color: var(--muted); }
.tm { font-weight: 700; font-size: 15px; line-height: 1.2; }
.tm small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.ttl { font-weight: 600; cursor: pointer; }
.meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 600; margin-right: 4px; }
.tag.w { background: var(--work-bg); color: var(--work); }
.tag.p { background: var(--pers-bg); color: var(--pers); }
.bad { color: var(--bad); font-weight: 600; }
.ok { color: var(--pers); }
.more { color: var(--muted); font-size: 18px; padding: 0 6px; border-radius: 6px; }
.more:hover { background: var(--soft); }
.empty { padding: 20px 0; color: var(--muted); text-align: center; }
.donelist { margin-top: 10px; }
.donelist summary { color: var(--muted); cursor: pointer; padding: 6px 2px; }

.right { padding: 12px 14px 12px 0; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.tl { position: relative; margin-left: 56px; }
.h { position: absolute; left: -56px; right: 0; border-top: 1px solid var(--soft); font-size: 11px; color: var(--muted); padding-left: 8px; }
.blk { position: absolute; left: 8px; right: 8px; border-radius: 7px; padding: 4px 10px; font-size: 13px; border-left: 4px solid; overflow: hidden; cursor: pointer; line-height: 1.3; }
.blk.w { background: var(--work-bg); border-color: var(--work); }
.blk.p { background: var(--pers-bg); border-color: var(--pers); }
.blk.x { background: var(--bad-bg); border-color: var(--bad); }
.blk.fix { background: repeating-linear-gradient(45deg, var(--bg), var(--bg) 6px, var(--block) 6px, var(--block) 12px); border-color: var(--muted); color: var(--muted); cursor: default; }
.blk.ev { left: 40%; z-index: 2; box-shadow: 0 1px 3px #0003; }
.now { position: absolute; left: -8px; right: 0; border-top: 2px solid #e53935; z-index: 3; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 50; max-width: 380px; width: calc(100% - 32px); }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--work); border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px #0003; }
.toast .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.toast .acts button { padding: 6px 10px; border-radius: 6px; background: var(--soft); font-size: 13px; }

dialog { margin: auto; border: 0; border-radius: 12px; padding: 20px; width: min(560px, calc(100% - 24px)); background: var(--card); color: var(--text); }
dialog::backdrop { background: #0006; }
dialog form { display: grid; gap: 12px; }
dialog label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
dialog h4 { margin-top: 6px; font-size: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dlg-actions { display: flex; gap: 8px; margin-top: 6px; }
.sp { flex: 1; }
.blockrow { display: grid; grid-template-columns: 1fr 100px 100px 34px; gap: 6px; margin-bottom: 6px; }
code { background: var(--soft); padding: 2px 6px; border-radius: 4px; }

/* Телефон: вариант Б — только список по времени */
@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; padding: 12px; }
  .right { display: none; }
  .top { padding: 8px 12px; gap: 6px; }
  .logo { font-size: 18px; }
  .tabs button { padding: 4px 8px; font-size: 14px; }
  #bell { margin-left: auto; }
  .icon { width: 34px; height: 34px; }
  .toasts { right: 8px; bottom: 8px; width: calc(100% - 16px); }
  .datenav { margin-left: 0; order: 3; width: 100%; justify-content: space-between; }
  .input { padding: 10px 12px; }
  .input .btn { display: none; }
  .draft { grid-template-columns: 1fr 1fr; }
  .draft input[name=title] { grid-column: 1 / -1; }
  .row2 { grid-template-columns: 1fr; }
}
