/* Dinerra Requests
   Chrome-and-mint, not warm-cream: a back-of-house tool, not a menu.
   Mono carries machine data (ticket numbers, times, statuses),
   sans carries anything a person wrote. */

:root {
  --bg:          #EFF3F2;
  --surface:     #FFFFFF;
  --ink:         #171C1A;
  --muted:       #667571;
  --line:        #DCE4E1;
  --line-strong: #C3D0CB;

  --accent:      #0E6B5C;
  --accent-ink:  #0A5045;
  --accent-soft: #E2F0EC;

  --open:        #4A6572;
  --progress:    #B4690E;
  --review:      #6D4AAE;
  --done:        #0E6B5C;
  --rejected:    #7C8783;

  --prio-low:    #9AA8A3;
  --prio-normal: #4A6572;
  --prio-high:   #D98324;
  --prio-urgent: #C0392B;

  --danger:      #C0392B;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(23, 28, 26, .06), 0 1px 8px rgba(23, 28, 26, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- shell ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.01em;
}

/* The mark reads as a docket on a rail: a clip over a slip of paper. */
.brand-mark {
  width: 14px; height: 18px;
  background: var(--accent);
  border-radius: 2px;
  position: relative;
  flex: none;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 3px; right: 3px; top: -3px;
  height: 4px;
  background: var(--ink);
  border-radius: 1px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}
.topbar-nav a { text-decoration: none; color: var(--muted); }
.topbar-nav a:hover { color: var(--ink); }
.topbar-nav a.is-active { color: var(--accent-ink); font-weight: 600; }

.who { color: var(--ink); font-weight: 500; }
.link-quiet { color: var(--muted) !important; }

.role-tag {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--accent-soft);
  color: var(--accent-ink);
  padding: 2px 5px;
  border-radius: 3px;
  margin-left: 6px;
  vertical-align: 1px;
}
.role-off { background: #EEE; color: var(--muted); }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0;
}

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}

.lede { color: var(--muted); margin: 0 0 20px; }
.backlink { margin: 0 0 14px; font-size: 14px; }
.backlink a { text-decoration: none; color: var(--muted); }
.backlink a:hover { color: var(--ink); }

/* ---------- flashes ---------- */

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash-ok    { background: var(--accent-soft); color: var(--accent-ink); border-color: #C4E0D8; }
.flash-error { background: #FCEBE9; color: #8E2C21; border-color: #F2CFCB; }

.warn-box {
  background: #FDF6E3;
  border: 1px solid #EFE0B8;
  color: #7A5B10;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}

/* ---------- filter rail ---------- */

.rail {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--line);
}

.rail-tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.rail-tab:hover { color: var(--ink); }
.rail-tab.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.rail-count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 9px;
}
.rail-tab.is-active .rail-count {
  background: var(--accent-soft);
  border-color: #C4E0D8;
  color: var(--accent-ink);
}

/* ---------- ticket list ---------- */

.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.ticket {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-left-color: var(--prio-normal);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .12s ease, transform .12s ease;
}
.ticket:hover { border-color: var(--line-strong); }
.ticket:hover .ticket-title { color: var(--accent-ink); }

.prio-edge-low    { border-left-color: var(--prio-low); }
.prio-edge-normal { border-left-color: var(--prio-normal); }
.prio-edge-high   { border-left-color: var(--prio-high); }
.prio-edge-urgent { border-left-color: var(--prio-urgent); }

.ticket-done, .ticket-rejected { opacity: .62; }
.ticket-done:hover, .ticket-rejected:hover { opacity: 1; }

.ticket-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 13px 4px 13px 15px;
  text-decoration: none;
  color: inherit;
}

.ticket-no {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  flex: none;
  padding-top: 1px;
}
.ticket-no-lg { font-size: 14px; }

.ticket-body { min-width: 0; }

.ticket-title {
  display: block;
  font-weight: 500;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}
.dot-sep { opacity: .5; }
.meta-chip { color: var(--muted); }

.ticket-status {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 15px 13px 4px;
}

.needs-you {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--review);
  background: #F1ECFA;
  border: 1px solid #DDD2F2;
  padding: 2px 6px;
  border-radius: 3px;
}

/* ---------- status + priority ---------- */

.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .03em;
  padding: 3px 9px;
  border-radius: 3px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill-open        { background: #EDF1F3; color: var(--open);      border-color: #DAE2E6; }
.pill-in_progress { background: #FBF0DF; color: var(--progress);  border-color: #F0DFC2; }
.pill-in_review   { background: #F1ECFA; color: var(--review);    border-color: #DDD2F2; }
.pill-done        { background: var(--accent-soft); color: var(--done); border-color: #C4E0D8; }
.pill-rejected    { background: #EFEFEF; color: var(--rejected);  border-color: #E0E0E0; }

.status-select {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  max-width: 130px;
}
.status-select.status-open        { color: var(--open); }
.status-select.status-in_progress { color: var(--progress); background: #FDF8F0; }
.status-select.status-in_review   { color: var(--review);   background: #F8F5FD; }
.status-select.status-done        { color: var(--done);     background: #F1F8F6; }
.status-select.status-rejected    { color: var(--rejected); }

.prio {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
.prio-low    { background: var(--prio-low); }
.prio-normal { background: var(--prio-normal); }
.prio-high   { background: var(--prio-high); }
.prio-urgent { background: var(--prio-urgent); }

.prio-chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid;
}
.prio-chip-low    { color: var(--prio-low);    border-color: #DDE3E1; background: #F6F8F7; }
.prio-chip-normal { color: var(--prio-normal); border-color: #DAE2E6; background: #EDF1F3; }
.prio-chip-high   { color: var(--prio-high);   border-color: #F0DFC2; background: #FBF3E6; }
.prio-chip-urgent { color: var(--prio-urgent); border-color: #F2CFCB; background: #FCEBE9; }

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}
.panel-narrow { max-width: 520px; margin-inline: auto; }

.panel-login { margin-top: 8vh; text-align: left; }
.login-mark {
  width: 22px; height: 28px;
  background: var(--accent);
  border-radius: 3px;
  position: relative;
  margin-bottom: 18px;
}
.login-mark::after {
  content: "";
  position: absolute;
  left: 5px; right: 5px; top: -4px;
  height: 6px;
  background: var(--ink);
  border-radius: 2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  align-items: start;
}

/* ---------- detail ---------- */

.detail { border-left: 4px solid var(--prio-normal); }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.detail-headline { min-width: 0; }
.detail-title {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin: 0 0 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.detail-facts dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 3px;
}
.detail-facts dd { margin: 0; font-size: 14px; }

.detail-body { overflow-wrap: anywhere; }

.attachments { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.attachment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.attachment {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.attachment:hover { border-color: var(--line-strong); background: #FAFCFB; }

.attachment-thumb {
  width: 42px; height: 42px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
  flex: none;
}
.attachment-thumb-doc {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
}
.attachment-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { font-family: var(--mono); font-size: 11px; color: var(--muted); flex: none; }

/* ---------- the review question ---------- */

.review-call {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  background: #F8F5FD;
  border: 1px solid #DDD2F2;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.review-title { font-size: 16px; margin: 0 0 2px; font-weight: 600; }
.review-body { margin: 0; font-size: 14px; color: var(--muted); }
.review-actions { display: flex; gap: 8px; flex: none; }

.admin-bar { padding: 14px 22px; }
.admin-status { display: flex; align-items: center; gap: 10px; }

/* ---------- comments ---------- */

.comment-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 12px; }

.comment {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #FBFCFC;
}
.comment-admin { background: var(--accent-soft); border-color: #C4E0D8; }

.comment-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.comment-author { font-weight: 600; font-size: 14px; }
.comment-time { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: auto; }
.comment-body { font-size: 14.5px; overflow-wrap: anywhere; }
.comments-empty { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.comment-form { display: grid; gap: 10px; justify-items: start; }
.comment-form textarea { width: 100%; }

/* ---------- forms ---------- */

.form { display: grid; gap: 16px; justify-items: stretch; }
.field { display: block; border: 0; padding: 0; margin: 0; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
}
.field-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field-optional { font-weight: 400; color: var(--muted); font-size: 12px; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 9px 11px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="file"] { font-size: 13px; font-family: var(--sans); }

.prio-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.prio-choice { cursor: pointer; }
.prio-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.prio-choice .prio-chip { font-size: 12px; padding: 6px 12px; transition: box-shadow .12s ease; }
.prio-choice input:checked + .prio-chip { box-shadow: inset 0 0 0 1px currentColor; font-weight: 600; }
.prio-choice input:focus-visible + .prio-chip { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  transition: background .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-quiet { background: var(--surface); color: var(--muted); border-color: var(--line-strong); }
.btn-quiet:hover { color: var(--ink); border-color: var(--muted); }
.btn-small { font-size: 12.5px; padding: 6px 11px; }
.btn-block { width: 100%; }

/* ---------- people ---------- */

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person.is-disabled { opacity: .55; }
.person-id { min-width: 0; }
.person-name { display: block; font-weight: 500; font-size: 14.5px; }
.person-email { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.person-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.person-count { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.person-you { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- empty ---------- */

.empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
}
.empty-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.empty-body { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

.fineprint { font-size: 13px; color: var(--muted); margin: 18px 0 0; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .wrap { padding: 20px 14px 56px; }
  .topbar-inner { padding: 0 14px; }
  .brand-name { display: none; }

  .ticket { flex-wrap: wrap; }
  .ticket-main { padding: 12px 12px 6px; width: 100%; }
  .ticket-status { padding: 0 12px 12px; width: 100%; }
  .ticket-title { white-space: normal; }

  .detail-head { flex-direction: column; gap: 10px; }
  .review-call { flex-direction: column; align-items: flex-start; }
  .panel { padding: 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Log out is a POST, so it is a button styled to sit with the nav links. */
.logout-form { display: inline; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
.link-button:hover { color: var(--ink); }
