/* Appily Eighteen — Chalk Crate Tally cart */

.page-chalk-tally {
  --ct-slate: #3d4a42;
  --ct-slate-dark: #2a332e;
  --ct-chalk: #f5f2ea;
  --ct-chalk-dust: rgba(245, 242, 234, 0.65);
  --ct-wood: #6b5b3e;
  --ct-wood-light: #8b7355;
  --ct-leaf: #8fae7a;
  --ct-amber: #c67d3a;
  --ct-ink: #2c2419;
  --ct-canvas: #ebe6dc;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(143, 174, 122, 0.12) 0%, transparent 42%),
    linear-gradient(180deg, var(--ct-canvas) 0%, var(--white) 320px);
}

/* ── Chalkboard hero ── */
.ct-hero {
  position: relative;
  padding: clamp(28px, 5vw, 44px) 0 clamp(22px, 4vw, 32px);
  overflow: hidden;
}

.ct-board-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(175deg, var(--ct-slate) 0%, var(--ct-slate-dark) 100%);
  opacity: 0.08;
  pointer-events: none;
}

.ct-chalk-smudge {
  position: absolute;
  top: 20%;
  left: 5%;
  width: 180px;
  height: 60px;
  background: radial-gradient(ellipse, var(--ct-chalk-dust) 0%, transparent 70%);
  filter: blur(8px);
  opacity: 0.5;
  pointer-events: none;
}

.ct-hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(20px, 4vw, 36px);
  align-items: center;
}

.ct-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ct-wood);
}

.ct-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.95rem, 4.2vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--ct-ink);
}

.ct-hero h1 em {
  font-style: normal;
  color: var(--ct-leaf);
}

.ct-lede {
  margin: 0;
  max-width: 520px;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* Tally peg counter */
.ct-peg-board {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px 22px 16px;
  min-width: 150px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--ct-wood-light) 0%, var(--ct-wood) 100%);
  color: var(--white);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.ct-peg-row {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}

.ct-peg {
  width: 8px;
  height: 28px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.ct-peg.is-marked {
  background: var(--ct-amber);
  box-shadow: 0 0 8px rgba(198, 125, 58, 0.5);
}

.ct-peg-num {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1;
}

.ct-peg-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.ct-peg-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
  font-weight: 700;
  width: 100%;
}

.ct-cold-tag {
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.15);
}

/* ── Floor ── */
.ct-floor {
  padding: clamp(16px, 3vw, 28px) 0 clamp(52px, 6vw, 80px);
}

/* Empty state */
.ct-empty {
  text-align: center;
  padding: 56px 28px 64px;
  background: var(--ct-chalk);
  border: 3px solid var(--ct-slate);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 40px rgba(61, 74, 66, 0.08);
}

.ct-empty-board {
  position: relative;
  width: 200px;
  height: 120px;
  margin: 0 auto 22px;
  background: linear-gradient(165deg, var(--ct-slate) 0%, var(--ct-slate-dark) 100%);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.ct-empty-chalk {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--ct-chalk);
  opacity: 0.45;
  letter-spacing: 0.08em;
}

.ct-empty-eraser {
  position: absolute;
  bottom: -10px;
  right: -12px;
  width: 36px;
  height: 14px;
  border-radius: 3px;
  background: #d4a574;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.ct-empty h2 {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.ct-empty p {
  max-width: 420px;
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.65;
}

/* Layout */
.ct-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: clamp(20px, 3vw, 28px);
  align-items: start;
}

.ct-lane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.ct-lane-tag {
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--ct-slate);
  color: var(--ct-chalk);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ct-lane-meta {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

/* Crate rows */
.ct-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.ct-row {
  position: relative;
  padding-left: 40px;
}

.ct-row-mark {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
  background: var(--ct-wood);
  box-shadow: 0 2px 0 rgba(44, 36, 25, 0.15);
}

.ct-row-card {
  display: grid;
  grid-template-columns: 84px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: var(--white);
  border: 2px solid rgba(107, 91, 62, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 3px 0 rgba(107, 91, 62, 0.06);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.ct-row-card:hover {
  border-color: var(--ct-leaf);
  box-shadow: 0 6px 16px rgba(44, 36, 25, 0.08);
}

.ct-row-thumb {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: var(--radius-md);
  background: var(--ct-chalk);
  overflow: hidden;
}

.ct-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}

.ct-row-fallback {
  font-size: 2rem;
  opacity: 0.5;
}

.ct-row-body {
  min-width: 0;
}

.ct-row-sku {
  display: inline-block;
  margin-bottom: 4px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ct-wood);
}

.ct-row-body h2 {
  margin: 0 0 4px;
  font-size: 0.98rem;
  line-height: 1.3;
}

.ct-row-body h2 a:hover {
  color: var(--ct-amber);
}

.ct-row-variant {
  margin: 0 0 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.ct-row-unit {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ct-ink);
}

.ct-row-qty label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.ct-row-qty input {
  width: 64px;
  padding: 8px 10px;
  border: 2px solid rgba(107, 91, 62, 0.2);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 700;
  background: var(--ct-chalk);
}

.ct-row-qty input:focus {
  outline: none;
  border-color: var(--ct-leaf);
}

.ct-row-line {
  text-align: right;
  min-width: 72px;
}

.ct-line-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.ct-row-line strong {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ct-ink);
}

.ct-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* Buttons */
.ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: background var(--transition), transform var(--transition), color var(--transition);
}

.ct-btn-primary {
  background: var(--ct-wood);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(107, 91, 62, 0.25);
}

.ct-btn-primary:hover {
  background: var(--ct-slate-dark);
  color: var(--white);
  transform: translateY(-1px);
}

.ct-btn-soft {
  background: rgba(143, 174, 122, 0.15);
  color: var(--ct-wood);
  border: 1px solid rgba(143, 174, 122, 0.35);
}

.ct-btn-soft:hover {
  background: rgba(143, 174, 122, 0.28);
}

.ct-btn-ghost {
  background: transparent;
  color: var(--ct-wood);
  border: 2px solid rgba(107, 91, 62, 0.25);
}

.ct-btn-ghost:hover {
  background: var(--ct-chalk);
}

.ct-btn-block {
  width: 100%;
}

/* Slate receipt */
.ct-slate {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.ct-slate-face {
  padding: 22px 20px 18px;
  background: linear-gradient(165deg, var(--ct-slate) 0%, var(--ct-slate-dark) 100%);
  color: var(--ct-chalk);
}

.ct-slate-store {
  margin: 0 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

.ct-slate-title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: var(--white);
}

.ct-slate-date {
  margin: 0 0 18px;
  font-size: 0.78rem;
  opacity: 0.65;
}

.ct-slate-rows {
  margin: 0 0 16px;
  padding: 0;
}

.ct-slate-rows div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  font-size: 0.88rem;
}

.ct-slate-rows dt {
  opacity: 0.8;
}

.ct-slate-rows dd {
  margin: 0;
  font-weight: 700;
}

.ct-slate-divider {
  height: 2px;
  margin: 14px 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 4px,
    rgba(255, 255, 255, 0.3) 4px,
    rgba(255, 255, 255, 0.3) 8px
  );
}

.ct-slate-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.ct-slate-total strong {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--white);
}

.ct-slate-notes {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.ct-slate-notes li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  opacity: 0.85;
}

.ct-slate-actions {
  display: grid;
  gap: 10px;
}

.ct-slate-actions .ct-btn-primary {
  background: var(--ct-amber);
  color: var(--white);
}

.ct-slate-actions .ct-btn-primary:hover {
  background: #a86530;
}

.ct-slate-actions .ct-btn-soft {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.25);
}

.ct-slate-actions .ct-btn-soft:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ct-slate-chalk {
  padding: 14px 20px;
  background: #2a332e;
  display: flex;
  justify-content: center;
  gap: 3px;
  align-items: flex-end;
}

.ct-slate-chalk span {
  width: 3px;
  background: rgba(245, 242, 234, 0.35);
  border-radius: 1px;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .ct-hero-grid {
    grid-template-columns: 1fr;
  }

  .ct-peg-board {
    justify-self: start;
  }

  .ct-layout {
    grid-template-columns: 1fr;
  }

  .ct-slate {
    position: static;
  }
}

@media (max-width: 700px) {
  .ct-row-card {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
  }

  .ct-row-qty {
    grid-column: 1;
  }

  .ct-row-line {
    grid-column: 2;
    text-align: left;
  }

  .ct-row-qty,
  .ct-row-line {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .ct-row-line {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .ct-form-actions {
    flex-direction: column;
  }

  .ct-btn {
    width: 100%;
  }
}
