:root {
  color-scheme: light;
  font-family: "Aptos", "Bahnschrift", "Segoe UI", sans-serif;
  background: #eef2f1;
  color: #14201c;
  min-height: 100vh;
  min-height: 100dvh;
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-soft: #f6f8f6;
  --surface-strong: #e7ece8;
  --ink: #14201c;
  --muted: #63706b;
  --faint: #8a9691;
  --line: #d8e0dc;
  --green: #126b54;
  --green-2: #0f5b48;
  --green-soft: #e6f4ee;
  --gold: #b7791f;
  --gold-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #235c8f;
  --blue-soft: #edf5fc;
  --shadow: 0 18px 50px rgba(20, 32, 28, 0.1);
  --shadow-soft: 0 8px 28px rgba(20, 32, 28, 0.07);
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 36px 0;
  background:
    linear-gradient(120deg, rgba(18, 107, 84, 0.08), transparent 34%),
    linear-gradient(180deg, #f8faf8 0%, var(--bg) 46%, #e7ece8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(20, 32, 28, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 28, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 75%);
}

.shell {
  position: relative;
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
}

#appPanel {
  display: grid;
  gap: 18px;
}

/* --- Unified App Header Card --- */

.app-header-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(216, 224, 220, 0.9);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-nav {
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
}

.app-nav-top-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-nav-start {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-nav-brand {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.app-nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.app-nav-links::-webkit-scrollbar {
  display: none;
}

.app-nav-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.app-nav .user-badge {
  margin-top: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.nav-link--active {
  background: var(--green-soft);
  color: var(--green-2);
  font-weight: 700;
}

.panel,
.result {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 224, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.result {
  margin-top: 0;
}

.panel {
  overflow: hidden;
}

.header {
  display: flex;
  gap: 28px;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.header-copy {
  max-width: 620px;
}

h1, h2, p {
  margin: 0;
}

h1 {
  color: var(--ink);
  font-size: 32px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.1;
}

h2 {
  color: var(--ink);
  font-size: 20px;
  font-weight: 730;
  letter-spacing: 0;
}

.header p,
#jobSelection p {
  color: var(--muted);
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.5;
}

.status,
.user-badge,
.connection-status {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  min-height: 30px;
  padding: 7px 12px;
  white-space: nowrap;
}

.status {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
  display: none;
}

.user-badge {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #40514b;
  font-weight: 760;
  margin-top: 12px;
  padding: 7px 12px;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 520px;
  padding-top: 2px;
}

.progress {
  margin: 24px -30px 0;
  padding: 18px 30px;
  background: linear-gradient(180deg, #fbfcfb, var(--surface-soft));
  border-bottom: 1px solid var(--line);
}

.progress ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  padding: 0;
  margin: 0;
}

.step {
  align-items: center;
  color: var(--faint);
  display: flex;
  gap: 10px;
  min-width: 0;
  position: relative;
}

.step:not(:last-child)::after {
  background: var(--line);
  content: "";
  height: 1px;
  left: 44px;
  position: absolute;
  right: 16px;
  top: 17px;
}

.step.completed:not(:last-child)::after {
  background: #9bd0bd;
}

.step-circle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: flex;
  flex: 0 0 34px;
  font-size: 13px;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.step-check {
  display: none;
  width: 15px;
  height: 15px;
}

.step-label {
  color: inherit;
  font-size: 13px;
  font-weight: 750;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step.active .step-circle {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 107, 84, 0.14);
  color: #fff;
}

.step.active .step-label,
.step.completed .step-label {
  color: var(--green-2);
}

.step.completed .step-circle {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.step.completed .step-number {
  display: none;
}

.step.completed .step-check {
  display: block;
}

form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

#applyForm {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#submitButton {
  grid-column: 1 / -1;
  width: 100%;
}

.wide-field {
  grid-column: 1 / -1;
}

.dropzone {
  position: relative;
  align-items: flex-start;
  background: var(--surface-soft);
  border: 1.5px dashed #bdc9c3;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 176px;
  padding: 22px;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.dropzone:hover,
.dropzone.drag-over {
  background: #eff8f3;
  border-color: var(--green);
  box-shadow: var(--shadow-soft);
  transform: translateY(-2px);
}

.dropzone.has-file {
  background: var(--green-soft);
  border-color: #7ebea7;
  border-style: solid;
}

.dropzone-icon {
  width: 36px;
  height: 36px;
  color: var(--green);
  margin-bottom: auto;
}

.dropzone .label {
  color: var(--ink);
  font-size: 16px;
  font-weight: 780;
  line-height: 1.25;
}

.dropzone .hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dropzone input {
  block-size: 1px;
  inline-size: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #384842;
  font-size: 13px;
  font-weight: 760;
}

.swatch-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch-btn {
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  height: 32px;
  padding: 0;
  width: 32px;
  transition: border-color 0.15s, transform 0.15s;
}

.swatch-btn:hover {
  transform: scale(1.15);
}

.swatch-btn.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px #fff inset;
  transform: scale(1.15);
}

.field input,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input {
  min-height: 44px;
  padding: 11px 13px;
}

textarea {
  line-height: 1.58;
  min-height: 180px;
  padding: 14px 44px 14px 14px;
  resize: vertical;
  width: 100%;
}

.notes-field textarea {
  min-height: 116px;
}

.result textarea {
  background: #fbfcfb;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 13px;
}

#resultCoverLetterText {
  min-height: 560px;
}

#resultBody {
  min-height: 320px;
}

.field input:focus,
textarea:focus {
  background: #fff;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 107, 84, 0.12);
}

button {
  align-items: center;
  background: var(--green);
  border: 1px solid transparent;
  border-radius: 7px;
  box-shadow: 0 10px 22px rgba(18, 107, 84, 0.18);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 14px;
  font-weight: 780;
  gap: 8px;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  width: fit-content;
}

button:hover:not(:disabled) {
  background: var(--green-2);
  box-shadow: 0 14px 28px rgba(18, 107, 84, 0.22);
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.secondary,
.header-link,
.logout-btn {
  background: #fff;
  border-color: var(--line);
  box-shadow: none;
  color: #35453f;
}

#sendButton:not(:disabled) {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 10px 22px rgba(18, 107, 84, 0.16);
  color: #fff;
}

#sendButton:not(:disabled):hover {
  background: var(--green-2);
  border-color: var(--green-2);
  color: #fff;
}

.secondary:hover:not(:disabled),
.header-link:hover:not(:disabled) {
  background: var(--surface-soft);
  border-color: #b7c3bd;
  box-shadow: 0 8px 18px rgba(20, 32, 28, 0.08);
  color: var(--ink);
}

.secondary.danger {
  background: var(--red-soft);
  border-color: #f3b3ad;
  color: var(--red);
}

.secondary.danger:hover:not(:disabled),
.logout-btn:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: #f3b3ad;
  box-shadow: 0 8px 18px rgba(180, 35, 24, 0.1);
  color: var(--red);
}

.header-link,
.logout-btn {
  border-radius: 999px;
  font-size: 12px;
  min-height: 30px;
  padding: 0 12px;
}

.result-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 18px;
}

.result-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.preview-expiry {
  align-items: center;
  background: var(--green-soft);
  border: 1px solid #cfe6dc;
  border-radius: 8px;
  color: var(--green-2);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  gap: 8px;
  margin: -4px 0 18px;
  padding: 10px 14px;
}

.preview-expiry-dot {
  background: var(--green);
  border-radius: 50%;
  flex: 0 0 auto;
  height: 8px;
  width: 8px;
}

.preview-expiry.is-warning {
  background: var(--gold-soft);
  border-color: #eed9a8;
  color: #7a5200;
}

.preview-expiry.is-warning .preview-expiry-dot {
  background: var(--gold);
}

.preview-expiry.is-expired {
  background: var(--red-soft);
  border-color: #f1c8c3;
  color: var(--red);
}

.preview-expiry.is-expired .preview-expiry-dot {
  background: var(--red);
}

.preview-expiry .btn-link {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  margin-left: auto;
  padding: 2px 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.preview-expiry.is-expired .btn-link {
  display: inline;
}

.preview-expiry .btn-link:disabled {
  cursor: default;
  opacity: 0.6;
  text-decoration: none;
}

#resultSubject {
  width: 100%;
}

.send-readiness { color: var(--muted); font-size: 13px; margin: -8px 0 14px; }
.pdf-preview-details { margin-top: 14px; }
.pdf-preview-details summary { cursor: pointer; font-weight: 700; }
.pdf-preview-details iframe { background: #fff; border: 1px solid #d7dce2; border-radius: 8px; height: min(75vh, 900px); margin-top: 12px; width: 100%; }

dl {
  display: grid;
  gap: 16px;
  margin: 0;
}

dl div {
  display: grid;
  gap: 7px;
}

.review-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.review-summary > div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.review-summary .wide-review {
  background: transparent;
  border: 0;
  grid-column: 1 / -1;
  padding: 0;
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

dd {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  overflow-wrap: anywhere;
}

.textarea-wrapper {
  position: relative;
  border-radius: 8px;
}

.copy-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(20, 32, 28, 0.06);
  color: var(--muted);
  display: flex;
  height: 32px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 32px;
}

.icon-btn {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(20, 32, 28, 0.06);
  color: var(--muted);
  display: flex;
  height: 32px;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: 44px;
  top: 8px;
  width: 32px;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  box-shadow: 0 6px 14px rgba(20, 32, 28, 0.08);
  color: var(--ink);
  transform: none;
}

.copy-btn:hover:not(:disabled) {
  background: var(--surface-soft);
  box-shadow: 0 6px 14px rgba(20, 32, 28, 0.08);
  color: var(--ink);
  transform: none;
}

.copy-btn.copied {
  background: var(--green-soft);
  border-color: #9bd0bd;
  color: var(--green-2);
  padding: 0 9px;
  width: auto;
}

.copy-btn.copied svg {
  display: none;
}

.copy-btn.copied::after {
  content: "Copied";
  font-size: 11px;
  font-weight: 800;
}

.error,
.notice.failure {
  background: var(--red-soft);
  border-color: #f6c5c1;
}

.error h2,
.error p,
.notice.failure h2,
.notice.failure p {
  color: var(--red);
}

.notice.success {
  background: var(--green-soft);
  border-color: #b8ddcf;
}

.notice.success h2,
.notice.success p {
  color: var(--green-2);
}

.notice p,
.error p {
  font-size: 14px;
  line-height: 1.55;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

#jobList {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

#jobList button {
  min-height: 54px;
  padding: 12px 16px;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

#jobDetailsForm {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#jobDetailsReview {
  border-top: 3px solid var(--green);
}

#jobDetailsReview textarea {
  min-height: 160px;
}

#generateLetterButton {
  grid-column: 1 / -1;
  width: 100%;
}

.spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.75s linear infinite;
}

.loading .spinner {
  display: inline-block;
}

#submitButton.loading .btn-icon {
  display: none;
}

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

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result:not([hidden]),
#jobSelection:not([hidden]),
#jobDetailsReview:not([hidden]),
#sendPanel:not([hidden]),
#errorPanel:not([hidden]),
#settingsPanel:not([hidden]),
#adminPanel:not([hidden]),
#paymentPanel:not([hidden]),
#historyPanel:not([hidden]),
#supportPanel:not([hidden]),
#adminDashboardPanel:not([hidden]),
#phoneVerifyPanel:not([hidden]),
#appHistoryPanel:not([hidden]),
#forgotPasswordPanel:not([hidden]),
#resetPasswordPanel:not([hidden]) {
  animation: fadeSlideUp 0.24s ease-out;
}

#loginPanel,
#registerPanel,
#forgotPasswordPanel,
#resetPasswordPanel {
  max-width: 420px;
  margin: 3.5vh auto 20px;
  width: min(420px, 100%);
  padding: 16px 20px;
}

#loginPanel .header,
#registerPanel .header,
#forgotPasswordPanel .header,
#resetPasswordPanel .header {
  align-items: center;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  position: relative;
  text-align: center;
}

#loginPanel .header p,
#registerPanel .header p,
#forgotPasswordPanel .header p,
#resetPasswordPanel .header p {
  font-size: 13.5px;
  color: var(--muted);
}

#loginForm,
#registerForm,
#forgotPasswordForm,
#resetPasswordForm {
  display: grid;
  gap: 8px;
  margin-top: 2px;
}

#adminForm,
#settingsForm {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

#loginPanel .field,
#registerPanel .field,
#forgotPasswordPanel .field,
#resetPasswordPanel .field {
  gap: 4px;
}

#loginPanel .field label,
#registerPanel .field label,
#forgotPasswordPanel .field label,
#resetPasswordPanel .field label {
  font-size: 12.5px;
}

#loginPanel .field input,
#registerPanel .field input,
#forgotPasswordPanel .field input,
#resetPasswordPanel .field input {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

#loginPanel .legal-links,
#registerPanel .legal-links {
  margin-top: 6px;
  font-size: 12px;
}

.login-error,
.forgot-error,
.forgot-success,
.admin-success,
.admin-error,
.settings-success,
.settings-error {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
}

.login-error,
.forgot-error,
.admin-error,
.settings-error {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.forgot-success,
.admin-success,
.settings-success {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

#loginButton,
#forgotButton,
#resetButton,
#adminCreateButton,
#settingsSaveButton {
  margin-top: 3px;
  width: 100%;
}

/* Animated fill for the login and registration actions only. */
.auth-pill-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 10rem;
  background-color: var(--green) !important;
  background-image: linear-gradient(var(--green-2), var(--green-2)), linear-gradient(var(--green), var(--green));
  background-position: left center, left center;
  background-repeat: no-repeat;
  background-size: 0% 100%, 100% 100%;
  transition: color .55s ease, background-size .65s ease, transform .24s ease, box-shadow .24s ease;
}
.auth-pill-button::after,
.auth-pill-button::before {
  display: none;
  position: absolute;
  z-index: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  content: "";
}
.auth-pill-button::after { background: var(--green); }
.auth-pill-button::before {
  width: 0;
  z-index: 1;
  background: var(--green-2);
  transition: width .55s ease;
  pointer-events: none;
}
.auth-pill-button:hover:not(:disabled)::before,
.auth-pill-button:focus-visible:not(:disabled)::before { width: 100%; }
.auth-pill-button > span { position: relative; z-index: 2; }
.auth-pill-button:hover:not(:disabled),
.auth-pill-button:focus-visible:not(:disabled) {
  background-size: 100% 100%, 100% 100%;
  background-color: var(--green-2) !important;
}

#loginButton {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  box-shadow: none;
  transform: none;
}

#loginButton:hover:not(:disabled),
#loginButton:active:not(:disabled) {
  box-shadow: none;
  transform: none;
}

#loginButton.auth-pill-button {
  width: auto;
  min-width: 150px;
  padding-inline: 22px;
  border-radius: 10rem;
  background-color: var(--green) !important;
}
#loginButton.auth-pill-button:hover:not(:disabled),
#loginButton.auth-pill-button:focus-visible:not(:disabled) {
  background-color: var(--green) !important;
  box-shadow: 0 10px 22px rgba(18, 107, 84, 0.18);
  transform: translateY(-1px);
}

#registerButton.auth-pill-button {
  width: auto;
  min-width: 150px;
  padding-inline: 22px;
}

/* Button 3-style outline sweep for navigation back actions. */
.back-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid var(--green) !important;
  border-radius: 4px;
  color: var(--green-2) !important;
  background: transparent !important;
  box-shadow: none !important;
  transition: color .5s ease, border-color .5s ease, transform .24s ease;
}
.back-button::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: var(--green);
  content: "";
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .55s ease;
}
.back-button > span { position: relative; z-index: 1; }
.back-button:hover:not(:disabled),
.back-button:focus-visible:not(:disabled) {
  color: #fff !important;
  border-color: var(--green) !important;
  background: transparent !important;
  transform: translateY(-1px);
}
.back-button:hover:not(:disabled)::before,
.back-button:focus-visible:not(:disabled)::before { transform: scaleX(1); transform-origin: left center; }

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.field-hint a {
  color: var(--green-2);
}

.pw-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-wrapper input {
  width: 100%;
  padding-right: 56px;
}

.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  min-height: auto;
}

.pw-toggle:hover:not(:disabled),
.pw-toggle:active:not(:disabled) {
  color: var(--green-2);
  background: var(--green-soft);
  box-shadow: none;
  transform: translateY(-50%);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.password-reqs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
}

.password-reqs span {
  color: var(--red);
  transition: color 0.15s;
}

.password-reqs span.met {
  color: var(--green-2);
}

.password-confirm-msg {
  font-size: 12px;
  margin-top: 2px;
  line-height: 1.4;
}

.password-confirm-msg.match {
  color: var(--green-2);
}

.password-confirm-msg.no-match {
  color: var(--red);
}

.gmail-connection {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.connection-status {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.connection-status.connected {
  background: var(--green-soft);
  border-color: #b8ddcf;
  color: var(--green-2);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 6px 0;
}

/* ========================================
   Integrated Subscription Status Bar
   ======================================== */

.sub-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fbfa;
  border-top: 1px solid rgba(216, 224, 220, 0.7);
  padding: 8px 18px;
  font-size: 13px;
  flex-wrap: wrap;
}

.sub-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.sub-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 10px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.sub-badge--active {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.sub-badge--expired {
  background: var(--gold-soft);
  border: 1px solid #edd698;
  color: var(--gold);
}

.sub-badge--unpaid {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.sub-badge--suspended {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.sub-badge--checking {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.sub-plan {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  white-space: nowrap;
}

.sub-divider {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.sub-usage {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.sub-days {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.sub-status-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sub-action-pay {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-weight: 800;
}

.sub-action-pay:hover:not(:disabled) {
  background: var(--green-2);
  border-color: var(--green-2);
  color: #fff;
}

.sub-action-renew {
  background: var(--gold-soft);
  border-color: #edd698;
  color: var(--gold);
  font-weight: 800;
}

.sub-action-renew:hover:not(:disabled) {
  background: #fdeab0;
  border-color: #dcc06e;
}

/* ========================================
   Phone Verification
   ======================================== */

.phone-verify-error {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.phone-verify-success {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

#phoneVerifyButton {
  margin-top: 3px;
  width: 100%;
}

#phoneResendButton {
  font-size: 13px;
  padding: 8px 14px;
  width: fit-content;
}

/* ========================================
   Gate Banner
   ======================================== */

.gate-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--gold-soft);
  border: 1px solid #edd698;
  border-radius: 8px;
  padding: 14px 20px;
}

.gate-banner-icon {
  flex-shrink: 0;
  color: var(--gold);
  display: flex;
  align-items: center;
}

.gate-banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.gate-banner-text strong {
  color: var(--gold);
  font-size: 14px;
}

.gate-banner-text span {
  color: #8a6d24;
  font-size: 13px;
  line-height: 1.4;
}

.gate-banner .secondary {
  flex-shrink: 0;
  min-height: 36px;
  font-size: 13px;
  padding: 0 14px;
}

/* ========================================
   Data Tables
   ======================================== */

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--surface-soft);
}

.data-table .mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
}

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

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

.status-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  padding: 4px 10px;
  white-space: nowrap;
  display: inline-block;
}

.status-pill--active {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.status-pill--expired {
  background: var(--gold-soft);
  border: 1px solid #edd698;
  color: var(--gold);
}

.status-pill--unpaid {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pill--suspended {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.status-pill--confirmed {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.status-pill--pending {
  background: var(--gold-soft);
  border: 1px solid #edd698;
  color: var(--gold);
}

.status-pill--amount-mismatch {
  background: var(--gold-soft);
  border: 1px dashed #dcc06e;
  color: var(--gold);
}

.status-pill--failed {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.status-pill--info {
  background: var(--blue-soft);
  border: 1px solid #b3d0ea;
  color: var(--blue);
}

.status-pill--activate,
.status-pill--suspend,
.status-pill--match,
.status-pill--create {
  background: var(--blue-soft);
  border: 1px solid #b3d0ea;
  color: var(--blue);
}

.status-pill--awarded {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.status-pill--capped {
  background: var(--blue-soft);
  border: 1px solid #b3d0ea;
  color: var(--blue);
}

.status-pill--reversed {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pill--flagged {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.status-pill--error {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

/* ========================================
   Refer a friend (settings)
   ======================================== */

.refer-section h3 {
  font-size: 15px;
  font-weight: 780;
  color: var(--green-2);
  margin: 0 0 6px;
}

.refer-section > p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 14px;
}

.refer-code-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 14px;
}

.refer-code-row input {
  flex: 1 1 auto;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  outline: none;
  padding: 11px 13px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.refer-code-row input:focus {
  background: #fff;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 107, 84, 0.12);
}

.refer-code-row button {
  flex: 0 0 auto;
  min-height: 44px;
}

#referralCodeDisplay {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  background: var(--green-soft);
  border-color: #b9d5c7;
  color: var(--green-2);
}

#referralCodeDisplay:focus {
  background: var(--green-soft);
  border-color: var(--green);
}

#referralLinkDisplay {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface-soft);
}

#referralLinkDisplay:focus {
  background: #fff;
}

.refer-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.refer-stat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 10px;
  text-align: center;
}

.refer-stat-value {
  display: block;
  font-size: 23px;
  font-weight: 800;
  color: var(--green-2);
  line-height: 1.2;
}

.refer-stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.refer-history h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 760;
  color: #384842;
}

/* ========================================
   Mini Buttons (admin table actions)
   ======================================== */

.mini-btn {
  min-height: 30px;
  min-width: 0;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 760;
  border-radius: 6px;
}

.danger-mini {
  background: var(--red-soft);
  border-color: #f6c5c1;
  color: var(--red);
  box-shadow: none;
}

.danger-mini:hover:not(:disabled) {
  background: #ffe0db;
  border-color: #f3b3ad;
  color: var(--red);
}

/* ========================================
   Payment Panel
   ======================================== */

.payment-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.payment-details > div {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.payment-details dt {
  margin-bottom: 6px;
}

.payment-amount dd {
  font-size: 22px;
  font-weight: 800;
  color: var(--green);
}

.payment-ref-code {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 18px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.05em;
}

.payment-steps {
  margin-bottom: 16px;
}

.payment-steps h3 {
  font-size: 15px;
  font-weight: 780;
  margin-bottom: 10px;
}

.payment-steps ol {
  margin: 0;
  padding-left: 20px;
}

.payment-steps li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
}

.payment-ref-inline {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-weight: 800;
}

.payment-note {
  background: var(--blue-soft);
  border: 1px solid #b3d0ea;
  border-radius: 7px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.payment-note p {
  font-size: 13px;
  color: var(--blue);
  line-height: 1.5;
}

#paymentCopyRef {
  width: fit-content;
}

#paymentDoneButton {
  width: 100%;
  margin-top: 8px;
}

#paymentRetryButton {
  width: 100%;
  margin-bottom: 8px;
}

.payment-loading {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  gap: 10px;
  justify-content: center;
  padding: 28px 0;
}

.payment-loading .spinner {
  border-color: var(--line);
  border-top-color: var(--green);
}

.payment-state-notice {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 12px 14px;
}

.payment-state-notice strong {
  display: block;
  margin-bottom: 2px;
}

.payment-state-notice--success {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.payment-state-notice--pending {
  background: var(--blue-soft);
  border: 1px solid #b3d0ea;
  color: var(--blue);
}

.payment-state-notice--warning {
  background: var(--gold-soft);
  border: 1px solid #edd698;
  color: var(--gold);
}

/* ========================================
   History & Support Panels
   ======================================== */

.history-empty {
  text-align: center;
  padding: 30px 0;
}

.history-empty p {
  color: var(--muted);
  font-size: 14px;
}

.history-load-more {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.support-success {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.support-error {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

#supportSubmitButton {
  width: 100%;
}

/* ========================================
   Admin Dashboard
   ======================================== */

.admin-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 18px;
  background: var(--surface-soft);
  overflow-x: auto;
  scrollbar-width: thin;
}

.admin-tab {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.admin-tab:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.admin-tab.active {
  color: var(--green);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(20, 32, 28, .12);
}

.admin-tab.active:hover {
  background: var(--green-soft);
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-stat {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.admin-stat-value {
  display: block;
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.admin-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 760;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.admin-tab-content .admin-error {
  margin-top: 14px;
}

/* ========================================
   Health Grid
   ======================================== */

.health-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.health-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.health-card dt {
  font-size: 11px;
  margin-bottom: 6px;
}

.health-card dd {
  font-size: 16px;
  font-weight: 800;
}

.health-value--healthy {
  color: var(--green-2);
}

.health-value--degraded {
  color: var(--gold);
}

.health-value--down {
  color: var(--red);
}

.health-value--unknown {
  color: var(--muted);
}

#healthSmsErrors {
  margin-top: 16px;
}

#healthSmsErrors h3 {
  font-size: 15px;
  font-weight: 780;
  margin-bottom: 10px;
}

/* ========================================
   Toast Notifications
   ======================================== */

#toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  max-width: 420px;
  width: calc(100% - 36px);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(20, 32, 28, 0.15);
  padding: 14px 12px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  pointer-events: auto;
  animation: toastIn 0.25s ease-out;
}

.toast--dismissing {
  animation: toastOut 0.25s ease-in forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  margin-top: 1px;
}

.toast--error { border-left: 3px solid var(--red); }
.toast--error .toast-icon { background: var(--red-soft); color: var(--red); }

.toast--success { border-left: 3px solid var(--green); }
.toast--success .toast-icon { background: var(--green-soft); color: var(--green-2); }

.toast--warning { border-left: 3px solid var(--gold); }
.toast--warning .toast-icon { background: var(--gold-soft); color: var(--gold); }

.toast--info { border-left: 3px solid var(--blue); }
.toast--info .toast-icon { background: var(--blue-soft); color: var(--blue); }

.toast-message {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-action {
  flex-shrink: 0;
  background: var(--green);
  border: none;
  border-radius: 6px;
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 780;
  min-height: 30px;
  padding: 0 12px;
  white-space: nowrap;
  transition: background 0.15s;
}

.toast-action:hover { background: var(--green-2); }

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  min-height: 0;
  padding: 0 2px;
  width: auto;
  transition: color 0.15s;
}

.toast-close:hover { color: var(--ink); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* Phones: keep toasts a compact card instead of a near-full-width bar, and
   clear the notch / status bar in the installed app (fixed elements ignore the
   body's safe-area padding). Falls back to the base top/right if env() is
   unsupported. */
@media (max-width: 620px) {
  #toast-container {
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    width: min(340px, calc(100% - 24px));
    gap: 8px;
  }

  .toast {
    padding: 11px 12px;
    font-size: 12.5px;
    border-radius: 10px;
  }

  .toast-icon {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .toast-action {
    font-size: 11.5px;
    padding: 0 10px;
  }

  .toast-close {
    font-size: 16px;
  }

  .toast--update {
    width: min(280px, calc(100vw - 24px));
    justify-self: end;
    gap: 8px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .toast--update .toast-icon {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  .toast--update .toast-action {
    min-height: 28px;
    padding: 0 8px;
    font-size: 11px;
  }
}

/* ========================================
   Admin Action Modal
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 32, 28, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(20, 32, 28, 0.25);
  width: min(480px, 100%);
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

.modal .result-header {
  margin-bottom: 0;
  padding-bottom: 14px;
}

.admin-action-submit {
  margin-top: 3px;
  width: 100%;
}

.danger-btn {
  background: var(--red);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.18);
}

.danger-btn:hover:not(:disabled) {
  background: #9a1e15;
  box-shadow: 0 14px 28px rgba(180, 35, 24, 0.22);
}

/* ========================================
   Danger Zone (Settings)
   ======================================== */

.danger-zone {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  border-radius: 8px;
  padding: 18px 20px;
  margin-top: 10px;
}

.danger-zone h3 {
  font-size: 15px;
  font-weight: 780;
  color: var(--red);
  margin-bottom: 6px;
}

.danger-zone > p {
  font-size: 13px;
  color: #8a4540;
  line-height: 1.5;
  margin-bottom: 12px;
}

.danger-zone-success,
.danger-zone-error {
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.danger-zone-success {
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  color: var(--green-2);
}

.danger-zone-error {
  background: var(--red-soft);
  border: 1px solid #f6c5c1;
  color: var(--red);
}

.danger-zone-btn {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.18);
}

.danger-zone-btn:hover:not(:disabled) {
  background: #9a1e15;
  border-color: #9a1e15;
  box-shadow: 0 14px 28px rgba(180, 35, 24, 0.22);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 860px) {
  .shell {
    width: min(720px, calc(100% - 28px));
  }

  #applyForm {
    grid-template-columns: 1fr;
  }

  #jobDetailsForm {
    grid-template-columns: 1fr;
  }

  .dropzone {
    min-height: 142px;
  }

  .payment-details {
    grid-template-columns: 1fr;
  }

  .admin-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .health-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body {
    padding: 14px 0;
  }

  .shell {
    width: calc(100% - 20px);
  }

  .panel,
  .result {
    padding: 18px;
  }

  #loginPanel,
  #registerPanel,
  #forgotPasswordPanel,
  #resetPasswordPanel {
    margin: 1.5vh auto 16px;
    padding: 14px;
  }

  .header,
  .result-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .header-right,
  .result-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .header-right .status {
    justify-content: center;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 19px;
  }

  button,
  .secondary,
  .header-link,
  .logout-btn {
    width: 100%;
  }

  .progress {
    margin: 18px -18px 0;
    padding: 14px 18px;
  }

  .step {
    flex-direction: column;
    gap: 7px;
    justify-content: flex-start;
    text-align: center;
  }

  .step:not(:last-child)::after {
    left: calc(50% + 23px);
    right: calc(-50% + 23px);
    top: 17px;
  }

  .step-label {
    font-size: 12px;
  }

  #appPanel {
    gap: 12px;
  }

  .app-header-card {
    border-radius: 8px;
  }

  .dropzone {
    min-height: 96px;
    padding: 12px 14px;
    gap: 4px;
  }

  .dropzone .dropzone-icon {
    width: 24px;
    height: 24px;
  }

  .dropzone .label {
    font-size: 13.5px;
  }

  .dropzone .hint {
    font-size: 11.5px;
  }

  .review-summary {
    grid-template-columns: 1fr;
  }

  #resultCoverLetterText,
  #resultBody {
    min-height: 280px;
  }

  .app-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px 8px;
    min-height: auto;
  }

  .app-nav-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }

  .app-nav-start {
    min-width: 0;
  }

  .app-nav-brand {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .app-nav-end {
    margin-left: auto;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .app-nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 2px;
  }

  .nav-link {
    font-size: 12.5px;
    padding: 5px 10px;
    flex-shrink: 0;
  }

  .admin-tabs {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 3px;
    margin-bottom: 14px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .admin-tabs .admin-tab {
    width: auto;
    min-width: max-content;
    min-height: 38px;
    flex: 0 0 auto;
    padding: 0 12px;
    font-size: 12px;
  }

  .app-nav .logout-btn,
  .app-nav .header-link {
    width: auto;
    font-size: 12px;
    padding: 4px 8px;
  }

  .sub-status {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }

  .sub-status-info {
    gap: 6px 8px;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
  }

  .sub-divider {
    display: inline-block;
    height: 12px;
  }

  .sub-status-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .sub-status-actions button,
  .sub-status-actions .header-link {
    width: auto;
    flex: 1 1 auto;
    font-size: 11.5px;
    padding: 5px 8px;
    min-height: 28px;
    text-align: center;
    justify-content: center;
  }

  .gate-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .gate-banner .secondary {
    width: 100%;
  }

  .admin-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .health-grid {
    grid-template-columns: 1fr;
  }

  .admin-tabs {
    gap: 2px;
  }

  .admin-tab {
    font-size: 12px;
    padding: 0 10px;
    min-height: 36px;
  }

  .action-cell {
    flex-direction: column;
  }

  .action-cell .mini-btn {
    width: 100%;
  }

  .data-table {
    font-size: 12px;
  }

  .data-table th,
  .data-table td {
    padding: 8px;
  }

  .refer-code-row {
    flex-wrap: wrap;
  }

  .refer-code-row input {
    flex: 1 1 100%;
  }

  .refer-code-row button {
    flex: 1 1 auto;
    width: auto;
    min-height: 42px;
  }

  .refer-stats {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
  }

  .refer-stat {
    padding: 8px;
  }

  .refer-stat-value {
    font-size: 19px;
  }

  .payment-details {
    grid-template-columns: 1fr;
  }

  .payment-ref-code {
    font-size: 16px;
  }

  .modal {
    padding: 16px;
    margin: 10px;
  }

}

/* ========================================
   Onboarding: Setup Checklist
   ======================================== */

.setup-checklist {
  background: linear-gradient(135deg, var(--green-soft) 0%, #f3faf6 100%);
  border: 1px solid #c9e3d6;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  margin: 20px 0 28px;
  padding: 18px 20px;
}

.setup-checklist-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.setup-checklist-head h3 {
  color: var(--green-2);
  font-size: 16px;
  font-weight: 730;
  margin: 0;
}

.setup-checklist-sub {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  margin-top: 4px;
}

.setup-checklist-dismiss {
  background: transparent;
  border: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 2px 6px;
}

.setup-checklist-dismiss:hover {
  color: var(--ink);
}

.setup-progress {
  background: rgba(255, 255, 255, 0.75);
  border-radius: 999px;
  height: 8px;
  margin: 14px 0 8px;
  overflow: hidden;
}

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

.setup-progress-label {
  color: var(--green-2);
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}

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

.setup-step {
  align-items: center;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 8px 6px;
}

.setup-step + .setup-step {
  border-top: 1px solid rgba(216, 224, 220, 0.65);
}

.setup-step-check {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: transparent;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  height: 22px;
  justify-content: center;
  width: 22px;
  flex: 0 0 auto;
}

.setup-step--done .setup-step-check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.setup-step-text {
  color: var(--ink);
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 600;
}

.setup-step--done .setup-step-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--green);
}

.setup-step-action {
  background: var(--green);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
}

.setup-step-action:hover {
  background: var(--green-2);
}

.setup-step--done .setup-step-action {
  display: none;
}

.setup-flash {
  animation: setupFlash 1s ease-out;
}

@keyframes setupFlash {
  0% { box-shadow: 0 0 0 0 rgba(18, 107, 84, 0.55); }
  100% { box-shadow: 0 0 0 14px rgba(18, 107, 84, 0); }
}

/* ========================================
   Onboarding: Spotlight Tour
   ======================================== */

.tour-overlay {
  inset: 0;
  position: fixed;
  z-index: 9000;
}

.tour-pane {
  background: transparent;
  cursor: pointer;
  position: fixed;
}

.tour-spotlight {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(10, 20, 16, 0.6), 0 0 0 2px var(--green);
  position: fixed;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
  pointer-events: none;
}

.tour-target {
  position: relative;
  z-index: 9001;
}

.tour-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-width: 300px;
  padding: 16px;
  position: fixed;
  width: 280px;
  z-index: 9002;
}

.tour-popover--above {
  margin-top: 0;
}

.tour-popover-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 730;
  margin: 0 0 6px;
}

.tour-popover-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.tour-popover-footer {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
}

.tour-skip {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 6px;
}

.tour-skip:hover {
  color: var(--ink);
}

.tour-dots {
  display: inline-flex;
  gap: 5px;
}

.tour-dot {
  background: var(--line);
  border-radius: 50%;
  height: 7px;
  width: 7px;
}

.tour-dot--active {
  background: var(--green);
  width: 18px;
  border-radius: 999px;
}

.tour-next {
  background: var(--green);
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
}

.tour-next:hover {
  background: var(--green-2);
}

/* --- Legal pages (Terms & Conditions, Privacy Policy) --- */

.legal-shell {
  width: min(860px, calc(100% - 36px));
}

.legal-panel {
  overflow: visible;
}

.legal-body {
  line-height: 1.65;
  color: var(--ink);
}

.legal-body .legal-lead {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 8px;
}

.legal-body h2 {
  font-size: 17px;
  margin: 26px 0 10px;
  color: var(--ink);
}

.legal-body p {
  margin: 0 0 14px;
}

.legal-body ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.legal-body li {
  margin: 0 0 8px;
}

.legal-body a,
.legal-nav a {
  color: var(--green-2);
}

.legal-nav {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 18px;
  font-size: 14px;
}

/* --- Consent checkbox --- */

.consent-field {
  align-items: flex-start;
  display: flex;
  gap: 8px;
  margin: 8px 0 2px;
}

.consent-field input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--green);
  height: 15px;
  width: 15px;
}

.consent-field label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.consent-field a {
  color: var(--green-2);
}

.legal-links {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
  text-align: center;
}

.legal-links a {
  color: var(--muted);
  text-decoration: underline;
}

.legal-links a:hover {
  color: var(--green-2);
}

.settings-legal {
  margin-top: 0;
  text-align: left;
}

/* ========================================
   PWA Saved Documents & Dropzone Indicators
   ======================================== */

.dropzone-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-doc-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.saved-doc-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  color: var(--green-2);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-doc-banner-info svg {
  flex-shrink: 0;
  stroke: var(--green-2);
}

.saved-doc-banner-info > span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-doc-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.banner-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--green-2);
  background: var(--green-soft);
  border: 1px solid #b8ddcf;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
  min-height: 0;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.banner-link-btn svg {
  flex-shrink: 0;
}

button.banner-link-btn:hover:not(:disabled) {
  background: #d7ece3;
  border-color: #7ebea7;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

button.banner-link-btn:active:not(:disabled) {
  transform: translateY(0);
}

.banner-link-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(18, 107, 84, 0.12);
}

.banner-link-btn--danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f6c5c1;
}

button.banner-link-btn--danger:hover:not(:disabled) {
  background: #fde8e6;
  border-color: #e5a49f;
}

.banner-link-btn--danger:focus-visible {
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.save-doc-checkbox {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding: 0 4px;
}

.save-doc-checkbox label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.save-doc-checkbox input[type="checkbox"] {
  accent-color: var(--green);
  cursor: pointer;
  margin: 0;
}

/* ========================================
   Settings Tabs & Sub-Cards
   ======================================== */

.settings-tab-nav {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.settings-tab-nav::-webkit-scrollbar {
  display: none;
}

.settings-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: none;
  min-height: 0;
  transition: all 0.16s ease;
  user-select: none;
}

.settings-tab-btn svg {
  flex-shrink: 0;
}

.settings-tab-btn:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.04);
}

.settings-tab-btn.is-active {
  color: var(--ink);
  background: #fff;
  border-color: rgba(20, 32, 28, 0.06);
  box-shadow: 0 2px 8px rgba(20, 32, 28, 0.08);
  font-weight: 700;
}

.settings-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.2;
}

.settings-tab-pane {
  display: block;
}

.settings-tab-pane[hidden] {
  display: none !important;
}

.settings-subcard {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

.settings-subcard-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 3px;
  color: var(--ink);
}

.settings-subcard-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.4;
}

.settings-subcard .field:last-child {
  margin-bottom: 0;
}

/* --- Saved Documents in Settings --- */

.saved-docs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.saved-docs-header > div {
  min-width: 0;
  flex: 1 1 auto;
}

.doc-storage-badge {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-box {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.doc-box--column {
  flex-direction: column;
  align-items: stretch;
}

.doc-box-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.doc-box-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.doc-box-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-box-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.doc-box-meta strong {
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.doc-box-meta span {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: break-word;
  word-break: break-word;
}

.doc-box-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.doc-box-actions > label.btn-sm,
.doc-box-actions > button.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.btn-sm {
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1.2;
  box-sizing: border-box;
}

.btn-sm.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-sm.btn-secondary:hover {
  background: var(--surface-soft);
  border-color: #bdc9c3;
}

.btn-sm.btn-danger {
  background: #fff;
  border-color: #f0c0ba;
  color: var(--red);
}

.btn-sm.btn-danger:hover {
  background: var(--red-soft);
  border-color: #e5a49f;
}

.supporting-docs-list {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.supporting-doc-item,
.saved-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.supporting-doc-item:hover,
.saved-doc-item:hover {
  border-color: #bdc9c3;
}

.supporting-doc-item.is-active,
.saved-doc-item.is-active {
  border-color: var(--green);
  background: #f6fbf8;
}

.supporting-doc-info,
.saved-doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  cursor: pointer;
}

.saved-doc-radio {
  accent-color: var(--green);
  cursor: pointer;
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.saved-doc-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--green-2);
  flex-shrink: 0;
}

.saved-doc-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.saved-doc-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.supporting-doc-name,
.saved-doc-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.doc-active-badge {
  display: inline-flex;
  align-items: center;
  background: var(--green-soft);
  color: var(--green-2);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  line-height: 1.2;
}

.supporting-doc-size,
.saved-doc-meta {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.saved-doc-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.empty-docs-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
  font-style: italic;
}

/* --- Document Picker Modal --- */
.doc-picker-modal-box {
  width: min(480px, calc(100vw - 28px));
  max-width: 100%;
  padding: 20px 16px;
  box-sizing: border-box;
  overflow: hidden;
}

.doc-picker-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 2px;
}

.doc-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.doc-picker-item:hover {
  border-color: #bdc9c3;
  background: var(--surface-soft);
}

.doc-picker-item.is-selected {
  border-color: var(--green);
  background: #f6fbf8;
}

.doc-picker-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.doc-picker-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.doc-picker-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.doc-picker-item-title-text {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 0 1 auto;
}

.doc-picker-item-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 620px) {
  .saved-docs-header {
    flex-wrap: wrap;
  }

  .saved-doc-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
    font-size: 12px;
  }

  .saved-doc-banner-info {
    width: 100%;
  }

  .saved-doc-banner-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid rgba(18, 107, 84, 0.15);
    padding-top: 6px;
    gap: 8px;
  }

  .saved-doc-banner-actions > .banner-link-btn {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    padding: 6px 10px;
  }

  .doc-box {
    padding: 12px 14px;
  }

  .doc-box-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .doc-box-left {
    width: 100%;
  }

  .doc-box-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .doc-box-actions > label.btn-sm,
  .doc-box-actions > button.btn-sm {
    flex: 1 1 0;
    min-height: 36px;
    padding: 8px 10px;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
  }

  .supporting-doc-item,
  .saved-doc-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 12px;
  }

  .supporting-doc-info,
  .saved-doc-info {
    width: 100%;
    min-width: 0;
  }

  .saved-doc-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    gap: 6px;
  }

  .saved-doc-actions > .btn-sm {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
    min-height: 32px;
    padding: 6px 10px;
    box-sizing: border-box;
  }

  .doc-storage-footer {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }
}

/* --- Installed PWA (standalone / minimal-ui): clear notches and gesture bars --- */
@media (display-mode: standalone), (display-mode: minimal-ui) {
  body {
    padding-top: calc(24px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* --- Touch-first devices: keep inputs at 16px+ so iOS Safari doesn't auto-zoom --- */
@media (pointer: coarse) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px;
  }
}
