/* PocketCall — дизайн-система PocketSpace (свой клиент, без Element) */
:root{
  --red:#e1251b; --ink:#1f1f1f; --ink2:#3a3a3a; --gray:#5d5d5d; --muted:#8c8c8c; --dim:#b4b4b0;
  --bg:#f0efea; --panel:#fff; --line:#e0ded6; --line2:#ebe9e2; --hover:#eceae3; --accent:#1f1f1f; --accent-soft:#eeede9;
  --body:"Inter",system-ui,-apple-system,"Segoe UI",sans-serif; --disp:"Inter","Montserrat",system-ui,sans-serif; --mono:"JetBrains Mono",monospace;
  --shadow:0 1px 2px rgba(35,33,28,.05),0 6px 18px -10px rgba(35,33,28,.14);
}
[data-theme="dark"]{
  --ink:#ececec; --ink2:#d9d9d9; --gray:#a9a9a9; --muted:#8b8b8b; --dim:#5e5e5e;
  --bg:#161619; --panel:#1f1f25; --line:#31313b; --line2:#29292f; --hover:#2a2a34; --accent:#3b3b48; --accent-soft:#2c2c38;
  --shadow:0 1px 2px rgba(0,0,0,.5),0 8px 24px -12px rgba(0,0,0,.85);
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{font-family:var(--body);color:var(--ink);background:var(--bg);overflow:hidden;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;letter-spacing:-.006em;transition:background-color .25s,color .2s}
button{font-family:inherit;cursor:pointer;color:inherit}
input,textarea{font-family:inherit}
svg{display:block}
.ico{width:20px;height:20px;stroke:currentColor;stroke-width:1.7;fill:none;stroke-linecap:round;stroke-linejoin:round}
::-webkit-scrollbar{width:9px;height:9px}::-webkit-scrollbar-thumb{background:#d3d1c8;border-radius:8px}
[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#3a3a45}
.hidden{display:none!important}

/* ---------- LOGIN ---------- */
.auth{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:24px;background:var(--bg)}
.auth-card{width:100%;max-width:400px;background:var(--panel);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);padding:34px 30px;animation:fadeup .35s ease both}
@keyframes fadeup{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
.auth-logo{display:block;height:46px;margin:0 auto 6px}
.auth-sub{text-align:center;color:var(--muted);font-size:.9rem;margin:0 0 22px;line-height:1.5}
.auth-tabs{display:flex;gap:4px;background:var(--accent-soft);border-radius:11px;padding:4px;margin-bottom:18px}
.auth-tab{flex:1;padding:9px 0;border:none;background:transparent;border-radius:8px;font-weight:700;font-size:.86rem;color:var(--muted);transition:.14s}
.auth-tab.on{background:var(--panel);color:var(--ink);box-shadow:var(--shadow)}
.field{margin-bottom:13px}
.field label{display:block;font-size:.74rem;font-weight:700;color:var(--muted);letter-spacing:.04em;margin:0 0 6px;text-transform:uppercase}
.field input{width:100%;background:var(--accent-soft);border:1px solid var(--line);border-radius:11px;padding:12px 13px;color:var(--ink);font-size:.95rem;font-weight:600;transition:.14s}
.field input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.btn{display:block;width:100%;padding:13px 16px;border:none;border-radius:12px;font-weight:700;font-size:.95rem;transition:.15s}
.btn-primary{background:var(--accent);color:#fff}.btn-primary:hover{background:#000}
[data-theme="dark"] .btn-primary:hover{background:#4c4c5a}
.btn-primary:disabled{opacity:.45;cursor:default}
.auth-err{color:var(--red);font-size:.84rem;font-weight:600;text-align:center;margin:0 0 14px;min-height:0;line-height:1.45}
.auth-foot{text-align:center;color:var(--dim);font-size:.76rem;margin-top:18px}

/* ---------- APP SHELL ---------- */
.app{display:flex;height:100%}
.rail{width:72px;flex:0 0 72px;background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column;align-items:center;padding:14px 0;gap:6px}
.rail .mark{width:42px;height:42px;cursor:pointer;border-radius:12px}
.rail .sp{flex:1}
.rb{width:44px;height:44px;border:none;background:transparent;display:grid;place-items:center;border-radius:13px;color:var(--muted);transition:.13s}
.rb:hover{color:var(--ink);background:var(--hover)}.rb.on{color:#fff;background:var(--accent)}
.rb .ico{width:21px;height:21px}
.rail .me{width:40px;height:40px;border-radius:50%;background:var(--accent);display:grid;place-items:center;color:#fff;font-weight:700;font-size:.82rem;font-family:var(--disp);cursor:pointer;border:2px solid var(--line);transition:.14s}
.rail .me:hover{border-color:var(--red);box-shadow:0 0 0 3px rgba(225,37,27,.16)}

/* sidebar */
.side{width:300px;flex:0 0 300px;background:var(--panel);border-right:1px solid var(--line);display:flex;flex-direction:column}
.side-top{padding:16px 14px 10px}
.side-logo{height:32px;display:block;margin-bottom:14px}
.newbtn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;padding:11px 14px;border:none;border-radius:11px;background:var(--accent);color:#fff;font-weight:700;font-size:.9rem;transition:.15s}
.newbtn:hover{background:#000}[data-theme="dark"] .newbtn:hover{background:#4c4c5a}
.newbtn .ico{width:17px;height:17px;stroke:#fff}
.search{margin:10px 0 4px;position:relative}
.search input{width:100%;background:var(--accent-soft);border:1px solid var(--line);border-radius:10px;padding:9px 12px;color:var(--ink);font-size:.86rem;font-weight:600}
.search input:focus{outline:none;border-color:var(--accent)}
.lbl{padding:14px 16px 6px;font-size:.68rem;font-weight:700;color:var(--muted);letter-spacing:.1em}
.rooms{flex:1;overflow-y:auto;padding:0 8px 10px}
.room{display:flex;align-items:center;gap:11px;padding:9px 10px;border-radius:11px;cursor:pointer;transition:background .12s;margin-bottom:1px}
.room:hover{background:var(--hover)}
.room.active{background:var(--accent-soft)}
.room .rav{width:40px;height:40px;flex:0 0 auto;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:700;font-size:.82rem;font-family:var(--disp)}
.room .rinfo{flex:1;min-width:0}
.room .rn{font-size:.9rem;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.room .rl{font-size:.78rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.room .rb-badge{flex:0 0 auto;min-width:19px;height:19px;padding:0 6px;border-radius:10px;background:var(--red);color:#fff;font-size:.68rem;font-weight:800;display:grid;place-items:center}
.rooms-empty{color:var(--dim);font-size:.84rem;text-align:center;padding:30px 16px;line-height:1.5}

/* main */
.main{flex:1;display:flex;flex-direction:column;min-width:0;background:var(--bg)}
.main-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;text-align:center;padding:24px;color:var(--muted)}
.main-empty .mk{width:64px;height:64px;opacity:.9}
.main-empty h2{font-family:var(--disp);font-weight:700;font-size:1.5rem;color:var(--ink)}
.main-empty h2 .a{color:var(--red)}
.main-empty p{max-width:42ch;line-height:1.55;font-size:.94rem}
.topbar{height:58px;flex:0 0 58px;display:flex;align-items:center;gap:12px;padding:0 18px;border-bottom:1px solid var(--line);background:var(--panel)}
.topbar .tav{width:38px;height:38px;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:700;font-size:.8rem;font-family:var(--disp);flex:0 0 auto}
.topbar .tname{font-weight:700;font-size:.98rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.topbar .tsub{font-size:.76rem;color:var(--muted);margin-top:1px}
.topbar .tact{margin-left:auto;display:flex;gap:6px}
.iconbtn{width:38px;height:38px;border-radius:10px;border:1px solid var(--line);background:var(--panel);display:grid;place-items:center;color:var(--gray);transition:.14s}
.iconbtn:hover{color:var(--ink);border-color:var(--muted);background:var(--hover)}
.iconbtn .ico{width:18px;height:18px}
.iconbtn.call .ico{color:var(--red);stroke:var(--red)}

.timeline{flex:1;overflow-y:auto;padding:22px 0 10px}
.tl-inner{max-width:820px;margin:0 auto;padding:0 26px;display:flex;flex-direction:column;gap:3px}
.daysep{align-self:center;font-size:.72rem;font-weight:700;color:var(--muted);background:var(--accent-soft);padding:4px 12px;border-radius:999px;margin:14px 0 10px}
.msg{display:flex;gap:10px;max-width:78%;animation:msgin .2s ease both}
@keyframes msgin{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.msg .mav{width:32px;height:32px;flex:0 0 auto;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:700;font-size:.7rem;font-family:var(--disp);align-self:flex-end}
.msg .mbody{display:flex;flex-direction:column;gap:2px;min-width:0}
.msg .msender{font-size:.74rem;font-weight:700;color:var(--gray);padding:0 4px}
.msg .bubble{padding:10px 14px;border-radius:16px;font-size:.95rem;line-height:1.5;word-wrap:break-word;white-space:pre-wrap}
.msg .mtime{font-size:.66rem;color:var(--muted);padding:0 4px;align-self:flex-end}
/* incoming */
.msg.in .bubble{background:var(--panel);border:1px solid var(--line);border-bottom-left-radius:5px;color:var(--ink)}
/* outgoing */
.msg.out{align-self:flex-end;flex-direction:row-reverse}
.msg.out .mav{display:none}
.msg.out .bubble{background:var(--accent-soft);border:1px solid var(--line);border-bottom-right-radius:5px}
.msg.out .msender{display:none}
.msg.out .mtime{align-self:flex-start}
.msg.pending .bubble{opacity:.6}
.msg.failed .bubble{border-color:var(--red)}
/* consecutive grouping */
.msg.cont .mav{visibility:hidden}
.msg.cont .msender{display:none}

/* composer */
.composer{flex:0 0 auto;padding:12px 22px 18px}
.cwrap{max-width:820px;margin:0 auto}
.cbox{display:flex;align-items:flex-end;gap:8px;background:var(--panel);border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow);padding:8px 8px 8px 14px;transition:.16s}
.cbox:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.cbox textarea{flex:1;border:none;outline:none;resize:none;background:transparent;color:var(--ink);font-size:.98rem;line-height:1.5;max-height:160px;min-height:24px;padding:6px 0}
.cbox textarea::placeholder{color:var(--muted)}
.sendbtn{width:40px;height:40px;flex:0 0 auto;border-radius:50%;border:none;background:var(--accent);display:grid;place-items:center;transition:.16s}
.sendbtn:disabled{opacity:.4}
.sendbtn:not(:disabled):hover{transform:scale(1.05)}
.sendbtn .ico{stroke:#fff;width:18px;height:18px}

/* modal */
.modal{position:fixed;inset:0;background:rgba(20,18,14,.5);display:none;align-items:center;justify-content:center;z-index:80;padding:24px}
.modal.show{display:flex}
.mbox{background:var(--panel);border:1px solid var(--line);border-radius:16px;max-width:420px;width:100%;box-shadow:0 30px 80px -20px rgba(0,0,0,.6);animation:fadeup .24s ease;overflow:hidden}
.mhead{display:flex;align-items:center;justify-content:space-between;padding:16px 18px;border-bottom:1px solid var(--line);font-family:var(--disp);font-weight:700;font-size:1.05rem}
.mhead .mx{width:30px;height:30px;border:none;background:transparent;color:var(--muted);font-size:1.2rem;border-radius:8px}.mhead .mx:hover{background:var(--hover);color:var(--ink)}
.mbody{padding:18px}
.mbody .hint{font-size:.84rem;color:var(--muted);margin:-6px 0 14px;line-height:1.5}
.menu-item{display:flex;align-items:center;gap:11px;width:100%;padding:12px;border:1px solid var(--line);background:var(--panel);border-radius:11px;font-weight:700;font-size:.9rem;color:var(--ink);margin-bottom:8px;transition:.13s}
.menu-item:hover{background:var(--hover);border-color:var(--muted)}
.menu-item .ico{width:18px;height:18px;color:var(--red)}
.menu-item.danger{color:var(--red)}.menu-item.danger .ico{color:var(--red)}

@media(max-width:720px){
  .rail{width:58px;flex-basis:58px}
  .side{width:240px;flex-basis:240px}
  .tl-inner,.cwrap{padding-left:16px;padding-right:16px}
}
