/* ShiftFlow base styles: palette, typography and shared components (DESIGN.md section 2). */

:root {
  --color-primary: #2563eb;
  --color-teal: #14b8a6;
  --color-teal-dark: #0f766e;
  --color-navy: #0f2d5b;
  --color-sky: #e8f1ff;
  --color-bg: #f8fbff;
  --color-warning: #f59e0b;
  --color-warning-text: #b45309;
  --color-error: #dc2626;
  --color-white: #ffffff;
  --color-muted: #5b6b85;
  --color-border: #d9e3f2;
  --color-error-bg: #fdecec;

  --radius-card: 16px;
  --radius-control: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 2px 8px rgba(15, 45, 91, 0.06), 0 1px 2px rgba(15, 45, 91, 0.04);

  --font: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --sidebar-width: 240px;
}

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

html,
body {
  margin: 0;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
  font-weight: 400;
  color: var(--color-navy);
  background: var(--color-bg);
}

h1 {
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  margin: 0;
}

h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 700;
  margin: 0;
}

h3 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  margin: 0;
}

.text-small {
  font-size: 14px;
  line-height: 20px;
}

.text-label {
  font-size: 12px;
  line-height: 16px;
}

a {
  color: var(--color-primary);
}

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-secondary {
  background: var(--color-teal);
  color: var(--color-navy);
}

.btn-outline {
  background: var(--color-white);
  color: var(--color-teal-dark);
  border-color: var(--color-teal-dark);
}

.btn-block {
  width: 100%;
}

/* Cards and tags */

.card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  background: var(--color-sky);
  color: var(--color-primary);
}

.tag-warning {
  background: #fef3c7;
  color: var(--color-warning-text);
}

/* Alert bars */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
}

.alert-error {
  background: var(--color-error-bg);
  border-color: #f5c2c2;
  color: #991b1b;
}

.alert-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-error);
  color: var(--color-white);
  font-weight: 700;
  font-size: 14px;
}

/* Manager layout: dark sidebar + content */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: none;
  width: var(--sidebar-width);
  background: var(--color-navy);
  color: var(--color-white);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  padding: 0 6px;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-control);
  color: var(--color-white);
  text-decoration: none;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.nav-item.is-active {
  background: var(--color-primary);
  font-weight: 600;
}

.nav-item.is-disabled {
  color: #b9c6dc;
  cursor: default;
}

.nav-soon {
  margin-inline-start: auto;
  font-size: 12px;
  line-height: 16px;
  color: #b9c6dc;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 32px;
}

.topbar {
  display: none;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--color-navy);
  font-size: 26px;
  line-height: 1;
  padding: 6px 8px;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Job cards */

.job-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.job-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-card-business {
  color: var(--color-muted);
}

.job-facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
}

.job-facts dt {
  color: var(--color-muted);
}

.job-facts dd {
  margin: 0;
}

.job-code {
  align-self: flex-start;
  font-family: ui-monospace, Consolas, monospace;
  direction: ltr;
}

.state-message {
  color: var(--color-muted);
  padding: 24px 0;
}

/* Mobile: sidebar becomes a slide-in menu opened from ☰ */

@media (max-width: 767px) {
  .app {
    display: block;
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--color-white);
    box-shadow: var(--shadow-soft);
  }

  .topbar .brand {
    color: var(--color-navy);
  }

  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 10;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    width: min(80vw, var(--sidebar-width));
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .content {
    padding: 20px 16px;
  }

  h1 {
    font-size: 24px;
    line-height: 32px;
  }
}

/* ---- Milestone 2 ---- */

/* Layout classes set display, so the hidden attribute needs to win explicitly. */
[hidden] {
  display: none !important;
}

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

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 32px 0 16px;
}

/* Alerts: info, warning and success variants */

.alert-info {
  background: var(--color-sky);
  border-color: #c7dafc;
  color: var(--color-navy);
}

.alert-info .alert-icon {
  background: var(--color-primary);
}

.alert-warning {
  background: #fef3c7;
  border-color: #fcd34d;
  color: var(--color-navy);
}

.alert-warning .alert-icon {
  background: var(--color-warning);
  color: var(--color-navy);
}

.alert-success {
  background: #e6f7f5;
  border-color: #99e0d8;
  color: var(--color-navy);
}

.alert-success .alert-icon {
  background: var(--color-teal-dark);
}

.alert-stack > .alert {
  margin-bottom: 12px;
}

/* Tags by status group (DESIGN.md: always a word, never colour alone) */

.tag-success {
  background: #e6f7f5;
  color: var(--color-teal-dark);
}

.tag-neutral {
  background: #eef1f5;
  color: #4b5563;
}

/* Form fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label,
.field-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

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

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-white);
  color: var(--color-navy);
  font: inherit;
}

.textarea {
  min-height: 88px;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: #8a97ad;
}

.input[dir="ltr"] {
  text-align: right;
}

.has-error .input,
.has-error .select,
.has-error .textarea,
.input.has-error {
  border-color: var(--color-error);
}

.field-error {
  font-size: 13px;
  line-height: 18px;
  color: var(--color-error);
  font-weight: 600;
}

.field-error:empty {
  display: none;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--color-primary);
  flex: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Choice chips (business type, template roles) */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border: none;
  margin: 0;
  padding: 0;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-white);
  font-weight: 600;
}

.chip input:checked + span {
  background: var(--color-sky);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.chip input:focus-visible + span {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Upload rows */

.upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-control);
  background: var(--color-white);
}

.upload-row .file-name {
  font-size: 14px;
  color: var(--color-muted);
  word-break: break-all;
}

.upload-row.is-done {
  border-style: solid;
  border-color: #99e0d8;
}

/* Editable lists in the job form */

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  padding: 14px;
  background: var(--color-white);
}

.item.is-off {
  background: var(--color-bg);
}

.item.is-off .item-body {
  display: none;
}

.item-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-head .input {
  flex: 1;
}

.item-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-inline-start: 30px;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-row .input {
  flex: 1;
  min-height: 40px;
  padding: 6px 12px;
}

.btn-link {
  background: none;
  border: none;
  padding: 6px 8px;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}

.btn-icon {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-muted);
  font-size: 18px;
  cursor: pointer;
  flex: none;
}

.btn-icon:hover {
  background: var(--color-bg);
  color: var(--color-error);
}

.btn-add {
  align-self: flex-start;
  border: 1px dashed var(--color-primary);
  background: var(--color-white);
  color: var(--color-primary);
}

/* Auth and wizard pages: centred column, mobile first */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 8px;
  color: var(--color-navy);
}

.auth-card h1 {
  text-align: center;
}

.auth-art {
  display: none;
}

@media (min-width: 900px) {
  .auth-page {
    grid-template-columns: 1fr 1fr;
  }

  .auth-art {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 48px;
    background: var(--color-sky);
  }

  .auth-art img {
    width: 100%;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-soft);
  }
}

.wizard-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wizard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.wizard-top .brand {
  color: var(--color-navy);
  padding: 0;
}

.steps {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  align-items: flex-start;
}

.steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  font-size: 12px;
  line-height: 16px;
  color: var(--color-muted);
  text-align: center;
}

.steps li::before {
  content: "";
  position: absolute;
  top: 16px;
  inset-inline-end: 50%;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
}

.steps li:first-child::before {
  display: none;
}

.steps li.is-done::before,
.steps li.is-current::before {
  background: var(--color-primary);
}

.step-dot {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  font-weight: 700;
  color: var(--color-muted);
}

.steps li.is-current .step-dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
}

.steps li.is-done .step-dot {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.steps li.is-current {
  color: var(--color-navy);
  font-weight: 600;
}

.step-count {
  text-align: center;
  color: var(--color-muted);
  margin-bottom: 24px;
}

.wizard-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.wizard-actions .btn-primary {
  flex: 1;
}

/* QR panel */

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.qr-panel canvas {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  border-radius: 12px;
  background: var(--color-white);
}

.copy-field {
  display: flex;
  gap: 8px;
  width: 100%;
}

.copy-field .input {
  flex: 1;
  direction: ltr;
  text-align: left;
  font-size: 14px;
}

/* Jobs */

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

.job-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.job-card-actions .btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

.business-qr {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.business-qr canvas {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 6px;
  font-size: 14px;
}

.sidebar-foot button {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: #b9c6dc;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Public pages */

.public-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 32px;
}

.public-header .brand {
  color: var(--color-navy);
  padding: 0;
  text-decoration: none;
}

.hero {
  display: grid;
  gap: 32px;
  align-items: center;
}

.hero img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}

.hero p {
  font-size: 18px;
  line-height: 28px;
}

@media (min-width: 800px) {
  .hero {
    grid-template-columns: 1fr 1fr;
  }
}

.public-footer {
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--color-muted);
}

.prose {
  max-width: 680px;
}

.board {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.board .job-grid {
  grid-template-columns: 1fr;
}

.board .job-card h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
}

.board-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 14px;
  color: var(--color-muted);
}

/* Job board branding (F67): --brand is set from the business's approved color */

.board {
  --brand: var(--color-primary);
}

.board .btn-primary {
  background: var(--brand);
}

.board-header {
  margin-bottom: 24px;
}

.board-cover {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-card);
  background: var(--color-sky);
}

.board-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.board-identity h1 {
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 3px solid var(--brand);
}

.has-cover .board-identity {
  margin-top: 12px;
}

.board-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border-radius: 50%;
  border: 4px solid var(--color-white);
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
}

.has-cover .board-logo {
  margin-top: -56px;
}

.board-description {
  margin: 0;
  white-space: pre-line;
  color: var(--color-muted);
}

.board-preview {
  max-width: 480px;
  padding: 16px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-bg);
  pointer-events: none;
}

/* Branding editor */

.branding-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

@media (min-width: 1100px) {
  .branding-layout {
    grid-template-columns: minmax(0, 1fr) 480px;
  }
}

.upload-row {
  flex-wrap: wrap;
}

.branding-thumb {
  display: block;
  object-fit: cover;
  border: 1px solid var(--color-border);
  background: var(--color-white);
}

.branding-thumb-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 50%;
}

.branding-thumb-cover {
  width: 96px;
  height: 48px;
  border-radius: 8px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.swatch {
  cursor: pointer;
}

.swatch-dot {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.swatch input:checked + .swatch-dot {
  box-shadow: 0 0 0 3px var(--color-white), 0 0 0 5px var(--color-navy);
}

.swatch input:focus-visible + .swatch-dot {
  outline: 3px solid var(--color-primary);
  outline-offset: 4px;
}

/* ShiftFlow team screen (F68) */

.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
}

.admin-bar .brand {
  color: var(--color-navy);
}

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px;
}

.review-list {
  display: grid;
  gap: 16px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.review-card {
  --brand: var(--color-primary);
}

.review-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.review-image {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.review-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-teal-dark);
}

.review-card details .board-preview {
  margin-top: 12px;
}

@media print {
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }
}
