





:root {
  
  --bg: #FBFAF7;
  --card: #FFFFFF;
  --menu-bg: #F4F2EC;
  --surface: #EFEDE6;
  --selected-bg: #FFFFFF;
  

  --text: #17181C;
  --text-secondary: #585B64;
  --text-muted: #585B64;
  



  


  --text-faint: #686B74;
  --border: #E3E0D8;
  --border-subtle: #EFECE4;
  --accent: #1F4FD8;
  --accent-bg: #E8EDFC;
  --ok: #2E7D4F;
  --info: #2A5FCC;
  --warn: #9C6100;
  --alert: #BE3320;
  --peer: #EFEDE6;
  --ok-bg: #E4F1E9;
  --info-bg: #E7EDFB;
  --warn-bg: #FBF0DC;
  --alert-bg: #FBE7E3;
  --sent-bg: #E8EDFC;
  --thread-line: rgba(31, 79, 216, 0.35);
  --hover: #FFFFFF;
  --shelf: #FFF9EE;
  --shelf-line: #EBDCBF;
  --tone-red: #FBE7E3;
  --tone-orange: #FBF0DC;
  --tone-green: #E4F1E9;
  --elevation: 0 1px 2px rgba(24, 20, 12, 0.07);
  --switch-off: #CFCBC1;
  --column: 980px;
  --read: 760px;
  

  --font-sans: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}


@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --card: #1B1D21;
    --menu-bg: #0F1013;
    --surface: #212429;
    --selected-bg: #1B1D21;
    --text: #ECEDEF;
    --text-secondary: #A1A4AC;
    --text-muted: #A1A4AC;
    

    --text-faint: #878A93;
    --border: #2A2D33;
    --border-subtle: #232529;
    --accent: #87A9FF;
    --accent-bg: #1D2436;
    --ok: #5FC98D;
    --info: #8FB2FF;
    --warn: #E2A54C;
    --alert: #FF8874;
    --peer: #212429;
    --ok-bg: #16261D;
    --info-bg: #181E2C;
    --warn-bg: #282016;
    --alert-bg: #2C1A17;
    --sent-bg: #1D2436;
    --thread-line: rgba(135, 169, 255, 0.5);
    --hover: #1B1D21;
    --shelf: #221C12;
    --shelf-line: #4A3A20;
    --tone-red: #2C1A17;
    --tone-orange: #282016;
    --tone-green: #16261D;
    --elevation: 0 1px 2px rgba(0, 0, 0, 0.35);
    --switch-off: #3B3F46;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font-sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}



#window { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }





@supports (overflow: clip) { #window { overflow: clip; } }


#menu {
  




  width: 284px;
  flex: 0 0 284px;
  background: var(--menu-bg);
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}




#menu > * { flex-shrink: 0; }



.pinned {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px; margin-bottom: 6px;
  border: 0; border-radius: 10px; cursor: pointer;
  background: var(--alert-bg); color: var(--alert);
  font: 600 14px/1.2 var(--font-sans); text-align: left;
}
.pinned.warn { background: var(--warn-bg); color: var(--warn); }
.pinned.info { background: var(--info-bg); color: var(--info); }
.pinned .item-icon { color: currentColor; }
.pinned .count { margin-left: auto; font: 700 15px/1 var(--font-mono); }
.pinned:hover { filter: brightness(0.97); }

.group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  padding: 14px 10px 6px;
}



#panel .group {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 10px 12px 6px; margin: 0;
  border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-secondary);
  text-align: left; font-family: inherit;
}
#panel .group:hover { color: var(--text); }
#panel .group .chevron { color: var(--text-faint); }
#panel .group.expanded .chevron { transform: rotate(90deg); }
#panel .group .count { margin-left: auto; font: 600 11px/1 var(--font-mono); color: var(--text-faint); }


#panel .panel-row.in-collapsed-group, #panel .panel-row.in-collapsed-container { display: none; }




.item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font: 400 15px/1.2 var(--font-sans);
  color: var(--text-secondary);
}
#menu .item { margin-bottom: 2px; }
.item:hover { background: var(--surface); }


.item.selected { background: var(--selected-bg); font-weight: 600; color: var(--text); box-shadow: var(--elevation); }
.item .counter { margin-left: auto; font: 600 11px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-muted); }


.item .dot { margin-left: 6px; }
.item .counter + .dot { margin-left: 6px; }





.menu-node { margin-bottom: 2px; }
.menu-node > summary { list-style: none; }
.menu-node > summary::-webkit-details-marker { display: none; }
.menu-node .chevron {
  margin-left: 6px; color: var(--text-faint); font-size: 15px; line-height: 1;
  transition: transform .12s; display: inline-block;
}
.menu-node[open] > summary .chevron { transform: rotate(90deg); }
.menu-node[open] > summary { font-weight: 600; color: var(--text); }
.well {
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
  margin: 2px 0 4px;
}
.well .item { height: 34px; font-size: 15px; }
.well .item.self { color: var(--text-faint); }
.well .menu-node .well { background: var(--card); }
.item-icon { width: 16px; height: 16px; flex: 0 0 16px; color: var(--text-faint); }





:root {
  --hue-blue: #2F6FEB; --hue-sky: #229ED9; --hue-violet: #7A5AE0;
  --hue-green: #2E9A5B; --hue-orange: #D98A1C; --hue-red: #D8433A;
  --hue-grey: #686B74;
  --menu-selected: #FFFFFF; --count-node-bg: #E8EDFC; --count-node: #2F5BD8;
  --count-bg: #E6E3DA; --count: #585B64;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hue-blue: #5B8CFF; --hue-sky: #34AEEA; --hue-violet: #8E72FF;
    --hue-green: #4CC47D; --hue-orange: #F0A23A; --hue-red: #FF6B5E;
    --hue-grey: #9A9FAB;
    --menu-bg: #0D1220; --border-menu: #1C2334;
    --menu-selected: #17223A; --count-node-bg: #1B2742; --count-node: #8FB2FF;
    --count-bg: #1E2533; --count: #C3C8D2;
  }
}
.hue-blue { color: var(--hue-blue); } .hue-sky { color: var(--hue-sky); }
.hue-violet { color: var(--hue-violet); } .hue-green { color: var(--hue-green); }
.hue-orange { color: var(--hue-orange); } .hue-red { color: var(--hue-red); }
.hue-grey { color: var(--hue-grey); }

#menu .item-icon { width: 18px; height: 18px; flex: 0 0 18px; }

#menu .tile, #menu .avatar {
  width: 22px; height: 22px; flex: 0 0 22px; margin: 0 -2px;
  border-radius: 50%; display: inline-grid; place-items: center; color: #fff;
}
#menu .avatar.square { border-radius: 6px; }
#menu .avatar { font: 600 10px/1 var(--font-sans); letter-spacing: 0.02em; }
#menu .tile .tile-sign { width: 13px; height: 13px; }
#menu .tile.hue-blue, #menu .avatar.hue-blue { background: var(--hue-blue); color: #fff; }
#menu .tile.hue-sky, #menu .avatar.hue-sky { background: var(--hue-sky); color: #fff; }
#menu .tile.hue-violet, #menu .avatar.hue-violet { background: var(--hue-violet); color: #fff; }
#menu .tile.hue-green, #menu .avatar.hue-green { background: var(--hue-green); color: #fff; }
#menu .tile.hue-orange, #menu .avatar.hue-orange { background: var(--hue-orange); color: #fff; }
#menu .tile.hue-red, #menu .avatar.hue-red { background: var(--hue-red); color: #fff; }
#menu .tile.hue-grey, #menu .avatar.hue-grey { background: var(--hue-grey); color: #fff; }


#menu .item.selected { background: var(--menu-selected); border-radius: 10px; }


#menu .item .counter {
  padding: 3px 7px; border-radius: 10px; min-width: 22px; text-align: center;
  background: var(--count-bg); color: var(--count);
}
#menu .menu-node > summary.item .counter { background: var(--count-node-bg); color: var(--count-node); }


#menu .item-plus {
  width: 24px; height: 24px; flex: 0 0 24px; margin-left: 6px;
  display: inline-grid; place-items: center; border: 0; border-radius: 6px;
  background: none; color: var(--text-faint); font: 400 18px/1 var(--font-sans); cursor: pointer;
}
#menu .item-plus:hover { background: var(--surface); color: var(--text); }

#menu .item + .item-plus.standalone { position: relative; float: right; margin: -34px 8px 0 0; }


#menu .menu-divider { height: 1px; background: var(--border-menu, var(--border)); margin: 8px 6px; }



#menu .group {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 0; background: none; font-family: inherit; text-align: left;
  font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text-faint);
  padding: 12px 10px 6px;
}
#menu .group .group-icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-faint); }
#menu button.group { cursor: pointer; }
#menu button.group:hover { color: var(--text-secondary); }
#menu .group-chevron { width: 12px; height: 12px; margin-left: auto; transition: transform .12s; }
#menu button.group[aria-expanded="false"] .group-chevron { transform: rotate(-90deg); }
#menu [data-in-section].in-collapsed-section { display: none; }


#menu .menu-node > summary .chevron { margin-left: auto; }
#menu .menu-node > summary .counter + .chevron, #menu .menu-node > summary .dot + .chevron { margin-left: 8px; }


#menu .well { background: none; padding: 0; margin: 0; border-radius: 0; }
#menu .well .item { height: 32px; padding-left: 22px; font-size: 14px; }
#menu .well .well .item { padding-left: 36px; }
#menu .well .well .well .item { padding-left: 50px; font-size: 13px; }
#menu .well .item.self { color: var(--text-faint); }

#menu-ask > .well > .menu-node > summary.item { font-weight: 600; color: var(--text); }

#menu-ask .well .menu-node .menu-node > summary.item { padding-left: 18px; font-weight: 400; color: var(--text-secondary); }
#menu-ask .well .menu-node .menu-node[open] > summary.item { color: var(--text); }
#menu-ask .well .menu-node .menu-node > summary .chevron { order: -1; margin: 0 -4px 0 0; width: 12px; }

#menu .well .item .item-name { flex: 1 1 auto; }
#menu .well .item .dot { margin: 0 2px 0 8px; }



.item.selected .item-icon:not([class*="hue-"]) { color: var(--text); }
.empty-icon { display: inline-block; }
.item-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }

#menu .item.nested-1 {
  height: 26px;
  padding: 0 9px 0 34px;
  font-size: 12px;
  color: var(--text-secondary);
}
#menu .item.nested-1 .counter { font-size: 10px; }
.nested-1 { padding-left: 30px; }


#middle { flex: 1; display: flex; min-width: 0; min-height: 0; }
#panel {
  


  width: 300px;
  flex: 0 0 300px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding-bottom: 20px;
}
#screen { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.column { max-width: var(--column); width: 100%; padding: 18px; margin: 0 auto; }





.column > * { margin-bottom: 26px; }
.column > *:last-child { margin-bottom: 0; }


.column > .caption, .column > .paragraph { margin-top: -14px; }


.column > .caption { font-size: 12px; line-height: 1.5; color: var(--text-faint); }
.column.read { max-width: var(--read); }








html { overscroll-behavior-y: contain; }


html { touch-action: manipulation; }
.feed { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior-y: contain; }
















.header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.more-slot { width: var(--control-h); height: var(--control-h); flex: 0 0 var(--control-h); }

.row .right-side .more, .shelf-row .more, .table .more, .row-group .more, .panel-row .more {
  width: var(--control-h-row); height: var(--control-h-row);
}
.header h1 { font-size: 28px; font-weight: 700; margin: 0; line-height: 1.1; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.label { font-size: 13px; line-height: 1.4; color: var(--text-secondary); margin-top: 4px; overflow-wrap: anywhere; }
.controls { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }


.section { margin-bottom: 26px; }



.section.pinned-bar { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 6px; margin-bottom: 12px; }
.section.pinned-bar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: linear-gradient(var(--bg), transparent); pointer-events: none;
}
.section-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: var(--text);
  margin: 0 0 10px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}


.section-header { display: flex; align-items: center; gap: 10px; }


.section-heading::after {
  content: ""; display: inline-block; vertical-align: middle;
  flex: 1 1 auto; min-width: 10px; width: auto; height: 1px;
  margin-left: 10px; background: var(--border-subtle);
}
.section > .section-heading { display: flex; align-items: center; width: 100%; }
.section-header .section-heading { margin-bottom: 10px; }
.section-header .right-side { margin-left: auto; margin-bottom: 10px; }




.section-card {
  background: none;
  border: 0;
  border-radius: 0;
}
.row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 10px;
  border-radius: 9px;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.section-card .row:last-child { border-bottom: 0; }
.row .bar { position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 2px; }
.row .body { flex: 1; min-width: 0; }
.row .title { font-size: 15px; font-weight: 600; line-height: 1.3; }


.name-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.meta-inline { font: 500 11px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .main { font-size: 15px; line-height: 1.35; color: var(--text-secondary); margin-top: 1px; }



.row .caption {
  font-size: 12px; line-height: 1.4; color: var(--text-faint); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 5px; font-size: 12px; }
.facts .label { color: var(--text-faint); margin-right: 5px; }
.facts .value { font: 500 12px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; }








.facts > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.facts .label, .facts .value { overflow-wrap: anywhere; }
.right-side { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }




.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  height: 19px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0 7px;
  border-radius: 5px;
  background: none;
  color: var(--text-faint);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); }
.pill.info { color: var(--info); }
.pill.warn { color: var(--warn); }
.pill.warn::before,
.pill.ok::before,
.pill.info::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; margin-right: 6px;
}
.pill.alert { background: var(--alert-bg); color: var(--alert); }


.pill:empty { padding: 0 2px; }
.pill:empty::before { margin-right: 0; }









:root { --control-h: 32px; --control-h-row: 28px; --control-radius: 8px; --side-phone: 16px; --tab-h: 56px; }
button.action, .action {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  height: var(--control-h);
  padding: 0 13px;
  border-radius: var(--control-radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
button.action:hover { border-color: var(--text-faint); }
button.action.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.action.primary:hover { filter: brightness(1.06); border-color: var(--accent); }
button.action.destructive { color: var(--alert); border-color: transparent; background: none; }
button.action.destructive:hover { background: var(--alert-bg); border-color: transparent; }
@media (prefers-color-scheme: dark) {
  button.action, .action { border-color: rgba(255, 255, 255, 0.18); box-shadow: none; }
}
button.action.link { border-color: transparent; background: none; color: var(--accent); }
button.action.link:hover { background: var(--accent-bg); border-color: transparent; }
button.action:disabled { opacity: 0.5; cursor: default; }






.row .right-side .action, .shelf-row .action, .step-header .action,
.table .action, .row-group .action, .section-header .action,
.section-header .more, .row .right-side .select select { height: var(--control-h-row); padding: 0 10px; font-size: 12px; }

.switch { width: 36px; height: 20px; border-radius: 10px; border: 0; background: var(--switch-off); position: relative; cursor: pointer; flex: 0 0 36px; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: left 0.15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 18px; }


.bubble { display: flex; margin: 6px 0; }
.bubble .text { padding: 10px 14px; border-radius: 18px; max-width: 72%; white-space: pre-wrap; word-wrap: break-word; line-height: 1.4; }
.bubble.свой { justify-content: flex-end; }



.bubble.свой .text { background: var(--sent-bg); border: 1px solid var(--accent); }
.bubble.ушло { justify-content: flex-end; }
.bubble.ушло .text { background: none; border: 1px dashed var(--accent); }


.bubble.сёма .text { background: var(--surface); }
.bubble.собеседник .text { background: var(--peer); }
.bubble.служебное { justify-content: flex-start; }
.bubble.служебное .text {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 11px;
  max-width: 100%;
}
.meta { font: 500 11px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-faint); margin: 2px 6px 10px; }
.meta.right { text-align: right; }
.thread-quote { border-left: 3px solid var(--thread-line); padding-left: 12px; margin: 8px 0; }


.composer {
  border-top: 1px solid var(--border);
  padding: 10px 18px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg);
}
.composer textarea {
  flex: 1;
  font: inherit;
  padding: 9px 13px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  resize: none;
  max-height: 140px;
}
.recipient { font-size: 10px; color: var(--text-muted); padding: 0 18px 4px; }


.form { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 26px; }
.form h3 { font-size: 13px; margin: 0 0 12px; }



.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 300px);
  align-items: center;
  column-gap: 16px;
  padding: 12px 0;
}






.field + .field { border-top: 1px solid var(--border-subtle); }
.form > .field:first-of-type { padding-top: 2px; }


.section.stack > .section-card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0 14px; }
.section.stack .form.rows { border: 0; background: none; border-radius: 0; padding: 0; margin: 0; }
.section.stack .form.rows + .form.rows { border-top: 1px solid var(--border-subtle); }
.section.stack .form.rows > .field.setting { padding: 10px 0; }



.hl { animation: hl-flash 2.6s ease-out 1; border-radius: 8px; }
@keyframes hl-flash {
  0%, 35% { background: var(--accent-bg); box-shadow: 0 0 0 6px var(--accent-bg); }
  100% { background: transparent; box-shadow: 0 0 0 6px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .hl { animation: none; background: var(--accent-bg); box-shadow: 0 0 0 6px var(--accent-bg); }
}







.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: 8px; margin-top: 8px; }
@media (max-width: 720px) {
  



  .form-actions .action { max-width: 100%; white-space: normal; height: auto; padding-top: 6px; padding-bottom: 6px; line-height: 1.25; }
}



.field label { font-size: 13px; color: var(--text); margin: 0; overflow-wrap: anywhere; }
.field .hint { grid-column: 1; overflow-wrap: anywhere; }
.field.wide-field { grid-template-columns: minmax(0, 1fr); }
.field.wide-field .hint, .field.wide-field label { grid-column: 1; }
.field input, .field select, .field textarea {
  width: 100%;
  justify-self: end;
  font: inherit;
  font-size: 14px;
  min-height: 36px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
}


.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.field textarea { max-width: 100%; }
.field input[type="number"] { max-width: 140px; }
.field-switch { grid-template-columns: minmax(0, 1fr) auto; }
@media (prefers-color-scheme: dark) {
  .field input, .field select, .field textarea { background: rgba(255, 255, 255, 0.06); }
}
.field .hint { font-size: 11px; line-height: 1.5; color: var(--text-muted); margin-top: 6px; max-width: 560px; }




.field-switch label:first-child { font-size: 13px; color: var(--text); margin: 0; }





.hidden-checkbox, .field .hidden-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.field-toggle {
  width: 36px; height: 20px; border-radius: 10px; background: var(--switch-off);
  position: relative; cursor: pointer; display: block; margin: 0;
}
.field-toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: left .15s;
}
.hidden-checkbox:checked + .field-toggle { background: var(--accent); }
.hidden-checkbox:checked + .field-toggle::after { left: 18px; }
.hidden-checkbox:focus-visible + .field-toggle { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 720px) { .field-toggle { width: 44px; height: 26px; border-radius: 13px; } .field-toggle::after { width: 22px; height: 22px; } .hidden-checkbox:checked + .field-toggle::after { left: 20px; } }

.error { color: var(--alert); font-size: 12px; padding: 10px 18px; }
.connecting { color: var(--text-muted); padding: 40px 18px; text-align: center; }
.empty { text-align: center; color: var(--text-muted); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .icon { font-size: 26px; line-height: 1; margin-bottom: 4px; width: auto; height: auto; background: none; color: var(--text-muted); flex: none; }
.empty .action { margin-top: 6px; }
.empty .title { font-size: 13px; font-weight: 600; color: var(--text); }

@keyframes slide-in { from { transform: translateX(-8px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { #menu.open-sheet, #panel.open-sheet, #dim-overlay { animation: none; } }




.grabber, .menu-header, #tabbar, .menu-nothing, #dim-overlay { display: none; }
#menu .menu-search { display: none; }


@media (max-width: 720px) {
  #menu, #panel { display: none; }
  

  #window { flex-direction: column; }
  #middle { flex: 1; min-height: 0; }

  



  body.panel-open #dim-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(23, 24, 28, 0.32);
    z-index: 19;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: fade-in .14s ease-out;
  }

  #menu.open-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: auto 0 0 0;
    width: auto;
    
    height: 82vh;
    height: 82dvh;
    max-height: 82dvh;
    

    

    padding: 0 14px calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px);
    border-right: 0;
    border-radius: 18px 18px 0 0;
    background: var(--menu-bg);
    z-index: 20;
    box-shadow: 0 -8px 32px rgba(24, 20, 12, 0.18);
    animation: rise .16s ease-out;
    overflow: hidden;
  }
  

  #panel.open-sheet {
    display: block;
    position: fixed;
    inset: 0 auto 0 0;
    width: 288px;
    max-width: 86vw;
    animation: slide-in .14s ease-out;
    background: var(--bg);
    z-index: 20;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  }
  


  .panel-picker {
    display: inline-flex; align-items: center; gap: 6px;
    max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .panel-picker .chevron-down { color: var(--text-faint); font-size: 15px; line-height: 1; }

  #menu.open-sheet .grabber { display: flex; justify-content: center; padding: 8px 0 4px; flex: 0 0 auto; }
  #menu.open-sheet .grabber span { width: 40px; height: 4px; border-radius: 2px; background: var(--switch-off); }
  #menu.open-sheet .menu-header {
    display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; flex: 0 0 auto;
  }
  .menu-header .face {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
    background: var(--accent); color: #FFFFFF;
    font: 600 13px/1 var(--font-sans);
    display: flex; align-items: center; justify-content: center; text-transform: uppercase;
  }
  .menu-header .owner {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 600 15px/1.2 var(--font-sans); color: var(--text);
  }
  .menu-header .icon-action {
    width: 40px; height: 40px; flex: 0 0 40px; border: 0; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0; color: var(--text-muted);
  }

  #menu.open-sheet .menu-search {
    display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
    height: 44px; margin: 0 0 8px; padding: 0 12px;
    border-radius: 12px; background: var(--surface);
    

    box-shadow: inset 0 0 0 1px var(--border);
  }
  

  .menu-search .search-icon { position: static; width: 17px; height: 17px; flex: 0 0 17px; color: var(--text-faint); }
  .menu-search input {
    flex: 1; min-width: 0; border: 0; background: none; outline: none;
    font: 400 15px/1.2 var(--font-sans); color: var(--text);
    -webkit-appearance: none; appearance: none;
  }
  .menu-search input::-webkit-search-cancel-button { display: none; }
  .menu-search .clear {
    width: 24px; height: 24px; flex: 0 0 24px; border: 0; border-radius: 12px; padding: 0;
    background: var(--border); color: var(--text-muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
  }
  .menu-search .clear svg { width: 12px; height: 12px; }
  #menu.searching .menu-search { background: var(--card); box-shadow: inset 0 0 0 1px var(--accent); }
  #menu.searching .menu-search .clear { display: flex; }
  #menu.searching .group, #menu.searching .pinned, #menu.searching .footer { display: none; }
  

  #menu.searching .menu-node .well { display: block; }
  #menu.open-sheet .menu-nothing {
    display: none;
    padding: 18px 24px; text-align: center;
    font: 400 13px/1.45 var(--font-sans); color: var(--text-muted);
  }
  #menu.searching.menu-empty .menu-nothing { display: block; }
  .hidden-by-search { display: none !important; }

  
  #menu.open-sheet > .pinned,
  #menu.open-sheet > .group,
  #menu.open-sheet > .item,
  #menu.open-sheet > .menu-node,
  #menu.open-sheet > .footer { flex: 0 0 auto; }
  #menu.open-sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; overflow-y: auto; }
  #menu.open-sheet > .grabber, #menu.open-sheet > .menu-header, #menu.open-sheet > .menu-search { position: sticky; top: 0; background: var(--menu-bg); z-index: 1; }
  #menu.open-sheet > .grabber { top: 0; }


  
  #menu.open-sheet .item { height: 48px; font-size: 16px; padding: 0 10px; border-radius: 10px; }
  #menu.open-sheet .well .item { height: 46px; font-size: 15px; }
  #menu.open-sheet .item .item-icon { width: 18px; height: 18px; flex: 0 0 18px; }
  #menu.open-sheet .item .counter { font-size: 13px; }
  #menu.open-sheet .pinned { height: 48px; padding: 0 12px; font-size: 16px; }
  #menu.open-sheet .menu-node .chevron { font-size: 0; width: 16px; height: 16px; margin-left: 8px; }
  

  #menu.open-sheet .menu-node .chevron::before {
    content: ""; display: block; width: 16px; height: 16px;
    background: currentColor;
    -webkit-mask: no-repeat center/16px url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6l4 4 4-4'/></svg>");
    mask: no-repeat center/16px url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M4 6l4 4 4-4'/></svg>");
  }
  #menu.open-sheet .menu-node[open] > summary .chevron { transform: rotate(180deg); }

  








  #tabbar {
    display: grid;
    grid-template-columns: repeat(var(--tabs, 4), minmax(0, 1fr));
    flex: 0 0 auto;
    width: 100%;
    background: var(--card);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 21;
  }
  .tab {
    position: relative;
    width: 100%; min-width: 0; justify-self: stretch;
    height: var(--tab-h); border: 0; background: none; cursor: pointer; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-muted);
    text-align: center;
  }
  .tab .tab-glyph { position: relative; display: block; flex: 0 0 22px; width: 22px; height: 22px; }
  .tab .tab-icon { display: block; width: 22px; height: 22px; }
  .tab .tab-name {
    display: block; max-width: 100%; padding: 0 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
    font: 500 11px/1 var(--font-sans);
  }
  .tab.selected { color: var(--text); }
  .tab.selected .tab-name { font-weight: 600; }
  



  .tab .tab-count {
    position: absolute; top: -6px; left: 100%; margin-left: 1px;
    min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
    background: var(--accent); color: #FFFFFF;
    font: 600 10px/17px var(--font-mono); text-align: center; white-space: nowrap;
    box-shadow: 0 0 0 2px var(--card);
  }
  .tab .tab-dot {
    position: absolute; top: -2px; left: 100%; margin-left: 1px;
    width: 8px; height: 8px; border-radius: 50%;
    box-shadow: 0 0 0 2px var(--card);
  }

  


  .column { padding: 14px var(--side-phone); }
  .bubble .text { max-width: 88%; }

  
  

  .row .avatar { width: 44px; height: 44px; font-size: 16px; font-weight: 600; }
  

  .row .name-line { flex-wrap: nowrap; }
  .row .name-line .title {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  




  .row .name-line .meta-inline { margin-left: auto; flex: 0 0 auto; max-width: 40%; }
  

  .row .caption {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; white-space: normal; font-size: 14px; line-height: 1.35;
  }
  
  .row.nested { padding-left: 42px; }
  .row.nested::before {
    content: "";
    position: absolute; left: 26px; top: 10px; bottom: 10px;
    width: 2px; border-radius: 1px; background: var(--thread-line);
  }
  .row.nested { position: relative; }

  
  


  #screen[data-screen^="chat:"] .header { padding: 8px var(--side-phone); gap: 8px; }
  #screen[data-screen^="chat:"] .header .label { display: none; }
  #screen[data-screen^="chat:"] .header h1 {
    font-size: 17px; line-height: 1.25; margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  

  #screen[data-screen^="chat:"] .header .controls {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #screen[data-screen^="chat:"] .header .controls::-webkit-scrollbar { display: none; }
  #screen[data-screen^="chat:"] .header .controls > * { flex: 0 0 auto; }
  #screen[data-screen^="chat:"] .header .select select { max-width: 46vw; }
  

  body.panel-open #middle { overflow: hidden; }
  #panel.open-sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  

  .header .burger:first-child { display: none; }
}



.row-wrap { border-bottom: 1px solid var(--border-subtle); }
.section-card > .row-wrap:last-child { border-bottom: 0; }
.row-wrap .row { border-bottom: 0; }
.row.clickable { cursor: pointer; }
.row.quiet { opacity: 0.55; }






.row.offer { display: none; }
.row-wrap:has(> .row.offer) { display: none; }
body.push-offer .row.offer { display: flex; background: var(--info-bg); margin-bottom: 14px; }
body.push-offer .row-wrap:has(> .row.offer) { display: block; border-bottom: 0; }
.row.tone-red { background: var(--tone-red); }
.row.tone-orange { background: var(--tone-orange); }
.row.tone-green { background: var(--tone-green); }
.row .above { font-size: 11px; color: var(--text-muted); }

.expansion { padding: 0 14px 12px 34px; }
.output {
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0;
  max-height: 320px;
  overflow: auto;
}
.command { margin: 8px 0; }
.command code {
  display: block;
  font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
  word-break: break-all;
}
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; min-width: 0; }




.attachments .action {
  max-width: 100%; min-width: 0;
  height: auto; min-height: var(--control-h-row);
  padding-top: 4px; padding-bottom: 4px;
  white-space: normal; overflow-wrap: anywhere;
  justify-content: flex-start; text-align: left; line-height: 1.3;
}
.preview { max-width: 260px; max-height: 200px; border-radius: 10px; cursor: pointer; }

.gauge { height: 6px; border-radius: 3px; background: var(--border); margin-top: 6px; max-width: 220px; }
.gauge .fill { height: 100%; border-radius: 3px; background: var(--accent); }


.row-icon { width: 24px; height: 24px; flex: 0 0 24px; display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.icon-16 { width: 16px; height: 16px; }
.icon, .avatar {
  width: 36px; height: 36px; border-radius: 18px;
  background: var(--text-faint); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex: 0 0 36px;
}



.row-image { display: inline-block; margin: 8px 0; max-width: 100%; }
.row-image img {
  display: block; max-width: min(420px, 100%); max-height: 320px;
  width: auto; height: auto; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface);
}


.row-menu { position: relative; }
.more {
  width: var(--control-h); height: var(--control-h); border-radius: var(--control-radius);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; list-style: none; color: var(--text-faint);
}
.more::-webkit-details-marker { display: none; }
.more:hover { background: var(--surface); color: var(--text); }
.more svg { width: 16px; height: 16px; fill: currentColor; }

.clip {
  width: 32px; height: 32px; border-radius: 16px; flex: 0 0 32px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-faint);
}
.clip:hover { background: var(--surface); color: var(--text); }
.attach-icon, .send-icon { width: 18px; height: 18px; }
.send {
  width: 32px; height: 32px; border-radius: 16px; flex: 0 0 32px;
  border: 0; background: var(--accent); color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.send:hover { filter: brightness(1.08); }
.dropdown {
  

  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  min-width: 200px;
  padding: 4px;
}
.menu-item {
  display: block; width: 100%; text-align: left;
  border: 0; background: none; color: inherit; font: inherit;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
}
.menu-item { font-size: 13px; }
.menu-item:hover { background: var(--surface); }
.menu-item.danger { color: var(--alert); }

.cards { display: flex; flex-wrap: wrap; gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
  

  flex: 1 1 calc(25% - 9px);
}
@media (max-width: 900px) { .card { flex: 1 1 calc(50% - 6px); } }
@media (max-width: 560px) { .card { flex: 1 1 100%; } }
.card.clickable { cursor: pointer; }
.card .label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }


.value-large {
  font: 600 32px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 7px 0 0;
  display: flex; align-items: baseline; gap: 6px;
}
.value-large .unit { font: 400 14px/1 var(--font-sans); color: var(--text-faint); }


.value-large.прозой { font: 600 21px/1.25 var(--font-sans); letter-spacing: -0.01em; }
.card .caption { font-size: 12px; line-height: 1.45; color: var(--text-faint); margin-top: 7px; }


.card { position: relative; overflow: hidden; }
.level-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.card.level-warn .level-bar { background: var(--warn); }
.card.level-alert .level-bar { background: var(--alert); }
.card.level-alert .value-large { color: var(--alert); }




.matrix-scroll { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.matrix th { font-size: 11px; font-weight: 600; color: var(--text-secondary); text-align: center; padding: 0 4px 9px; white-space: nowrap; }
.matrix th:first-child { text-align: left; }




.matrix td.who { padding: 5px 12px 5px 2px; border-top: 1px solid var(--border-subtle); font-size: 13px; }
.matrix td.who .title { font-size: 13px; font-weight: 600; }
.matrix td.who small { display: block; font: 500 11px/1.4 var(--font-mono); color: var(--text-faint); overflow-wrap: anywhere; }
.matrix td.cell { text-align: center; padding: 5px 0; border-top: 1px solid var(--border-subtle); width: 1%; white-space: nowrap; }
.cell-button {
  width: 22px; height: 22px; border-radius: 6px; padding: 0;
  border: 1px solid var(--border); background: none; color: transparent;
  font: 600 12px/1 var(--font-sans); cursor: pointer;
}
.cell-button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cell-button.out { background: var(--warn-bg); border-color: var(--shelf-line); color: var(--warn); }
.cell-button:hover { border-color: var(--text-faint); }


.cell-na { color: var(--text-faint); font-size: 13px; cursor: help; }


.cell-button.inherited { border-style: dashed; }
.cell-button.on.inherited { background: color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }


.cell-label { display: none; }

.matrix tr.matrix-row.warn td.who { box-shadow: inset 3px 0 0 var(--warn); padding-left: 10px; }
.matrix tr.matrix-row.alert td.who { box-shadow: inset 3px 0 0 var(--alert); padding-left: 10px; }
.matrix tr.matrix-row.ok td.who { box-shadow: inset 3px 0 0 var(--ok); padding-left: 10px; }
.matrix tr.matrix-row.info td.who { box-shadow: inset 3px 0 0 var(--info); padding-left: 10px; }
.matrix tr.matrix-row.nested td.who { padding-left: 26px; }
.matrix tr.matrix-row.nested td.who .title { font-weight: 500; }
.matrix td.who .title .pill { margin-left: 8px; vertical-align: 1px; }
.matrix td.controls { width: 1%; text-align: right; }




.matrix.rights th { white-space: normal; line-height: 1.25; vertical-align: bottom; min-width: 70px; max-width: 84px; padding-left: 2px; padding-right: 2px; }
.matrix.rights td.cell { min-width: 70px; }
.matrix.rights td.who { min-width: 170px; }
@media (max-width: 720px) { .cell-button { width: 30px; height: 30px; } }



@media (max-width: 720px) {
  .matrix-scroll { overflow-x: visible; }
  .matrix, .matrix tbody { display: block; width: 100%; }
  .matrix thead { display: none; }
  .matrix tr.matrix-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
  .matrix tr.matrix-row:first-child { border-top: 0; }
  .matrix td.who { flex: 1 0 100%; width: 100%; border: 0; padding: 0 2px 2px; }
  .matrix tr.matrix-row.warn td.who, .matrix tr.matrix-row.alert td.who,
  .matrix tr.matrix-row.ok td.who, .matrix tr.matrix-row.info td.who { padding-left: 10px; }
  .matrix tr.matrix-row.nested { padding-left: 14px; }
  .matrix tr.matrix-row.nested td.who { padding-left: 2px; }
  .matrix td.cell { display: block; flex: 0 0 auto; width: auto; padding: 0; border: 0; text-align: left; }
  .matrix td.cell.na { display: none; }
  .matrix td.controls { flex: 0 0 auto; margin-left: auto; }
  .matrix.rights td.cell, .matrix.rights td.who { min-width: 0; }
  .cell-label { display: inline; }
  .cell-button {
    width: auto; min-width: 44px; height: 32px; padding: 0 12px; border-radius: 16px;
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--text-secondary); font: 500 12px/1 var(--font-sans); white-space: nowrap;
  }
  .cell-button .cell-mark:empty { display: none; }
  .cell-button.on { color: #fff; }
  .cell-button.out { color: var(--warn); }
  .cell-button.on.inherited { color: var(--text); }
}




.shelf {
  background: var(--shelf);
  border: 1px solid var(--shelf-line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.shelf-header { display: flex; align-items: center; gap: 8px; padding: 11px 16px 10px; }
.shelf-header .what { font-size: 13px; font-weight: 700; color: var(--warn); }
.shelf-header .count { font: 500 11px/1 var(--font-mono); color: var(--text-faint); }
.shelf-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-top: 1px solid var(--shelf-line);
}
.shelf-row .body { min-width: 0; flex: 1 1 auto; }
.shelf-row .title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.shelf-row .caption { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.shelf-row .right-side { margin-left: auto; flex: 0 0 auto; }
@media (max-width: 720px) {
  .shelf-row { flex-wrap: wrap; }
  .shelf-row .right-side { width: 100%; justify-content: flex-start; }
}



.row-group > summary {
  display: flex; align-items: baseline; gap: 10px;
  padding: 11px 8px; cursor: pointer; list-style: none;
  border-bottom: 1px solid var(--border-subtle);
}
.row-group > summary::-webkit-details-marker { display: none; }
.row-group > summary::before {
  content: "›"; color: var(--text-faint); font-size: 15px; line-height: 1;
  transition: transform .12s; display: inline-block;
}
.row-group[open] > summary::before { transform: rotate(90deg); }
.row-group > summary:hover { background: var(--hover); }
.row-group .title { font-size: 15px; font-weight: 600; flex: 0 1 auto; overflow-wrap: anywhere; }
.row-group .caption { font-size: 12px; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 0; }
.row-group .count { margin-left: auto; font: 600 12px/1 var(--font-mono); color: var(--text-faint); }
.row-group .inside { padding-left: 22px; }


.alert-box {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px;
  border-radius: 12px; background: var(--alert-bg);
}
.alert-box .title { font-size: 15px; font-weight: 600; color: var(--alert); }
.alert-box .caption { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.alert-box .right-side { margin-left: auto; }


.figures { display: flex; align-items: stretch; margin: 4px 0 6px; }
.figure { flex: 1 1 0; padding: 0 18px; display: flex; flex-direction: column; gap: 4px; border-left: 1px solid var(--border-subtle); }
.figure:first-child { padding-left: 0; border-left: 0; }
.figure b { font: 600 22px/1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.figure b .unit { font: 400 12px/1 var(--font-sans); color: var(--text-faint); margin-left: 4px; }
.figure span { font-size: 12px; color: var(--text-faint); }
@media (max-width: 720px) { .figures { flex-wrap: wrap; gap: 12px 0; } .figure { flex: 1 1 50%; } }

.subheading { font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }



.callout { background: var(--accent-bg); border-radius: 8px; padding: 8px 12px; font-size: 11px; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
.callout b { color: var(--text); font-weight: 600; }
.paragraph { margin: 0; line-height: 1.5; }
.paragraph, .subheading, .error, .column > .caption { overflow-wrap: anywhere; }
.rail { padding-left: 2px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 18px 0; }


.segments {
  display: inline-flex;
  background: var(--surface);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.segment {
  font-size: 12px;
  font-weight: 600;
  height: 26px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.segment.selected { background: var(--card); color: var(--text); box-shadow: var(--elevation); }
.segment:hover:not(.selected) { color: var(--text); }
.chip {
  font: inherit; font-size: 12px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: inherit;
  cursor: pointer;
}
.chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }




.subtabs-bar { display: flex; padding: 10px 18px 0; }
.subtabs-bar .segments { max-width: 100%; }



.header { flex-wrap: wrap; }
.tabs-bar { order: 10; flex: 1 1 100%; display: flex; padding-top: 6px; min-width: 0; }
.tabs-bar .segments { max-width: 100%; }


.segment-count {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
}
.segment.selected .segment-count { background: var(--surface); color: var(--text); }
.segment-count.at-warn { background: var(--warn); color: #fff; }
.segment-count.at-alert { background: var(--alert); color: #fff; }
.filters-bar { display: flex; gap: 10px; align-items: center; padding: 8px 18px 0; flex-wrap: wrap; }
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-icon { position: absolute; left: 8px; width: 14px; height: 14px; color: var(--text-faint); pointer-events: none; }
.search {
  font: inherit; font-size: 13px;
  height: 28px;
  padding: 0 10px 0 28px; border-radius: 8px;
  border: 1px solid transparent; background: var(--surface); color: inherit;
  min-width: 240px;
}
.search:focus { background: var(--card); border-color: var(--accent); outline: none; }

.panel-header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.panel-header .title { font-size: 13px; font-weight: 600; }
.panel-header .action { margin-left: auto; }
.panel-row { display: flex; align-items: stretch; position: relative; }


.panel-row .item {
  flex: 1; min-width: 0;
  height: auto; min-height: 58px;
  align-items: flex-start;
  padding: 9px 10px;
  gap: 8px;
}

#panel.sections {
  width: 208px; flex: 0 0 208px;
  padding: 12px 10px 20px;
  background: var(--menu-bg);
  display: flex; flex-direction: column; gap: 2px;
}
#panel.sections .panel-header { padding: 2px 10px 6px; }
#panel.sections .panel-search { display: flex; margin: 0 0 8px; }
#panel.sections .panel-search .search {
  width: 100%; min-width: 0; height: 32px; border-radius: 8px;
  background: var(--card); border-color: var(--border); padding-left: 30px;
}
#panel.sections .panel-search .search:focus { border-color: var(--accent); }
#panel.sections .panel-search .search-icon { left: 9px; }
#panel.sections .panel-row .item {
  min-height: 36px; height: 36px; align-items: center; padding: 0 10px;
  border-radius: 8px; gap: 8px; color: var(--text-secondary); font-size: 13px;
}
#panel.sections .panel-row .item:hover { color: var(--text); }
#panel.sections .panel-row .item.selected { color: var(--text); font-weight: 600; }
#panel.sections .panel-row .title { font: inherit; color: inherit; }
#panel.sections .panel-row .item-icon { width: 15px; height: 15px; flex: 0 0 15px; }
#panel.sections .panel-row .counter {
  align-self: center; font: 500 11px/1.3 var(--font-mono); color: var(--text-faint);
}
#panel.sections .panel-row .counter.warn { color: var(--warn); font-weight: 600; }
#panel.sections .panel-row .counter.alert { color: var(--alert); font-weight: 600; }
#panel.sections .panel-row .mark {
  width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; margin-left: auto;
}
#panel.sections .panel-row .mark.warn { background: var(--warn); }
#panel.sections .panel-row .mark.alert { background: var(--alert); }
#panel.sections .panel-row .item .counter, #panel.sections .panel-row .item .mark { margin-left: auto; }
.row.catalog-link::after {
  content: ""; width: 6px; height: 6px; flex: 0 0 6px; align-self: center;
  border: solid var(--text-faint); border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg); margin: 0 4px;
}

@media (max-width: 720px) {
  #middle:has(> #panel.sections) { flex-direction: column; }
  #panel.sections {
    width: 100%; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap;
    gap: 2px 4px; padding: 8px 10px;
    border-right: 0; border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  #panel.sections .panel-header { display: none; }
  #panel.sections .panel-search { flex: 0 0 100%; margin-bottom: 3px; }
  #panel.sections .panel-search .search { height: 36px; }
  #panel.sections .panel-row { flex: 0 0 auto; }
  #panel.sections .panel-row .item { height: auto; min-height: 36px; padding: 0 8px; }
  #panel.sections .panel-row .item-icon { display: none; }
}

.panel-row .title { font: 600 15px/1.3 var(--font-sans); color: var(--text); }
.panel-row .counter {
  margin-left: auto; align-self: flex-start;
  font: 500 11px/1.3 var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--text-faint); white-space: nowrap;
}
.panel-row .dot { margin-top: 5px; }


.panel-row .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.panel-row .title, .panel-row .caption { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-row .caption { font: 400 12px/1.35 var(--font-sans); color: var(--text-faint); margin-top: 2px; }
.item.selected .caption { color: var(--text-muted); }


.panel-row.nested-1 .item { padding-left: 30px; }
.panel-row.nested-2 .item { padding-left: 44px; }
.panel-row.container .title { color: var(--text-muted); font-weight: 600; }

.chevron { width: 12px; height: 12px; flex: 0 0 12px; color: var(--text-faint); transition: transform .15s; }
.chevron.expanded { transform: rotate(90deg); }


.collapse-container {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 4px; padding: 0;
  border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--text-faint);
}
.collapse-container:hover { background: var(--hover); color: var(--text); }
.collapse-container .chevron { transition: transform .15s; }
.collapse-container.expanded .chevron { transform: rotate(90deg); }
.panel-row.container { display: flex; align-items: center; }
@media (max-width: 720px) { .collapse-container { width: 40px; height: 40px; } }
.panel-row.thread::before { content: ""; position: absolute; top: 0; bottom: 0; left: 22px; border-left: 2px solid var(--thread-line); }
.panel-row.thread.nested-2::before { left: 36px; }
.thread-icon { width: 14px; height: 14px; flex: 0 0 14px; color: var(--accent); }
.item.selected .thread-icon { color: var(--accent); }


.footer { font-size: 11px; color: var(--text-muted); padding: 12px 9px 0; margin-top: auto; }
.footer .line { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.footer .bar { height: 3px; border-radius: 2px; background: var(--border); margin-top: 6px; }
.footer .bar .fill { height: 100%; border-radius: 2px; background: var(--accent); }

.turn { margin: 6px 0; }


.feed-day { text-align: center; font-size: 11px; color: var(--text-muted); margin: 10px 0 4px; }
.bottom { border-top: 1px solid var(--border); background: var(--bg); padding-bottom: env(safe-area-inset-bottom, 0); }
.bottom .composer { border-top: 0; }



.outbox {
  display: flex; flex-direction: column; gap: 6px;
  margin: 8px 18px 0; padding: 8px 12px;
  background: var(--shelf); border: 1px solid var(--shelf-line); border-radius: 11px;
}
.outbox[hidden] { display: none; }
.queue-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.queue-item .queue-text { flex: 1 1 auto; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.queue-item .queue-time { font-size: 11px; color: var(--text-muted); flex: 0 0 auto; }
.queue-item .action { flex: 0 0 auto; }
.queue-item.doubtful .queue-time { color: var(--warn); }
.queue-item.sent .queue-time { color: var(--ok); }








.pull-refresh {
  flex: 0 0 auto; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px; color: var(--text-faint);
}
.pull-refresh .sign {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 17px; height: 17px;
}
.pull-refresh .sign svg { width: 15px; height: 15px; }


.pull-refresh.threshold { font-size: 13px; font-weight: 600; color: var(--accent); }
.pull-refresh.threshold .sign {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-bg);
}
.pull-refresh.threshold .sign svg { transform: rotate(180deg); }
.pull-refresh.running { font-size: 13px; color: var(--text-secondary); }
.pull-refresh.running .sign svg { animation: spin .9s linear infinite; }
.pull-refresh.done { font-weight: 600; color: var(--ok); }


.pull-refresh.failed {
  font-weight: 600; color: var(--alert);
  background: var(--alert-bg); border-radius: 10px; margin: 0 18px 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .pull-refresh.running .sign svg { animation: none; }
}


.banner { font-size: 11px; line-height: 1.4; color: var(--text-muted); padding: 8px 18px 10px; }
.recipient.to-sema { color: var(--accent); }





button.action.burger, .burger, button.action.panel-picker { display: none; }
.heading { min-width: 0; }

.code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 240px; }

@media (max-width: 720px) {
  button.action.burger, .burger { display: inline-flex; width: 36px; padding: 0; }
  button.action.panel-picker { display: inline-flex; width: auto; padding: 0 10px; }
  



}




.set-picker {
  position: fixed; z-index: 40;
  background: var(--card); border: 1px solid var(--border); border-radius: 11px;
  box-shadow: 0 8px 32px rgba(24, 20, 12, 0.18);
  display: flex; flex-direction: column; overflow: hidden;
  max-height: min(360px, calc(100vh - 40px));
}
.set-picker .search-box { padding: 8px; border-bottom: 1px solid var(--border-subtle); }
.set-picker .search { width: 100%; min-width: 0; padding-left: 10px; }
.set-picker .options { overflow-y: auto; padding: 4px; min-height: 0; }
.set-picker .option {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 13px; color: var(--text);
  background: none; border: 0; border-radius: 7px; padding: 7px 9px; cursor: pointer;
}
.set-picker .option:hover, .set-picker .option:focus-visible { background: var(--surface); }
.set-picker .option.selected { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.set-picker .nothing { padding: 10px; font-size: 12px; color: var(--text-faint); }


@media (max-width: 720px) {
  .set-picker {
    left: 0 !important; right: 0; top: auto !important; bottom: 0;
    width: auto !important; max-height: 70dvh;
    border-radius: 14px 14px 0 0;
  }
  .set-picker .option { padding: 12px 10px; font-size: 15px; }
}






@media (max-width: 720px) {
  

  .filters-bar { flex-wrap: wrap; }
  


  .header .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  

  .tabs-bar { order: 0; flex: 1 1 0; min-width: 0; padding-top: 0; align-self: center; }
  .header .heading { flex-basis: 100%; }
  





  .header:has(.tabs-bar) .controls { width: auto; flex: 0 1 auto; max-width: 62%; margin-left: auto; }
  .subtabs-bar { padding-top: 2px; }
  .filters-bar { padding-top: 2px; }
  .header { padding-bottom: 4px; }
  .chips, .filters-bar .segments, .tabs-bar .segments, .subtabs-bar .segments {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    


    padding-inline: 4px 24px;
    scroll-padding-inline: 12px;
  }
  .chips::-webkit-scrollbar, .filters-bar .segments::-webkit-scrollbar,
  .tabs-bar .segments::-webkit-scrollbar, .subtabs-bar .segments::-webkit-scrollbar { display: none; }
  


  

  .filters-bar .search-box { flex: 1 1 120px; min-width: 0; }
  .filters-bar { flex-wrap: nowrap; padding-top: 6px; }
  .search { min-width: 0; width: 100%; }
  






  .header { padding: 8px var(--side-phone); gap: 6px; }
  .header h1 { font-size: 20px; line-height: 1.15; }
  .header .label {
    font-size: 12px; line-height: 1.35; margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  

  .header .controls {
    width: 100%; margin-left: 0; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none;
  }
  .header .controls::-webkit-scrollbar { display: none; }
  .header .controls > * { flex: 0 0 auto; }
  .header .controls .row-menu { margin-left: auto; }
  
  .header .controls:empty { display: none; }
  


  .header .controls { gap: 6px; max-width: 100%; min-width: 0; }
  .header .controls .segments {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%;
    padding-inline: 4px 24px; scroll-padding-inline: 12px;
  }
  .header .controls .segments::-webkit-scrollbar { display: none; }
  


  .chips.scrolls-right, .segments.scrolls-right {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  }
  .chips.scrolls-left, .segments.scrolls-left {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px);
    mask-image: linear-gradient(to right, transparent 0, #000 22px);
  }
  .chips.scrolls-left.scrolls-right, .segments.scrolls-left.scrolls-right {
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  }
  




  .matter-actions .action, .row .right-side .action, .section-header .right-side .action {
    max-width: 100%; min-width: 0;
    height: auto; min-height: var(--control-h-row);
    padding-top: 4px; padding-bottom: 4px;
    white-space: normal; overflow-wrap: anywhere; line-height: 1.25;
  }
  

  html, body { max-width: 100%; overflow-x: hidden; }
  .column { max-width: 100%; }
  .row, .bubble, .section-card { min-width: 0; }
  .row .label, .row .value, .fact .value { overflow-wrap: anywhere; }
  pre, code, .command, .output { overflow-x: auto; max-width: 100%; }

  
  #menu .item, #menu .menu-node > summary { height: 48px; font-size: 16px; }
  #menu .well .item { height: 46px; }
  button, .button, .chip, .tab, .item, summary, .row.clickable,
  input[type="checkbox"] + .switch, .burger {
    min-height: 44px;
  }
  button, .button { min-width: 44px; }
  button.switch {
    min-height: 0; min-width: 0; width: 44px; height: 26px;
    border-radius: 13px; flex: 0 0 44px;
  }
  button.switch::after { width: 22px; height: 22px; }
  button.switch.on::after { left: 20px; }
  .chip, .tab { display: inline-flex; align-items: center; }
  .item, .row { padding-top: 10px; padding-bottom: 10px; }

  

  input, textarea, select { font-size: 16px; }

  

  .section-header { flex-wrap: wrap; }
  .section-header .right-side { margin-left: 0; width: 100%; justify-content: flex-start; }
  .section-heading::after { display: none; }

  .field { grid-template-columns: minmax(0, 1fr); }
  .field input, .field select, .field textarea { justify-self: stretch; margin-top: 6px; }
  .field-switch { grid-template-columns: minmax(0, 1fr) auto; }
  .field-switch .field-toggle { margin-top: 0; }

  

  .field:has(.field-segments) { grid-template-columns: minmax(0, 1fr); }
  .field:has(.field-segments) .field-segments { justify-self: stretch; margin-top: 6px; }
  .field:has(.field-segments) .segment { flex: 1 1 0; justify-content: center; text-align: center; }

  




  .row:has(.main) .facts { display: none; }
}


@media (max-width: 360px) {
  :root { --side-phone: 12px; }
  .column { padding: 10px var(--side-phone); }
  .bubble .text { max-width: 94%; }
}






.graph { margin: 0 0 12px; }
.graph svg { width: 100%; height: auto; display: block; background: var(--card); border-radius: 10px; }
.graph .edge { stroke: var(--border); stroke-width: 1; }
.graph .node circle { fill: var(--accent); opacity: 0.85; }
.graph .node text { font-size: 10px; fill: var(--text); }
.graph .node.dim circle { opacity: 0.25; }
.graph .node.dim text { opacity: 0.45; }
.graph .node.selected circle { stroke: var(--text); stroke-width: 2; }

.graph .node[data-goto] { cursor: pointer; outline: none; }
.graph .node[data-goto]:hover circle,
.graph .node[data-goto]:focus-visible circle { opacity: 1; stroke: var(--text); stroke-width: 1.5; }
.graph .node[data-goto]:hover text,
.graph .node[data-goto]:focus-visible text { font-weight: 600; }
.graph figcaption { font-size: 11px; color: var(--text-muted); padding: 6px 2px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.area-mark { display: inline-flex; align-items: center; gap: 4px; }
.area-mark .dot { width: 7px; height: 7px; flex: 0 0 7px; }








.field-segments { justify-self: end; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.field-segments::-webkit-scrollbar { display: none; }
.field-segments .segment { cursor: pointer; padding: 4px 10px; }



.field-segments .segment { position: relative; }
.field-segments input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }




.field-segments .segment.selected:not(:has(input:checked)) { background: none; color: var(--text-secondary); box-shadow: none; }
.field-segments .segment:has(input:checked) { background: var(--card); color: var(--text); box-shadow: var(--elevation); }


.field-segments .segment.tone-ok:has(input:checked) { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.field-segments .segment.tone-warn:has(input:checked) { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.field-segments .segment.tone-alert:has(input:checked) { background: var(--alert-bg); color: var(--alert); box-shadow: none; }
.field-segments .segment:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }


.row-check { position: relative; width: 18px; height: 18px; flex: 0 0 18px; margin-top: 2px; cursor: pointer; }
.row-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.row-check span {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--card);
}
.row-check input:checked + span { background: var(--accent); border-color: var(--accent); }
.row-check input:checked + span::after {
  content: ""; position: absolute; left: 5px; top: 4px;
  width: 5px; height: 9px; border: 1.5px solid #fff; border-top: 0; border-left: 0;
  transform: rotate(42deg);
}
.row-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row:has(.row-check input:checked) { background: var(--sent-bg); }

.select-bar {
  display: none; align-items: center; gap: 10px;
  padding: 8px 16px; margin-bottom: 8px;
  background: var(--sent-bg); border-radius: 8px; font-size: 13px;
}
.select-bar.shown { display: flex; flex-wrap: wrap; }
.select-bar .count { font-weight: 600; }


.select-bar .action[data-bulk] { margin-left: auto; }
.select-bar .action[data-bulk] ~ .action[data-bulk] { margin-left: 0; }
.field-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-choice {
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px;
  font-size: 12px; cursor: pointer; background: var(--card);
  display: inline-flex; align-items: center; min-height: 34px;
}
.chip-choice { position: relative; }
.chip-choice input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.chip-choice:has(input:checked), .chip-choice.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
@media (max-width: 720px) { .chip-choice { min-height: 44px; } }



.row:hover { background: var(--hover); }
.row.clickable:hover { background: var(--hover); }
.busy { opacity: 0.55; pointer-events: none; }
button.busy::after { content: "…"; margin-left: 4px; }



.wizard fieldset.step { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0 0 10px; }
.wizard legend { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 0 6px; }

.row .avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--text-faint); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none; margin-right: 10px; }


.row .avatar.file {
  width: 34px; height: 42px; flex: 0 0 34px;
  border-radius: 6px;
  font-size: 9px; letter-spacing: 0.02em;
  text-transform: uppercase;
  align-items: flex-end;
  padding-bottom: 5px;
}
.row .avatar.icon { background: var(--accent); }


.row .avatar.square { border-radius: 8px; }
.row .meta { font: 500 11px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-faint); margin-top: 3px; }
.row.wide .right-side { margin-left: auto; }

.link-banner { position: fixed; left: 12px; right: 12px; bottom: 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--card); color: var(--text); border: 1px solid var(--warn); font-size: 13px; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,.2); }



@media (max-width: 720px) {
  body:has(#tabbar) .link-banner { bottom: calc(var(--tab-h) + 1px + env(safe-area-inset-bottom) + 8px); }
}





.snapshot-header { padding: 8px 18px; font-size: 11px; line-height: 1.4; color: var(--text);
  background: color-mix(in srgb, var(--warn) 14%, var(--bg)); border-bottom: 1px solid var(--warn); }



.not-in-snapshot { display: none !important; }


dialog.ask { border: 0; border-radius: 12px; padding: 16px; max-width: 420px; width: calc(100% - 32px);
  background: var(--card); color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
dialog.ask::backdrop { background: rgba(0,0,0,.35); }
dialog.ask .ask-text { margin: 0 0 10px; font-size: 13px; line-height: 1.45; white-space: pre-line; }
dialog.ask .ask-input { width: 100%; box-sizing: border-box; margin-bottom: 12px; }


dialog.ask .ask-text { font-size: 15px; line-height: 1.45; color: var(--text); margin-bottom: 14px; }
dialog.ask .right-side { gap: 8px; }
dialog.ask .action.danger {
  background: var(--alert); border-color: var(--alert); color: #fff;
}
dialog.ask .action.danger:hover { filter: brightness(1.05); }





a.chip { text-decoration: none; color: inherit; }
a.chip.selected { color: #fff; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }





.details-more, .fold > .section-heading { display: flex; align-items: center; gap: 8px; }
.details-more { font-size: 11px; color: var(--accent); padding: 6px 14px 8px; }
.details-more::before, .fold > .section-heading::before {
  content: "›"; flex: 0 0 auto; width: 12px; text-align: center;
  font-size: 17px; line-height: 1; color: var(--text-muted);
  display: inline-block; transition: transform 0.15s;
}
details[open] > .details-more::before, .fold[open] > .section-heading::before { transform: rotate(90deg); }
.fold > .section-heading { padding: 6px 8px; margin-left: -8px; border-radius: 8px; }
.fold > .section-heading:hover { background: var(--hover); }
.fold > .section-heading:hover::before { color: var(--text); }
.details-more:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }


h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }
.item.selected:focus-visible { outline-color: var(--accent); outline-offset: -3px; }


label.select { display: inline-flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--text-muted); }
label.select select, .controls select, .row .right-side select {
  font: inherit; font-size: 12px; font-weight: 500; height: var(--control-h-row); padding: 0 26px 0 10px; border-radius: var(--control-radius);
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%; background-size: 4px 4px; background-repeat: no-repeat;
}
.row .right-side { flex-wrap: wrap; align-items: center; }



.row.wide { flex-wrap: wrap; }
.row .body { flex: 1 1 220px; min-width: 0; }
.row .caption, .row .title, .row .above { overflow-wrap: anywhere; }
label.select select, .controls select, .row .right-side select { max-width: 190px; }


.sparkline { width: 120px; height: 22px; flex: none; }
.sparkline polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }


.row.clickable:focus-visible { outline-offset: -2px; }




a.row-link { color: inherit; text-decoration: none; }
a.row-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.row.clickable:hover a.row-link { text-decoration: none; }



summary.section-heading { display: flex; align-items: center; margin: 0; padding: 4px 14px; }
.section-card > .section { margin-bottom: 0; }
.section-card > .section + .row-wrap, .section-card > .section + .section { border-top: 1px solid var(--border); }


.bubble { position: relative; }
.bubble .bubble-menu { position: absolute; top: 2px; right: 4px; }
.bubble .bubble-menu summary { padding: 0 6px; opacity: .55; }
.bubble:hover .bubble-menu summary { opacity: 1; }






.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-align: left; padding: 0 10px 8px; letter-spacing: 0.02em; white-space: nowrap;
}
.table td { padding: 9px 10px; border-top: 1px solid var(--border-subtle); font-size: 14px; vertical-align: middle; }
.table tr:hover td { background: var(--hover); }
.table td.who { padding-left: 2px; }
.table td.who .title { font-size: 14px; font-weight: 600; }
.table td.who small { display: block; font: 500 11px/1.4 var(--font-mono); color: var(--text-faint); }


.table td.who .title { color: var(--text); }
.table td.who .title .pill { margin-left: 8px; vertical-align: 1px; }


.table td.who { width: 22%; }
.table td.table-cell.has-select { width: 27%; min-width: 0; }
.table td.table-cell.has-select select[data-option-set] { width: 100%; min-width: 164px; text-overflow: ellipsis; }
.table td.table-cell.has-select select:not([data-option-set]) { width: auto; }

.table tr.table-row.warn td.who { box-shadow: inset 3px 0 0 var(--warn); padding-left: 10px; }
.table tr.table-row.alert td.who { box-shadow: inset 3px 0 0 var(--alert); padding-left: 10px; }
.table tr.table-row.ok td.who { box-shadow: inset 3px 0 0 var(--ok); padding-left: 10px; }
.table tr.table-row.info td.who { box-shadow: inset 3px 0 0 var(--info); padding-left: 10px; }

.table td.table-cell.has-select { padding-top: 5px; padding-bottom: 5px; }
.table td.table-cell.has-select label.select { display: block; }
.table td.table-cell.has-select select { max-width: 100%; }


.table td.table-cell.mono { font: 500 13px/1.4 var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.table td.table-cell.ok { color: var(--ok); }
.table td.table-cell.info { color: var(--info); }
.table td.table-cell.warn { color: var(--warn); }
.table td.table-cell.alert { color: var(--alert); }

.table th.right-aligned { text-align: right; }
.table th:first-child { padding-left: 2px; }


.table td.controls { white-space: nowrap; text-align: right; }
.table td.controls .right-side { justify-content: flex-end; flex-wrap: nowrap; }





@media (max-width: 720px) {
  .table-scroll { overflow-x: visible; }
  .table { min-width: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 10px 0; border-top: 1px solid var(--border-subtle); }
  .table tr:first-child { border-top: 0; }
  .table tr:hover td { background: none; }
  .table td { padding: 3px 0; border: 0; }
  .table td.who, .table td.table-cell.has-select { width: 100%; }
  .table td.who { padding-left: 2px; padding-bottom: 6px; }
  .table td.who .title { font-size: 14px; }
  .table tr.table-row.warn td.who, .table tr.table-row.alert td.who,
  .table tr.table-row.ok td.who, .table tr.table-row.info td.who { padding-left: 10px; }
  .table td.table-cell { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; }
  .table td.table-cell[data-label]::before {
    content: attr(data-label); flex: 0 0 92px; font-size: 11px; font-weight: 500; color: var(--text-faint);
  }
  .table td.table-cell.mono { text-align: left; }
  .table td.table-cell.has-select { padding-top: 3px; padding-bottom: 3px; }
  .table td.table-cell.has-select label.select { flex: 1 1 0; min-width: 0; }
  .table td.table-cell.has-select select { width: 100%; max-width: none; }
  .table td.controls { white-space: normal; text-align: left; position: static; }
  .table td.controls .right-side { justify-content: flex-start; flex-wrap: wrap; }
}





.pill-row { margin-bottom: 14px; }
.pill-row > .section-heading { display: flex; align-items: center; width: 100%; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill.set {
  font: 600 11px/19px var(--font-mono);
  background: var(--surface); color: var(--text-secondary);
}
.pill.set::before { display: none; }
.pill.set.ok { background: var(--ok-bg); color: var(--ok); }
.pill.set.info { background: var(--info-bg); color: var(--info); }
.pill.set.warn { background: var(--warn-bg); color: var(--warn); }
.pill.set.alert { background: var(--alert-bg); color: var(--alert); }
.pill.tail { background: var(--accent-bg); color: var(--accent); border: 0; }
.pill.tail.pressable { cursor: pointer; font: 600 11px/1 var(--font-sans); height: 19px; padding: 0 7px; border-radius: 5px; }
.pill-row .caption { font-size: 12px; color: var(--text-faint); margin-top: 6px; }






.wizard-step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0;
}
.wizard-step + .wizard-step { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; }
.wizard-step:has(+ .wizard-step) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.step-header { display: flex; align-items: center; gap: 14px; padding: 13px 16px; }
.step-header .number {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 11px/1 var(--font-sans);
  background: var(--surface); color: var(--text-secondary);
}
.step-header .number svg { width: 12px; height: 12px; }
.wizard-step.done .number { background: var(--ok-bg); color: var(--ok); }
.wizard-step.open .number { background: var(--accent); color: #fff; }
.step-header .title { font-size: 15px; font-weight: 600; min-width: 0; }
.wizard-step.next .title { color: var(--text-secondary); }
.step-header .result { font: 500 12px/1.4 var(--font-mono); color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-header .right-side { margin-left: auto; }
.step-body { padding: 0 16px 14px; border-top: 1px solid var(--border-subtle); padding-top: 12px; }
.step-body .form { border: 0; background: none; padding: 0; margin-bottom: 0; }
@media (max-width: 720px) {
  .step-header { flex-wrap: wrap; }
  .step-header .result { flex: 1 1 100%; padding-left: 38px; }
}





.crumbs { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-faint); margin-bottom: 4px; flex-wrap: wrap; }
.crumbs.in-feed { margin: 0 0 10px; }
.crumbs .crumb {
  border: 0; background: none; padding: 0; margin: 0;
  font: inherit; color: var(--text-faint); cursor: pointer; height: auto;
}
.crumbs .crumb:hover { color: var(--text); }
.crumbs .crumb-chevron { width: 11px; height: 11px; flex: 0 0 11px; color: var(--border); }
.crumbs .crumb-chevron:last-child { display: none; }
.crumbs .here { color: var(--text-secondary); font-weight: 600; }
@media (max-width: 720px) {
  .crumbs .crumb { min-height: 0; min-width: 0; }
  


  .crumbs:not(:has(.here)) .crumb {
    color: var(--accent); font-size: 13px; padding: 9px 16px 9px 0; margin: -9px 0 -5px;
  }
}







.who { font-size: 11px; font-weight: 600; color: var(--text-faint); margin: 0 6px 2px; }
.who.right { text-align: right; }





.thinking {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 6px 0;
  padding: 9px 13px;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
}
.thinking .what { font-size: 13px; color: var(--text-secondary); }
.thinking .by-whom { font: 500 11px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-faint); }
.thinking .dots { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.thinking .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); display: block; animation: thinking-pulse 1.2s infinite; }
.thinking .dots i:nth-child(2) { animation-delay: .2s; }
.thinking .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes thinking-pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .thinking .dots i { animation: none; }
  .thinking .dots i:nth-child(2) { opacity: .6; }
  .thinking .dots i:nth-child(3) { opacity: .3; }
}





.matter {
  position: relative;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  



  clip-path: inset(0 round 12px);
}


.matter:has(details.row-menu[open]) { clip-path: none; }
.matter.level-warn .level-bar { background: var(--warn); }
.matter.level-alert .level-bar { background: var(--alert); }
.matter.level-ok .level-bar { background: var(--ok); }
.matter.level-info .level-bar { background: var(--info); }
.matter-header { display: flex; align-items: center; gap: 10px; padding: 11px 14px 10px; }
.matter-icon {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text-secondary);
}
.matter-icon.warn { background: var(--warn-bg); color: var(--warn); }
.matter-icon.alert { background: var(--alert-bg); color: var(--alert); }
.matter-icon.ok { background: var(--ok-bg); color: var(--ok); }
.matter-icon.info { background: var(--info-bg); color: var(--info); }
.matter-name { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; }
.matter-name b { font-size: 13px; font-weight: 700; line-height: 1.3; }



.matter-name b, .matter-meta, .matter-prose, .matter-quiet, .matter-caution span:last-child { overflow-wrap: anywhere; }
.matter-meta { font: 500 11px/1.3 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-faint); }


.matter-header .right-side { margin-left: auto; flex: 0 0 auto; max-width: 55%; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 8px; }
.matter-header .pill { white-space: normal; overflow-wrap: anywhere; height: auto; min-height: 19px; }


.matter .pill::before { display: none; }
.matter .pill.warn { background: var(--warn-bg); }
.matter .pill.ok { background: var(--ok-bg); }
.matter .pill.info { background: var(--info-bg); }
.countdown-large { font: 600 19px/1 var(--font-mono); font-variant-numeric: tabular-nums; }

.matter-body { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 9px; }
.matter-prose { font-size: 14px; line-height: 1.45; }
.matter-code, .matter-diff {
  background: var(--surface);
  border-radius: 8px;
  padding: 9px 11px;
  margin: 0;
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 320px;
}


.matter-diff { font: 13px/1.55 var(--font-sans); }
.matter-diff .plus { color: var(--ok); }
.matter-diff .minus { color: var(--alert); }
.matter-links { display: flex; flex-direction: column; gap: 7px; align-items: flex-start; }
.matter-link {
  font: inherit; font-size: 13px; text-align: left;
  border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer;
  max-width: 100%; overflow-wrap: anywhere;
}
.matter-link:hover { color: var(--text); }
.matter-quiet { font-size: 12px; line-height: 1.55; color: var(--text-faint); }


.matter-caution { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; line-height: 1.55; color: var(--text-faint); }
.matter-caution span:first-child { color: var(--warn); flex: 0 0 auto; }
.matter-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--border-subtle); background: var(--bg);
  

  position: relative; z-index: 1;
}


.matter-actions .dropdown { top: auto; bottom: calc(100% + 4px); }




.matter-actions .row-menu { position: static; }
.matter-actions .dropdown { right: 10px; max-width: calc(100% - 20px); }
.matter-actions .action { height: var(--control-h-row); padding: 0 10px; font-size: 12px; }


.matter-actions .spacer { flex: 1 1 auto; min-width: 12px; }




.chain {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.chain-count { font: 500 12px/1 var(--font-mono); color: var(--text-faint); }
.chain .scale { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.chain .notch { width: 9px; height: 9px; border-radius: 50%; background: var(--border); display: block; flex: 0 0 9px; }
.chain .notch.current { background: var(--accent); }
.chain .scale .caption { font-size: 12px; line-height: 1.5; color: var(--text-faint); margin-left: 8px; min-width: 0; }
.chain-mails { border-top: 1px solid var(--border-subtle); padding-top: 4px; }
.chain-mails .row { padding: 9px 0; }




.mail-class {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 13px 16px; margin: 10px 0;
}


.mail-class .body { min-width: 0; flex: 1 1 0; }
.mail-class .title { font-size: 14px; font-weight: 600; }
.mail-class .caption { font-size: 12px; line-height: 1.55; color: var(--text-faint); margin-top: 2px; }
.mail-class .segments { margin-left: auto; flex: 0 0 auto; }
button.segment { border: 0; background: none; font-family: inherit; cursor: pointer; }




.switcher { margin: 10px 0; }
.entities { display: flex; gap: 10px; flex-wrap: wrap; }
.entity {
  flex: 1 1 200px; min-width: 0; max-width: 100%;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  padding: 11px 13px; font: inherit; text-align: left; cursor: pointer;
  

  color: var(--text);
}
.entity:hover { border-color: var(--text-faint); }
.entity.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.entity .top { display: flex; align-items: center; gap: 7px; max-width: 100%; }
.entity .name { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }


.entity .bottom { font-size: 12px; line-height: 1.35; color: var(--text-faint); overflow-wrap: anywhere; }

@media (max-width: 720px) {
  

  .matter, .chain, .mail-class, .thinking, .entity { max-width: 100%; }
  .matter-code, .matter-diff { max-width: 100%; }
  .matter-actions .action { min-height: 44px; height: 44px; }
  

  .mail-class { flex-wrap: wrap; align-items: flex-start; }
  .mail-class .segments { margin-left: 0; width: 100%; }
  .mail-class .segment { flex: 1 1 0; justify-content: center; min-height: 44px; }
  


  .entities { flex-wrap: wrap; gap: 8px; }
  .entity { flex: 1 1 calc(50% - 4px); min-width: 0; padding: 10px 11px; }
  

  .thinking { flex-wrap: wrap; min-height: 0; }
  .thinking .action { margin-left: auto; }
}




.mail-view { margin-top: 6px; }
.view-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.view-switch .view {
  font: 11px/1 inherit; padding: 6px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text-secondary);
}
.view-switch .view.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.view-switch .view.images { margin-left: auto; }
.mail-frame {
  width: 100%; height: 60vh; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; display: block; resize: vertical; overflow: auto;
}
.mail-view.full-height .mail-frame { height: 88vh; }
.mail-view[data-view="as-text"] .mail-frame { display: none; }
.mail-view[data-view="as-text"] .mail-as-text { display: block; }
@media (max-width: 720px) { .mail-frame { height: 55vh; } }







.save-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 18px; border-top: 1px solid var(--border);
  background: var(--card); box-shadow: 0 -4px 14px rgba(40, 34, 20, 0.06);
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}
.save-bar[hidden] { display: none; }


.save-bar.attention { animation: save-bar-attention .8s ease-in-out 2; }
@keyframes save-bar-attention {
  0%, 100% { box-shadow: 0 -4px 14px rgba(40, 34, 20, 0.06); }
  50% { box-shadow: 0 0 0 3px var(--warn), 0 -4px 14px rgba(40, 34, 20, 0.06); }
}
@media (prefers-reduced-motion: reduce) { .save-bar.attention { animation: none; outline: 2px solid var(--warn); } }
.save-bar .what { font-size: 12px; color: var(--text-secondary); min-width: 0; }
.save-bar .what b { color: var(--text); font-weight: 600; }
.save-bar .what .trouble { color: var(--alert); font-weight: 600; }
.save-bar .right-side { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }



.field.changed > label::after {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn); margin-left: 6px; vertical-align: middle;
}



.not-saved {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 10px;
  background: var(--alert-bg); border-radius: 9px; padding: 9px 12px;
}
.not-saved[hidden] { display: none; }
.not-saved .dot { background: var(--alert); margin-top: 5px; width: 7px; height: 7px; flex: 0 0 7px; }
.not-saved .text { min-width: 0; flex: 1 1 auto; font-size: 11px; line-height: 1.45; color: var(--text); }
.not-saved .text b { display: block; font-size: 12px; color: var(--alert); }
.not-saved .action { flex: 0 0 auto; }



.leave {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 10px 18px 0; padding: 12px 14px;
  background: var(--shelf); border: 1px solid var(--shelf-line); border-radius: 11px;
}
.leave[hidden] { display: none; }
.leave .gist { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.leave .gist b { font-size: 13px; color: var(--warn); }
.leave .gist .what { font-size: 11px; line-height: 1.45; color: var(--text-secondary); }
.leave .right-side { margin-left: auto; display: flex; gap: 8px; flex: 0 0 auto; }

@media (max-width: 720px) {
  .save-bar .action, .leave .action { min-height: 44px; }
  .leave .right-side, .save-bar .right-side { margin-left: 0; width: 100%; }
  .leave .right-side .action, .save-bar .right-side .action { flex: 1 1 0; justify-content: center; }
}


details.fragment > .section-card { display: flex; flex-direction: column; gap: 6px; }
.fragment-search { display: flex; align-items: center; gap: 6px; padding: 4px 10px 2px; }
.fragment-search .search { width: 100%; min-width: 0; }
.fragment-loading { padding: 8px 14px; color: var(--text-muted); }




body.waiting::after {
  content: ""; position: fixed; top: 0; left: 0; height: 2px; width: 28%;
  background: var(--accent); border-radius: 0 2px 2px 0; z-index: 60;
  animation: waiting-run 1.1s ease-in-out infinite;
}
@keyframes waiting-run {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(360%); }
}
@media (prefers-reduced-motion: reduce) {
  body.waiting::after { animation: none; width: 100%; opacity: .6; }
}





.pattern-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 10px 0; }




.pattern-col { border: 1px solid var(--border); border-radius: 10px; background: var(--card); padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; align-content: start; min-width: 0; }
.pattern-col h3 { margin: 0; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pattern-col.ok h3 { color: var(--ok); }
.pattern-col.warn h3 { color: var(--warn); }
.pattern-col.alert h3 { color: var(--alert); }
.pattern-col .explain { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-secondary); }
.pattern-col .pats { display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow: auto; align-content: flex-start; }
.pat { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 8px; border-radius: 6px; background: var(--surface); font: 11.5px/1.35 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.pat > span { overflow-wrap: anywhere; }
.pat.hit { outline: 2px solid var(--accent); }
.pat-x { border: 0; background: none; color: var(--text-faint); cursor: pointer; font: inherit; padding: 0 4px; border-radius: 4px; }
.pat-x:hover { color: var(--alert); }
.pat-x:focus-visible { outline: 2px solid var(--accent); }
.pat-add { display: flex; gap: 6px; }
.pat-add input { flex: 1 1 auto; min-width: 0; height: var(--control-h-row); padding: 0 8px; border: 1px solid var(--border); border-radius: var(--control-radius); background: var(--card); color: var(--text); font: 12px var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); }
.pat-add .action { height: var(--control-h-row); }
@media (max-width: 720px) {
  .pattern-cols { grid-template-columns: minmax(0, 1fr); }
  .pat-x, .pat-add input, .pat-add .action { min-height: 44px; }
}








.form.rows { padding: 2px 14px; margin-bottom: 18px; }
.form.rows h3 {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); margin: 10px 0 0;
}
.form.rows > .field.setting {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 1px;
  align-items: center; padding: 9px 0;
}
.form.rows > .field.setting:first-of-type { padding-top: 9px; }
.setting-label { grid-column: 1; grid-row: 1; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.field.setting .hint.setting-hint {
  grid-column: 1; grid-row: 2; margin: 0; max-width: 64ch;
  font-size: 11px; line-height: 1.4; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  cursor: pointer;
}
.field.setting .hint.setting-hint.open { display: block; }
.field.setting .hint.setting-hint:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.setting-control {
  grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px;
  justify-self: end; flex-wrap: wrap; justify-content: flex-end; min-width: 0;
}
.setting-control input[type="text"], .setting-control input[type="password"] {
  width: 240px; max-width: 100%; height: var(--control-h-row); min-height: 0;
  padding: 0 9px; font-size: 12px; border-radius: var(--control-radius);
}


.secure-wrap { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.secure-wrap input { flex: 1 1 auto; min-width: 0; }
.setting-control .secure-wrap { width: auto; }
.secure-show {
  flex: none; height: var(--control-h-row); padding: 0 8px; font: 12px var(--font-sans);
  border: 1px solid var(--border); border-radius: var(--control-radius);
  background: var(--card); color: var(--text-secondary); cursor: pointer;
}
.secure-show[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.secure-show:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting-control .setting-number {
  width: 86px; max-width: 100%; height: var(--control-h-row); min-height: 0; padding: 0 8px;
  font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums; text-align: right;
  border-radius: var(--control-radius);
}
.setting-control select {
  width: auto; max-width: 100%; height: var(--control-h-row); min-height: 0; padding: 0 8px; font-size: 12px;
  border-radius: var(--control-radius);
}

.setting-control input, .setting-control select { margin-top: 0; }
.setting-control .unit { font-size: 11px; color: var(--text-faint); }
.setting-control .field-toggle { margin: 0; }



.to-default {
  border: 0; background: none; color: var(--accent); font: inherit; font-size: 11px; font-weight: 600;
  padding: 2px 4px; border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.to-default:hover { text-decoration: underline; }
.to-default:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field.setting.is-default .to-default { display: none; }

.form.rows .field.changed > label::after { content: none; }
.form.rows .field.changed > .setting-label::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}



.form.rows > .field.setting:has(textarea.code) { grid-template-columns: minmax(0, 1fr); align-items: start; }
.form.rows > .field.setting:has(textarea.code) > .setting-control { grid-column: 1; grid-row: auto; justify-self: stretch; margin-top: 8px; }
.setting-control textarea.code { width: 100%; max-width: 100%; margin-top: 0; }



.setting-control .field-chips { gap: 6px; justify-content: flex-end; }
.setting-control .chip-choice { min-height: var(--control-h-row); padding: 0 11px; font-size: 12px; }




.timespan { display: inline-flex; align-items: center; gap: 6px; }
.setting-control .time-input {
  width: 92px; max-width: 100%; height: var(--control-h-row); min-height: 0; padding: 0 6px;
  font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums; text-align: center;
  border-radius: var(--control-radius); margin-top: 0;
}
@media (max-width: 720px) {
  .timespan { width: 100%; }
  .setting-control .time-input { flex: 1 1 0; width: auto; height: 36px; font-size: 16px; }
}



.more-fields { margin-top: 4px; border-top: 1px dashed var(--border); }
.more-fields > summary {
  list-style: none; cursor: pointer; padding: 9px 0; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); display: flex; align-items: center; gap: 8px;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::before { content: "›"; font-size: 17px; line-height: 1; color: var(--text-muted); width: 12px; text-align: center; transition: transform .15s; }
.more-fields[open] > summary::before { transform: rotate(90deg); }
.more-fields > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.form.rows .more-body > .field.setting {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 1px;
  align-items: center; padding: 9px 0;
}
@media (max-width: 720px) {
  .form.rows .more-body > .field.setting { grid-template-columns: minmax(0, 1fr); }
  .form.rows .more-body > .field.setting.setting-switch { grid-template-columns: minmax(0, 1fr) auto; }
}



.field-segments .segment.disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; text-decoration-thickness: 1px; }




.section.danger .section-heading { color: var(--alert); }
.section.danger > .section-card {
  border: 1px solid color-mix(in srgb, var(--alert) 45%, var(--border)); border-radius: 10px; padding: 2px 14px;
}
.section.danger .row { padding-left: 0; padding-right: 0; }


.shelf-actions { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  

  .shelf-header { flex-wrap: wrap; row-gap: 6px; }
  .shelf-header .count { flex: 1 1 100%; order: 3; line-height: 1.4; }
  .shelf-actions { margin-left: auto; }
}



@media (max-width: 720px) {
  #sec-entity .select { display: none; }
  


  #sec-entity .row { padding: 8px 4px; gap: 10px; align-items: center; }
  #sec-entity .row .avatar { width: 34px; height: 34px; font-size: 14px; margin-right: 0; }
  #sec-entity .row .body { flex: 1 1 0; }
  #sec-entity .row .caption { display: none; }
  #sec-entity .row .right-side { width: auto; margin-left: auto; justify-content: flex-end; }
  

  #sec-entity .row .right-side .pill + .pill { display: none; }
}



details.fold.fine { border: 1px dashed var(--border); border-radius: 10px; margin-bottom: 18px; }
.fold.fine > .section-heading {
  margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); flex-wrap: nowrap; min-width: 0; white-space: nowrap;
}
.fold.fine > .section-heading::after { display: none; }
.fold.fine .fine-note {
  font-weight: 500; color: var(--text-muted); min-width: 0; flex: 0 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fold.fine .fine-state { margin-left: auto; flex: 0 0 auto; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.fold.fine .fine-state.changed { color: var(--accent); font-weight: 600; }
details.fragment.fine > .section-card { gap: 0; border-top: 1px dashed var(--border); padding: 4px 14px 8px; }
details.fine .form.rows { border: 0; background: none; padding: 0; margin: 0 0 4px; }
details.fine .form.rows h3 { margin-top: 14px; }
details.fine .form.rows:first-child h3 { margin-top: 8px; }
details.fine .form.rows > .field.setting { padding: 7px 0; }
details.fine .setting-label { font-size: 12px; }

@media (max-width: 720px) {
  .form.rows > .field.setting { grid-template-columns: minmax(0, 1fr); }
  .form.rows > .field.setting.setting-switch { grid-template-columns: minmax(0, 1fr) auto; }
  .setting-control { grid-column: 1; grid-row: auto; justify-self: stretch; margin-top: 6px; justify-content: flex-start; }
  .setting-switch > .setting-control { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; justify-self: end; justify-content: flex-end; }
  .setting-control .field-segments { width: 100%; }
  .setting-control .field-segments .segment { flex: 1 1 0; justify-content: center; text-align: center; }
  .setting-control .field-chips { justify-content: flex-start; width: 100%; }
  
  .setting-control .chip-choice { min-height: 36px; flex: 1 1 calc(50% - 6px); justify-content: center; }
  .setting-control input[type="text"], .setting-control input[type="password"], .setting-control select { width: 100%; }
  .setting-control .secure-wrap { width: 100%; }
  .setting-control .setting-number { height: 36px; font-size: 16px; }
  .setting-control input[type="text"], .setting-control select { height: 36px; }
  .to-default { min-height: 32px; min-width: 0; padding: 0 8px; }
  


  body:has(#tabbar) .save-bar { padding-bottom: 10px; }
}
