:root {
  color-scheme: light;
  --bg: #f7f3ed;
  --ink: #202124;
  --muted: #6b6258;
  --line: #ded6cb;
  --panel: #fffdf9;
  --accent: #006d77;
  --accent-strong: #004f58;
  --warm: #d97706;
  --ok: #16794c;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 18px 14px 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 2px 18px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.75rem, 9vw, 2.55rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.05rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-strong);
  font-size: 1.35rem;
  font-weight: 800;
}

.icon-button svg,
.icon-only svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stats article,
.panel,
.seller-card,
.booklet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats article {
  padding: 13px;
}

.stats span,
.meta,
label {
  color: var(--muted);
  font-size: 0.83rem;
}

.stats strong {
  display: block;
  margin-top: 5px;
  font-size: 1.55rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 18px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ece4d8;
}

.tab {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 1px 4px rgb(58 42 24 / 10%);
}

.view:not(.active) {
  display: none;
}

.view.active {
  display: block;
}

.view.forms-view.active {
  display: grid;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 2px 10px;
}

.section-title span {
  color: var(--muted);
  font-weight: 800;
}

.list,
.forms-view {
  display: grid;
  gap: 10px;
}

.seller-card,
.booklet-card,
.panel {
  padding: 14px;
}

.seller-card {
  user-select: none;
  touch-action: manipulation;
}

.seller-card header,
.booklet-card header,
.booklet-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.seller-card h3,
.booklet-card h3 {
  margin: 0;
  font-size: 1rem;
}

.pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e2f2ef;
  color: var(--accent-strong);
  padding: 5px 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.progress {
  height: 9px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #eadfce;
}

.progress > span {
  display: block;
  height: 100%;
  width: var(--value);
  border-radius: inherit;
  background: var(--ok);
}

.empty {
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.panel {
  display: grid;
  gap: 12px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.booklet-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.booklet-choice-card {
  display: grid;
  gap: 8px;
  user-select: none;
  touch-action: manipulation;
}

.booklet-actions {
  display: flex;
  justify-content: flex-end;
}

.booklet-choice span {
  font-weight: 850;
}

.booklet-choice small {
  color: var(--muted);
  font-weight: 750;
}

.booklet-choice.active {
  border-color: var(--accent);
  background: #e2f2ef;
}

.sales-form {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.sales-form h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.seller-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.secondary-button,
.plain-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  background: #fff;
  color: var(--accent-strong);
  font-weight: 850;
}

.icon-only {
  display: inline-grid;
  place-items: center;
  width: 44px;
  padding: 0;
}

.plain-button {
  min-height: 36px;
}

.dialog {
  width: min(calc(100% - 28px), 520px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgb(32 33 36 / 45%);
}

.dialog .panel {
  margin: 0;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px 14px;
}

.login-panel {
  width: min(100%, 420px);
}

label {
  display: grid;
  gap: 6px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(0 109 119 / 14%);
}

textarea {
  resize: vertical;
}

.number-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

button[type="submit"],
.save-sold,
.danger-button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 850;
}

.save-sold {
  min-width: 82px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink);
  font-size: 0.95rem;
}

.switch-row input {
  position: relative;
  width: 54px;
  height: 30px;
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: #c9beb0;
  padding: 0;
}

.switch-row input::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: 160ms ease;
}

.switch-row input:checked {
  background: var(--accent);
}

.switch-row input:checked::after {
  transform: translateX(24px);
}

.admin-options,
.nested-form {
  display: grid;
  gap: 12px;
}

.nested-form {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.danger-zone {
  color: #7f1d1d;
}

.danger-button {
  background: #b42318;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  width: min(calc(100% - 28px), 480px);
  transform: translate(-50%, 120%);
  border-radius: 8px;
  background: #1f2933;
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  transition: 180ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (min-width: 700px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
