:root {
  color-scheme: light;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  --ink: #173230;
  --muted: #4c6662;
  --line: #d5e2dd;
  --paper: #fff;
  --ground: #f0f5f2;
  --accent: #076253;
  --soft: #e4f3ed;
  --error: #8a2523;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #046eae; outline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; max-width: 100%; }
button, .button, input, select, textarea {
  min-height: 2.65rem;
  border: 1px solid #a0b6b0;
  border-radius: .55rem;
  background: var(--paper);
  padding: .4rem .75rem;
}
.button { display: inline-flex; align-items: center; text-decoration: none; }
button { cursor: pointer; }
button:hover, .button:hover { background: var(--soft); }
button:disabled { cursor: default; opacity: .6; }
.primary { background: var(--accent); color: white; border-color: var(--accent); }
.primary:hover { background: #064d43; }
.quiet { background: transparent; border-color: transparent; }
input:not([type="checkbox"]), select, textarea { width: 100%; }
label { display: grid; gap: .25rem; min-width: 0; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1rem; }
.muted, time { color: var(--muted); }
.skip { position: fixed; top: .5rem; left: .5rem; transform: translateY(-160%); z-index: 1; background: white; padding: .5rem; }
.skip:focus { transform: none; }
#masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.mast-inner { max-width: 88rem; margin: auto; padding: .8rem clamp(1rem, 3vw, 3rem); display: flex; gap: 1rem 1.6rem; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 750; font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand span { background: var(--accent); color: white; border-radius: .6rem; padding: .2rem .55rem; }
.mast-inner nav, .user { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.mast-inner nav a { padding: .55rem .65rem; border-radius: .5rem; color: var(--muted); text-decoration: none; }
.mast-inner nav a[aria-current], .mast-inner nav a:hover { background: var(--soft); color: var(--accent); }
.user { margin-inline-start: auto; }
#content { margin: auto; padding: clamp(1rem, 3vw, 2.6rem) clamp(1rem, 3vw, 3rem) 3rem; max-width: 88rem; }
.page-title { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-title p { margin-top: .45rem; }
.panel, .login-card { background: var(--paper); border: 1px solid var(--line); border-radius: .85rem; padding: 1rem; }
.login-card { max-width: 27rem; margin: 3rem auto; display: grid; gap: 1rem; }
.panel > p + *, .panel > h2 + *, .panel > h1 + * { margin-top: .65rem; }
.feedback:not(:empty) { color: var(--error); }
.feedback:empty { display: none; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .75rem; align-items: end; margin-bottom: 1rem; }
.filters label { font-size: .875rem; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.filter-actions { grid-column: 1 / -1; }
@media (min-width: 70rem) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(2, minmax(0, .9fr)) auto; }
  .filter-actions { grid-column: auto; }
}
.inbox { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.inbox > * { min-width: 0; }
.inbox-head { padding: .95rem 1rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.inbox .panel { margin: 0; padding: 0; }
.scrollbox { max-height: clamp(17rem, calc(100vh - 24rem), 38rem); overflow: auto; overflow-anchor: none; padding: .15rem .5rem; }
.message-list { margin: 0; padding: 0; list-style: none; }
.message-list li { margin: 0; }
.message-row { display: grid; text-align: left; grid-template-columns: minmax(0, 1fr) auto; width: 100%; gap: .28rem .6rem; border-color: transparent; border-bottom-color: var(--line); border-radius: 0; padding: .7rem .55rem; }
.message-row[aria-pressed="true"] { background: var(--soft); border-radius: .45rem; }
.message-row > span, .message-row > strong { min-width: 0; overflow-wrap: anywhere; }
.message-row > strong { font-size: 1rem; }
.message-row > time, .message-row .meta { font-size: .78rem; }
.message-row .excerpt, .message-row .meta { grid-column: 1 / -1; }
.excerpt { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta, .pill { color: var(--muted); font-size: .82rem; }
.pill { background: var(--soft); color: var(--accent); border-radius: 99rem; padding: .1rem .55rem; width: fit-content; overflow-wrap: anywhere; }
.inbox-state, .detail-state, .inbox-more { margin: .65rem 1rem; }
.inbox-state:empty, .detail-state:empty, .inbox-state:has(> .feedback:empty), .detail-state:has(> .feedback:empty) { display: none; }
.detail-head { display: grid; gap: .35rem; }
.bubble { background: #f2f6f5; border: 1px solid var(--line); padding: .75rem; margin: .5rem .25rem; border-radius: .75rem; max-width: 94%; }
.bubble.outbound { margin-inline-start: auto; background: var(--soft); }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-block: .3rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: .75rem; margin-top: .7rem; }
.cards > .panel, .stack, .step-form, .diagnostics { display: grid; gap: .65rem; align-content: start; }
.group + .group { margin-top: 1.45rem; }
.step-form { max-width: 34rem; }
.step-form label:has(input[type="checkbox"]) { display: flex; align-items: center; flex-direction: row-reverse; justify-content: start; }
.step-form button { justify-self: start; }
.method-selection { width: min(100%, 34rem); }
.method-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin-top: 1rem; }
.method-card {
  aspect-ratio: 1; display: grid; grid-template-rows: minmax(3rem, auto) auto;
  align-content: center; gap: .45rem; padding: clamp(.65rem, 3vw, 1.25rem);
  min-width: 0; border: 1px solid var(--line); border-radius: .85rem; background: var(--ground);
  color: var(--ink); text-align: start; text-decoration: none; overflow-wrap: anywhere;
}
.method-card strong { align-self: end; color: var(--accent); font-size: clamp(1rem, 3.8vw, 1.2rem); line-height: 1.25; }
.method-card span { color: var(--muted); font-size: .875rem; line-height: 1.35; }
.method-card:hover { background: var(--soft); border-color: var(--accent); }
.method-error { margin-top: .75rem; width: fit-content; border-radius: .55rem; padding: .35rem .7rem; background: #fff0ee; color: var(--error); }
.method-error:empty { display: none; }
.setup-guide > summary { cursor: pointer; width: fit-content; gap: .55rem; }
.setup-guide > summary::after { content: ""; width: .42rem; height: .42rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); margin-top: -.18rem; }
.setup-guide[open] > summary::after { transform: rotate(225deg); margin-top: .2rem; }
.setup-guide[open] > :not(summary) { margin-top: .65rem; }
.telegram-guide { background: var(--ground); border: 1px solid var(--line); border-radius: .75rem; padding: .75rem 1rem; max-width: 34rem; }
.telegram-guide ol { margin: 0 0 .65rem; padding-inline-start: 1.3rem; }
.telegram-guide li + li { margin-top: .3rem; }
.whatsapp-setup { display: grid; gap: 1.25rem; align-items: start; margin-top: 1rem; }
.whatsapp-setup:not(:has(.setup-guide[open])) .whatsapp-form { max-width: 38rem; }
.whatsapp-guide { display: grid; gap: .65rem; background: var(--ground); border: 1px solid var(--line); border-radius: .75rem; padding: 1rem; min-width: 0; }
.whatsapp-guide summary { cursor: pointer; color: var(--accent); font-weight: 650; padding-block: .35rem; }
.whatsapp-guide details + details { border-top: 1px solid var(--line); padding-top: .3rem; }
.whatsapp-guide :is(ol, ul) { margin: .25rem 0 .35rem; padding-inline-start: 1.3rem; }
.whatsapp-guide li { margin-top: .4rem; overflow-wrap: anywhere; }
.whatsapp-form { min-width: 0; }
.whatsapp-form .step-form { max-width: none; }
.whatsapp-form .step-form > label + .muted { font-size: .875rem; margin-top: -.4rem; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .25rem .5rem; }
.copy-result { grid-column: 1 / -1; font-size: .875rem; }
.copy-result:empty { display: none; }
@media (min-width: 56rem) {
  .whatsapp-setup:has(.setup-guide[open]) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
@media (max-width: 22rem) { .method-cards { grid-template-columns: minmax(0, 1fr); max-width: 14rem; } }
.detail-head .actions { margin-left: auto; }
.diagnostics { margin: .3rem 0; padding: 0; }
.diagnostics div { border-left: 2px solid var(--line); padding-left: .65rem; }
.diagnostics dd { margin: 0; }
.detail-back { display: none; }
@media (max-width: 48rem) {
  .inbox { grid-template-columns: 1fr; }
  .inbox:not(.detail-open) .conversation, .detail-open .journal { display: none; }
  .detail-back { display: inline-flex; justify-self: start; }
  #workspace:has(.detail-open) > :is(.page-title, .filters, .filter-error) { display: none; }
  .detail-head .actions { margin-left: 0; }
  .scrollbox { max-height: 66vh; }
}
@media (max-width: 36rem) {
  .mast-inner { gap: .4rem; }
  .mast-inner nav { order: 1; width: 100%; }
  .mast-inner nav a { padding: .35rem .45rem; font-size: .86rem; }
  .user { font-size: .85rem; }
  .user button { min-height: 2.2rem; padding: .25rem; }
}
