:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5c6b7a;
  --line: #d7dee7;
  --accent: #0b5fff;
  --accent-hover: #0948c6;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 920px; margin: 0 auto; padding: 1.25rem; }
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding-top: .9rem;
  padding-bottom: .9rem;
}
.site-header .nav {
  margin-left: 0;
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.nav { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.nav a { color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none; }
.nav a:hover { color: var(--text); }

.langSwitch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--muted);
  flex-shrink: 0;
  margin-left: auto;
}
.langSwitch:hover { color: var(--text); }
.langFlag {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  line-height: 1;
  width: 22px;
  height: 15px;
}
.langFlagImg {
  display: block;
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(26, 35, 50, 0.12);
}
.langSwitch select {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font: inherit;
  background: transparent;
}
.langSwitch:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 999px;
}
.appError {
  background: var(--danger-bg);
  color: var(--danger);
  border-bottom: 1px solid #fecdca;
  padding: .75rem 1.25rem;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin: 0 0 1.25rem;
}
.tab {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: .65rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab-panel { padding-top: .25rem; }

/* Segmented tab switch (account) — not native buttons */
.tab-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 0 0 1.35rem;
  background: #e8eef5;
  border-radius: 10px;
  border: 1px solid var(--line);
}
button.tab-switch__item {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: .7rem .9rem;
  border: 0 !important;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  outline: none;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
button.tab-switch__item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.45);
}
button.tab-switch__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.tab-switch__item.is-active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 1px 2px rgba(26, 35, 50, 0.08), 0 0 0 1px rgba(26, 35, 50, 0.06);
}

.channel-list-title {
  margin: 0 0 .75rem;
  font-size: 1.05rem;
}
.channel-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.channel-item {
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.channel-item:last-child { border-bottom: 0; }
.channel-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.channel-item-name {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.channel-details {
  margin: 0;
  display: grid;
  gap: .55rem .75rem;
}
.channel-details > div {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: .5rem;
  align-items: start;
}
.channel-details dt {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 600;
}
.channel-details dd {
  margin: 0;
  word-break: break-word;
}
@media (max-width: 560px) {
  .channel-details > div {
    grid-template-columns: 1fr;
    gap: .15rem;
  }
}
.hero {
  padding: 3rem 0 2rem;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  margin: 0 0 .75rem;
}
.hero p { color: var(--muted); margin: 0 0 1.5rem; max-width: 36rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn-secondary:hover { background: #eef2f6; color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h2 { margin: 0 0 1rem; font-size: 1.2rem; }
label { display: block; font-size: .85rem; font-weight: 600; margin: 0 0 .35rem; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  margin: 0 0 .85rem;
  background: #fff;
}
textarea { resize: vertical; min-height: 4.5rem; }
.form-actions { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.error-box {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.search-row { display: flex; gap: .5rem; }
.search-row input { margin-bottom: 0; flex: 1; }
.product {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.product:last-child { border-bottom: 0; }
.product h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.meta { color: var(--muted); font-size: .9rem; }
.price { font-weight: 700; white-space: nowrap; }
.product-actions { display: flex; flex-direction: column; gap: .5rem; align-items: stretch; }
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: #123;
  color: #fff;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  display: none;
}
.toast.show { display: block; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
}
.stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem;
}
.stat .label { color: var(--muted); font-size: .8rem; }
.stat .value { font-size: 1.35rem; font-weight: 700; }
.pick {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: .35rem;
  color: var(--muted);
}
.pick input { margin: 0; }
code.aff-id {
  background: #f0f4f8;
  padding: .15rem .4rem;
  border-radius: 4px;
  font-size: .95rem;
}
