/* Partner Store — warm & approachable design system */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  --color-bg: #F5F9F9;
  --color-bg-warm: #E8F3F3;
  --color-card: #FFFEFE;
  --color-text: #2A3A3A;
  --color-text-muted: #6B7B7B;
  --color-primary: #0092B3;
  --color-primary-hover: #007A96;
  --color-primary-dark: #006280;
  --color-primary-soft: #E0F4F8;
  --color-secondary: #4F7A5B;
  --color-secondary-soft: #E4EEE3;
  --color-border: #D4E8E8;
  --color-error: #B23B2E;
  --color-error-soft: #FBE5E1;

  --color-accent-online: #3A6EA5;
  --color-accent-online-soft: #E2ECF5;
  --color-accent-local: #2F8577;
  --color-accent-local-soft: #E1EFEA;

  --color-market-teal: #00A0B0;
  --color-market-teal-soft: #E0F4F6;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  --shadow-card: 0 4px 16px rgba(58, 46, 39, 0.08), 0 1px 3px rgba(58, 46, 39, 0.06);
  --shadow-lift: 0 8px 24px rgba(58, 46, 39, 0.12);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--color-bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: radial-gradient(circle at top left, var(--color-bg-warm) 0%, var(--color-bg) 45%);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, legend {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

h1 { font-size: 2rem; margin: 0 0 0.25em; }
h2 { font-size: 1.375rem; margin: 2em 0 0.75em; }
h3 { font-size: 1.1rem; margin: 1.5em 0 0.5em; }

a {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
  word-break: break-word;
}

a:hover {
  color: var(--color-primary-hover);
  border-bottom-color: currentColor;
}

/* ---- Site header ---- */

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  padding: 1rem max(1.5rem, calc((100% - 880px) / 2)) 0.75rem;
  animation: rise 0.5s ease both;
}

.site-header .wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-primary);
}

.site-header .tagline {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.site-header .lang-switcher {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  font-size: 0.85rem;
}

.site-header .lang-switcher a {
  color: var(--color-text-muted);
}

.site-header .lang-switcher .lang-switcher-active {
  font-weight: 700;
  color: var(--color-primary);
}

/* ---- Page shell ---- */

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  animation: rise 0.6s ease both;
}

/* Wider layout for staff back office */
.page-staff {
  max-width: 1200px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  margin-bottom: 1.75rem;
}

.card + .card {
  margin-top: -0.25rem;
}

.subtitle {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-top: -0.35em;
}

/* ---- Forms ---- */

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.75rem;
}

fieldset + fieldset {
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}

legend {
  font-size: 1.05rem;
  padding: 0;
  margin-bottom: 1rem;
}

form p, .field {
  margin: 0 0 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="file"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  max-width: 420px;
}

textarea {
  min-height: 5.5em;
  resize: vertical;
}

/* ---- Field width helpers ("appropriate for Singapore"-length values) ---- */

.field--narrow input { max-width: 130px; }
.field--medium input { max-width: 220px; }
.field--wide input, .field--wide textarea { max-width: 100%; }

/* ---- Two-fields-per-row layout, mobile-friendly ---- */

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin-bottom: 1.6rem;
}

.field-row > p {
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: 1fr;
  }
}

/* ---- "Applying as" fixed store-type indicator (choose-path already decided this) ---- */

.applying-as {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.6rem;
}

.applying-as strong {
  color: var(--color-text);
}

/* ---- Required-field marker ---- */

.required-mark {
  color: var(--color-primary);
  margin-left: 0.15em;
}

.required-legend {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: -0.5rem 0 1.25rem;
}

/* ---- Yes/No toggle buttons (replaces boring checkboxes/selects for y/n questions) ---- */

.yn-toggle {
  display: inline-flex;
  gap: 0.6rem;
}

.yn-toggle-checkbox {
  display: none;
}

.yn-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.yn-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.yn-btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(226, 98, 45, 0.3);
}

/* ---- Rich text editor (Store Description) ---- */

.rich-text-editor {
  background: #fff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  max-width: 100%;
}

.rich-text-editor .ql-toolbar {
  border: none;
  border-bottom: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.rich-text-editor .ql-container {
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
}

.rich-text-editor .ql-editor {
  min-height: 12em;
}

.char-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

.char-count.is-over-limit {
  color: var(--color-error);
  font-weight: 600;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

input[type="radio"] {
  accent-color: var(--color-primary);
  margin-right: 0.4em;
}

ul:has(input[type="radio"]) {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 1.5rem;
}

button, input[type="submit"], a.button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.4rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  box-shadow: 0 2px 8px rgba(226, 98, 45, 0.35);
  display: inline-block;
  text-decoration: none;
}

button:hover, input[type="submit"]:hover, a.button:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(226, 98, 45, 0.4);
  color: #fff;
}

button:active, input[type="submit"]:active, a.button:active {
  transform: translateY(0);
}

/* Secondary/destructive actions: any button whose form posts to reject/-failure endpoints */
form[action*="reject"] button {
  background: transparent;
  color: var(--color-error);
  box-shadow: none;
  border: 1.5px solid var(--color-error-soft);
}

form[action*="reject"] button:hover {
  background: var(--color-error-soft);
  box-shadow: none;
}

.error {
  color: var(--color-error);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  padding: 0.6rem 0.9rem;
  border-bottom: 2px solid var(--color-border);
}

td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

tbody tr:hover {
  background: var(--color-bg-warm);
}

/* ---- Editable Application Details (staff detail page) ---- */

.editable-details table th {
  width: 40%;
}

.editable-details input {
  max-width: none;
  width: 100%;
}

/* ---- Status badges ---- */

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
}

.status-badge[data-status="approved"],
.status-badge[data-status="live"] {
  background: var(--color-secondary-soft);
  color: var(--color-secondary);
}

.status-badge[data-status="rejected"],
.status-badge[data-status="rejected_integration_failed"],
.status-badge[data-status="compliance_failed"] {
  background: var(--color-error-soft);
  color: var(--color-error);
}

.legacy-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--color-text-muted);
  color: var(--color-card);
  margin-left: 0.5rem;
}

.meta-line {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: -0.5em;
}

/* ---- Documents / lists ---- */

.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-list li {
  background: var(--color-bg-warm);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
}

/* ---- Agreement box ---- */

.agreement-box {
  max-height: 500px;
  overflow-y: auto;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  background: var(--color-bg-warm);
  margin-bottom: 1.5rem;
}

.agreement-box h2 {
  margin-top: 0;
}

.agreement-box--full {
  max-height: none;
  overflow-y: visible;
}

@media print {
  .no-print, .site-header {
    display: none !important;
  }

  .agreement-box {
    max-height: none;
    overflow-y: visible;
    border: none;
    background: #fff;
    padding: 0;
  }
}

/* Tighter spacing for sign agreement form */
#sign-form p {
  margin-bottom: 1rem;
}

#sign-form small {
  margin-top: 0.25rem;
}

#signature-pad {
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: #fff;
  display: block;
  margin: 0.5rem 0 1rem;
}

.signature-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.signature-actions button[type="button"] {
  background: transparent;
  color: var(--color-text-muted);
  box-shadow: none;
  border: 1.5px solid var(--color-border);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
}

.signature-actions button[type="button"]:hover {
  background: var(--color-bg-warm);
  color: var(--color-text);
  transform: none;
  box-shadow: none;
}

/* ---- Links (magic-link URLs shown to staff) ---- */

.link-box {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.85rem;
  background: var(--color-bg-warm);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: block;
  overflow-wrap: anywhere;
}

/* ---- Confirmation / invalid-link pages ---- */

.confirmation {
  text-align: center;
  padding: 3rem 2rem;
}

.confirmation .badge-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
  background: var(--color-secondary-soft);
  color: var(--color-secondary);
}

.confirmation.is-invalid .badge-icon {
  background: var(--color-error-soft);
  color: var(--color-error);
}

.confirmation h1 {
  margin-bottom: 0.5rem;
}

.confirmation p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ---- Action groups on the staff detail page ---- */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
}

.action-row form {
  margin: 0;
}

/* Filter form inputs - consistent styling */
.filter-form {
  align-items: flex-end;
}

.filter-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.filter-input {
  min-width: 200px;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  background: #fff;
  transition: border-color 0.2s ease;
}

.filter-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.filter-input::placeholder {
  color: var(--color-text-muted);
}

/* ---- Choose-path cards (/apply/choose-path) ---- */

.path-choice-intro {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 2.5rem;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.path-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 720px) {
  .path-choice-grid {
    grid-template-columns: 1fr;
  }
}

.path-card {
  display: flex;
  flex-direction: column;
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--color-card);
  border: 1.5px solid var(--color-border);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.path-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.path-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.path-card--online .path-card-icon {
  background: var(--color-accent-online-soft);
  color: var(--color-accent-online);
}

.path-card--local .path-card-icon {
  background: var(--color-accent-local-soft);
  color: var(--color-accent-local);
}

.path-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}

.path-card .path-card-subhead {
  color: var(--color-text-muted);
  margin: 0 0 1.25rem;
  font-size: 0.98rem;
}

.path-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  flex-grow: 1;
}

.path-card li {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.45;
}

.path-card li svg {
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.path-card--online li svg {
  color: var(--color-accent-online);
}

.path-card--local li svg {
  color: var(--color-accent-local);
}

.path-card-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}

.path-card--online .path-card-cta {
  background: var(--color-accent-online);
}

.path-card--local .path-card-cta {
  background: var(--color-accent-local);
}

/* ---- /apply wizard progress ---- */

.wizard-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.wizard-progress li {
  padding-bottom: 0.4rem;
  border-bottom: 2px solid transparent;
}

.wizard-progress li.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.wizard-progress li.is-done {
  color: var(--color-secondary);
}

.wizard-step-label {
  margin: 0 0 1.75rem;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.wizard-back-link {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 0.7rem 0.5rem;
}

.wizard-back-link:hover {
  color: var(--color-text);
}

.action-row:has(.wizard-back-link) {
  justify-content: space-between;
}

/* ---- Staff toolbar (back link + quick search) ---- */

.staff-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.staff-toolbar-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--color-text-muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: none;
}

.staff-toolbar-back:hover {
  color: var(--color-text);
}

.staff-search {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}

.staff-search input[type="search"] {
  max-width: 280px;
  margin-bottom: 0;
}

.staff-search button {
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
}

/* ---- Integration checklist (compact, one row per system) ---- */

.checklist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.checklist-row {
  display: grid;
  grid-template-columns: 120px 160px 1fr auto;
  align-items: start;
  gap: 0.75rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
}

.checklist-system {
  font-weight: 600;
  padding-top: 0.65rem;
}

.checklist-status {
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
  max-width: 100%;
  border-color: var(--color-border);
  background: #fff;
  color: var(--color-text-muted);
}

.checklist-status[data-status="done"] {
  background: var(--color-secondary-soft);
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.checklist-status[data-status="in_progress"] {
  background: var(--color-primary-soft);
  color: var(--color-primary-hover);
  border-color: var(--color-primary);
}

.checklist-reference {
  min-height: 2.5rem;
  max-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  resize: none;
  overflow: hidden;
  max-width: 100%;
  transition: min-height 0.15s ease, max-height 0.15s ease;
}

.checklist-reference:focus {
  min-height: 6em;
  max-height: 12em;
  overflow: auto;
}

.checklist-save {
  padding: 0.55rem 1.2rem;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .checklist-row {
    grid-template-columns: 1fr;
  }

  .checklist-system {
    padding-top: 0;
  }
}

/* ---- Path progress stepper ---- */

.path-progress-intro {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin: -0.5rem 0 1.25rem;
}

.phase-stepper {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.phase-stepper li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  padding: 0 0.5rem;
}

.phase-stepper li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 20px;
  left: calc(50% + 26px);
  right: calc(-50% + 26px);
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.phase-stepper li.is-done:not(:last-child)::after {
  background: var(--color-secondary);
}

.phase-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 700;
  background: #fff;
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  z-index: 1;
  margin-bottom: 0.5rem;
}

.phase-stepper li.is-done .phase-dot {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: #fff;
}

.phase-stepper li.is-active .phase-dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 5px var(--color-primary-soft);
}

.phase-label {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  max-width: 150px;
}

.phase-stepper li.is-active .phase-label {
  color: var(--color-text);
  font-weight: 700;
}

.phase-stepper li.is-done .phase-label {
  color: var(--color-text);
  font-weight: 600;
}

@media (max-width: 640px) {
  .phase-stepper {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .phase-stepper li {
    flex-direction: row;
    text-align: left;
    gap: 0.85rem;
    padding: 0;
  }

  .phase-stepper li .phase-dot {
    margin-bottom: 0;
  }

  .phase-stepper li:not(:last-child)::after {
    display: none;
  }

  .phase-label {
    max-width: none;
  }
}

.path-rejected-banner {
  background: var(--color-error-soft);
  color: var(--color-error);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
}

/* ---- Take Action modal (Stage History) ---- */

.action-modal {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 2rem;
  width: min(560px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
}

.action-modal::backdrop {
  background: rgba(58, 46, 39, 0.45);
}

.action-modal h2 {
  margin-top: 0;
}

.action-modal-section {
  border-top: 1px solid var(--color-border);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

.action-modal-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.action-modal-section h3 {
  margin: 0 0 0.25rem;
}

.action-modal-close {
  background: transparent;
  color: var(--color-text-muted);
  box-shadow: none;
  border: 1.5px solid var(--color-border);
  margin-top: 1.5rem;
}

.action-modal-close:hover {
  background: var(--color-bg-warm);
  color: var(--color-text);
  transform: none;
  box-shadow: none;
}

/* ---- Internal notes ---- */

.internal-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.internal-notes-list li {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.25rem;
}

.internal-notes-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* ---- Application Details View/Edit Pattern ---- */

.application-details {
  padding: 0 !important;
  overflow: hidden !important;
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.details-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.btn-edit,
.btn-secondary,
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn-edit {
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}

.btn-edit:hover {
  background: var(--color-primary-soft);
  transform: translateY(-1px);
}

.btn-edit svg {
  flex-shrink: 0;
}

.btn-secondary {
  background: white;
  color: var(--color-text-muted);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-warm);
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: var(--shadow-card);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.btn-primary svg,
.btn-secondary svg,
.btn-edit svg {
  flex-shrink: 0;
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

/* View Mode - Definition List */
.application-details[data-mode="view"] .detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
}

.application-details[data-mode="view"] .detail-row {
  display: contents;
}

.application-details[data-mode="view"] dt {
  padding: 0.875rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  background: var(--color-bg-warm);
  border-bottom: 1px solid var(--color-border);
  align-self: center;
}

.application-details[data-mode="view"] dd {
  margin: 0;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.application-details[data-mode="view"] dd:empty::before {
  content: "—";
  color: var(--color-text-muted);
  font-style: italic;
}

/* Edit Mode - Form Fields */
.application-details[data-mode="edit"] {
  background: #FFFCF5;
}

.application-details[data-mode="edit"] .detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  padding: 1.5rem;
}

.application-details[data-mode="edit"] .detail-row {
  display: contents;
}

.application-details[data-mode="edit"] label {
  align-self: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.application-details[data-mode="edit"] input {
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.application-details[data-mode="edit"] input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.application-details[data-mode="edit"] input:required:invalid {
  border-color: var(--color-error);
}

/* Mobile Responsive - Application Details */
@media (max-width: 767px) {
  .details-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .details-header h2 {
    font-size: 1.125rem;
  }

  .btn-edit,
  .btn-secondary,
  .btn-primary {
    justify-content: center;
    width: 100%;
    min-height: 44px;
  }

  .edit-actions {
    flex-direction: column-reverse;
    gap: 0.5rem;
  }

  /* View Mode Mobile */
  .application-details[data-mode="view"] .detail-grid {
    grid-template-columns: 1fr;
  }

  .application-details[data-mode="view"] .detail-row {
    display: block;
  }

  .application-details[data-mode="view"] dt {
    padding: 0.75rem 1rem 0.375rem;
    border-bottom: none;
  }

  .application-details[data-mode="view"] dd {
    padding: 0.375rem 1rem 0.875rem;
  }

  /* Edit Mode Mobile */
  .application-details[data-mode="edit"] .detail-grid {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .application-details[data-mode="edit"] .detail-row {
    display: block;
    margin-bottom: 1rem;
  }

  .application-details[data-mode="edit"] .detail-row:last-child {
    margin-bottom: 0;
  }

  .application-details[data-mode="edit"] label {
    display: block;
    margin-bottom: 0.375rem;
  }

  .application-details[data-mode="edit"] input {
    width: 100%;
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom */
  }
}

/* ---- Documents Grid ---- */

.documents-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.document-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-card);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.document-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.document-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
}

.document-info {
  flex: 1;
  min-width: 0;
}

.document-type {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.document-filename {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.document-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.doc-action {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
}

.doc-action svg {
  flex-shrink: 0;
}

.doc-action-view {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.doc-action-view:hover {
  background: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.doc-action-download {
  background: var(--color-secondary);
  color: white;
  border-color: var(--color-secondary);
}

.doc-action-download:hover {
  background: #3F624A;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.no-documents {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--color-text-muted);
}

.no-documents svg {
  margin-bottom: 1rem;
  color: var(--color-border);
}

.no-documents p {
  margin: 0;
  font-size: 0.9375rem;
}

/* Mobile - Documents */
@media (max-width: 767px) {
  .document-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .document-icon {
    align-self: center;
  }

  .document-filename {
    white-space: normal;
    word-break: break-all;
  }

  .document-actions {
    flex-direction: column;
  }

  .doc-action {
    justify-content: center;
    width: 100%;
    min-height: 44px;
  }
}

/* ---- Internal Notes Section ---- */

.internal-notes-section {
  padding: 0 !important;
}

.add-note-form {
  padding: 1.5rem;
  border-bottom: 2px solid var(--color-border);
  background: var(--color-bg-warm);
}

.add-note-form button {
  margin-top: 1rem;
}

.notes-log {
  padding: 0;
}

.note-entry {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.15s ease;
}

.note-entry:hover {
  background: var(--color-bg-warm);
}

.note-entry:last-child {
  border-bottom: none;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.note-author {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-primary);
}

.note-timestamp {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.note-body {
  color: var(--color-text);
  line-height: 1.6;
}

.note-body p {
  margin: 0 0 0.5rem;
}

.note-body p:last-child {
  margin-bottom: 0;
}

.no-notes-message {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Mobile - Internal Notes */
@media (max-width: 767px) {
  .note-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .note-timestamp {
    font-size: 0.7rem;
  }
}

/* ---- Integration Checklist Table ---- */

.integration-checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.checklist-subtitle {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.checklist-progress {
  text-align: right;
  min-width: 200px;
}

.progress-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.integration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.integration-table thead {
  background: var(--color-bg-warm);
  border-bottom: 2px solid var(--color-border);
}

.integration-table th {
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.integration-row-header {
  background: var(--color-bg-warm);
  border-bottom: none !important;
}

.integration-description {
  padding: 0.625rem 0.75rem !important;
  font-size: 0.8125rem;
}

.integration-description .system-name {
  font-weight: 700;
  color: var(--color-text);
  margin-right: 0.75rem;
}

.integration-description .system-description {
  color: var(--color-text-muted);
  font-style: italic;
}

.integration-table tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.15s ease;
}

.integration-table tbody tr:hover {
  background: var(--color-bg-warm);
}

.integration-row-header:hover {
  background: var(--color-bg-warm) !important;
}

.integration-row[data-status="done"] {
  background: linear-gradient(to right, #f9fdf9, #fff);
}

.integration-row[data-status="done"]:hover {
  background: linear-gradient(to right, #f3fbf3, #fafcfa);
}

.integration-table td {
  padding: 1rem 0.75rem;
  vertical-align: top;
}

.integration-cell-system {
  width: 2%;
  /* Hidden - system name is in description row above */
}

.integration-cell-status {
  width: 14%;
}

.integration-cell-assigned {
  width: 22%;
}

.integration-cell-reference {
  width: 54%;
}

.integration-cell-actions {
  width: 8%;
  text-align: right;
}

.integration-form {
  display: contents;
}

.status-select {
  padding: 0.5rem 0.625rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--color-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
  width: 100%;
}

.status-select[data-status="not_started"] {
  border-color: var(--color-border);
}

.status-select[data-status="in_progress"] {
  border-color: var(--color-warning);
  background: var(--color-warning-soft);
}

.status-select[data-status="done"] {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  font-weight: 600;
}

.status-select[data-status="na"] {
  border-color: var(--color-text-muted);
  opacity: 0.6;
}

.status-select:hover {
  border-color: var(--color-primary);
}

.status-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.assign-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.assignee-select {
  flex: 1;
  padding: 0.5rem 0.625rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.875rem;
  cursor: pointer;
}

.assignee-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.btn-assign-me-small {
  padding: 0.5rem;
  background: var(--color-bg-warm);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-assign-me-small:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-assign-me-small.assigned {
  background: var(--color-success-soft);
  border-color: var(--color-success);
  color: var(--color-success);
}

.reference-input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.reference-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.reference-input::placeholder {
  color: var(--color-text-muted);
}

.updated-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.btn-save-small {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.btn-save-small:hover {
  background: var(--color-primary-hover);
}

/* Mobile - Integration Table */
@media (max-width: 1024px) {
  .integration-table,
  .integration-table thead,
  .integration-table tbody,
  .integration-table tr,
  .integration-table td {
    display: block;
  }

  .integration-table thead {
    display: none;
  }

  .integration-table tbody tr {
    margin-bottom: 1rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
  }

  .integration-table td {
    padding: 0.5rem 0;
    width: 100% !important;
  }

  .integration-cell-system {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.75rem;
  }

  .integration-cell-actions {
    text-align: left;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    margin-top: 0.75rem;
  }

  .btn-save-small {
    width: 100%;
  }
}

/* ---- Market Hero Section ---- */

.market-hero {
  text-align: center;
  margin: 0 auto 2rem;
  padding: 2rem 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fcfc 100%);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(0, 146, 179, 0.08);
}

.market-hero-logo {
  display: block;
  max-width: 320px;
  height: auto;
  margin: 0 auto 1.25rem;
}

.market-hero-tagline {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: 0 0 0.5rem;
  font-weight: 500;
}

.market-hero-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.market-hero-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Larger hero for application start pages */
.page-apply .market-hero-logo {
  max-width: 380px;
}

.page-apply .market-hero-title {
  font-size: 2rem;
}

/* Compact hero for transactional pages */
.page-sign .market-hero,
.page-status .market-hero {
  padding: 1.5rem 1.25rem;
}

.page-sign .market-hero-logo,
.page-status .market-hero-logo {
  max-width: 280px;
  margin-bottom: 1rem;
}

.page-sign .market-hero-title,
.page-status .market-hero-title {
  font-size: 1.5rem;
}

/* Mobile hero */
@media (max-width: 767px) {
  .market-hero {
    margin-bottom: 1.5rem;
    padding: 1.5rem 1rem;
    border-radius: var(--radius-md);
  }

  .market-hero-logo {
    max-width: 240px !important;
  }

  .market-hero-tagline {
    font-size: 0.875rem;
  }

  .market-hero-title {
    font-size: 1.5rem !important;
  }

  .market-hero-subtitle {
    font-size: 0.875rem;
  }
}

/* ---- Staff user management ---- */

.toolbar-link {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-primary);
  text-decoration: none;
  padding: 0.5rem 0;
}

.toolbar-link:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

.page-intro {
  color: var(--color-text-muted);
  margin: -0.5rem 0 1.5rem;
  max-width: 640px;
}

.flash {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-weight: 500;
  font-size: 0.9375rem;
}

.flash-error {
  background: var(--color-error-soft);
  color: var(--color-error);
  border: 1.5px solid var(--color-error);
}

.flash-success {
  background: var(--color-secondary-soft);
  color: var(--color-secondary);
  border: 1.5px solid var(--color-secondary);
}

.add-user-card {
  margin-bottom: 1.5rem;
}

.add-user-card h2 {
  margin-top: 0;
  font-size: 1.125rem;
}

.add-user-hint {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  margin: 0.75rem 0 0;
}

.filter-form select.filter-input {
  cursor: pointer;
}

.you-badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-row-inactive td {
  color: var(--color-text-muted);
}

.role-form {
  margin: 0;
}

.role-form select {
  padding: 0.4rem 0.5rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.875rem;
  cursor: pointer;
}

.role-form select:disabled {
  background: var(--color-bg-warm);
  cursor: not-allowed;
}

.btn-deactivate,
.btn-reactivate {
  padding: 0.4rem 0.875rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid transparent;
  background: transparent;
}

.btn-deactivate {
  color: var(--color-error);
  border-color: var(--color-error);
}

.btn-deactivate:hover {
  background: var(--color-error);
  color: #fff;
}

.btn-reactivate {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.btn-reactivate:hover {
  background: var(--color-secondary);
  color: #fff;
}
