/* Desklo, the product. Light screens: they are the brightest thing in a
 * blue-hour frame, as a real laptop screen is. */

.app {
  --ink: #141a2e;
  --ink-2: #5a6178;
  --line: #e2e5ec;
  --paper: #ffffff;
  --desk: #f4f5f8;
  --rail: #eceef3;
  --act: #1f2b5c;
  --wait: #f0b65e;
  --wait-ink: #85550f;
  --ok: #2f7a57;
  --del: #b5413a;

  width: 880px; height: 550px;
  position: relative; display: grid; grid-template-rows: 42px minmax(0, 1fr);
  background: var(--desk); color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  border-radius: 7px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 90px rgba(200, 215, 255, .16), 0 50px 120px -40px rgba(2, 4, 16, .85);
  text-align: start;
}
.app button { cursor: pointer; }
.app :focus-visible { outline: 2px solid #3b5bdb; outline-offset: 2px; }
.app svg { flex: none; }

/* bar */
.app-bar {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px;
  padding-inline: 16px; background: #fbfbfd; border-bottom: 1px solid var(--line);
}
.app-brand { display: inline-flex; align-items: center; gap: 8px; font: 500 15px/1 var(--serif); }
.app-brand svg { width: 16px; height: 16px; color: var(--ink); }
.app-crumb { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.app-crumb .chev { width: 12px; height: 12px; opacity: .6; }
[dir="rtl"] .app-crumb .chev { transform: scaleX(-1); }
.app-crumb-now { color: var(--ink); font-weight: 500; }
.app-local { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.app-local svg { width: 15px; height: 15px; color: var(--ok); }
.app-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--act); color: #fff; font: 600 10.5px/1 var(--sans); letter-spacing: .02em; }

.app-body { display: grid; grid-template-columns: 238px 1fr; min-height: 0; padding-bottom: 68px; }

/* thread: what you asked, what it did */
.app-thread { background: var(--rail); border-inline-end: 1px solid var(--line); padding: 18px 16px; display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: hidden; }
.msg-who { display: flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--sans); color: var(--ink-2); margin-bottom: 7px; }
.msg p { margin: 0; font-size: 13px; line-height: 1.5; }
.msg-you p { background: var(--paper); border: 1px solid var(--line); border-radius: 9px 9px 9px 3px; padding: 9px 11px; }
[dir="rtl"] .msg-you p { border-radius: 9px 9px 3px 9px; }
.asst-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--wait); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.steps li { display: grid; grid-template-columns: 16px 1fr; gap: 7px; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); opacity: .0; transform: translateY(3px); transition: opacity .45s, transform .45s cubic-bezier(.2, .8, .2, 1); }
.steps li.on { opacity: 1; transform: none; }
.ck { width: 16px; height: 16px; color: var(--ok); }
.ck path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .5s .12s cubic-bezier(.6, 0, .3, 1); }
.steps li.on .ck path { stroke-dashoffset: 0; }
.msg-reply { margin-top: 12px !important; opacity: 0; transform: translateY(4px); transition: opacity .5s, transform .5s cubic-bezier(.2, .8, .2, 1); }
.msg-reply.on { opacity: 1; transform: none; }

/* main column: the draft and the ask */
.app-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 18px 22px 16px; overflow: hidden; }
.doc { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.doc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.doc-head h3 { margin: 0; font: 600 15.5px/1.3 var(--sans); }
.doc-sub { font-size: 12.5px; color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 500 11px/1 var(--sans); padding: 4px 8px 4px; border-radius: 99px; background: #fbecd2; color: var(--wait-ink); }
.chip-branch { background: #e8ebf3; color: var(--ink-2); }
.chip-branch svg { width: 12px; height: 12px; }

/* law: the letter types itself */
.letter {
  margin-top: 12px; flex: 1; min-height: 0; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 3px;
  padding: 22px 28px; font: 400 14.5px/1.62 var(--serif); color: #1e2438; white-space: pre-wrap;
}
.letter.editing { outline: 2px solid #3b5bdb; outline-offset: -2px; }
.letter-type { display: inline; margin: 0; }
.caret { display: inline-block; width: 1.5px; height: 1.05em; vertical-align: -.15em; background: var(--act); margin-inline-start: 1px; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { visibility: hidden; } }
.files { display: flex; gap: 8px; padding: 10px 0 0; opacity: var(--p, 0); transform: translateY(calc((1 - var(--p, 0)) * 6px)); }
.file { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 6px 9px; }
.file svg { width: 14px; height: 14px; color: var(--ink-2); }

/* accounting: figures roll, the unconfirmed invoices drop into a tray */
.vat { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13.5px; }
.vat th, .vat td { padding: 7px 0; text-align: start; font-weight: 400; }
.vat thead th { font: 500 11.5px/1 var(--sans); color: var(--ink-2); padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.vat .num, .vat thead th:not(:first-child) { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }
[dir="rtl"] .vat .num, [dir="rtl"] .vat thead th:not(:first-child) { text-align: left; }
.vat tbody tr[data-k="row"] { border-bottom: 1px solid #edf0f4; opacity: calc(.25 + var(--p, 0) * .75); }
.vat tbody th { font-weight: 500; }
.vat tfoot th { font-weight: 600; padding-top: 12px; }
.vat tfoot td.total { position: relative; font-weight: 600; font-size: 15px; padding-top: 12px; }
.vat tfoot td.total::before, .vat tfoot td.total::after {
  content: ""; position: absolute; inset-inline-start: 30%; inset-inline-end: 0; transform: scaleX(var(--rule, 0)); transform-origin: right;
}
[dir="rtl"] .vat tfoot td.total::before, [dir="rtl"] .vat tfoot td.total::after { transform-origin: left; inset-inline-start: 0; inset-inline-end: 30%; }
.vat tfoot td.total::before { top: 4px; border-top: 1px solid var(--ink); }
.vat tfoot td.total::after { bottom: 0; height: 4px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.vat-out-slot td { padding: 0; }
.outs, .tray-list { list-style: none; margin: 0; padding: 0; }
.outs li, .tray-list li { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline; font-size: 13px; }
.outs li { position: relative; padding: 6px 0; color: var(--ink-2); border-bottom: 1px solid #edf0f4; max-height: calc((1 - var(--move, 0)) * 34px); opacity: calc(1 - var(--move, 0)); overflow: hidden; }
.outs li::after { content: ""; position: absolute; inset-inline: 0; top: 50%; height: 1.5px; background: var(--del); transform: scaleX(var(--strike, 0)); transform-origin: left; }
[dir="rtl"] .outs li::after { transform-origin: right; }
.outs .out-why, .tray-list .out-why { grid-column: 1 / -1; font-size: 11.5px; color: var(--del); }
.outs .out-why { display: none; }
.out-amt { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; }
.tray { margin-top: 14px; background: #fbf4e6; border: 1px solid #efdcb6; border-radius: 6px; padding: 10px 12px calc(var(--move, 0) * 4px); opacity: calc(.35 + var(--move, 0) * .65); }
.tray-title { font: 600 11.5px/1 var(--sans); color: var(--wait-ink); }
.tray-list li { padding: 5px 0 0; max-height: calc(var(--move, 0) * 46px); opacity: var(--move, 0); overflow: hidden; transform: translateY(calc((1 - var(--move, 0)) * -14px)); }

/* real estate: photos develop, words ink in, viewings land on the day */
.doc-listing { flex-direction: row; gap: 20px; }
.listing { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.photos { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 6px; height: 86px; }
.ph { border-radius: 4px; filter: grayscale(calc(1 - var(--dev, 0))) brightness(calc(.55 + var(--dev, 0) * .45)); opacity: calc(.35 + var(--dev, 0) * .65); }
.ph1 { background: linear-gradient(180deg, #2a3768 0%, #6d6a9c 38%, #e7a77f 54%, #4d6ea3 56%, #29406f 100%); }
.ph2 { background: radial-gradient(70% 60% at 30% 35%, #ffd7a0 0%, #c98a55 40%, #5b3a2a 100%); }
.ph3 { background: linear-gradient(160deg, #f1efe9 0%, #d9d4c8 45%, #a7a194 46%, #8d8679 100%); }
.listing-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: 12.5px; color: var(--ink-2); }
.listing-facts .lf-price { margin-inline-start: auto; font: 600 15px/1 var(--sans); color: var(--ink); direction: ltr; unicode-bidi: plaintext; }
.listing-text { margin: 0; font: 400 14px/1.6 var(--serif); color: #1e2438; }
.listing-text.editing { outline: 2px solid #3b5bdb; outline-offset: 3px; }
.listing-text .w { opacity: calc(.13 + var(--on, 0) * .87); }
.sched { width: 196px; flex: none; border-inline-start: 1px solid var(--line); padding-inline-start: 18px; display: flex; flex-direction: column; }
.sched-day { font: 600 12.5px/1 var(--sans); margin-bottom: 14px; }
.sched-axis { position: relative; flex: 1; max-height: 300px; border-inline-start: 1px solid #cfd4df; margin-inline-start: 34px; direction: inherit; }
.sched-axis .tick { position: absolute; inset-inline-end: calc(100% + 8px); top: calc(var(--x) * 100%); transform: translateY(-50%); font: 500 10.5px/1 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.slot {
  position: absolute; inset-inline-start: 8px; inset-inline-end: 0; top: calc(var(--x) * 100%);
  transform: translateY(-50%) translateX(calc((1 - var(--drop, 0)) * 36px)); opacity: var(--in, 0);
  display: grid; gap: 2px; padding: 7px 9px; border-radius: 5px; background: var(--paper); border: 1px solid var(--line); border-inline-start: 3px solid var(--act);
  font-size: 12px; line-height: 1.25;
}
[dir="rtl"] .slot { transform: translateY(-50%) translateX(calc((1 - var(--drop, 0)) * -36px)); }
.slot b { font: 600 12px/1 var(--sans); font-variant-numeric: tabular-nums; }
.slot::before { content: ""; position: absolute; inset-inline-start: -13px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--act); box-shadow: 0 0 0 3px var(--desk); }

/* software: the diff is written, the tests tick */
.diff { margin-top: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; font: 400 12.5px/1.65 "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace; }
.diff-file { font: 600 11.5px/1 var(--sans); color: var(--ink-2); padding: 8px 12px; background: #f2f3f7; border-bottom: 1px solid var(--line); }
.diff-file:not(:first-child) { border-top: 1px solid var(--line); }
.ln { display: grid; grid-template-columns: 22px 1fr; padding-inline: 8px 12px; white-space: pre; position: relative; }
.ln code { font: inherit; overflow: hidden; text-overflow: clip; }
.gut { color: var(--ink-2); user-select: none; }
.ln-ctx { color: #3a4058; }
.ln-del { background: #fcebe8; color: #8d2b25; }
.ln-del code { background: linear-gradient(var(--del), var(--del)) left 55% / calc(var(--strike, 0) * 100%) 1.5px no-repeat; }
.ln-add { background: #e5f3eb; color: #1c5236; max-height: calc(var(--grow, 0) * 21px); opacity: var(--grow, 0); }
.tests { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.tests li { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.tests .ck path { transition: none; stroke-dashoffset: calc(1 - var(--tick, 0)); }
.t-name { color: var(--ink-2); }
.t-res { color: var(--ok); font-weight: 500; opacity: var(--tick, 0); font-variant-numeric: tabular-nums; }
.tests li:last-child .t-name { color: var(--ink); font-weight: 500; }

/* the ask: everything stops here until a person decides */
.ask { z-index: 2; background: var(--ink); color: #eef0f6; transform: translateY(105%); position: absolute; inset-inline: 0; bottom: 0; transition: transform .8s cubic-bezier(.16, 1, .3, 1), background .6s; }
.ask[data-state="waiting"], .ask[data-state="approved"], .ask[data-state="later"] { transform: none; }
.ask-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 22px 15px; }
.ask-lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--wait); box-shadow: 0 0 calc(6px + var(--breath, .5) * 10px) calc(1px + var(--breath, .5) * 4px) rgba(240, 182, 94, calc(.3 + var(--breath, .5) * .3)); }
.ask-q { margin: 0; font: 500 14.5px/1.35 var(--sans); }
.ask-note { margin: 2px 0 0; font-size: 12px; color: #a8afc6; }
.ask-actions { display: flex; gap: 8px; }
.b { border-radius: 5px; padding: 9px 13px 10px; font: 500 13px/1 var(--sans); border: 1px solid transparent; white-space: nowrap; transition: background .3s, box-shadow .3s, border-color .3s; }
.b-quiet { background: transparent; color: #d6dae6; border-color: rgba(255, 255, 255, .2); }
.b-quiet:hover { border-color: rgba(255, 255, 255, .45); }
.b-go { background: var(--wait); color: var(--ink); font-weight: 600; box-shadow: 0 0 22px -4px rgba(240, 182, 94, .55); }
.b-go:hover { background: #f8cf8b; box-shadow: 0 0 30px 0 rgba(240, 182, 94, .7); }
.b-go:active { background: #d99a3d; }
.ask-done { display: none; align-items: center; gap: 9px; padding: 15px 22px 16px; font: 500 13.5px/1.3 var(--sans); }
.ask-done .ck { color: #8fe0b5; }
.ask-done .ck path { stroke-dashoffset: 0; }
.ask-rec { color: #a8afc6; font-weight: 400; }
.ask[data-state="approved"] { background: #173a2b; }
.ask[data-state="later"] { background: #2a3048; }
.ask[data-state="later"] .ck { display: none; }
.ask[data-state="approved"] .ask-row, .ask[data-state="later"] .ask-row { display: none; }
.ask[data-state="approved"] .ask-done, .ask[data-state="later"] .ask-done { display: flex; }

/* phone layout: the draft and the ask, nothing else */
.app.narrow { width: 358px; border-radius: 10px; }
.app.narrow .app-bar { grid-template-columns: auto 1fr auto; gap: 10px; padding-inline: 12px; }
.app.narrow .app-crumb { display: none; }
.app.narrow .app-local { justify-self: end; }
.app.narrow .app-body { grid-template-columns: 1fr; padding-bottom: 128px; }
.app.narrow .app-thread { display: none; }
.app.narrow .app-main { padding: 14px 14px 12px; }
.app.narrow .letter { padding: 16px 18px; font-size: 14px; }
.app.narrow .ask-row { grid-template-columns: auto 1fr; padding: 14px; }
.app.narrow .ask-actions { grid-column: 1 / -1; }
.app.narrow .ask-actions .b-go { flex: 1; }
.app.narrow .ask-done { padding: 15px 14px; }
.app.narrow .doc-listing { flex-direction: column; gap: 14px; }
.app.narrow .listing-text { display: none; }
.app.narrow .listing { flex: none; }
.app.narrow .sched { width: auto; border: 0; padding: 0; }
.app.narrow .sched-axis { display: grid; gap: 8px; border: 0; margin: 0; }
.app.narrow .sched-axis .tick { display: none; }
.app.narrow .slot { position: relative; inset: auto; top: auto; transform: translateX(calc((1 - var(--drop, 0)) * 36px)); grid-template-columns: 52px 1fr; align-items: center; }
.app.narrow[dir="rtl"] .slot { transform: translateX(calc((1 - var(--drop, 0)) * -36px)); }
.app.narrow .slot::before { display: none; }
.app.narrow .ln { white-space: pre-wrap; word-break: break-all; }
.app.narrow .ln-add { max-height: calc(var(--grow, 0) * 42px); }
.app.narrow .diff-file:nth-of-type(2), .app.narrow .diff-file:nth-of-type(2) ~ .ln { display: none; }
.app.narrow .vat { font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .ask, .steps li, .msg-reply, .ck path { transition: none; }
}

/* clinic: today's list, then the WhatsApp message types itself */
.today { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.today li { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 5px; font-size: 13px; background: var(--paper); border: 1px solid var(--line); opacity: var(--in, 0); transform: translateY(calc((1 - var(--in, 0)) * 6px)); }
.today li b { font-weight: 600; font-variant-numeric: tabular-nums; }
.today li.flag { border-inline-start: 3px solid var(--wait, #c98a2c); }
.chip-quiet { background: #e8ebf3; color: var(--ink-2); }
.chip-ok { background: #e1f1e6; color: #1c5236; }
.wa { margin-top: 10px; flex: 1; min-height: 0; overflow: hidden; background: #efe9e0; border: 1px solid var(--line); border-radius: 5px; padding: 16px; }
.wa.editing { outline: 2px solid #3b5bdb; outline-offset: -2px; }
.wa-bubble { margin: 0; max-width: 88%; background: #dcf4cf; color: #1e2a1e; border-radius: 8px; border-start-end-radius: 2px; padding: 10px 12px; font: 400 14px/1.55 var(--sans); white-space: pre-wrap; margin-inline-start: auto; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.app.narrow .today li:not(.flag) { display: none; }
.app.narrow .wa { padding: 12px; }
