:root{
  --bg:#fafafa; --card:#ffffff; --ink:#1a1a1a; --mut:#707070; --line:#e6e6e6;
  --green:#1a9a4a; --amber:#c77800; --red:#cc3333;
  --green-bg:#e8f6ee; --amber-bg:#fdf3e3; --red-bg:#fbeaea;
  --chip:#f0f0f0;
}
@media (prefers-color-scheme: dark){
  :root{ --bg:#141414; --card:#1d1d1d; --ink:#ececec; --mut:#9a9a9a; --line:#2e2e2e;
    --green:#4cc47e; --amber:#e0a34a; --red:#e06a6a;
    --green-bg:#17301f; --amber-bg:#33270f; --red-bg:#331a1a; --chip:#282828; }
}
:root[data-theme="light"]{ --bg:#fafafa; --card:#ffffff; --ink:#1a1a1a; --mut:#707070; --line:#e6e6e6;
  --green:#1a9a4a; --amber:#c77800; --red:#cc3333;
  --green-bg:#e8f6ee; --amber-bg:#fdf3e3; --red-bg:#fbeaea; --chip:#f0f0f0; }
:root[data-theme="dark"]{ --bg:#141414; --card:#1d1d1d; --ink:#ececec; --mut:#9a9a9a; --line:#2e2e2e;
  --green:#4cc47e; --amber:#e0a34a; --red:#e06a6a;
  --green-bg:#17301f; --amber-bg:#33270f; --red-bg:#331a1a; --chip:#282828; }

body{ background:var(--bg); color:var(--ink);
  font:16px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  margin:0; padding:0 16px 64px; }
.wrap{ max-width:760px; margin:0 auto; }
header{ padding:28px 0 10px; }
h1{ font-size:20px; margin:0; font-weight:650; }
.sub{ color:var(--mut); font-size:13.5px; margin-top:4px; }

nav{ display:flex; gap:8px; flex-wrap:wrap; margin:18px 0 22px; }
nav button{ border:1px solid var(--line); background:var(--card); color:var(--mut);
  padding:7px 14px; border-radius:20px; font-size:14px; cursor:pointer; }
nav button.on{ color:var(--ink); border-color:var(--ink); font-weight:600; }

section{ display:none; }
section.on{ display:block; }
.screen-note{ color:var(--mut); font-size:13.5px; margin:0 0 14px; }

.card{ background:var(--card); border:1px solid var(--line); border-radius:12px; overflow:hidden; }
.row{ padding:26px 26px; cursor:pointer; }
.row-top{ display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; font-size:17px; line-height:1.5; }
.who{ font-weight:650; white-space:nowrap; }
.done{ flex:1; min-width:180px; }
.st{ font-size:12.5px; white-space:nowrap; display:flex; align-items:center; gap:6px; color:var(--mut); }
.cnt{ font-size:12.5px; color:var(--mut); white-space:nowrap; }
.dot{ width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot.g{ background:var(--green); } .dot.a{ background:var(--amber); } .dot.r{ background:var(--mut); }
.detail{ display:none; margin:16px 0 0 6px; padding-left:16px; border-left:2px solid var(--line);
  font-size:15px; line-height:1.8; color:var(--mut); }
.tech{ font-size:12px; color:var(--mut); opacity:.65; }
.more{ font-size:13px; color:var(--mut); cursor:pointer; text-decoration:underline dotted; }
.morelist{ margin-top:6px; }
.row.open .detail{ display:block; }
.detail b{ color:var(--ink); font-weight:600; }
.task{ display:flex; align-items:center; gap:8px; margin-bottom:6px; flex-wrap:wrap; }
.hint{ color:var(--mut); font-size:12.5px; margin-top:10px; }

.pr{ display:flex; gap:10px; align-items:baseline; margin:6px 0; flex-wrap:wrap; }
.light{ font-size:12px; font-weight:650; padding:2px 9px; border-radius:11px; white-space:nowrap; }
.light.g{ color:var(--green); background:var(--green-bg); }
.light.a{ color:var(--amber); background:var(--amber-bg); }
.light.r{ color:var(--red); background:var(--red-bg); }

h2{ font-size:15px; font-weight:650; margin:26px 0 10px; }
h2:first-child{ margin-top:0; }
.q{ padding:14px 18px; border-bottom:1px solid var(--line); }
.q:last-child{ border-bottom:none; }
.q .from{ font-size:13px; color:var(--mut); margin-bottom:3px; }
.quote{ font-style:italic; }
.act{ margin-top:8px; }
.btn{ display:inline-block; border:1px solid var(--ink); border-radius:18px; padding:5px 14px;
  font-size:13.5px; color:var(--ink); cursor:pointer; background:none; }
.empty{ padding:26px 18px; color:var(--mut); text-align:center; font-size:14.5px; }
.gap{ border:1px dashed var(--amber); border-radius:12px; padding:14px 18px; margin-top:10px;
  font-size:14px; color:var(--mut); background:var(--card); }
.gap b{ color:var(--amber); }

.meta{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.chip{ background:var(--chip); border-radius:8px; padding:8px 12px; font-size:13.5px; }
.chip b{ display:block; font-size:12px; color:var(--mut); font-weight:500; }

table{ border-collapse:collapse; width:100%; font-size:14px; }
.tbl{ overflow-x:auto; }
th,td{ text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); vertical-align:top; }
th{ font-size:12.5px; color:var(--mut); font-weight:600; }
td:first-child{ white-space:nowrap; }

ul.rules{ margin:6px 0 0; padding-left:20px; }
ul.rules li{ margin:7px 0; }
.compass{ border-left:3px solid var(--ink); padding:4px 0 4px 14px; margin-top:22px; font-style:italic; }
.agent-a{ background:var(--chip); border-radius:8px; padding:10px 12px; margin-top:8px; font-size:14px; }
.agent-a b{ font-size:12px; color:var(--mut); display:block; font-weight:500; }

.threads{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.th{ border:1px solid var(--line); background:var(--card); color:var(--mut); padding:6px 13px;
  border-radius:18px; font-size:13.5px; cursor:pointer; display:flex; align-items:center; gap:6px; }
.th.on{ color:var(--ink); border-color:var(--ink); font-weight:600; }
.unread{ width:7px; height:7px; border-radius:50%; background:var(--amber); display:inline-block; }
.chatbox{ display:none; padding:14px 16px; }
.chatbox.on{ display:block; }
.msg{ max-width:88%; margin:10px 0; padding:9px 13px; border-radius:12px; font-size:14.5px; }
.msg.them{ background:var(--chip); border-bottom-left-radius:4px; }
.msg.me{ background:var(--green-bg); margin-left:auto; border-bottom-right-radius:4px; }
.msg.sys{ background:none; color:var(--mut); font-size:13px; text-align:center; max-width:100%;
  padding:2px 0; }
/* подпись дня между сообщениями: вчерашняя переписка не должна читаться как сегодняшняя */
.msg.daysep{ font-size:12px; letter-spacing:.3px; margin:16px 0 6px; text-transform:uppercase; }
.m-who{ font-size:12px; color:var(--mut); margin-bottom:2px; font-weight:600; }
.m-head{ display:flex; justify-content:space-between; align-items:center; gap:8px; }
.reply-btn{ border:0; background:none; color:var(--mut); cursor:pointer; font-size:16px; padding:0 2px; }
.reply-quote{ border-left:3px solid var(--mut); padding:4px 8px; margin:2px 0 7px; opacity:.78;
  display:flex; flex-direction:column; font-size:12.5px; line-height:1.35; }
.reply-quote span{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:360px; }
.reply-draft{ margin:8px 0 -2px; padding:7px 12px; border-left:3px solid var(--green);
  background:var(--card); display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:12.5px; }
.reply-draft[hidden]{ display:none; }
.reply-draft div{ min-width:0; display:flex; flex-direction:column; }
.reply-draft span{ color:var(--mut); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.reply-draft button{ border:0; background:none; color:var(--mut); cursor:pointer; font-size:16px; }
.read-ticks{ border:0; background:none; color:var(--mut); cursor:pointer; font-size:11px; padding:0 2px; }
.read-ticks.read{ color:#2196d3; }
.read-backdrop{ position:fixed; inset:0; z-index:100; background:rgba(0,0,0,.3); display:flex; align-items:flex-end; }
.read-sheet{ width:100%; max-height:60vh; overflow-y:auto; background:var(--card); border-radius:18px 18px 0 0;
  padding:18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.read-preview{ color:var(--mut); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin:2px 0 12px; }
.read-person{ display:flex; align-items:center; gap:8px; padding:7px 0; font-size:14px; }
.read-person small{ margin-left:auto; color:var(--mut); }
.read-icon{ width:23px; color:var(--mut); }
.read-icon.yes{ color:#2196d3; }
.composer{ border:1px solid var(--line); border-radius:22px; padding:9px 16px; margin-top:14px;
  color:var(--mut); font-size:14px; display:flex; justify-content:space-between; gap:10px; }
.att{ letter-spacing:3px; white-space:nowrap; }
.voice{ display:inline-flex; align-items:center; gap:8px; }
.vbar{ display:inline-block; width:120px; height:3px; background:var(--mut); border-radius:2px; position:relative; }
.vbar::after{ content:""; position:absolute; left:0; top:-2.5px; width:8px; height:8px; border-radius:50%; background:var(--ink); }
.photo{ display:inline-block; background:var(--chip); border:1px solid var(--line); border-radius:8px;
  padding:26px 18px; margin:4px 0; font-size:13px; color:var(--mut); }
