/* The panel looks like the Telegram app its admins live in all day (owner,
   2026-10-28: "take the design from Telegram"): a white chat list, the open
   chat on a green wallpaper, the shop's own messages in light-green bubbles,
   coloured round avatars, one Telegram blue. Telegram's own #3390ec carries
   white text at only 3.3:1, so text sits on --blue (4.9:1) and #3390ec is
   decoration only (--blue-bright). Red only where something is late or
   stopped, amber only for test mode. No framework; JavaScript only on the
   chat page. Every text pair below was measured (wiki/05). */

:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #686c72;       /* 5.3:1 on white, 4.8:1 on --hover */
  --line: #e7e8ea;
  --line-strong: #d0d3d7;
  --hover: #f4f4f5;

  --blue: #1f73c4;        /* white on it 4.9:1; on white 4.9:1 */
  --blue-hover: #1a63a9;
  --blue-bright: #3390ec; /* Telegram's: dots, underlines, focus -- never under text */
  --blue-soft: #e6f0fb;

  --wall: linear-gradient(160deg, #e2ebcf 0%, #cfe0bd 45%, #dde5bb 100%);
  --wall-ink: #45553f;    /* hint text on the wallpaper, >= 5.4:1 */
  --day: #5a7650;         /* date chip; white on it 4.9:1 */
  --out: #eeffde;         /* the shop's bubble */
  --out-meta: #2f7d2e;    /* 4.9:1 on --out */

  --red: #d4373a;
  --red-text: #b4282b;    /* 5.9:1 on white */
  --red-soft: #fdecec;
  --amber: #a35200;
  --amber-soft: #fff6e5;

  --rail: #2d3a4a;        /* Telegram Desktop's folder rail, sampled from the owner's screenshot */
  --rail-sel: #1d2733;
  --rail-hover: #364558;
  --rail-ink: #b3bdc8;    /* labels; white when selected */
  --rail-red: #ff9c9c;    /* "To'xtatish" on the rail */

  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 35, 47, .15);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 32px; }
h2 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 28px 0 8px; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.warn { color: var(--amber); }
.late { color: var(--red-text); }

/* ---- header ----------------------------------------------------------
   Full width on every tab. Only `main` is centred at 760px: a header that
   is centred on /javoblar but full-width on the inbox jumps sideways when the
   tabs are switched (wiki/05). */
.top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.top-in {
  padding: 10px 16px 2px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; margin-right: auto;
  font-size: 17px; font-weight: 500; color: var(--text);
}
.brand::before {
  content: "D"; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 15px; font-weight: 500;
}
.brand:hover { text-decoration: none; }
.state { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #4fae4e; }

.stop summary {
  list-style: none; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--red-text);
  padding: 4px 10px; border-radius: 8px;
}
.stop summary::-webkit-details-marker { display: none; }
.stop summary:hover { background: var(--red-soft); }
.stop[open] summary { display: none; }
.stop form { display: flex; gap: 8px; }
.stop input { width: 200px; }
.top .ic, .rail-exit { display: none; }   /* the rail's icons and exit: computer only */

/* folder tabs, as above Telegram's chat list */
.tabs {
  padding: 0 8px;
  display: flex; gap: 4px; overflow-x: auto;
}
.tabs a {
  position: relative; flex: none; padding: 10px 12px 11px; color: var(--muted); font-weight: 500; font-size: 15px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--blue); }
.tabs a.on::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--blue-bright);
}
.count {
  display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 10px;
  background: var(--blue); color: #fff; font-size: 12px; font-weight: 500; line-height: 20px; text-align: center;
}
@media (max-width: 480px) {
  .tabs { padding: 0; gap: 0; justify-content: space-between; }
  .tabs a { padding: 10px 10px 11px; font-size: 14px; }
}

.halted { background: var(--red-soft); color: var(--red-text); }
.halted-in {
  padding: 10px 16px;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
}
.halted .muted { color: var(--red-text); }
.halted form { display: flex; gap: 12px; align-items: center; font-size: 13px; }
.quiet { margin: 0; padding: 8px 16px; background: var(--amber-soft); color: var(--amber); font-size: 13px; }
@media (min-width: 800px) {
  .top-in, .halted-in, .quiet { padding-left: 24px; padding-right: 24px; }
  .tabs { padding: 0 16px; }
  /* content keeps its 760px but starts on the header's left edge */
  main { max-width: 808px; margin-left: 0; padding-left: 24px; padding-right: 24px; }
}

/* ---- controls ---------------------------------------------------------- */
input {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px;
}
input:focus { outline: none; border-color: var(--blue-bright); box-shadow: 0 0 0 1px var(--blue-bright); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 6px 14px; border: 0; border-radius: 10px;
  background: none; color: var(--blue); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s;
}
.btn:hover { background: var(--blue-soft); text-decoration: none; }
.btn:focus-visible, a:focus-visible, summary:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue-bright); outline-offset: 2px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-text); color: #fff; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
form { margin: 0; }

/* pill filters: /javoblar chips and the inbox filter */
.chips { display: flex; gap: 6px; overflow-x: auto; }
.chips { margin: 4px 0 12px; }
.chips a {
  flex: none; padding: 4px 12px; border-radius: 16px; background: var(--hover);
  color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap;
}
.chips a:hover { color: var(--text); text-decoration: none; }
.chips a.on { background: var(--blue); color: #fff; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0; }
.empty { color: var(--muted); padding: 48px 16px; text-align: center; }

/* ---- lists (/javoblar) ------------------------------------------------- */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.row { padding: 14px 4px; border-bottom: 1px solid var(--line); }
.row-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.name { font-weight: 500; overflow-wrap: anywhere; }
.row-top .muted { font-size: 13px; }
.left { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.left.late { color: var(--red-text); font-weight: 500; }
.unread .name { font-weight: 500; }
.meta { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.meta a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); }
.text { margin: 8px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sub { margin: 4px 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.said {
  display: inline-block; margin: 2px 0 4px; padding: 6px 10px; border-radius: 12px 12px 4px 12px;
  background: var(--out); font-size: 14px; box-shadow: var(--shadow);
}
.actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 8px; margin-left: -8px; }
.actions form { display: flex; flex-wrap: wrap; gap: 8px; }

.flag summary { list-style: none; color: var(--red-text); }
.flag summary::-webkit-details-marker { display: none; }
.flag summary:hover { background: var(--red-soft); }
.flag[open] summary { display: none; }
.flag form { gap: 8px; }
.flag input { width: 220px; max-width: 100%; }

/* ---- login / footer --------------------------------------------------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login h1 {
  margin: 0 0 12px; font-size: 26px; font-weight: 500; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 20px;
}
.login h1::before {
  content: "D"; display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 52px; font-weight: 500;
}
.login label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.login input { padding: 14px 16px; border-radius: 12px; }
.login .btn { min-height: 54px; border-radius: 12px; font-size: 15px; text-transform: uppercase; letter-spacing: .03em; }
.error { color: var(--red-text); font-size: 14px; margin: 0; text-align: center; }
.foot {
  max-width: 760px; margin: 0 auto; padding: 24px 16px 32px;
  display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 12px;
}
.foot form { display: inline; }

/* ---- the chat page (/ and /chat/...) ------------------------------------
   A computer shows the list and one chat side by side, the page itself
   never scrolling; a phone shows `/` as the list and `/chat/...` as the
   chat alone (body.home / body.open). */
main.wide { max-width: none; width: 100%; margin: 0; padding: 0; }  /* auto margins would shrink it in the flex column */
.ic {
  width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.pad { padding: 0 16px; }

.inbox { display: grid; grid-template-columns: minmax(0, 1fr); }  /* nowrap rows must not widen it */
.qlist { background: #fff; }
.qrows { list-style: none; margin: 0; padding: 14px 8px 8px; }

/* a row of Telegram's chat list */
.qrow { display: flex; gap: 10px; align-items: center; padding: 8px 9px; border-radius: 12px; color: var(--text); }
.qrow:hover { background: var(--hover); text-decoration: none; }
.qrow-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.qrow-top { display: flex; align-items: baseline; gap: 8px; }
.qrow-top .name {
  flex: 1; min-width: 0; font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qrow-text, .qrow-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qrow-text { font-size: 15px; color: var(--muted); }
.qrow-meta { font-size: 12px; color: var(--muted); }
.qrow .left.late { padding: 0 7px; border-radius: 10px; background: var(--red-soft); }
.unread .qrow-text { color: var(--text); }
.unread .qrow-top::after {          /* the unread mark sits right, after the time */
  content: ""; order: 3; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-bright);
  align-self: center;
}
.qrow.sel { background: var(--blue); color: #fff; }
.qrow.sel .name, .qrow.sel .qrow-text, .qrow.sel .qrow-meta, .qrow.sel .left { color: #fff; }
.qrow.sel .left.late { background: rgba(0, 0, 0, .18); }   /* white on a lighter tint was 3.4:1 */
.qrow.sel .qrow-top::after { background: #fff; }

/* coloured round avatars, white initials (each >= 4.5:1) */
.av {
  width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 18px; font-weight: 500; color: #fff;
}
.t0 { background: #c0504f; } .t1 { background: #b5602a; } .t2 { background: #7b5fd6; }
.t3 { background: #1f7c93; } .t4 { background: #b84a7f; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wall); }
.chat-head {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 16px 6px 20px;
  border-bottom: 1px solid var(--line); background: #fff;
}
.chat-head .av { width: 40px; height: 40px; font-size: 15px; }
.who { flex: 1; min-width: 0; line-height: 1.3; }
.who .name { font-size: 16px; font-weight: 500; }
.who .muted { font-size: 13px; overflow-wrap: anywhere; }
.chat-acts, .chat-acts form { display: flex; gap: 4px; align-items: center; }
.back { display: none; place-items: center; width: 32px; height: 32px; color: var(--muted); }
.back .ic { width: 24px; height: 24px; }

.thread {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.thread > * { flex-shrink: 0; }                /* a flex column squeezes the question card flat */
.thread > :first-child { margin-top: auto; }   /* short threads sit at the bottom */
.day { text-align: center; margin: 8px 0 4px; position: sticky; top: 0; z-index: 1; }
.day span {
  display: inline-block; padding: 2px 10px; border-radius: 12px; background: var(--day);
  color: #fff; font-size: 13px; font-weight: 500;
}
/* A computer shows every message from the left edge, avatar by the last of
   a run, as Telegram Desktop does in a wide window -- centring the thread at
   760px left a wide empty strip of wallpaper on the left (owner, 2026-10-28).
   A phone keeps the customer left and the shop right, without avatars. */
.msg { display: flex; align-items: flex-end; gap: 8px; }
.msg.mine { justify-content: flex-end; }
.av.mav { width: 36px; height: 36px; font-size: 14px; }
.av.shop { background: var(--blue); }
.av.gap { visibility: hidden; }
.bubble {
  max-width: min(70%, 480px); padding: 6px 10px 5px; border-radius: 12px 12px 12px 4px;
  background: #fff; box-shadow: var(--shadow);
}
.mine .bubble { background: var(--out); border-radius: 12px 12px 4px 12px; }
.bubble p { margin: 0; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.bmeta {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 2px 8px; margin-top: 1px;
  font-size: 12px; color: var(--muted);
}
.mine .bmeta { color: var(--out-meta); }
.st { display: inline-flex; align-items: center; gap: 3px; }
.st .ic { width: 14px; height: 14px; }
.st.ok { color: var(--out-meta); font-weight: 500; }
.st.wait { color: var(--blue); }
.st.bad { color: var(--red-text); font-weight: 500; }
.qcard {
  align-self: center; width: min(100%, 520px); margin: 6px 0; overflow: hidden;
  background: #fff; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(16, 35, 47, .18);
}
.qcard-top { padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.qcard-text { margin: 0; padding: 12px 14px 10px; font-size: 17px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.qcard-why { margin: 0; padding: 10px 14px 12px; background: #f7f8f9; font-size: 13px; line-height: 1.45; color: var(--muted); }
.qcard-why p { margin: 0 0 4px; }
.qcard-why .ink { color: var(--text); }
.qcard-why a { font-weight: 500; }
.gone { text-decoration: line-through; color: var(--muted); }   /* deleted by the customer */

/* the composer floats on the wallpaper, as in Telegram */
.compose { padding: 4px 16px 14px; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose textarea {
  flex: 1; min-width: 0; min-height: 54px; max-height: 160px; resize: none;
  padding: 16px 18px; border: 0; border-radius: 16px 16px 4px 16px;
  font: inherit; font-size: 16px; line-height: 1.35; color: var(--text); background: #fff; box-shadow: var(--shadow);
}
.compose textarea::placeholder { color: var(--muted); }
.compose textarea:focus { outline: none; box-shadow: var(--shadow), 0 0 0 2px var(--blue-bright); }
.send {
  position: relative; width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: var(--blue); color: #fff; box-shadow: var(--shadow);
}
.send:hover { background: var(--blue-hover); }
.send:disabled { opacity: .6; cursor: default; }
.send .ic { width: 24px; height: 24px; margin-left: -2px; }
.send span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }  /* the label stays for screen readers */
.compose .hint { margin: 6px 0 0 6px; font-size: 12px; color: var(--wall-ink); }
.compose .oneline { color: var(--amber); }
.compose .error { margin: 0 0 8px; text-align: left; }
.compose.manual p {
  margin: 0; padding: 12px 16px; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow);
  font-size: 14px; color: var(--muted);
}
.chat-empty { display: grid; place-items: center; }
.chat-empty .empty { color: var(--wall-ink); }

@media (min-width: 800px) {
  body.inbox-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .inbox-page main.wide { flex: 1; min-height: 0; }
  .inbox { height: 100%; grid-template-columns: 380px minmax(0, 1fr); }
  .qlist { border-right: 1px solid var(--line); overflow-y: auto; }
  .msg.mine { justify-content: flex-start; }
  .mine .bubble { border-radius: 12px 12px 12px 4px; }
  .qcard { align-self: flex-start; margin-left: 44px; }   /* under the bubbles: avatar 36 + gap 8 */
}
@media (max-width: 799px) {
  .home .chat { display: none; }
  /* `/` opens nothing on a phone: the first row is not shown as selected */
  .home .qrow.sel { background: none; color: var(--text); }
  .home .qrow.sel .name { color: var(--text); }
  .home .qrow.sel .qrow-text, .home .qrow.sel .qrow-meta, .home .qrow.sel .left { color: var(--muted); }
  .home .qrow.sel .left.late { color: var(--red-text); background: var(--red-soft); }
  .home .qrow.sel .qrow-top::after { background: var(--blue-bright); }
  .open .qlist, .open .top, .open .foot { display: none; }
  body.open { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  .open main.wide { flex: 1; min-height: 0; }
  .open .inbox { height: 100%; }
  .back { display: grid; margin-left: -6px; }
  .chat-head { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  .chat-head .av { width: 36px; height: 36px; font-size: 14px; }
  .chat-acts { order: 3; width: 100%; overflow-x: auto; margin: 0 -8px; }
  .chat-acts .btn { min-height: 32px; padding: 4px 10px; font-size: 13px; }
  .av { width: 48px; height: 48px; font-size: 17px; }
  .thread { padding: 12px 8px; gap: 6px; }
  .bubble { max-width: 85%; }
  .av.mav { display: none; }
  .compose { padding: 4px 8px 10px; }
  .compose textarea { min-height: 48px; padding: 13px 14px; }
  .send { width: 48px; height: 48px; }
}

/* ---- the rail ----------------------------------------------------------
   On a computer the header is Telegram Desktop's dark folder rail on the
   left (owner, 2026-10-28, with a screenshot of it): the tabs become
   folders, "To'xtatish" and "Chiqish" sit at its foot, and the page gets the
   ~50 px of height the header took. `.top-in` dissolves so its children
   order themselves among the folders. The stop form opens beside the rail. */
@media (min-width: 800px) {
  body { padding-left: 76px; }
  .top {
    position: fixed; inset: 0 auto 0 0; width: 76px; z-index: 20;
    display: flex; flex-direction: column; padding: 12px 0 8px;
    border: 0; background: var(--rail); color: var(--rail-ink);
  }
  .top-in { display: contents; }
  .top .ic { display: block; width: 26px; height: 26px; stroke-width: 1.7; }
  .brand { order: 0; margin: 0 auto 14px; font-size: 0; gap: 0; }
  .brand::before { width: 42px; height: 42px; font-size: 17px; }

  .tabs { order: 1; flex-direction: column; gap: 0; padding: 0; overflow: visible; }
  .tabs a {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; font-size: 12px; line-height: 1.25; text-align: center; color: var(--rail-ink);
  }
  .tabs a:hover { color: #fff; background: var(--rail-hover); }
  .tabs a.on { color: #fff; background: var(--rail-sel); }
  .tabs a.on::after { display: none; }
  .tabs .count { position: absolute; top: 4px; left: calc(50% + 4px); margin: 0; box-shadow: 0 0 0 2px var(--rail); }
  .tabs a.on .count { box-shadow: 0 0 0 2px var(--rail-sel); }
  .tabs a.sep { margin-top: 9px; }
  .tabs a.sep::before {
    content: ""; position: absolute; top: -5px; left: 18px; right: 18px; height: 1px; background: var(--rail-hover);
  }

  .state {
    order: 2; margin-top: auto; flex-direction: column; gap: 4px; padding: 8px 4px;
    font-size: 11px; line-height: 1.25; text-align: center; color: var(--rail-ink);
  }
  .stop { order: 3; position: relative; }
  .stop summary, .stop[open] summary {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; border-radius: 0; font-size: 12px; line-height: 1.25; color: var(--rail-red);
  }
  .stop summary:hover, .stop[open] summary { background: var(--rail-hover); }
  .stop form {
    position: absolute; left: calc(100% + 8px); bottom: 4px; padding: 12px; border-radius: 12px;
    background: #fff; box-shadow: 0 4px 16px rgba(16, 35, 47, .3);
  }
  .rail-exit { order: 4; display: block; }
  .rail-exit button {
    width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px; border: 0; background: none; color: var(--rail-ink);
    font: inherit; font-size: 12px; line-height: 1.25; cursor: pointer;
  }
  .rail-exit button:hover { color: #fff; background: var(--rail-hover); }
  .foot { display: none; }   /* "Chiqish" is on the rail; a stale reader has its own banner */
}
