/* Pink Response AI backOffice. Same palette as the phone app. */
:root {
  --rose: #FF2E74; --violet: #7C4DFF; --amber: #FFC53D; --teal: #22E0BE; --coral: #FF6B4A;
  --ink: #07070C; --surface: #12121C; --raised: #1B1B24; --text: #E9E4F2; --muted: #9A93AD;
  --line: rgba(255,255,255,0.14); --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--rose); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; }
code { background: var(--raised); padding: 0 .3em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.coral-text { color: var(--coral); }
.empty { color: var(--muted); padding: 1rem 0; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; gap: 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.brand { color: var(--text); font-weight: 800; font-size: 1.1rem; }
.brand span, .login h1 span { color: var(--rose); }
.provider { color: var(--muted); }
.phone-state { margin-left: auto; font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.phone-state.on { color: var(--teal); border-color: var(--teal); }
.phone-state.off { color: var(--amber); border-color: var(--amber); }
.menu-btn { display: none; background: none; border: 0; color: var(--text); font-size: 1.3rem; cursor: pointer; }

.shell { display: flex; min-height: calc(100vh - 52px); }
.side { width: 220px; flex-shrink: 0; padding: 1rem .6rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.side a, .side .linklike { display: block; padding: .45rem .7rem; border-radius: 8px; color: var(--text); text-align: left; width: 100%; }
.side a:hover { background: var(--raised); text-decoration: none; }
.side a.active { background: rgba(255,46,116,.15); color: var(--rose); }
.side .sep { height: 1px; background: var(--line); margin: .5rem .3rem; }
main { flex: 1; padding: 1.4rem; min-width: 0; max-width: 1200px; }

.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--rose); color: #fff; font-size: .75rem; text-align: center; line-height: 1.4em; }
.chip { display: inline-block; font-size: .72rem; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.coral { color: var(--coral); border-color: var(--coral); } .chip.amber { color: var(--amber); border-color: var(--amber); }
.chip.teal { color: var(--teal); border-color: var(--teal); } .chip.violet { color: #b39bff; border-color: var(--violet); }

.page-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .search { margin-left: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; }
.card.narrow { max-width: 560px; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--teal); color: var(--teal); background: rgba(34,224,190,.08); }
.flash.error { border-color: var(--coral); color: var(--coral); background: rgba(255,107,74,.08); }

input, select, textarea, button, .button { font: inherit; color: var(--text); }
input:not([type=checkbox]):not([type=file]), select, textarea { width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rose); outline-offset: -1px; }
input[type=time] { width: auto; }
textarea { resize: vertical; }
label { display: block; color: var(--muted); font-size: .88rem; }
label > input, label > select, label > textarea { margin-top: .25rem; color: var(--text); }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .95rem; }
fieldset { border: 0; padding: 0; margin: 0; }
fieldset:disabled { opacity: .7; }
button, .button { display: inline-block; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: .5rem 1rem; cursor: pointer; }
button:hover, .button:hover { border-color: var(--rose); text-decoration: none; }
button.primary, .button.primary { background: var(--rose); border-color: var(--rose); color: #fff; font-weight: 600; }
button.danger, .linklike.danger { color: var(--coral); }
.linklike { background: none; border: 0; padding: 0; color: var(--rose); cursor: pointer; }
form.inline { display: inline; }
.stack > * + * { margin-top: .8rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem 1rem; }
.actions { display: flex; gap: .6rem; align-items: center; margin-top: .6rem; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tabs a { padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.tabs a.active { border-color: var(--rose); color: var(--rose); }

.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "who when" "preview preview"; gap: .15rem 1rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); color: var(--text); background: var(--surface); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--raised); text-decoration: none; }
.row .who { grid-area: who; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.row .preview { grid-area: preview; color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .when { grid-area: when; color: var(--muted); font-size: .8rem; }
.row.unread .preview { color: var(--text); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; font-size: .9rem; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
tr.disabled td { opacity: .5; }
.preview-cell { color: var(--muted); max-width: 420px; }

.thread-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.2rem; align-items: start; }
.messages { display: flex; flex-direction: column; gap: .5rem; padding: .5rem 0 1rem; }
.msg { display: flex; flex-direction: column; max-width: 78%; }
.msg.in { align-self: flex-start; } .msg.out { align-self: flex-end; align-items: flex-end; }
.bubble { padding: .55rem .8rem; border-radius: 14px; background: var(--raised); white-space: pre-wrap; word-wrap: break-word; }
.msg.out .bubble { background: rgba(255,46,116,.18); border: 1px solid rgba(255,46,116,.35); }
.msg .meta { font-size: .74rem; color: var(--muted); margin-top: .15rem; }
.pending-row { font-size: .82rem; color: var(--muted); padding: .3rem .6rem; border-left: 2px solid var(--amber); margin: .3rem 0; }
.pending-row.failed { border-color: var(--coral); color: var(--coral); }
.composer { position: sticky; bottom: 0; display: flex; gap: .5rem; align-items: flex-end; background: var(--ink); padding: .6rem 0; }
.composer textarea { flex: 1; }
.composer select { width: auto; }
.approval textarea { margin: .5rem 0; }
.approval-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
blockquote { margin: .6rem 0; padding: .4rem .8rem; border-left: 3px solid var(--line); color: var(--muted); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0 0 1rem; font-size: .9rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.thumbs { display: flex; gap: .4rem; flex-wrap: wrap; }
.thumbs img { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.thumbs img.selected { border-color: var(--rose); }

.schedule .day { display: flex; align-items: center; gap: .8rem; padding: .35rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.schedule .day-name { width: 100px; }
.schedule .ranges { display: flex; flex-direction: column; gap: .3rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.gallery figure { margin: 0; padding: .5rem; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.gallery figcaption { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .4rem; font-size: .88rem; }
.pair-code { font-size: 2.2rem; font-weight: 800; letter-spacing: .15em; color: var(--rose); margin: .3rem 0; }
.pair-qr { width: 260px; max-width: 100%; background: #fff; border-radius: 12px; line-height: 0; }
.pair-qr svg { width: 100%; height: auto; display: block; }
.perm-form { display: flex; flex-direction: column; gap: .2rem; }
.test-result { border-top: 1px solid var(--line); padding-top: .6rem; }
.amber-text { color: var(--amber); }
.pager { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; }
.load-earlier { text-align: center; margin: 0 0 .5rem; }
details.edit-person summary { cursor: pointer; list-style: none; }
details.edit-person summary::-webkit-details-marker { display: none; }
details.edit-person[open] { min-width: 220px; }

/* Lines: a coloured dot per line (line id mod 6), chips, switcher, rights grid. */
.line-dot { display: inline-block; width: .55em; height: .55em; border-radius: 50%; margin-right: .35em; vertical-align: middle; background: var(--muted); }
.line-dot.l0 { background: var(--teal); } .line-dot.l1 { background: var(--violet); } .line-dot.l2 { background: var(--amber); }
.line-dot.l3 { background: var(--coral); } .line-dot.l4 { background: var(--rose); } .line-dot.l5 { background: #8B93A7; }
.chip.line { color: var(--text); }
.line-switch select { width: auto; padding: .2rem .5rem; font-size: .85rem; }
.lines-offline { font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--coral); color: var(--coral); white-space: nowrap; }
.lines-offline:hover { text-decoration: none; background: rgba(255,107,74,.1); }
.hidden { display: none !important; }
.line-tabs { margin-top: -.4rem; }
.line-scope { margin-top: -.4rem; }
.also-writes { margin: -.6rem 0 .8rem; }
.sends-from { margin: .4rem 0 0; }
.card.notice { border-color: var(--amber); }
.rights-grid { width: auto; background: none; }
.rights-grid th, .rights-grid td { padding: .3rem .5rem; text-transform: none; letter-spacing: 0; }
.rights-grid th label.check { font-size: .78rem; color: var(--muted); align-items: flex-start; }
.usable-on { display: flex; flex-direction: column; gap: .2rem; }
.usable-on .indent { padding-left: 1.4rem; }
.copy-form, .bind-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.copy-form select, .bind-form select { width: auto; max-width: 260px; padding: .2rem .4rem; }
.phone-card h2 { margin: 0; }
.fallback-form label { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.fallback-form select { width: auto; }

/* "How this page works" tips. */
.help-tip { border: 1px solid var(--violet); background: rgba(124,77,255,.08); border-radius: var(--radius); padding: .8rem 1.1rem; margin-bottom: 1rem; }
.help-tip .help-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.help-tip ol { margin: .5rem 0 0; padding-left: 1.3rem; }
.help-tip li + li { margin-top: .25rem; }
.help-show { margin: -.4rem 0 .6rem; text-align: right; }

/* Getting started. */
.steps { list-style: none; padding: 0; margin: 0; }
.step.done { opacity: .75; }
.step.next { border-color: var(--rose); }
.step-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.step-head h2 { margin: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; background: var(--raised); border: 1px solid var(--line); font-weight: 700; }
.step.done .step-num { background: var(--teal); color: var(--ink); border-color: var(--teal); }
.step.next .step-num { background: var(--rose); color: #fff; border-color: var(--rose); }
ol.how { padding-left: 1.3rem; margin: .4rem 0 .6rem; }
ol.how li + li { margin-top: .2rem; }
.done-card { border-color: var(--teal); }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
label.check.big { font-size: 1.05rem; font-weight: 600; }

/* Insert buttons and live preview. */
.insert-bar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.chip-btn { font-size: .8rem; padding: .15rem .6rem; border-radius: 999px; background: var(--raised); border: 1px solid var(--violet); color: #c9b8ff; }
.chip-btn:hover { border-color: var(--rose); }
.preview-live { background: var(--raised); border-radius: 8px; padding: .5rem .7rem; white-space: pre-wrap; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login { width: 100%; max-width: 360px; }
.login h1 { margin-bottom: 1rem; }
.login label { margin-bottom: .8rem; }
.login button { width: 100%; margin-top: .4rem; }

@media (max-width: 900px) {
  .thread-layout { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .menu-btn { display: block; }
  .provider { display: none; }
  .top { flex-wrap: wrap; gap: .5rem; }
  .phone-state { margin-left: 0; }
  .side { display: none; position: fixed; inset: 52px 0 0 0; background: var(--surface); width: auto; z-index: 9; border: 0; }
  .side.open { display: flex; }
  main { padding: 1rem; }
  .msg { max-width: 92%; }
  .page-head .search { margin-left: 0; width: 100%; }
}
.spare-codes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .4rem; }
.spare-codes code { font-size: 1.05rem; letter-spacing: .05em; }
