/* Hypercare support portal — Labflow palette, light and dark. */

:root {
  --pine: #153c3c;
  --pine-deep: #0e2b2f;
  --pine-black: #081d1f;
  --green: #3f9d81;
  --green-light: #68d0a6;
  --mint: #4adfad;
  --soft: #e6f2ec;
  --paper: #f6f8f7;
  --line: #e3e9e7;
  --muted: #566863;
  --faint: #8a9a96;

  --bg: var(--paper);
  --surface: #ffffff;
  --surface-sunken: #fafbfb;
  --text: #10201f;
  --text-muted: var(--muted);
  --text-faint: var(--faint);
  --border: var(--line);
  --border-strong: #cfdad6;
  --accent: var(--pine);
  --accent-hover: var(--pine-deep);
  --accent-soft: var(--soft);
  --ring: rgb(63 157 129 / 0.35);
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --shadow-sm: 0 1px 2px rgb(8 29 31 / 0.05);
  --shadow-md: 0 4px 16px -4px rgb(8 29 31 / 0.1), 0 1px 3px rgb(8 29 31 / 0.05);
  --shadow-lg: 0 20px 40px -12px rgb(8 29 31 / 0.18);
  --radius: 14px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1a1b;
    --surface: #102426;
    --surface-sunken: #0d1f21;
    --text: #e8f0ee;
    --text-muted: #a3b5b1;
    --text-faint: #7d918d;
    --border: #1e3a3b;
    --border-strong: #2a4a4b;
    --accent: var(--mint);
    --accent-hover: var(--green-light);
    --accent-soft: #133330;
    --danger: #f97066;
    --danger-soft: #2a1614;
    --shadow-md: 0 4px 16px -4px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 20px 40px -12px rgb(0 0 0 / 0.6);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Class-level `display` rules outrank the UA stylesheet's [hidden], and several
   elements here are toggled through the attribute. Settle it once. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px 96px;
}

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 0 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  flex: none;
}

@media (prefers-color-scheme: dark) {
  .brand-mark {
    color: var(--pine-black);
  }
}

.brand-mark svg {
  width: 19px;
  height: 19px;
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.phase-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .phase-pill {
    color: var(--mint);
  }
}

.topbar-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* "Live" indicator: a solid dot with a ring that expands and fades out of it. */
.live-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
  from {
    transform: scale(1);
    opacity: 0.65;
  }
  to {
    transform: scale(2.8);
    opacity: 0;
  }
}

.live-label {
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
}

/* No separator when no cover hours are configured. */
.live-hours:empty {
  display: none;
}

.live-hours::before {
  content: "·";
  margin-right: 7px;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------- intro */

.intro h1 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 640;
}

.lede {
  margin: 0 0 26px;
  color: var(--text-muted);
  max-width: 60ch;
}

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.form {
  padding: 8px 26px 26px;
  margin-top: 18px;
}

/* -------------------------------------------------------------- identity */

.identity {
  padding: 20px 22px;
}

.identity-intro {
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.identity-intro svg {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 2px;
  color: var(--accent);
}

.identity-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.identity-grid .span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 560px) {
  .identity-grid {
    grid-template-columns: 1fr;
  }
}

.identity-save {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* The saved state: a person chip instead of three inputs. */
.profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.profile-body {
  min-width: 0;
  flex: 1;
}

.profile-name {
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.customer-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.profile-meta {
  font-size: 13.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.saved-flag svg {
  width: 13px;
  height: 13px;
  color: var(--green);
}

.link-btn {
  border: 0;
  background: none;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 6px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--accent);
  cursor: pointer;
}

.link-btn:hover {
  background: var(--accent-soft);
}

/* On a narrow screen "Change" would squeeze the email into an ellipsis, so drop it
   onto its own row, indented to sit under the name rather than under the avatar. */
@media (max-width: 520px) {
  .profile {
    flex-wrap: wrap;
    row-gap: 12px;
  }

  .profile-body {
    flex: 1 1 calc(100% - 58px);
  }

  .profile > .link-btn {
    flex: none;
    margin-left: 52px;
  }
}

/* ---------------------------------------------------------------- fields */

.field {
  border: 0;
  padding: 0;
  margin: 22px 0 0;
  min-width: 0;
}

.field > label,
.field > legend {
  display: block;
  padding: 0;
  margin-bottom: 7px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

.optional,
.legend-badge {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-faint);
}

.legend-badge {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.field-hint {
  margin: 7px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.attachments-field > .field-hint {
  margin: -2px 0 12px;
  max-width: 62ch;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 128px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--ring);
}

.field-error {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--danger);
  display: none;
}

.field.invalid .field-error {
  display: block;
}

.field.invalid input[type="text"],
.field.invalid input[type="email"],
.field.invalid input[type="password"],
.field.invalid textarea {
  border-color: var(--danger);
}

.form-error {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 14px;
}

/* -------------------------------------------------------- category chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    color 0.14s ease,
    transform 0.1s ease;
}

.chip svg {
  width: 14px;
  height: 14px;
  color: var(--text-faint);
  transition: color 0.14s ease;
}

.chip:hover {
  border-color: var(--green);
  background: var(--surface-sunken);
}

.chip[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 550;
}

.chip[aria-checked="true"] svg {
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  .chip[aria-checked="true"],
  .chip[aria-checked="true"] svg {
    color: var(--pine-black);
  }
}

.chip:active {
  transform: scale(0.98);
}

.chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ------------------------------------------------------------ priorities */

.priorities {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 620px) {
  .priorities {
    grid-template-columns: 1fr 1fr;
  }
}

.priority {
  position: relative;
  /* Buttons centre their contents, so a card whose hint wraps onto an extra line
     pushes its label out of step with the others. Pin the layout to the top. */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 11px 12px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.14s ease,
    background 0.14s ease,
    box-shadow 0.14s ease;
}

.priority::before {
  content: "";
  position: absolute;
  inset: 11px auto 11px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--pri-color);
}

.priority-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.priority-hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.priority:hover {
  border-color: var(--border-strong);
  background: var(--surface-sunken);
}

.priority[aria-checked="true"] {
  border-color: var(--pri-color);
  background: color-mix(in srgb, var(--pri-color) 8%, var(--surface));
  box-shadow: 0 0 0 1px var(--pri-color);
}

.priority:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ----------------------------------------------------------- impact step */

.impact-block {
  margin-top: 14px;
  padding: 13px 15px 15px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  animation: impact-in 0.18s ease;
}

@keyframes impact-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.impact-question {
  margin: 0 0 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.impacts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

@media (max-width: 620px) {
  .impacts {
    grid-template-columns: 1fr;
  }
}

.impact {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 9px 12px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.14s ease,
    background 0.14s ease;
}

.impact-label {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.impact-hint {
  margin-top: 1px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.impact:hover {
  border-color: var(--green);
}

.impact[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.impact:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

/* ------------------------------------------------------------ attachments */

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  padding: 16px 16px 13px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.dropzone.dragging {
  border-color: var(--green);
  background: var(--accent-soft);
}

.capture-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 620px) {
  .capture-buttons {
    grid-template-columns: 1fr;
  }
}

.capture-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.14s ease,
    transform 0.1s ease,
    box-shadow 0.14s ease;
}

.capture-btn svg {
  width: 20px;
  height: 20px;
  margin-bottom: 5px;
  color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  .capture-btn svg {
    color: var(--mint);
  }
}

.capture-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.capture-sub {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
}

.capture-btn:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.capture-btn:active {
  transform: translateY(0);
}

.capture-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.capture-btn[hidden] {
  display: none;
}

.phi-warning {
  display: flex;
  gap: 9px;
  margin: 10px 0 0;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 12.5px;
  line-height: 1.55;
}

.phi-warning svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
}

@media (prefers-color-scheme: dark) {
  .phi-warning {
    background: #2a2110;
    border-color: #4d3c15;
    color: #fbbf24;
  }
}

.region-gate {
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.dropzone.locked {
  opacity: 0.55;
}

.capture-btn[disabled] {
  cursor: not-allowed;
}

.capture-btn[disabled]:hover {
  border-color: var(--border-strong);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.capture-note {
  margin: 11px 0 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* Stays on screen rather than being a toast the user misses while their browser has
   taken them off to the window they picked. */
.capture-result {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 11px 0 0;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.45;
  animation: impact-in 0.2s ease;
}

.capture-result svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.attachment.just-added {
  animation: attach-flash 2.4s ease;
}

@keyframes attach-flash {
  0%,
  55% {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--ring);
  }
  100% {
    border-color: var(--border);
    box-shadow: none;
  }
}

.dropzone-hint {
  margin: 12px 0 2px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-faint);
}

kbd {
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
}

.drop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 92%, transparent);
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
  pointer-events: none;
}

.dropzone.dragging .drop-overlay {
  display: grid;
}

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

.attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.thumb {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}

.thumb-icon {
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.thumb-icon svg {
  width: 19px;
  height: 19px;
}

.attachment-body {
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.attachment.failed .attachment-meta {
  color: var(--danger);
}

.progress {
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--green);
  transition: width 0.2s ease;
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.privacy-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------- actions */

.turnstile {
  margin-top: 20px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.btn,
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  /* .btn is used on <a> as well as <button>, which would otherwise keep its underline. */
  text-decoration: none;
  transition:
    background 0.14s ease,
    transform 0.1s ease;
}

@media (prefers-color-scheme: dark) {
  .btn,
  .submit-btn {
    color: var(--pine-black);
  }
}

.btn:hover,
.submit-btn:hover {
  background: var(--accent-hover);
}

.btn:active,
.submit-btn:active {
  transform: scale(0.99);
}

.btn:focus-visible,
.submit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.btn[disabled],
.submit-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn.secondary:hover {
  background: var(--surface-sunken);
}

.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.submit-btn.busy .spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.actions-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ------------------------------------------------- customer & data region */

.context-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

@media (max-width: 620px) {
  .context-grid {
    grid-template-columns: 1fr;
  }
}

.context-grid .field {
  margin: 0;
}

.context-hint {
  margin-top: 8px;
}

select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

select:focus-visible {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--ring);
}

.field.invalid select {
  border-color: var(--danger);
}

/* --------------------------------------------------------------- history */

.history {
  margin-top: 30px;
}

.history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.history-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.015em;
}

.history-note {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    border-color 0.14s ease,
    transform 0.1s ease,
    box-shadow 0.14s ease;
}

.tile:hover {
  border-color: var(--green);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tile:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.tile-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tile-ref {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.tile-flag {
  padding: 0 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10.5px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .tile-flag {
    background: #3a2f10;
    color: #fbbf24;
  }
}

.tile-title {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  font-size: 12px;
  color: var(--text-faint);
}

/* ----------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(8 29 31 / 0.35);
  backdrop-filter: blur(2px);
}

.modal {
  position: fixed;
  z-index: 41;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(80vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: impact-in 0.18s ease;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.modal-grid {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: 8px 14px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 13.5px;
}

.modal-grid dt {
  color: var(--text-muted);
}

.modal-grid dd {
  margin: 0;
  word-break: break-word;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section h3 {
  margin: 0 0 7px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.modal-description {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
}

.modal-files {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.modal-foot {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* --------------------------------------------------------------- success */

.success {
  margin-top: 18px;
  padding: 34px 28px 30px;
  text-align: center;
}

.success-tick {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--green);
  animation: pop 0.35s cubic-bezier(0.2, 1.3, 0.5, 1);
}

.success-tick svg {
  width: 27px;
  height: 27px;
}

@keyframes pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

.success h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.success p {
  margin: 0 auto;
  max-width: 46ch;
  color: var(--text-muted);
  font-size: 14.5px;
}

.reference {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 20px;
  padding: 9px 10px 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.success-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.bau-note {
  margin: 26px auto 0;
  max-width: 62ch;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-faint);
}

/* ------------------------------------------------------- recording bar */

.recording-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  border-radius: 999px;
  background: var(--pine-black);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: rise 0.25s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f04438;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
  }
}

.rec-time {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.rec-text {
  color: rgb(255 255 255 / 0.7);
}

@media (max-width: 480px) {
  .rec-text {
    display: none;
  }
}

.rec-stop {
  padding: 7px 15px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--pine-black);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.rec-stop:hover {
  background: var(--soft);
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 340px;
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--pine-black);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.22s ease;
}

.toast svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--mint);
}

.toast.error svg {
  color: #fda29b;
}

@media (max-width: 480px) {
  .toasts {
    left: 16px;
    right: 16px;
    justify-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
