/* ==========================================================================
   StitchChart Studio — design system
   ========================================================================== */

:root {
  --font-ui: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --bg: #f7f4ee;
  --bg-tint: #efe9dd;
  --surface: #fffdf9;
  --surface-2: #f3eee3;
  --surface-3: #e9e2d3;
  --ink: #211d17;
  --ink-soft: #453e34;
  --muted: #776d5f;
  --line: #e3dbcb;
  --line-strong: #d2c7b2;
  --accent: #b4553a;
  --accent-hover: #9c4630;
  --accent-soft: #f6e4dd;
  /* Text-safe accent: 4.5:1+ on the page, tint and soft backgrounds. Fills, borders and
     icons keep the brand --accent, which only needs 3:1 as a non-text colour. */
  --accent-text: #a94b31;
  --accent-ink: #fffaf7;
  --green: #2f4a3f;
  --green-soft: #e3ebe4;
  --canvas-bg: #e9e3d6;
  --danger: #a3312c;
  --danger-soft: #f8e4e2;
  --warn: #845114;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(40, 32, 20, 0.06), 0 2px 8px rgba(40, 32, 20, 0.04);
  --shadow: 0 10px 30px rgba(40, 32, 20, 0.09), 0 2px 6px rgba(40, 32, 20, 0.05);
  --shadow-lg: 0 28px 70px rgba(30, 24, 14, 0.18);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #14130f;
  --bg-tint: #1a1915;
  --surface: #1d1c17;
  --surface-2: #25241e;
  --surface-3: #2f2d25;
  --ink: #f4eee2;
  --ink-soft: #ddd4c4;
  --muted: #a49a89;
  --line: #322f27;
  --line-strong: #46412f;
  --accent: #e2795a;
  --accent-hover: #ef8a6b;
  --accent-soft: #3a2921;
  --accent-text: var(--accent);
  --accent-ink: #1d1613;
  --green: #6fa78d;
  --green-soft: #23302a;
  --canvas-bg: #211f19;
  --danger: #e0847a;
  --danger-soft: #3a2422;
  --warn: #e0ad6b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-root {
  min-height: 100dvh;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
  line-height: 1.08;
}
h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.18;
}
h3 {
  font-size: 1.16rem;
}
p {
  margin: 0 0 0.7em;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  max-width: 100%;
  display: block;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.83rem;
}
.tiny {
  font-size: 0.75rem;
}
.mono {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
.center {
  text-align: center;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
}
.stack {
  display: grid;
  gap: 14px;
}
.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-3);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-outline {
  background: transparent;
  border-color: var(--line-strong);
}
.btn-outline:hover {
  background: var(--surface-2);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  filter: brightness(0.94);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}
.btn-lg {
  padding: 14px 26px;
  font-size: 0.98rem;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  transition: background 0.14s ease, color 0.14s ease;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* -------------------------------------------------------------- inputs --- */
.field {
  display: grid;
  gap: 6px;
}
.label {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.textarea {
  min-height: 84px;
  resize: vertical;
}
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
  user-select: none;
}
.checkbox input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}
.print-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 12px;
}
.print-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
  border-radius: 3px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.help {
  font-size: 0.8rem;
  color: var(--muted);
}
.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* --------------------------------------------------------------- cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad {
  padding: 22px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.73rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: transparent;
}
.badge-green {
  background: var(--green-soft);
  color: var(--green);
  border-color: transparent;
}
.badge-warn {
  background: color-mix(in srgb, var(--warn) 14%, transparent);
  color: var(--warn);
  border-color: transparent;
}

/* ---------------------------------------------------------------- nav ---- */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.app-nav .container {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--green);
  color: #f3ead8;
  display: grid;
  place-items: center;
}
.nav-links {
  display: flex;
  gap: 22px;
  margin-left: 16px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 550;
}
.nav-links a:hover {
  color: var(--accent-text);
}
.nav-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --------------------------------------------------------------- hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
  background: radial-gradient(1200px 500px at 78% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 65%),
    radial-gradient(900px 400px at 5% 10%, color-mix(in srgb, var(--green) 10%, transparent), transparent 60%);
}
.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px;
  align-items: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: '';
  width: 26px;
  height: 1.5px;
  background: var(--accent);
  display: block;
}
.hero .lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 46ch;
  margin: 20px 0 26px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.hero-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 14px;
}
.hero-visual {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  transform: rotate(-1.2deg);
}
.hero-visual canvas {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}
.hero-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.hero-badge {
  position: absolute;
  right: -18px;
  bottom: 44px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.78rem;
  display: grid;
  gap: 2px;
  transform: rotate(1.8deg);
}
.hero-badge strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
}

/* ------------------------------------------------------------ sections --- */
.section {
  padding: 68px 0;
}
.section-tint {
  background: var(--bg-tint);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section-head {
  max-width: 640px;
  margin-bottom: 38px;
}
.section-head p {
  color: var(--muted);
  margin-top: 12px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 14px;
}
.feature h3 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}
.feature p {
  color: var(--muted);
  font-size: 0.89rem;
  margin: 0;
}

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}
.compare-col {
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.compare-col.highlight {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  background: linear-gradient(180deg, var(--accent-soft), transparent 70%);
}
.compare-col h3 {
  margin-bottom: 12px;
}
.compare-col ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.89rem;
}
.compare-col li {
  margin-bottom: 7px;
}

/* ------------------------------------------------------------- pricing --- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.plan {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
}
.plan.featured {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)), var(--surface) 55%);
}
.plan-tag {
  position: absolute;
  top: -12px;
  right: 22px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
}
.plan h3 {
  font-size: 1.1rem;
}
.plan-price {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: -0.03em;
  margin-top: 4px;
}
.plan-price span {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}
.plan-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 4px;
  display: grid;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.plan-list li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.plan-list svg {
  flex: 0 0 auto;
  margin-top: 3px;
  color: var(--green);
}
.plan .btn {
  margin-top: 10px;
}

/* ----------------------------------------------------------------- faq --- */
.faq {
  display: grid;
  gap: 10px;
  max-width: 820px;
}
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px 18px;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.94rem;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq p {
  color: var(--muted);
  margin: 10px 0 0;
  font-size: 0.88rem;
}

/* -------------------------------------------------------------- footer --- */
.footer {
  border-top: 1px solid var(--line);
  padding: 34px 0;
  color: var(--muted);
  font-size: 0.83rem;
}
.footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

/* ---------------------------------------------------------------- auth --- */
.auth-wrap {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.auth-side {
  background: var(--green);
  color: #f3ead8;
  padding: 54px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-side::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(243, 234, 216, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 234, 216, 0.08) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}
.auth-side h2 {
  color: #f7efe0;
  font-size: 2rem;
  position: relative;
}
.auth-side p {
  color: rgba(247, 239, 224, 0.75);
  position: relative;
}
.auth-side .brand {
  color: #f3ead8;
  position: relative;
}
.auth-side .brand-mark {
  background: rgba(255, 255, 255, 0.12);
}
.auth-main {
  display: grid;
  place-items: center;
  padding: 44px 24px;
}
.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
}
.auth-card h1 {
  font-size: 2rem;
  margin-bottom: 2px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--ink);
}
.google-btn:hover {
  background: var(--surface-2);
}

/* ----------------------------------------------------------- dashboard --- */
.dash {
  padding: 34px 0 70px;
}
.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.dash-head h1 {
  font-size: 2rem;
}
.dash-stats {
  display: flex;
  gap: 26px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.dash-stat {
  display: grid;
  gap: 1px;
}
.dash-stat strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.dash-stat span {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
}
.chart-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.chart-card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
.chart-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--surface-2);
}
.chart-card .chart-meta {
  padding: 13px 14px 14px;
  display: grid;
  gap: 6px;
  flex: 1;
}
.chart-card h3 {
  font-size: 1rem;
  font-family: var(--font-ui);
  font-weight: 650;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-sub {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.76rem;
}
.progress-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}
.chart-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.chart-card:hover .chart-actions,
.chart-card:focus-within .chart-actions {
  opacity: 1;
}
.chart-actions .icon-btn {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-sm);
}
.chart-create {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  min-height: 230px;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  background: transparent;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  font-family: inherit;
  font-size: 0.9rem;
}
.chart-create:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}
.chart-create .plus {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}

/* --------------------------------------------------------------- table --- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 650;
}
.table tr:hover td {
  background: var(--surface-2);
}
.table .legacy-row td {
  background: color-mix(in srgb, var(--warn) 8%, transparent);
}
.stock-table {
  table-layout: fixed;
}
.stock-table th:first-child,
.stock-table td:first-child {
  width: 86px;
}
.stock-table th:nth-child(2),
.stock-table td:nth-child(2) {
  width: 76px;
}
.stock-table th:nth-child(4),
.stock-table td:nth-child(4) {
  width: 96px;
}
.legacy-mobile {
  display: none;
}
@media (max-width: 560px) {
  .stock-table th:first-child,
  .stock-table td:first-child {
    display: none;
  }
  .stock-table th,
  .stock-table td {
    padding: 8px 6px;
  }
  .stock-table th:nth-child(2),
  .stock-table td:nth-child(2) {
    width: 68px;
  }
  .stock-table th:nth-child(4),
  .stock-table td:nth-child(4) {
    width: 74px;
  }
  .stock-table input {
    width: 64px !important;
    padding: 5px 4px !important;
  }
  .legacy-mobile {
    display: inline;
  }
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.48);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fade 0.16s ease;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(520px, 100%);
  max-height: min(90dvh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-wide {
  width: min(880px, 100%);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-size: 1.2rem;
}
.modal-body {
  padding: 20px;
  overflow: auto;
  display: grid;
  gap: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

/* -------------------------------------------------------------- toasts --- */
.toast-host {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: grid;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 11px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 0.87rem;
  font-weight: 550;
  animation: pop 0.2s ease;
  max-width: 360px;
}
:root[data-theme='dark'] .toast {
  background: var(--surface-3);
  color: var(--ink);
}
.toast-success {
  background: var(--green);
  color: #f4f0e4;
}
.toast-error {
  background: var(--danger);
  color: #fff;
}
.toast-out {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* --------------------------------------------------------------- offline --- */
.offline-banner {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 210;
  background: var(--warn);
  color: #fff8e8;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 550;
  text-align: center;
  max-width: calc(100% - 32px);
}

/* -------------------------------------------------------------- loading --- */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 40px 0;
  justify-content: center;
}
.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty {
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  padding: 60px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}
.empty-icon {
  color: var(--accent);
  opacity: 0.7;
}
.empty h3 {
  color: var(--ink);
  margin-top: 4px;
}
.empty p {
  max-width: 40ch;
  margin: 0;
}

/* ---------------------------------------------------------------- tabs --- */
.tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 999px;
  font-size: 0.82rem;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------- misc pages ---- */
.page-head {
  padding: 40px 0 10px;
}
.page-head h1 {
  font-size: 2rem;
  margin-bottom: 6px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  padding: 28px 0 70px;
}
.settings-nav {
  display: grid;
  gap: 4px;
  position: sticky;
  top: 84px;
}
.settings-nav a {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 550;
}
.settings-nav a:hover,
.settings-nav a.active {
  background: var(--surface-2);
  color: var(--ink);
}
.banner {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.87rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  margin-bottom: 18px;
}
.banner-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.kbd {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  color: var(--ink-soft);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* --------------------------------------------------- focus and errors --- */

/* Keyboard focus is always visible; pointer focus keeps the softer field ring. */
:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex='-1'])):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary:focus-visible,
.btn-danger:focus-visible {
  outline-color: var(--ink);
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 45%, var(--surface));
}
.field-error {
  display: block;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 550;
  margin-top: 2px;
}
.checkbox {
  flex-wrap: wrap;
}
.checkbox .field-error {
  flex-basis: 100%;
}
.error-state {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--danger-soft);
}
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--bg);
  font-weight: 650;
}
.skip-link:focus {
  top: 12px;
}
.shortcut-list {
  display: grid;
  gap: 7px;
}
.shortcut-row {
  display: grid;
  grid-template-columns: minmax(130px, max-content) 1fr;
  gap: 12px;
  align-items: baseline;
  font-size: 0.88rem;
}
.shortcut-row .kbd {
  justify-self: start;
}

/* ------------------------------------------------------------ responsive - */
@media (max-width: 980px) {
  .hero .container {
    grid-template-columns: 1fr;
    gap: 34px;
  }
  .hero {
    padding: 44px 0 40px;
  }
  .hero-visual {
    transform: none;
  }
  .feature-grid,
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth-wrap {
    grid-template-columns: 1fr;
  }
  .auth-side {
    display: none;
  }
  .compare {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    display: flex;
    overflow-x: auto;
  }
  .nav-links {
    display: none;
  }
}

@media (max-width: 640px) {
  .feature-grid,
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  .container {
    padding: 0 18px;
  }
  .section {
    padding: 44px 0;
  }
  .hero-badge {
    display: none;
  }
  .chart-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .dash-stats {
    gap: 18px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Plans: sale pricing, price locks and promo entry */
.plan-sale {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
}
.plan-was {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: line-through;
  margin-right: 6px;
}
.plan-lock {
  margin: 2px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}
.sale-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 9px 14px;
  margin: 0 auto 18px;
  max-width: 760px;
}
.promo-row {
  margin-top: 18px;
  align-items: center;
}

/* Marketplace */
.market-toolbar {
  margin: 0 0 18px;
  align-items: center;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}
.market-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.market-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.market-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.market-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.market-plain svg {
  width: 42px;
  height: 42px;
  color: var(--muted);
}
.market-free {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.market-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
}
.market-price {
  font-weight: 700;
  color: var(--ink);
}
.market-detail-img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

/* Admin console */
.admin-tabs {
  margin: 4px 0 18px;
  width: fit-content;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.admin-stat strong {
  font-size: 20px;
}
.admin-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.admin-row {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.admin-row:last-child {
  border-bottom: 0;
}
.admin-user-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.admin-actions {
  margin-top: 10px;
  align-items: center;
}

/* Licence tabs on the pricing page */
.pricing-tabs {
  margin: 18px 0 6px;
  width: fit-content;
}
