/* FILE: ticketbook/ui/my.css
 *
 * The employee's page. The world is app.css's — its tokens, its two themes,
 * its base surfaces — and this file only lays that world out for a phone.
 *
 * Same rules as the desk: ruled lines rather than boxes, nothing round, no
 * shadow, blue only for the action that commits and for "you", a status told
 * by its mark and its word. Different sizes: the desk is dense because it is
 * read all day at a desk, and this is read once, at arm's length, by somebody
 * whose laptop is not working. Body text is 16px (which also keeps iOS from
 * zooming into a field on focus) and every control is at least 44px tall.
 */

.my {
  --my-text: 16px;
  --my-small: 14px;
  --my-head: 22px;
  --my-lead: 28px;
  --my-touch: 44px;
  --my-gutter: 16px;

  font-size: var(--my-text);
  line-height: 1.5;
  background: var(--ink-1);
  min-height: 100dvh;
}

/* ── The top rule ──────────────────────────────────────────────────────── */

.my-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 52px;
  padding: 0 var(--my-gutter);
  padding-top: env(safe-area-inset-top);
  background: var(--ink-0);
  border-bottom: var(--w-band) solid var(--rule-3);
  margin-bottom: 4px;
}

/* The register's double head rule, as on the desk's gate. */
.my-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: var(--hair);
  background: var(--rule-2);
}

.my-top__id {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--bone-1);
  text-decoration: none;
  font-weight: 600;
  min-height: var(--my-touch);
}

.my-top__mark {
  color: var(--live-ink);
  line-height: 0;
}

.my-top__mark svg {
  width: 18px;
  height: 18px;
}

.my-top__who {
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--bone-2);
  font-size: var(--my-small);
}

.my-top__out {
  font: inherit;
  font-size: var(--my-small);
  color: var(--live-ink);
  background: none;
  border: 0;
  padding: 0 0 0 var(--s-2);
  min-height: var(--my-touch);
  cursor: pointer;
  white-space: nowrap;
}

/* The way back to the desk, for IT only. Drawn as the desk's own ghost button
   (.tbtn), the twin of its My tickets: a ruled box says "another place", where
   bare blue words beside Sign out read as one more action. The box is 32px so
   it sits inside the 52px rule; ::after carries the 44px touch target. */
.my-top__desk {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--s-3);
  color: var(--bone-1);
  font-size: var(--my-small);
  text-decoration: none;
  white-space: nowrap;
  border: var(--w-rule) solid var(--rule-2);
  border-radius: var(--radius);
}

.my-top__desk::after {
  content: "";
  position: absolute;
  inset: -6px 0;
}

.my-top__desk:hover {
  border-color: var(--rule-3);
  background: var(--ink-3);
}

/* At the narrowest phones the name would shrink to one letter and an ellipsis
   beside the button; an IT person knows who they are, so it goes instead. */
@media (max-width: 360px) {
  .my-top:has(#my-desk:not([hidden])) .my-top__who {
    display: none;
  }

  .my-top:has(#my-desk:not([hidden])) .my-top__desk {
    margin-left: auto;
  }
}

.my-top__desk[hidden] {
  display: none;
}

.my-top__who[hidden] + .my-top__out {
  margin-left: auto;
}

/* ── Where you are ─────────────────────────────────────────────────────── */

.my-nav {
  display: flex;
  border-bottom: var(--w-rule) solid var(--rule-2);
  background: var(--ink-1);
}

.my-nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--my-touch);
  color: var(--bone-2);
  text-decoration: none;
  border-bottom: var(--w-band) solid transparent;
}

.my-nav a + a {
  border-left: var(--w-rule) solid var(--rule-1);
}

.my-nav a[aria-current="page"] {
  color: var(--bone-1);
  font-weight: 600;
  border-bottom-color: var(--live);
}

/* ── The column ────────────────────────────────────────────────────────── */

.my-main {
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--s-5) var(--my-gutter) calc(var(--s-7) + env(safe-area-inset-bottom));
}

.my-main:focus {
  outline: none;
}

.my-lead {
  margin: 0;
  font-size: var(--my-lead);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.my-head {
  margin: 0;
  font-size: var(--my-head);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.my-prose {
  margin: var(--s-3) 0 0;
  max-width: 60ch;
  color: var(--bone-1);
}

.my-prose--quiet,
.my-quiet {
  color: var(--bone-2);
}

.my-quiet {
  margin: var(--s-2) 0 0;
  font-size: var(--my-small);
}

/* A section's or a field's name. NOT the desk's uppercase label: on this page
   "IT" is a word in almost every label, and set in capitals "What IT did"
   reads "WHAT IT DID" — the pronoun. Sentence case keeps IT the department. */
.my-label {
  display: block;
  margin: 0 0 var(--s-2);
  font-size: var(--my-small);
  font-weight: 600;
  color: var(--bone-2);
}

.my-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.my-link,
.my-back {
  display: inline-flex;
  align-items: center;
  min-height: var(--my-touch);
  color: var(--live-ink);
}

.my-back {
  margin: calc(-1 * var(--s-3)) 0 var(--s-2);
  text-decoration: none;
  font-size: var(--my-small);
}

/* ── Buttons: the stamp and the plate ──────────────────────────────────────
 * The stamp is the desk's committed action — a solid plate, words knocked out
 * — and there is at most one on a screen. The plate is everything else: the
 * same shape, ruled rather than filled. */

.my-stamp,
.my-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--my-touch);
  padding: var(--s-2) var(--s-4);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.my-stamp {
  color: var(--live-on);
  background: var(--live);
  border: 0;
}

.my-stamp:hover {
  background: color-mix(in srgb, var(--live) 84%, #000);
}

.my-plate {
  color: var(--bone-1);
  background: transparent;
  border: var(--w-rule) solid var(--rule-3);
}

.my-plate:hover {
  background: var(--ink-3);
}

.my-stamp:disabled,
.my-plate:disabled {
  opacity: 0.6;
  cursor: progress;
}

.my-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

/* What the page says back: a refusal in rubric, a confirmation in ink. */
.my-alert,
.my-note {
  margin: var(--s-4) 0 0;
  padding-left: var(--s-3);
  line-height: 1.5;
}

.my-alert {
  border-left: var(--w-band) solid var(--rubric);
  color: var(--rubric-ink);
}

.my-note {
  border-left: var(--w-band) solid var(--live);
  color: var(--bone-1);
  margin-bottom: var(--s-4);
}

/* ── Signed out, and the wrong door ─────────────────────────────────────── */

.my-door {
  padding-top: var(--s-6);
}

.my-door .my-stamp,
.my-door .my-plate {
  margin-top: var(--s-5);
  min-width: min(100%, 22ch);
}

/* ── Your tickets ──────────────────────────────────────────────────────── */

.my-listhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: var(--w-band) solid var(--rule-3);
}

.my-ask {
  margin: var(--s-4) 0 0;
  padding-left: var(--s-3);
  border-left: var(--w-band) solid var(--live);
}

.my-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.my-row {
  border-bottom: var(--w-rule) solid var(--rule-2);
}

.my-row__link {
  display: grid;
  gap: var(--s-1);
  padding: var(--s-3) 0;
  color: var(--bone-1);
  text-decoration: none;
}

.my-row__link:hover .my-row__title {
  text-decoration: underline;
  text-decoration-thickness: var(--hair);
  text-underline-offset: 3px;
}

.my-row__top,
.my-row__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  font-size: var(--my-small);
}

.my-row__top {
  justify-content: space-between;
}

.my-row__title {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.my-row__date {
  color: var(--bone-2);
}

.my-row__ask {
  color: var(--live-ink);
  font-weight: 600;
}

/* A resolved row is IT asking a question, so it carries the "you" blue in its
   margin — confirming what its own line already says. */
.my-row[data-status="resolved"] .my-row__link {
  border-left: var(--w-band) solid var(--live);
  padding-left: var(--s-3);
}

.my-ref {
  font-family: var(--font-figure);
  font-size: var(--my-small);
  font-variant-numeric: tabular-nums;
  color: var(--bone-2);
}

.my-empty {
  padding-top: var(--s-4);
}

/* ── Status: mark and word ─────────────────────────────────────────────── */

.my-status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-size: var(--my-small);
  color: var(--bone-2);
}

.my-status__mark {
  line-height: 0;
}

.my-status--claimed,
.my-status--resolved {
  color: var(--bone-1);
}

.my-status--resolved .my-status__mark {
  color: var(--live-ink);
}

/* ── One ticket ────────────────────────────────────────────────────────── */

.my-ticket__head {
  padding-bottom: var(--s-4);
  border-bottom: var(--w-band) solid var(--rule-3);
}

.my-ticket__head .my-ref {
  display: block;
  margin-bottom: var(--s-1);
}

.my-ticket__state {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-1) var(--s-3);
  margin: var(--s-3) 0 0;
}

.my-ticket__line {
  color: var(--bone-1);
}

.my-block {
  padding: var(--s-4) 0;
  border-bottom: var(--w-rule) solid var(--rule-2);
}

.my-block--resolution {
  border-left: var(--w-band) solid var(--live);
  padding-left: var(--s-3);
}

.my-block--ask {
  background: var(--live-wash);
  padding: var(--s-4) var(--s-3);
  border-bottom: 0;
  margin-top: var(--s-3);
}

.my-ask__q {
  display: block;
  margin: 0;
  font-size: var(--my-head);
  font-weight: 600;
}

/* The conversation: who, when, then what was said — ruled like a trail.
   "You" is set in the blue that means self everywhere else in this world. */
.my-convo {
  list-style: none;
  margin: 0;
  padding: 0;
}

.my-said {
  padding: var(--s-3) 0;
  border-top: var(--w-rule) solid var(--rule-1);
}

.my-said:first-child {
  border-top: 0;
  padding-top: 0;
}

.my-said__who {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  margin: 0 0 var(--s-1);
  font-size: var(--my-small);
}

.my-said__name {
  font-weight: 600;
}

.my-said--you .my-said__name {
  color: var(--live-ink);
}

.my-said__at {
  color: var(--bone-3);
  font-variant-numeric: tabular-nums;
}

.my-said--you {
  padding-left: var(--s-3);
  border-left: var(--w-rule) solid var(--live);
}

.my-reply {
  border-bottom: 0;
}

/* ── Fields ────────────────────────────────────────────────────────────── */

.my-form .my-head {
  margin-bottom: 0;
}

.my-field {
  margin: var(--s-5) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

/* You write on a ruled line, not in a box — except where you write a
   paragraph, which gets its ruled frame so it is visibly somewhere to type. */
.my-input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: var(--my-text);
  color: var(--bone-1);
  caret-color: var(--live-ink);
  background: transparent;
  border: 0;
  border-bottom: var(--w-band) solid var(--rule-3);
  padding: var(--s-2) 0;
  min-height: var(--my-touch);
}

.my-input--area {
  border: var(--w-rule) solid var(--rule-3);
  border-bottom-width: var(--w-band);
  padding: var(--s-2) var(--s-3);
  resize: vertical;
  background: var(--ink-0);
}

.my-input:focus {
  outline: none;
  border-color: var(--live);
}

.my-choices {
  display: grid;
  gap: 0;
}

.my-choices legend {
  padding: 0;
}

.my-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
  padding: var(--s-3) 0;
  border-top: var(--w-rule) solid var(--rule-1);
  cursor: pointer;
}

.my-choice:last-child {
  border-bottom: var(--w-rule) solid var(--rule-1);
}

.my-choice input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--live);
}

.my-choice:has(input:checked) {
  background: var(--live-wash);
}

.my-choice__text {
  display: grid;
}

.my-choice__name {
  font-weight: 600;
}

.my-choice__line {
  color: var(--bone-2);
  font-size: var(--my-small);
}

/* ── Files ─────────────────────────────────────────────────────────────────
 * Pictures under what was said, as thumbnails a thumb can hit; anything else
 * as its name and size on a ruled plate. Square, ruled, no radius, no shadow:
 * a picture is a framed print on the page, not a card floating over it. */

.my-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  list-style: none;
  margin: var(--s-3) 0 0;
  padding: 0;
}

.my-thumb {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  padding: 0;
  overflow: hidden;
  color: var(--bone-3);
  background: var(--ink-0);
  border: var(--w-rule) solid var(--rule-3);
  cursor: zoom-in;
}

.my-thumb:disabled {
  cursor: default;
}

.my-thumb:focus-visible,
.my-file:focus-visible,
.my-view__close:focus-visible,
.my-attach__remove:focus-visible {
  outline: var(--w-band) solid var(--live);
  outline-offset: 2px;
}

.my-thumb__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-thumb__wait {
  padding: var(--s-2);
  font-size: var(--my-small);
  text-align: center;
}

.my-file {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  max-width: 100%;
  min-height: var(--my-touch);
  padding: var(--s-2) var(--s-3);
  font: inherit;
  color: var(--bone-1);
  background: transparent;
  border: var(--w-rule) solid var(--rule-3);
  cursor: pointer;
}

.my-file:hover {
  background: var(--ink-3);
}

.my-file__name {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

.my-file__size {
  flex: none;
  color: var(--bone-3);
  font-size: var(--my-small);
  font-variant-numeric: tabular-nums;
}

/* The picture, as large as the screen allows. Above everything; the page
   under it is dimmed with its own ink, not a shadow. */
.my-view {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: color-mix(in srgb, var(--ink-0) 97%, transparent);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  cursor: zoom-out;
}

.my-view__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-2) var(--my-gutter);
  border-bottom: var(--w-rule) solid var(--rule-3);
  background: var(--ink-0);
  cursor: default;
}

.my-view__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--my-small);
  color: var(--bone-2);
}

.my-view__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  padding: var(--s-3);
  object-fit: contain;
}

/* Adding files to a message: a plate to pick, and a ruled list of what is
   on its way — each with its own thumbnail, its state, and a way to take it
   off. A refused one is told in rubric beside itself. */
.my-attach {
  margin-top: var(--s-3);
}

.my-attach__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}

.my-attach__hint {
  color: var(--bone-3);
  font-size: var(--my-small);
}

.my-attach__input {
  display: none;
}

.my-attach__list {
  list-style: none;
  margin: var(--s-3) 0 0;
  padding: 0;
}

.my-attach__item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-top: var(--w-rule) solid var(--rule-1);
}

.my-attach__item:last-child {
  border-bottom: var(--w-rule) solid var(--rule-1);
}

.my-attach__pic {
  display: block;
  width: 48px;
  height: 48px;
  background: var(--ink-3);
  border: var(--w-rule) solid var(--rule-2);
  overflow: hidden;
}

.my-attach__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.my-attach__text {
  display: grid;
  min-width: 0;
}

.my-attach__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-attach__line {
  color: var(--bone-3);
  font-size: var(--my-small);
}

.my-attach__item--refused .my-attach__line {
  color: var(--rubric-ink);
}

.my-attach__item--refused .my-attach__pic {
  border-color: var(--rubric);
}

.my-attach__remove {
  min-height: var(--my-touch);
  padding: 0 var(--s-2);
  font: inherit;
  font-size: var(--my-small);
  color: var(--live-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* A form with files dragged over it says so with the one colour that means
   "this will act". */
form[data-dropping="yes"] {
  outline: var(--w-band) dashed var(--live);
  outline-offset: var(--s-1);
}

/* ── Wider than a phone ────────────────────────────────────────────────── */

@media (min-width: 720px) {
  .my {
    --my-gutter: 24px;
  }

  .my-main {
    padding-top: var(--s-6);
  }

  .my-nav {
    justify-content: center;
  }

  .my-nav a {
    flex: 0 0 auto;
    min-width: 12rem;
  }

  .my-thumb {
    width: 128px;
    height: 128px;
  }
}
