:root {
  --bg: #f4efe8;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #1f2933;
  --muted: #62707c;
  --border: #dccfbe;
  --accent: #c96d2d;
  --accent-soft: #f3dfd0;
  --success: #207857;
  --warn: #a05d1a;
  --danger: #a23232;
  --radius: 20px;
  --shadow: 0 20px 60px rgba(58, 39, 18, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 109, 45, 0.14), transparent 22rem),
    linear-gradient(180deg, #fbf7f1 0%, #f2ede6 100%);
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 0.8rem;
  background: rgba(251, 247, 241, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(220, 207, 190, 0.8);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.brand-lockup.compact {
  gap: 0.65rem;
  font-size: 0.95rem;
}

.job-brand-lockup {
  min-width: 0;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.9rem;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.brand-logo {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  padding: 0.2rem;
  border-radius: 1rem;
  background: white;
  border: 1px solid var(--border);
  box-shadow: 0 6px 14px rgba(58, 39, 18, 0.08);
}

.brand-text {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.brand-text strong {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--muted);
  text-transform: uppercase;
}

.brand-job-name {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 20rem);
}

.brand-subtitle,
.muted,
.empty {
  color: var(--muted);
}

.page {
  width: min(1120px, calc(100% - 1.25rem));
  margin: 1rem auto 2rem;
}

.hero-card,
.panel,
.brand-card,
.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card,
.brand-card {
  padding: 1.25rem;
}

.brand-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, white) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.job-app-nav-spacer {
  height: 6rem;
}

.job-app-nav {
  position: fixed;
  left: 50%;
  bottom: 0.9rem;
  z-index: 35;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 1rem));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.6rem;
  border: 1px solid rgba(220, 207, 190, 0.9);
  border-radius: 26px;
  background: rgba(251, 247, 241, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(58, 39, 18, 0.16);
}

.job-app-link {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.65rem 0.35rem;
  border-radius: 18px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}

.job-app-link svg {
  width: 1.35rem;
  height: 1.35rem;
}

.job-app-link.active {
  background: var(--accent);
  color: white;
}

.brand-card.public {
  border-width: 0;
}

.brand-copy h1,
.hero-card h1,
.panel h1,
.panel h2 {
  margin: 0.25rem 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

.hero-actions,
.topbar-actions,
.form-actions,
.quick-status,
.shopping-actions,
.selection-side {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.topbar-actions {
  gap: 0.45rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  border-radius: 0.95rem;
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(58, 39, 18, 0.08);
}

.icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
}

.inline-icon-link {
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.4rem;
  color: var(--accent);
}

.inline-icon-link svg {
  width: 1rem;
  height: 1rem;
}

.button,
button,
select,
input,
textarea {
  font: inherit;
}

.button,
button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.15rem;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button.secondary {
  background: #203646;
}

.button.ghost {
  background: white;
  color: var(--ink);
  border: 1px solid var(--border);
}

.button.small {
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
}

.button.active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.two-up {
  grid-template-columns: 1fr;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.metric-card {
  padding: 1rem;
  display: grid;
  gap: 0.15rem;
}

.metric-card strong {
  font-size: 1.5rem;
}

.panel {
  padding: 1rem;
}

.panel.narrow {
  max-width: 760px;
  margin: 0 auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stack-list {
  display: grid;
  gap: 0.8rem;
}

.list-card,
.task-card,
.group-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  padding: 0.95rem;
  text-decoration: none;
}

.list-card.static {
  display: grid;
  gap: 0.5rem;
}

.list-card,
.task-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.task-group {
  display: grid;
  gap: 0.8rem;
}

.task-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.task-group-header h3 {
  margin: 0;
}

.task-card.compact {
  padding: 0.65rem 0.8rem;
}

.swipe-shell {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}

.swipe-card {
  position: relative;
  z-index: 2;
  transition: transform 0.18s ease;
  touch-action: pan-y;
}

.swipe-edit-link,
.swipe-delete-form {
  position: absolute;
  inset: 0 auto 0 0;
  width: 96px;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.swipe-edit-link {
  align-items: center;
  justify-content: center;
  background: #24435a;
  color: white;
  text-decoration: none;
  font-weight: 800;
}

.swipe-delete-form {
  inset: 0 0 0 auto;
}

.swipe-shell.is-open-left .swipe-edit-link {
  opacity: 1;
  pointer-events: auto;
}

.swipe-shell.is-open-right .swipe-delete-form {
  opacity: 1;
  pointer-events: auto;
}

.swipe-delete-button {
  width: 100%;
  border-radius: 0;
  background: #bf3c2c;
  color: white;
  font-weight: 800;
}

.drag-handle {
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--muted);
  cursor: grab;
  font-weight: 800;
}

.parent-task {
  border-left: 4px solid var(--accent);
  background:
    linear-gradient(
      90deg,
      rgba(201, 109, 45, 0.16) 0%,
      rgba(201, 109, 45, 0.16) var(--task-progress, 0%),
      rgba(255, 255, 255, 0.96) var(--task-progress, 0%),
      rgba(255, 255, 255, 0.96) 100%
    );
}

.subtask-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.65rem;
  padding-left: 1rem;
  border-left: 2px dashed #d8c5b0;
}

.subtask-card {
  border: 1px solid #eadbcf;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: #fffaf5;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-track {
  flex: 1;
  height: 0.7rem;
  border-radius: 999px;
  background: #eadfd2;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #e5aa62 100%);
}

.progress-label {
  min-width: 3rem;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
}

.quick-subtask-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.quick-subtask-form input[type="text"] {
  flex: 1;
  min-width: 12rem;
}

.compact-list {
  gap: 0.55rem;
}

.compact-task-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

.compact-task-row::-webkit-details-marker {
  display: none;
}

.subtask-card summary::-webkit-details-marker {
  display: none;
}

.compact-task-main,
.compact-task-actions,
.check-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.compact-task-main {
  flex: 1;
  min-width: 0;
}

.compact-task-actions {
  min-width: 3rem;
  justify-content: flex-end;
}

.task-title-text {
  font-weight: 700;
  line-height: 1.25;
}

.task-title-text.is-done {
  text-decoration: line-through;
  color: var(--muted);
}

.check-form {
  margin: 0;
}

.check-form input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
}

.mini-progress {
  min-width: 2.8rem;
  text-align: right;
  font-weight: 700;
  color: var(--muted);
}

.parent-task-body {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.compact-meta {
  gap: 0.45rem;
}

.compact-copy {
  font-size: 0.92rem;
  color: var(--muted);
}

.child-row {
  cursor: default;
}

.tappable-subtask {
  cursor: pointer;
}

.subtask-toggle {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.subtask-detail {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eadbcf;
}

.task-group + .task-group {
  margin-top: 0.5rem;
}

.floating-add-button {
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  width: 3.7rem;
  height: 3.7rem;
  border-radius: 999px;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 18px 40px rgba(32, 21, 10, 0.24);
  z-index: 40;
}

.task-modal {
  width: min(680px, calc(100% - 1rem));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.task-modal::backdrop {
  background: rgba(26, 23, 20, 0.45);
}

.task-modal-close-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.modal-header {
  margin-bottom: 0;
}

.review-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}

.review-keep {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
}

.document-panel {
  padding: 0.75rem;
}

.document-frame {
  width: 100%;
  min-height: 80vh;
  border: 0;
  border-radius: 16px;
  background: white;
}

.document-image {
  width: 100%;
  border-radius: 16px;
  background: white;
}

.shopping-card {
  align-items: center;
}

.shopping-group {
  display: grid;
  gap: 0.65rem;
}

.shopping-group-header h3 {
  margin: 0;
  font-size: 1rem;
}

.shopping-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: white;
}

.shopping-copy {
  display: grid;
  gap: 0.15rem;
}

.shopping-quick-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.shopping-quick-row input,
.shopping-supplier-pill {
  min-height: 3rem;
  padding: 0.8rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: white;
}

.shopping-supplier-pill {
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  font-weight: 700;
  white-space: nowrap;
  background: #f8f0e7;
}

.shopping-supplier-input {
  flex: 0 0 11rem;
}

.shopping-item-input {
  flex: 1 1 18rem;
  min-width: 12rem;
}

.shopping-qty-input {
  flex: 0 0 6.5rem;
}

.shopping-tabs {
  margin-bottom: 1rem;
}

.shopping-add-button,
.shopping-new-supplier-button {
  min-height: 3rem;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .job-hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .job-app-nav {
    width: calc(100% - 0.8rem);
    bottom: 0.4rem;
    padding: 0.5rem;
  }

  .floating-add-button {
    right: 0.9rem;
    bottom: 5.8rem;
  }

  .shopping-quick-row {
    align-items: stretch;
  }

  .shopping-quick-row input,
  .shopping-supplier-pill,
  .shopping-add-button,
  .shopping-new-supplier-button {
    width: 100%;
  }

  .shopping-supplier-input,
  .shopping-item-input,
  .shopping-qty-input {
    flex: 1 1 auto;
  }
}

.task-card {
  display: grid;
  gap: 0.75rem;
}

.task-copy,
.lead,
.list-card p {
  margin: 0;
}

.task-meta,
.detail-list,
.tab-row,
.qr-preview,
.inline-upload {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.detail-list {
  display: grid;
  gap: 0.75rem;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #eee2d5;
}

.company-job-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.45rem;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--accent-soft);
}

.status-badge.done,
.status-badge.completed,
.status-badge.delivered,
.status-badge.installed,
.status-badge.approved {
  background: #dff6ec;
  color: var(--success);
}

.status-badge.waiting,
.status-badge.pending,
.status-badge.ordered {
  background: #fff1de;
  color: var(--warn);
}

.status-badge.archived,
.status-badge.urgent {
  background: #f8dfdf;
  color: var(--danger);
}

.color-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
}

.tab-row {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.tab {
  padding: 0.8rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.75);
}

.tab.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.form-grid {
  display: grid;
  gap: 0.85rem;
}

.form-grid.compact {
  gap: 0.7rem;
}

.form-grid label {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: white;
}

.checkbox-row input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: white;
}

.form-grid textarea {
  resize: vertical;
}

.thumb-preview,
.mini-thumb,
.company-logo {
  border-radius: 16px;
  object-fit: cover;
}

.thumb-preview {
  width: 100%;
  max-width: 14rem;
  aspect-ratio: 4 / 3;
}

.mini-thumb {
  width: 3.5rem;
  height: 3.5rem;
}

.company-logo {
  width: 7rem;
  max-height: 7rem;
  background: rgba(255, 255, 255, 0.75);
  padding: 0.5rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.photo-card {
  overflow: hidden;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--border);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.photo-meta {
  padding: 0.8rem;
  display: grid;
  gap: 0.2rem;
}

.flash-stack {
  width: min(1120px, calc(100% - 1.25rem));
  margin: 0.75rem auto 0;
  display: grid;
  gap: 0.5rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: white;
}

.flash.success {
  border-color: #bfe8d7;
}

.flash.error {
  border-color: #efc2c2;
}

.qr-preview {
  justify-content: center;
}

.qr-preview img {
  width: min(18rem, 100%);
  background: white;
  padding: 0.75rem;
  border-radius: 20px;
}

.simple-list {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
}

.print-card {
  background: white;
}

@media (min-width: 780px) {
  .job-app-nav {
    width: min(640px, calc(100% - 2rem));
  }

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

  .metric-row {
    grid-template-columns: repeat(4, 1fr);
  }

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

  .span-2 {
    grid-column: span 2;
  }

  .brand-card {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

@media print {
  .topbar,
  .flash-stack,
  .button {
    display: none !important;
  }

  body {
    background: white;
  }

  .page {
    width: 100%;
    margin: 0;
  }
}
