:root {
  color-scheme: dark;
  --bg: #101011; --panel: #19191b; --well: #141416; --field: #222225;
  --ink: #f1eee6; --soft: #b8b3b3; --muted: #a29ca4;
  --border: #363436; --line: #302e30; --sage: #c7d3ad; --sage-bg: #32392b;
  --wine: #651c32; --wine-light: #d7a4b5;
  font: 15px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 80% -30%, #36252d 0%, transparent 49%), var(--bg); }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 18px; height: 18px; flex: none; vertical-align: middle; }
.shell { width: min(1320px, 100%); margin-inline: auto; padding-inline: clamp(18px, 4.5vw, 72px); }
.topbar { background: #151516; border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; gap: clamp(18px, 5vw, 85px); align-items: center; min-height: 68px; }
.brand { display: flex; gap: 9px; align-items: center; font-weight: 520; font-size: 17px; letter-spacing: -.04em; }
.brand .icon { width: 34px; height: 34px; }
.brand span { font-size: 23px; letter-spacing: -.075em; font-weight: 400; }
.brand i { width: 1px; height: 19px; background: #494449; margin: 0 2px; }
nav, .buttons, .labelrow, .headline, .weeknav, form, .chips, .schedule-row, .posthead, .preview-heading {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
nav { gap: 5px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select, input:not([type=checkbox]), textarea {
  border: 1px solid var(--border); border-radius: 8px; background: var(--field); padding: 8px 12px;
}
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; font-weight: 570; cursor: pointer; }
button:hover { background-color: #323034; border-color: #696168; }
button:disabled, select:disabled { opacity: .58; cursor: default; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }
nav button { color: var(--soft); background: transparent; border-color: transparent; padding: 8px 12px; }
nav button.active { color: var(--sage); background: var(--sage-bg); border-color: #465038; }
.mode { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; color: var(--soft); font-size: 12px; white-space: nowrap; }
.mode::before { content: ''; width: 7px; height: 7px; background: var(--sage); border-radius: 50%; }
main { padding-block: clamp(25px, 4vh, 52px) 48px; }
.headline, .labelrow { justify-content: space-between; }
.headline { margin: 0 0 24px; }
h1 { margin: 0; font-size: clamp(35px, 4.1vw, 60px); font-weight: 530; line-height: 1.11; letter-spacing: -.065em; }
h2, .block > .labelrow > label { margin: 0; font-size: 17px; font-weight: 620; letter-spacing: -.035em; }
h2 { margin-bottom: 12px; }
.columns { display: grid; grid-template-columns: minmax(0, 1.67fr) minmax(290px, 1fr); gap: 20px; align-items: start; }
.card { border: 1px solid var(--border); border-radius: 17px; padding: clamp(18px, 2.1vw, 30px); background: var(--panel); min-width: 0; margin-bottom: 18px; }
.block + .block { margin-top: 21px; }
.chips { gap: 8px; }
.chips label { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 550; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--field); max-width: 100%; overflow-wrap: anywhere; }
.chips label:after { content: '+'; color: var(--muted); font-size: 14px; }
.chips label:has(:checked) { background: var(--sage-bg); border-color: #697656; }
.chips label:has(:checked):after { content: '✓'; color: var(--sage); }
.chips label:has(:focus-visible),.drop:focus-within { outline: 2px solid var(--sage); }
.chips input,.drop input { position: absolute; inset: 0; cursor: pointer; opacity: 0; width: 100%; height: 100%; margin: 0; }
.social { display: inline-grid; vertical-align: middle; place-items: center; width: 23px; height: 23px; border-radius: 6px; flex: none; }
.social svg { width: 100%; height: 100%; }
.social.telegram { background: #209dd9; border-radius: 50%; }
.social.vk { background: #0077ff; }
.social.odnoklassniki { background: #e9780b; }
.social.odnoklassniki svg { width: 85%; }
.social.max { background: linear-gradient(145deg,#05b8ff,#385bf4 52%,#a335eb); }
.social.max svg { width: 75%; height: 75%; }
.picker { position: relative; display: inline-flex; align-items: center; max-width: 100%; min-width: 0; }
.picker > .social { position: absolute; left: 9px; pointer-events: none; width: 18px; height: 18px; }
.picker:has(.social) > select { padding-left: 34px; }
select { font-size: 13px; max-width: 100%; min-width: 0; }
.writing { margin-top: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--well); overflow: hidden; }
.writing:focus-within { border-color: #767c6c; }
.tools { display: flex; align-items: center; padding: 5px 8px; gap: 3px; background: var(--field); border-bottom: 1px solid var(--line); }
.tools button { background: transparent; color: var(--soft); border: 0; padding: 4px 7px; }
.tools button:hover { background: #333; color: white; }
.tools button b,.tools button i { font-family: Georgia,serif; font-size: 17px; }
.tools .icon { width: 15px; }
.rule { width: 1px; height: 16px; background: #494449; margin: 0 4px; }
textarea { display: block; width: 100%; resize: vertical; background: var(--well); }
.writing textarea { background: transparent; padding: 14px; border: 0; outline: none; min-height: 130px; }
::placeholder { color: #969095; }
.drop { position: relative; padding: 14px; display: flex; align-items: center; justify-content: center; gap: 12px; background: var(--well); border: 1px dashed #555057; border-radius: 9px; font-size: 14px; font-weight: 560; cursor: pointer; }
.drop:hover { border-color: var(--sage); }
.drop small { display: block; font-weight: 400; }
.uploadmark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: #29282a; color: var(--sage); }
small { color: var(--muted); font-size: 12px; }
.schedule-row { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.schedule-row label { display: inline-flex; gap: 7px; align-items: center; font-weight: 560; font-size: 14px; }
.schedule-row label .icon { color: var(--sage); }
.schedule-row input { margin-left: auto; font-size: 13px; max-width: 100%; min-width: 0; }
.buttons { justify-content: flex-end; margin-top: 17px; }
.primary { background: var(--wine); border-color: #91435a; color: white; }
.primary:hover { background: #7f2a44; border-color: #a65a71; }
.preview-heading { gap: 8px; }.preview-heading .icon { color: var(--sage); }
.preview .picker, .preview select { width: 100%; }
.stage { position: relative; isolation: isolate; overflow: hidden; background: radial-gradient(ellipse at 0 0,#533540,transparent 76%), radial-gradient(ellipse at 93% 110%,#505740,transparent 65%),#232225; padding: 37px 18px; margin: 15px 0 21px; border-radius: 12px; border: 1px solid #4a4045; }
.wave { position: absolute; inset: 0; width: 100%; height: 100%; color: #c7988a; opacity: .5; z-index: -1; }
.post { background: #f5f1e9; border: 1px solid #fff8ee; color: #29252a; border-radius: 12px; padding: 16px; overflow-wrap: anywhere; box-shadow: 0 10px 30px #0004; }
.posthead { flex-wrap: nowrap; font-size: 14px; line-height: 1.2; }
#previewAvatar { display: inline-flex; }.posthead .social,.posthead .icon { width: 30px; height: 30px; }
#previewBody { white-space: pre-wrap; margin-top: 14px; font-size: 14px; }.post a { color: #651c32; }
blockquote { border-left: 3px solid #738553; margin: 5px 0; padding: 3px 10px; background: #e6ebdc; }
.preview > label { font-size: 14px; font-weight: 580; }.preview textarea { margin-top: 8px; font-size: 14px; }
#media img,#media video { max-width: 100%; max-height: 260px; border-radius: 8px; display: block; margin-top: 10px; }
#notice { padding: 10px 14px; border: 1px solid #515749; border-radius: 8px; background: #262923; }
#files { padding: 0; margin: 0; }#files li,.day,.channelrow { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#files li span { flex: 1; overflow-wrap: anywhere; }#files button { padding: 3px 8px; }
#resetText { margin-top: 8px; }
.weeknav { padding-bottom: 17px; border-bottom: 1px solid var(--border); }.weeknav h2 { margin: 0; }.weeknav #period { margin-left: auto; }
.day > strong { min-width: 100px; font-weight: 550; }.day small { margin-left: auto; }
.day button,.entry { min-width: 0; max-width: 100%; overflow-wrap: anywhere; text-align: left; }.entry { flex-wrap: wrap; justify-content: flex-start; }
.entry-channel { display: inline-flex; align-items: center; gap: 4px; color: var(--soft); font-size: 12px; }.entry-channel .social { width: 15px; height: 15px; }
#drafts { display: flex; gap: 8px; flex-wrap: wrap; }
#days.month { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); margin-top: 12px; }
.month .day { display: flex; align-content: flex-start; justify-content: space-between; gap: 4px; padding: 8px; border: 1px solid var(--line); min-height: 85px; }
.month .day strong { min-width: 0; font-size: 13px; }.month .day button { padding: 3px 5px; font-size: 12px; }
.channelrow { align-items: end; margin-bottom: 15px; }.channelrow label { flex: 1; min-width: 130px; font-size: 13px; }
.channelrow input,.channelrow textarea { margin-top: 7px; display: block; width: 100%; }.channelrow .social { margin-right: 6px; }
#channelList { margin-bottom: 24px; }
@media(max-width:860px){
  .columns { grid-template-columns: minmax(0,1.38fr) minmax(240px,1fr); gap: 12px; }
  .mode { font-size: 0; }.topbar-inner { gap: 15px; }
}
@media(max-width:680px){
  .topbar-inner { flex-wrap: wrap; padding-block: 12px 8px; gap: 9px; }
  nav { order: 2; width: 100%; }.mode { font-size: 11px; }
  nav button { flex: 1; padding: 7px 2px; font-size: 12px; }
  .columns { grid-template-columns: minmax(0,1fr); }.headline { gap: 8px; margin-bottom: 17px; }.headline button { padding: 7px; }
  .card { padding: 16px; }.chips { gap: 6px; }.chips label { padding: 5px 7px; }
  .weeknav #period { margin-left: 0; }#days.month { grid-template-columns: repeat(2,minmax(0,1fr)); }.month .spacer { display: none; }
  .schedule-row input { margin-left: 0; }.buttons { justify-content: flex-start; }.channelrow { align-items: stretch; }.stage { padding: 29px 18px; }
}

.chips { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(165px,100%),1fr)); max-height:300px; overflow:auto; padding:2px; }
.chips label { border-radius:9px; gap:10px; min-width:0; padding:9px 10px; }
.chips label::after { margin-left:auto; }
.channel-avatar { position:relative; flex:none; display:inline-grid; place-items:center; width:36px; height:36px; border-radius:50%; background:#484438; color:#fff3d7; font-size:12px; font-weight:650; }
.channel-avatar > img { width:100%;height:100%;object-fit:cover;border-radius:inherit; }
.channel-avatar > .social { position:absolute;right:-3px;bottom:-2px;width:15px;height:15px;margin:0;box-shadow:0 0 0 1px var(--panel); }
.channel-avatar > .social svg { width:100%;height:100%; }.channel-avatar > .social.max svg {width:76%;height:76%;}
.channel-name { display:flex;flex-direction:column;min-width:0; }.channel-name strong {overflow-wrap:anywhere;font-size:14px;}.channel-name small {font-weight:400;}
.settingsForm {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(210px,100%),1fr));align-items:start;margin-top:12px;}
.settingsForm label {display:grid;gap:5px;font-size:13px;color:var(--soft);}
.settingsForm input,.settingsForm select,.settingsForm textarea {width:100%;min-width:0;}
.settingsForm button {align-self:end;}.settingsForm>div {align-self:end;}
.channelrow button {margin-left:auto;}.channelrow {align-items:center;}summary {cursor:pointer;font-weight:600;}

#reconnectDialog { width:min(420px,calc(100% - 24px)); padding:24px; border:1px solid var(--border); border-radius:16px; background:var(--panel); color:var(--ink); }
#reconnectDialog::backdrop { background:#000a; }
#reconnectForm { display:grid; gap:12px; }
#reconnectForm h2,#reconnectForm p { margin:0; }
#reconnectForm label { display:grid; gap:5px; font-size:14px; }
#reconnectForm p { color:var(--soft); font-size:14px; }
#reconnectChannel { display:flex; align-items:center; gap:10px; }
#reconnectMessage:empty { display:none; }
.channelrow button + button {margin-left:0;}
.community-actions {display:flex;flex-wrap:wrap;gap:10px;}
.community-actions a {display:inline-flex;align-items:center;gap:8px;color:var(--ink);text-decoration:none;border:1px solid var(--border);background:var(--field);border-radius:8px;padding:8px 12px;}
.community-panel {max-width:620px;margin:32px auto;overflow-wrap:anywhere;}
.community-panel h1 {font-size:30px;}
.community-panel #groups label {display:flex;align-items:center;gap:8px;padding:8px 0;}

.logout{margin-left:auto}.post-settings{margin-top:16px}.post-settings label{display:block;padding:12px 0 0;color:var(--soft)}.login-page{min-height:100dvh;display:grid;place-items:center;padding:20px}.login-card{width:min(100%,410px);padding:32px}.login-card h1{font-size:34px;margin:26px 0 20px}.login-card form,.login-card label{display:grid;gap:8px}.login-card form{gap:14px}.login-card [role=alert]{margin:0;color:#f2b6bc}
