/* Reply Inbox — an answer sheet: the customer's message is the question,
   your reply is the answer, and anything waiting for you gets highlighted. */

:root {
  --paper: #F7F9FC;
  --paper-2: #FFFFFF;
  --ink: #1C2B44;
  --pencil: #5E6B7E;
  --rule: #D6DEEA;
  --margin-line: #E9A7A2;
  --highlight: #FFE45C;
  --highlight-ink: #3D3300;
  --ok: #1E7F57;
  --bad: #C2362B;
  --focus: #2F6FED;
  --ig: #B8327D; --fb: #2D64C8; --wa: #178C45; --yt: #D21F18;
  --line: 1.8rem;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1A2B; --paper-2: #16233A; --ink: #E6ECF5; --pencil: #9AA8BC;
    --rule: #26354F; --margin-line: #6B3A3D; --highlight: #E8CF3C; --highlight-ink: #2A2300;
    --ok: #4CC38A; --bad: #F07067; --focus: #7FA6FF;
    --ig: #E06BAE; --fb: #7EA6F0; --wa: #4CC37A; --yt: #FF6B63;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.5 "Atkinson Hyperlegible", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code { font-size: .92em; background: var(--paper-2); padding: .05em .3em; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: var(--radius);
  padding: .6rem 1rem; border: 1.5px solid transparent; line-height: 1.2;
  min-height: 44px; /* comfortable tap target */
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { filter: brightness(1.15); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover { border-color: var(--pencil); }
.btn-danger { color: var(--bad); }
.btn-link { background: none; border: 0; padding: .4rem .2rem; min-height: auto; text-decoration: underline; text-underline-offset: 3px; font-weight: 400; color: var(--pencil); }
.btn[disabled] { opacity: .55; cursor: progress; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem; font: inherit; font-size: .9rem;
  padding: .35rem .8rem; border-radius: 999px; border: 1.5px solid var(--rule);
  background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--pencil); }
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip-n { font-weight: 700; }

.notice { margin: .6rem 0; padding: .6rem .8rem; border-radius: var(--radius); font-size: .92rem; }
.notice-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

/* ---------- top ---------- */
.top { max-width: 760px; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 16px .25rem; }
.top-row { display: flex; align-items: baseline; justify-content: space-between; }
.top h1 { font-size: 1.75rem; line-height: 1.15; margin: .2rem 0 .8rem; letter-spacing: -.01em; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { width: 46px; height: 28px; border-radius: 999px; background: var(--rule); position: relative; flex: none; transition: background .2s; }
.thumb { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper-2); box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track .thumb { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch-text { display: flex; flex-direction: column; font-size: .92rem; line-height: 1.3; }
.switch-text span { color: var(--pencil); }

.links-wrap { display: flex; align-items: center; gap: .5rem; }
.links-label { font-size: .85rem; color: var(--pencil); }
.links { list-style: none; display: flex; gap: .4rem; margin: 0; padding: 0; }
.links li.off .pmark { background: transparent; color: var(--pencil); border: 1.5px dashed var(--rule); }

/* platform marks: plain letter badges */
.pmark {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px;
  font-size: .72rem; font-weight: 700; color: #fff; letter-spacing: .02em; flex: none;
}
.pmark-instagram { background: var(--ig); }
.pmark-facebook { background: var(--fb); }
.pmark-whatsapp { background: var(--wa); }
.pmark-youtube { background: var(--yt); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pmark { color: #10192A; } }

/* folders: the count is the headline, the highlighter marks what needs you */
.tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px .2rem; border-bottom: 1.5px solid var(--rule); }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; flex-direction: column; text-decoration: none; padding: .35rem .75rem .6rem; border-bottom: 3px solid transparent; margin-bottom: -1.5px; white-space: nowrap; color: var(--pencil); }
.tab-n { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--ink); }
.tab-l { font-size: .85rem; }
.tab.is-on { border-bottom-color: var(--ink); color: var(--ink); }
.tab-pending .tab-n {
  align-self: flex-start; padding: 0 .3rem; margin-left: -.3rem;
  background: linear-gradient(100deg, transparent 0 2%, var(--highlight) 4% 94%, transparent 97%);
  color: var(--highlight-ink); border-radius: 3px 8px 4px 9px;
}
.tab-pending .tab-n[data-zero] { background: none; color: var(--ink); }

.filters { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .8rem 0 .3rem; }
.filters::-webkit-scrollbar { display: none; }

.banner {
  position: sticky; top: 0; z-index: 5; max-width: 760px; margin: .5rem auto 0; padding: .55rem 16px;
  background: var(--highlight); color: var(--highlight-ink); display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
}
.banner .btn-link { color: var(--highlight-ink); font-weight: 700; }
.banner[hidden] { display: none; }

/* ---------- the sheet ---------- */
.sheet { max-width: 760px; margin: 0 auto; padding: .5rem 16px 4rem; }
.sheet-note { color: var(--pencil); font-size: .9rem; margin: .5rem 0 0; }

.item {
  display: grid; grid-template-columns: 3.25rem 1fr; gap: 0 .9rem;
  padding: 1.25rem 0 1.4rem; border-bottom: 1.5px solid var(--rule); position: relative;
}
.item .margin {
  display: flex; flex-direction: column; align-items: flex-start; gap: .45rem;
  border-right: 2px solid var(--margin-line); padding-right: .6rem; min-height: 100%;
}
.item-pending .margin::before {
  /* a highlighter swipe down the margin of anything that needs you */
  content: ""; position: absolute; left: -16px; top: 1.1rem; bottom: 1.2rem; width: 6px;
  background: var(--highlight); border-radius: 3px 5px 4px 6px;
}
.ago { font-size: .78rem; color: var(--pencil); line-height: 1.2; }
.margin .ago { word-break: break-word; }

.who { display: flex; flex-wrap: wrap; align-items: baseline; gap: .15rem .6rem; }
.author { font-size: 1.05rem; overflow-wrap: anywhere; }
.where { color: var(--pencil); font-size: .88rem; }

.question { font-size: 1.12rem; line-height: 1.5; margin: .45rem 0 .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.thread { margin: .5rem 0 0; font-size: .92rem; }
.thread summary { color: var(--pencil); cursor: pointer; width: fit-content; }
.thread ol { list-style: none; margin: .5rem 0 0; padding: 0 0 0 .8rem; border-left: 2px solid var(--rule); }
.thread li { margin-bottom: .5rem; }
.thread p { margin: 0 0 .2rem; white-space: pre-wrap; }
.t-us { color: var(--pencil); padding-left: .8rem; }

/* the answer area is ruled like exam paper */
.answer-label { display: block; font-size: .85rem; color: var(--pencil); margin-bottom: .3rem; }
.answer textarea {
  width: 100%; resize: vertical; font: inherit; font-size: 1.02rem; color: var(--ink);
  line-height: var(--line); padding: .3rem .8rem .5rem; min-height: calc(var(--line) * 3 + .8rem);
  border: 1.5px solid var(--rule); border-radius: var(--radius);
  background-color: var(--paper-2);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line));
  background-position: 0 calc(.3rem + 2px); background-attachment: local;
}
.answer textarea:focus { border-color: var(--ink); outline: none; }
.answer textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.answer-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-top: .45rem; }
.claude-note { margin: 0; font-size: .88rem; color: var(--pencil); display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: baseline; }
.cat { font-weight: 700; color: var(--ink); }
.cat-sensitive { color: var(--bad); }
.count { font-size: .8rem; color: var(--pencil); white-space: nowrap; }
.count.is-over { color: var(--bad); font-weight: 700; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .9rem; }
.actions .btn-danger { margin-left: auto; }
@media (max-width: 479px) {
  .answer .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .answer .actions .btn-primary { grid-column: 1 / -1; }
  .answer .actions .btn-danger { margin-left: 0; }
}

.rewrite { margin-top: .8rem; padding: .8rem; border: 1.5px dashed var(--rule); border-radius: var(--radius); }
.rewrite[hidden] { display: none; }
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.ask { display: flex; gap: .5rem; }
.ask input { flex: 1; min-width: 0; font: inherit; padding: .55rem .75rem; border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); min-height: 44px; }
.is-busy textarea { opacity: .5; }

.sent-reply { border-left: 3px solid var(--ok); padding: .1rem 0 .1rem .9rem; }
.sent-label { margin: 0 0 .2rem; font-size: .85rem; color: var(--ok); font-weight: 700; }
.sent-label .ago { font-weight: 400; }
.sent-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* leaving the sheet once handled: answers the person's action */
.item.is-leaving { transition: opacity .35s ease, transform .35s ease; opacity: 0; transform: translateX(14px); }
.item.is-done-ok .margin::before { background: var(--ok); }

.empty { text-align: left; padding: 3rem 0; max-width: 34rem; }
.empty h2 { font-size: 1.35rem; margin: 0 0 .4rem; }
.empty p { color: var(--pencil); margin: 0; }

/* ---------- login ---------- */
.page-login { min-height: 100vh; display: grid; place-items: center; }
.login { width: 100%; max-width: 380px; padding: 2rem 16px; }
.login h1 { font-size: 2rem; margin: .8rem 0 .3rem; }
.login-sub { color: var(--pencil); margin: 0 0 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.login-form label { display: flex; flex-direction: column; gap: .35rem; font-weight: 700; font-size: .95rem; }
.login-form input { font: inherit; font-weight: 400; padding: .7rem .8rem; border: 1.5px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); color: var(--ink); min-height: 48px; }
.login-form input:focus { border-color: var(--ink); outline: none; }
.login-form input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.hint { color: var(--pencil); font-size: .88rem; margin: 0; }

@media (min-width: 640px) {
  .item { grid-template-columns: 4.5rem 1fr; gap: 0 1.25rem; }
  .item-pending .margin::before { left: -22px; }
  .pmark { width: 2.25rem; height: 2.25rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
