:root {
  --bg: #f6f6f6;
  --ink: #111;
  --muted: #6b6b6b;
  --line: #ececec;
  --red: #c90000;
  --header: #0d0d0d;
  --card: #fff;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(13, 13, 13, 0.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.logo { display: block; height: 24px; width: auto; }
.logo--on-dark { filter: brightness(0) invert(1); }

.top {
  height: 64px;
  background: var(--header);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.top__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.top__brand span {
  color: rgba(255,255,255,.72);
  font-size: 13px;
  font-weight: 500;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,.18);
}
.top__status { font-size: 12px; color: rgba(255,255,255,.7); }

.connect-banner {
  margin: 20px 28px 0;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  width: calc(100% - 56px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow);
}
.connect-banner[hidden] { display: none !important; }
.connect-banner p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

main { padding: 24px 28px 48px; min-width: 0; }

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
  align-items: start;
}
.side {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: 20px 14px;
  background: #f3f3f3;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.side__label {
  margin: 0 10px 8px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.side button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.side button.is-active {
  background: #c90000;
  color: #fff;
}
.side__help {
  margin-top: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.side__help p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.kpi strong { font-size: 26px; letter-spacing: -0.03em; }

[hidden] { display: none !important; }

.toolbar, .request {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.search { flex: 1; min-width: 220px; }
.search input, select, .request input, textarea {
  width: 100%;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  background: #fff;
}
select { width: auto; min-width: 160px; }

.btn, a.btn {
  background: var(--header);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn--red { background: var(--red); }
.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid #e4e4e4;
}
.btn--danger { background: var(--red); }
.check { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; min-height: 1.2em; margin: 0 0 12px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; }
.page-sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-head__actions { display: flex; align-items: center; gap: 12px; }
.sync-meta { margin: 0; color: var(--muted); font-size: 12px; }
.btn--sm { padding: 8px 12px; font-size: 12px; border-radius: 10px; }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 480px;
}
.otable { width: 100%; border-collapse: collapse; font-size: 13px; }
.otable th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
  white-space: nowrap;
}
.otable td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.order-main { cursor: pointer; }
.order-main:hover { background: #fafafa; }
.order-sub { background: #fcfcfc; }
.order-sub td { font-size: 12px; }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-cell img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  background: #f3f3f3;
}
.mini { color: var(--muted); font-size: 12px; }
.ocards { display: none; }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.badge--fulfillment { background: #f3e8ff; color: #6e40c9; margin-top: 0; }
.badge--scheduled { background: #fff4e5; color: #9a6700; }
.badge--waiting { background: #f3e8ff; color: #6e40c9; }
.badge--received, .badge--published { background: #eef8f0; color: #1a7f37; }
.badge--hidden, .badge--ineligible { background: #f4f4f4; color: #666; }

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(13,13,13,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}
.modal__card {
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.modal__card h2 { margin: 0 0 6px; }
.check-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
}
.check-line img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; }
.test-mail { display: grid; gap: 6px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.test-mail input { width: 100%; border: 1px solid #e6e6e6; border-radius: 12px; padding: 11px 14px; font: inherit; }
.when { border: 0; margin: 12px 0; padding: 0; display: flex; gap: 16px; }
.when legend { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 16px;
  align-items: start;
}
.list, .detail, .products {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.list { padding: 8px; min-height: 360px; }
.detail { padding: 20px; position: sticky; top: 16px; }
.row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}
.row:hover, .row.is-open { background: #fafafa; }
.row--order { grid-template-columns: 1fr auto; align-items: center; }
.row img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  background: #f3f3f3;
}
.row h3 { margin: 0 0 4px; font-size: 14px; }
.row p { margin: 0; color: var(--muted); font-size: 12px; }
.stars { color: var(--red); letter-spacing: 1px; font-size: 13px; }
.badge {
  display: inline-flex;
  background: #eef8f0;
  color: #1a7f37;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.badge--wait { background: #fff4e5; color: #9a6700; }
.badge--hide { background: #f4f4f4; color: #666; }
.empty { color: var(--muted); padding: 28px 16px; margin: 0; }

.detail h2 { margin: 0 0 8px; font-size: 18px; }
.detail .meta { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.detail .body { white-space: pre-wrap; line-height: 1.55; margin: 0 0 14px; }
.media-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.media-row img, .media-row video {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.detail textarea { min-height: 90px; margin-bottom: 8px; }
.subs { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

.products { margin-top: 16px; padding: 16px 18px; }
.products h2 { margin: 0 0 12px; font-size: 15px; }
.products table { width: 100%; border-collapse: collapse; font-size: 13px; }
.products th, .products td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); }
.products th { color: var(--muted); font-weight: 500; }

.request {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.request label { font-size: 13px; color: var(--muted); }
.request input { margin-top: 6px; min-width: 220px; }
.recent {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.recent button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.recent-label {
  width: 100%;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .otable th:nth-child(2), .otable td:nth-child(2) { display: none; }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .side__label, .side__help { display: none; }
  .side button { white-space: nowrap; }
  .workspace { grid-template-columns: 1fr; }
  .detail { position: static; }
  .top { padding: 0 16px; }
  main { padding: 16px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .connect-banner {
    width: calc(100% - 32px);
    margin: 16px auto 0;
    flex-direction: column;
    align-items: flex-start;
  }
  .otable { display: none; }
  .ocards { display: grid; gap: 12px; padding: 12px; }
  .ocard {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    display: grid;
    gap: 8px;
    background: #fff;
  }
  .ocard__top {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    cursor: pointer;
  }
  .table-wrap { min-height: 0; background: transparent; border: 0; box-shadow: none; }
}
