:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #20212b;
  --muted: #707386;
  --line: #e7e9f2;
  --orange: #ff7a1a;
  --purple: #6f43d6;
  --green: #16a56b;
  --danger: #d64045;
  --shadow: 0 18px 45px rgba(31, 33, 48, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 270px;
  padding: 22px;
  background: #fff;
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--purple));
}
.side-nav { display: grid; gap: 5px; margin-top: 28px; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 650;
}
.side-nav a.active, .side-nav a:hover { background: #fff3e9; color: #a74605; }

.main { width: 100%; margin-left: 270px; padding: 28px; padding-bottom: 96px; }
.auth-main { margin-left: 0; display: grid; place-items: center; min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.topbar h1, .auth-card h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; }
.top-actions, .actions, .switch-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 800;
  background: #eef0f7;
  color: var(--ink);
}
.button.primary { color: #fff; background: linear-gradient(135deg, var(--orange), var(--purple)); }
.button.ghost { background: #fff; border: 1px solid var(--line); }
.button.danger { background: #fff0f1; color: var(--danger); }
.button.copy.copied { background: #e9fbf3; color: var(--green); }

.panel, .auth-card, .metric, .product-card, .publication-card, .variant, .plan {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 22px; margin-bottom: 22px; }
.panel.accent { background: linear-gradient(135deg, #ffffff, #fff7ef 60%, #f3f0ff); }
.panel h2, .plan h2 { margin: 0 0 16px; font-size: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.muted, .empty { color: var(--muted); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eefaf4;
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
}

.metric-grid, .plan-grid, .product-grid, .variant-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric { padding: 18px; }
.metric span { color: var(--muted); font-weight: 700; }
.metric strong { display: block; margin-top: 10px; font-size: 32px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 22px; }

.form { display: grid; gap: 14px; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 750; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.auth-card { width: min(520px, calc(100% - 28px)); padding: 30px; }
.auth-card p { color: var(--muted); }
.auth-brand { margin-bottom: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--purple); font-weight: 800; }
.installer { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.toast {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 750;
}
.toast.success { border-color: #b8efd5; background: #effcf6; color: #087047; }
.toast.error { border-color: #f2bdc0; background: #fff0f1; color: #a8242b; }

.list, .template-list, .publication-list { display: grid; gap: 12px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: #fafbff; border: 1px solid var(--line); border-radius: 8px; }
.publication-card, .variant, .product-card, .plan { padding: 18px; }
.product-card img { aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; margin-bottom: 12px; background: #f1f2f7; }
.product-card h3 { min-height: 48px; font-size: 17px; margin: 0 0 8px; }
.variant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan.current { outline: 2px solid var(--green); }
.template-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.template-item summary { cursor: pointer; font-weight: 800; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
.link-button { border: 0; background: transparent; color: var(--purple); font-weight: 800; cursor: pointer; }

#artCanvas {
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.logo-preview { width: 96px; height: 96px; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.admin-payment { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 12px; }

.bottom-nav { display: none; }

@media (max-width: 1080px) {
  .metric-grid, .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid, .plan-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 14px 92px; }
  .topbar { align-items: flex-start; }
  .top-actions span { display: none; }
  .grid.two, .inline-form, .variant-grid, .metric-grid, .product-grid { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 8px 10px;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 20;
  }
  .bottom-nav a {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 54px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 18px;
  }
  .bottom-nav span { font-size: 11px; font-weight: 750; }
  .bottom-nav .create { background: #fff3e9; color: #a74605; }
}
