/* Helpdesk public pages: the raise-a-ticket form, the sign-in page and the
   customer portal. Same "Sunlit Beige" tokens as main_v5/app.css so a donor
   moving from the v5 site to support sees one Thaagam, not an admin panel. */

:root {
  --ink: #15110D;
  --ink-45: rgba(21, 17, 13, .45);
  --ink-55: rgba(21, 17, 13, .55);
  --ink-65: rgba(21, 17, 13, .65);
  --page: #EBE6DC;
  --beige: #F4EEE2;
  --cream: #EFE7D8;
  --border: #E2D8C6;
  --border-strong: #D9CDB6;
  --selected: #FDF9F2;
  --red: #C8271E;
  --red-deep: #8F1A13;
  --red-tint: #FBE9E7;
  --blue: #1E8FB5;
  --blue-tint: #DCEFF5;
  --blue-text: #16708F;
  --green: #17804A;
  --green-tint: #DCF5E8;
  --amber: #B8740A;
  --amber-tint: #FDF2DC;
  --font-ui: Archivo, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", Archivo, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--red); font-weight: 700; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ---- Page shell: a phone-width column, roomier on desktop ---- */
.hd-screen {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 18px 48px;
  background: var(--beige);
}
@media (min-width: 600px) {
  .hd-screen { margin: 32px auto; min-height: 0; border-radius: 28px; padding: 28px 32px 40px;
               box-shadow: 0 10px 40px rgba(21, 17, 13, .08); }
}

/* ---- Wide pages (the raise-a-ticket form): two columns on a desktop ----
   Phone and tablet: one column, intro on top. Desktop: the intro and the
   promises sit in a sticky column on the left, the form in a card on the right,
   so a 1440px screen isn't a 560px strip of form in a sea of beige. */
.hd-layout { display: block; }
.hd-main__card { margin-top: 4px; }
@media (min-width: 960px) {
  .hd-screen--wide { max-width: 1120px; padding: 32px 48px 48px; }
  .hd-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 48px; align-items: start; }
  .hd-aside { position: sticky; top: 32px; }
  .hd-aside .hd-title { font-size: 36px; }
  .hd-aside .hd-trust { margin-top: 26px; }
  .hd-main__card { margin-top: 0; background: #fff; border: 1px solid var(--border); border-radius: 24px; padding: 8px 28px 28px; }
  .hd-main__card .hd-input, .hd-main__card .hd-textarea, .hd-main__card .hd-upload { background-color: var(--beige); }
  .hd-main__card .hd-select { background-color: var(--beige); }
  .hd-main__card .hd-input:focus, .hd-main__card .hd-textarea:focus { background: #fff; }
}
.hd-aside__more { display: none; }
@media (min-width: 960px) {
  .hd-aside__more { display: block; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border);
                    font-size: 13.5px; color: var(--ink-55); }
  .hd-foot--mobile { display: none; }
}

.hd-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.hd-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; }
.hd-brand:hover { text-decoration: none; }
.hd-brand__mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center; font: 800 16px var(--font-display);
}
.hd-brand__name { font: 800 15px var(--font-display); }
.hd-top__link { font-size: 13px; }
.hd-top__link button { background: none; border: 0; padding: 0; color: var(--red); font: 700 13px var(--font-ui); cursor: pointer; }

/* ---- Headings ---- */
.hd-eyebrow { font: 700 11px var(--font-ui); letter-spacing: 1.5px; text-transform: uppercase; color: var(--red); }
.hd-title { margin: 6px 0 0; font: 800 28px/1.15 var(--font-display); }
.hd-sub { margin: 8px 0 0; color: var(--ink-55); font-size: 14px; }
.hd-hero { margin-bottom: 22px; }

/* ---- Cards and sections ---- */
.hd-card { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 18px; }
.hd-card + .hd-card { margin-top: 14px; }
.hd-section-title {
  margin: 26px 0 10px; font: 800 11px var(--font-ui); letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-45);
}

/* ---- Fields ---- */
.hd-field { margin-bottom: 16px; }
.hd-label {
  display: block; margin-bottom: 7px;
  font: 700 11px var(--font-ui); letter-spacing: 1px; text-transform: uppercase; color: var(--ink-55);
}
.hd-label .req { color: var(--red); }
.hd-label .opt { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink-45); }
.hd-input, .hd-textarea {
  width: 100%; padding: 13px 14px;
  /* 16px or more, or iPhone Safari zooms the whole page when the input is tapped. */
  font: 600 16px var(--font-ui); color: var(--ink);
  background: #fff; border: 1.5px solid var(--border); border-radius: 14px;
  appearance: none; -webkit-appearance: none; transition: border-color .15s;
}
.hd-textarea { min-height: 130px; line-height: 1.6; resize: vertical; }
/* Dropdown: same box as the inputs, with our own arrow instead of the OS one. */
.hd-select {
  width: 100%; height: 52px; padding: 0 44px 0 14px; cursor: pointer;
  font: 600 16px var(--font-ui); color: var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315110D' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 16px center / 16px;
  border: 1.5px solid var(--border); border-radius: 14px;
  appearance: none; -webkit-appearance: none; transition: border-color .15s;
}
.hd-select:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-tint); }
.hd-select:invalid, .hd-select.is-empty { color: var(--ink-45); font-weight: 500; }
.hd-select option { color: var(--ink); font-weight: 500; }
.hd-field--bad .hd-select { border-color: var(--red); }
.hd-topic-hint { margin-top: 7px; font-size: 12.5px; color: var(--red); min-height: 0; }
.hd-topic-hint:empty { display: none; }
.hd-input::placeholder, .hd-textarea::placeholder { color: var(--ink-45); font-weight: 500; }
.hd-input:focus, .hd-textarea:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-tint); }
.hd-field--bad .hd-input, .hd-field--bad .hd-textarea { border-color: var(--red); background: #FFFBFA; }
.hd-error { margin-top: 6px; font: 700 12.5px var(--font-ui); color: var(--red); }
.hd-help { margin-top: 6px; font-size: 12.5px; color: var(--ink-45); }
.hd-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .hd-row { grid-template-columns: 1fr; gap: 0; } }

/* ---- File upload: a drop card instead of a bare file input ---- */
.hd-upload { position: relative; display: flex; align-items: center; gap: 12px; padding: 13px;
  background: #fff; border: 1.5px dashed var(--border-strong); border-radius: 14px; cursor: pointer; }
.hd-upload:hover { background: var(--selected); }
.hd-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.hd-upload__ico { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--cream);
  display: flex; align-items: center; justify-content: center; }
.hd-upload__ico svg { width: 19px; height: 19px; fill: none; stroke: var(--ink); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.hd-upload__txt { min-width: 0; }
.hd-upload__ttl { display: block; font: 700 14px var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-upload__sub { display: block; font-size: 12px; color: var(--ink-45); }

/* ---- Buttons ---- */
.hd-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 26px; border: 0; border-radius: 26px; cursor: pointer;
  background: var(--red); color: #fff; font: 800 15px var(--font-ui); text-decoration: none;
}
.hd-btn:hover { background: var(--red-deep); text-decoration: none; }
.hd-btn--block { display: flex; width: 100%; }
.hd-btn--ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--border-strong); }
.hd-btn--ghost:hover { background: var(--selected); }
.hd-btn--small { height: 40px; padding: 0 18px; font-size: 13.5px; }
.hd-btn[disabled] { opacity: .7; cursor: wait; }

/* ---- Notices ---- */
.hd-alert { margin-bottom: 16px; padding: 12px 14px; border-radius: 14px; font: 600 13.5px/1.5 var(--font-ui); }
.hd-alert--bad { background: var(--red-tint); color: var(--red-deep); }
.hd-alert--ok { background: var(--green-tint); color: var(--green); }
.hd-alert--info { background: var(--blue-tint); color: var(--blue-text); }

.hd-trust { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding: 0 2px; }
.hd-trust__item { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--ink-55); }
.hd-trust__item svg { width: 16px; height: 16px; flex: none; margin-top: 2px; fill: none; stroke: var(--green);
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.hd-foot { margin-top: 26px; text-align: center; font-size: 13px; color: var(--ink-55); }

/* ---- Done / empty states ---- */
.hd-done { text-align: center; padding: 18px 4px 6px; }
.hd-done__ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 22px;
  background: var(--green-tint); display: flex; align-items: center; justify-content: center; }
.hd-done__ico svg { width: 30px; height: 30px; fill: none; stroke: var(--green); stroke-width: 2.6;
  stroke-linecap: round; stroke-linejoin: round; }
.hd-ref { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 9px 14px;
  background: var(--cream); border: 1px solid var(--border); border-radius: 12px; font-weight: 700; font-size: 13px; }
.hd-ref b { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

/* ---- Ticket list ---- */
.hd-list { background: #fff; border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.hd-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; color: var(--ink); font-weight: 400; }
.hd-item + .hd-item { border-top: 1px solid var(--border); }
.hd-item:hover { background: var(--selected); text-decoration: none; }
.hd-item__txt { flex: 1; min-width: 0; }
.hd-item__ttl { display: block; font: 700 14px/1.35 var(--font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-item__sub { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-45); }
.hd-empty { padding: 26px 16px; text-align: center; color: var(--ink-55); }

/* ---- Status pills ---- */
.hd-pill { display: inline-block; padding: 4px 10px; border-radius: 20px; font: 700 11.5px var(--font-ui); white-space: nowrap;
  background: var(--cream); color: var(--ink-65); }
.hd-pill--NEW, .hd-pill--OPEN, .hd-pill--IN_PROGRESS { background: var(--blue-tint); color: var(--blue-text); }
.hd-pill--WAITING_CUSTOMER { background: var(--amber-tint); color: var(--amber); }
.hd-pill--RESOLVED, .hd-pill--CLOSED { background: var(--green-tint); color: var(--green); }

/* ---- Conversation ---- */
.hd-thread { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.hd-msg { max-width: 88%; padding: 12px 14px; border-radius: 18px; background: #fff; border: 1px solid var(--border); }
.hd-msg--mine { align-self: flex-end; background: var(--ink); color: var(--beige); border-color: var(--ink); border-bottom-right-radius: 6px; }
.hd-msg--team { align-self: flex-start; border-bottom-left-radius: 6px; }
.hd-msg__meta { font-size: 11.5px; color: var(--ink-45); margin-bottom: 4px; }
.hd-msg--mine .hd-msg__meta { color: rgba(244, 238, 226, .65); }
.hd-msg__body { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.hd-msg__file { display: block; margin-top: 6px; font-size: 13px; }
.hd-msg--mine .hd-msg__file { color: #FFD7D3; }

/* ---- Star rating: radio buttons drawn as stars (reversed so ~ selects lower stars) ---- */
.hd-stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; margin-bottom: 12px; }
.hd-stars input { position: absolute; opacity: 0; pointer-events: none; }
.hd-stars label { font-size: 34px; line-height: 1; color: var(--border-strong); cursor: pointer; transition: color .1s; }
.hd-stars input:checked ~ label, .hd-stars label:hover, .hd-stars label:hover ~ label { color: #F0A400; }
.hd-stars input:focus-visible + label { outline: 2px solid var(--ink); border-radius: 6px; }

/* Honeypot: off-screen for people, still in the form for bots. */
.hd-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ============================================================================
   Phones: a compact, app-like form
   ----------------------------------------------------------------------------
   The desktop sizes made the phone form ~2.5 screens tall with the Submit
   button out of sight. Here: tighter rhythm, smaller headings, and a Submit
   bar that stays at the bottom of the screen while the donor scrolls.
   ========================================================================== */
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .hd-screen { padding: 14px 16px calc(28px + env(safe-area-inset-bottom)); }

  .hd-top { margin-bottom: 16px; }
  .hd-brand__mark { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
  .hd-brand__name { font-size: 14px; }
  .hd-top__link, .hd-top__link button { font-size: 12.5px; }

  .hd-hero { margin-bottom: 14px; }
  .hd-eyebrow { font-size: 10px; }
  .hd-title { font-size: 23px; line-height: 1.2; margin-top: 4px; }
  .hd-sub { font-size: 13.5px; margin-top: 6px; line-height: 1.5; }

  .hd-section-title { margin: 18px 0 8px; font-size: 10.5px; }
  .hd-field { margin-bottom: 12px; }
  .hd-label { margin-bottom: 5px; font-size: 10.5px; }
  .hd-input, .hd-textarea { padding: 11px 13px; border-radius: 12px; }   /* font stays 16px: no iOS zoom */
  .hd-select { height: 46px; border-radius: 12px; }
  .hd-textarea { min-height: 104px; }
  .hd-error, .hd-help { font-size: 12px; }

  .hd-upload { padding: 10px; gap: 10px; border-radius: 12px; }
  .hd-upload__ico { width: 34px; height: 34px; border-radius: 10px; }
  .hd-upload__ttl { font-size: 13.5px; }
  .hd-upload__sub { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .hd-trust { margin-top: 14px; gap: 6px; }
  .hd-trust__item { font-size: 12px; }
  .hd-foot { margin-top: 16px; font-size: 12.5px; }

  .hd-card { padding: 16px; border-radius: 16px; }
  .hd-btn { height: 48px; font-size: 15px; }

  /* The first section label on the form duplicates the field label under it. */
  .hd-main__card > .hd-section-title:first-of-type { display: none; }

  /* Submit stays reachable: pinned to the bottom of the screen while scrolling. */
  .hd-submit-bar {
    position: sticky; bottom: 0; z-index: 5;
    margin: 18px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--beige) 70%, rgba(244, 238, 226, 0));
  }
  .hd-submit-bar .hd-btn { margin-top: 0 !important; box-shadow: 0 6px 18px rgba(200, 39, 30, .25); }
}

/* Very small phones (320px): a little more room for text. */
@media (max-width: 360px) {
  .hd-screen { padding-left: 12px; padding-right: 12px; }
  .hd-title { font-size: 21px; }
  .hd-submit-bar { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
}

/* Phones show less text: anything marked hd-desktop-only is hidden, and the
   short hd-mobile-only versions take its place. */
.hd-mobile-only { display: none; }
@media (max-width: 600px) {
  .hd-desktop-only { display: none !important; }
  .hd-mobile-only { display: block; }
  .hd-title { margin-top: 0; }
  .hd-hero { margin-bottom: 10px; }
  .hd-upload__ttl { line-height: 34px; }   /* the hint line is gone: centre the title by the icon */
  .hd-foot { margin-top: 10px; }
}
