/* GridPortal - client-facing ticket portal.

   Styled to The Grid Corporation's brand guide (the grid-branding skill):
   Primary Gold #CC9900, Gold Bright #F8C119, Gold Mid #E4A500,
   Charcoal #1B2227, body text #333333, light grey #F5F5F5, white.
   Roboto, Bold 700 for headings and Regular 400 for body, Arial fallback.

   Two rules from the guide shape most of what follows:

   1. Gold is an ACCENT, never a base. It appears here only as the divider rule
      under the charcoal bands, the active tab, the primary button, and the
      "waiting on you" status. Nothing is a large gold field.
   2. Gold text on white is 2.6:1 and fails contrast, so gold is never used for
      body copy. Where gold is a fill, the text on it is charcoal (6.4:1).

   Deliberately light-only. The brand is defined light-first, the live site is
   white with charcoal bands, and the guide publishes no dark-mode palette, so
   inventing one would be going off-brand rather than following it. */

:root {
  color-scheme: light;

  --gold:        #CC9900;
  --gold-bright: #F8C119;
  --gold-mid:    #E4A500;
  --charcoal:    #1B2227;
  --ink:         #333333;
  --grey:        #F5F5F5;
  --white:       #FFFFFF;

  --ink-soft:  #6a6a6a;
  --hairline:  #e3e3e0;
  --hairline-dark: rgba(255, 255, 255, 0.14);
  --shadow: 0 1px 2px rgba(27, 34, 39, 0.06), 0 10px 28px rgba(27, 34, 39, 0.07);

  --font: Roboto, Arial, Helvetica, system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--grey);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: #8a6800; }          /* gold darkened to clear contrast on light */
a:hover { color: var(--gold); }

.muted { color: var(--ink-soft); }

/* -- charcoal bands, with the guide's thin gold rule ---------------------- */

.site-header {
  background: var(--charcoal);
  border-bottom: 3px solid var(--gold);
}

.site-header .bar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* The approved logo lockup ships with a WHITE wordmark, so it only ever sits
   on charcoal here. Clear space around it is roughly the icon height, per the
   guide, and it stays above the ~100px minimum width. */
.logo { display: block; width: 132px; height: auto; }

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13.5px;
  min-width: 0;
}

.header-right .who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 40vw;
}

.btn-ghost {
  display: inline-block;
  background: none;
  border: 1px solid var(--hairline-dark);
  color: var(--white);
  border-radius: 3px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(248, 193, 25, 0.08);
}

.site-footer {
  margin-top: auto;
  background: var(--charcoal);
  border-top: 3px solid var(--gold);
  color: rgba(255, 255, 255, 0.66);
  font-size: 13px;
}

.site-footer .bar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px 22px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.site-footer a { color: var(--gold-bright); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* -- page ----------------------------------------------------------------- */

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 { font-size: 22px; }

.page-head .sub {
  color: var(--ink-soft);
  font-size: 13.5px;
}

.card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* -- centred pages (login, sent, expired) --------------------------------- */

.centred {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 56px;
}

.centred-inner { width: 100%; max-width: 410px; }

/* The logo needs a charcoal panel on these pages, since its wordmark is white
   and the page is light. The guide sanctions a solid colour panel behind the
   mark, and it mirrors the site's own dark bands. */
.logo-panel {
  background: var(--charcoal);
  border-radius: 4px 4px 0 0;
  border-bottom: 3px solid var(--gold);
  padding: 22px 26px;
  display: flex;
  justify-content: center;
}

.centred .body { padding: 26px; }

.centred h1 { font-size: 19px; margin-bottom: 8px; }

.centred p { margin: 0 0 6px; font-size: 14.5px; }

.tagline {
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* -- forms ---------------------------------------------------------------- */

form { margin-top: 22px; }

label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--charcoal);
}

input[type="email"], input[type="text"] {
  width: 100%;
  padding: 11px 13px;
  border-radius: 3px;
  border: 1px solid #cfcfca;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}

input[type="email"]::placeholder, input[type="text"]::placeholder { color: #9b9b95; }

input[type="email"]:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(204, 153, 0, 0.18);
}

#code {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
  color: var(--charcoal);
}

#code::placeholder { letter-spacing: 0.3em; font-weight: 400; }

button[type="submit"] {
  margin-top: 16px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: 3px;
  background: var(--gold-mid);
  color: var(--charcoal);      /* 6.4:1 - never white on gold */
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}

button[type="submit"]:hover { background: var(--gold-bright); }

button[type="submit"]:focus-visible {
  outline: 2px solid var(--charcoal);
  outline-offset: 2px;
}

.error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 3px;
  border-left: 3px solid #b3302f;
  background: #fdf4f4;
  color: #8c2624;
  font-size: 13.5px;
}

.notice {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: 3px;
  border-left: 3px solid var(--gold);
  background: #fdf8ea;
  color: #6b5200;
  font-size: 13.5px;
}

/* -- tabs ----------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}

.tab {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}

.tab:hover { color: var(--charcoal); }

.tab[aria-current="page"] {
  color: var(--charcoal);
  font-weight: 700;
  border-bottom-color: var(--gold);
}

/* -- table ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

/* Charcoal header row with white bold text, as the guide specifies for
   tabular material. */
thead th {
  text-align: left;
  padding: 11px 20px;
  background: var(--charcoal);
  color: var(--white);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: var(--grey); }   /* zebra, per the guide */
tbody tr:hover { background: #fdf8ea; }                  /* faintest gold wash */
tbody tr:last-child td { border-bottom: none; }

/* Waiting-on-customer rows get the same gold-notice treatment as .notice,
   permanently rather than only on hover. Same specificity as the zebra/hover
   rules above (tbody tr.__) - it wins only because it comes after them in
   source order. Do not reorder relative to them. */
tbody tr.row-waiting { background: #fdf8ea; }
tbody tr.row-waiting:hover { background: #faf1d6; }
tbody tr.row-waiting td:first-child { border-left: 3px solid var(--gold); }

td.number {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

td.subject { min-width: 240px; font-weight: 500; color: var(--charcoal); }
td.when { white-space: nowrap; color: var(--ink-soft); font-size: 13px; }
td.priority { color: var(--ink-soft); font-size: 13.5px; white-space: nowrap; }
td.type { color: var(--ink); font-size: 13.5px; white-space: nowrap; }
td.contact { color: var(--ink); font-size: 13.5px; white-space: nowrap; }

/* -- status and priority -------------------------------------------------- */
/* The brand palette has no green or red, so the semantic colours below are the
   same ones the internal ATAPI dashboard already uses for exactly this job,
   in their light-theme values. Reusing them keeps the two products consistent
   rather than inventing a second vocabulary.
   Every one is >=4.96:1 against both white and the #F5F5F5 zebra row, so they
   stay legible; raw brand gold is 2.6:1 and is therefore never used as text,
   only as a border with darkened gold (#6b5200) on top. */

/* Priority is a tinted pill with a dot, so every level reads as coded at a
   glance. An earlier version left Medium as plain body charcoal, which was a
   bad default: most tickets sit at Medium, so most rows looked uncoloured.
   Each pairing below clears 4.5:1 against both its own tint and the zebra row. */

.priority-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
}

.priority-cell::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.tone-critical {
  color: #b3302f;
  background: #fdf4f4;
  border-color: #e9bfbe;
  font-weight: 700;
}

.tone-high {
  color: #a4521a;
  background: #fdf6ef;
  border-color: #e8cbb2;
  font-weight: 700;
}

/* Medium is the commonest priority by far, so leaving it as plain grey made the
   whole column look uncoloured on a typical screen. It gets brand gold. */
.tone-medium {
  color: #6b5200;
  background: #fdf8ea;
  border-color: #e8d49a;
}

.tone-low, .tone-neutral {
  color: var(--ink-soft);
  background: #f7f7f6;
  border-color: var(--hairline);
}

.tone-low::before, .tone-neutral::before { opacity: 0.55; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--hairline);
  background: var(--white);
  color: var(--ink);
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Solid gold fill, charcoal text: the loudest thing on the page, reserved for
   the one status a client can act on. "Waiting on 3rd Party" is us waiting on
   someone else and deliberately does not get this treatment. */
.badge-waiting {
  background: var(--gold-mid);
  border-color: var(--gold);
  color: var(--charcoal);
  font-weight: 700;
}

/* Filled charcoal so a brand new ticket is unmistakable in a long list. */
.badge-new {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: var(--white);
  font-weight: 500;
}

.badge-active { color: var(--charcoal); border-color: #b9b9b3; font-weight: 500; }
.badge-held   { color: var(--ink-soft); border-color: var(--hairline); background: var(--grey); }
.badge-done   { color: #147a14; border-color: #b6d6b6; background: #f3faf3; }

.status-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

/* Same darkened-gold tone as .notice - raw brand gold text fails AA. */
.status-callout {
  font-size: 12px;
  font-weight: 600;
  color: #6b5200;
}

/* -- empty state ---------------------------------------------------------- */

.empty { padding: 56px 24px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--charcoal); font-weight: 700; margin-bottom: 5px; }

/* -- small screens: the table becomes stacked cards ----------------------- */

@media (max-width: 640px) {
  main { padding: 20px 14px 40px; }
  .site-header .bar, .site-footer .bar { padding: 12px 16px; }
  .header-right .who { display: none; }
  .logo { width: 112px; }

  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }

  tbody tr { padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
  tbody tr:nth-child(even) { background: var(--white); }
  tbody tr:hover { background: var(--white); }
  tbody tr.row-waiting, tbody tr.row-waiting:hover { background: #fdf8ea; }

  tbody td {
    padding: 3px 0;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
  }

  /* Label each cell, since the header row is gone. */
  tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    flex: none;
  }

  td.subject { display: block; font-size: 15.5px; margin-bottom: 8px; }
  td.subject::before { display: none; }

  /* The empty-state cell has no data-label and spans the row. */
  td.empty { display: block; text-align: center; }
  td.empty::before { display: none; }
}
