:root {
  --ink: #16212b;
  --muted: #5b6b78;
  --line: #d9e1e7;
  --bg: #f3f6f8;
  --card: #ffffff;
  --brand: #0f3d4a;
  --brand-2: #1a7f93;
  --danger: #b42318;
  --warn-bg: #fff4e5;
  --warn-ink: #8a4b00;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1em; }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 10px 12px; border-radius: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--brand); color: #fff;
}
.brand { font-weight: 700; letter-spacing: .2px; }
.brand span { color: #85d8e9; }
.who { font-size: 13px; opacity: .9; display: flex; gap: 10px; align-items: center; }
.who button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 6px; padding: 4px 8px; font-size: 12px; }

.view { max-width: 960px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.center { text-align: center; max-width: 420px; margin: 40px auto; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.tab {
  flex: 1; min-width: 100px; padding: 10px 12px; border: 1px solid var(--line);
  background: #fff; border-radius: 999px; font-size: 15px; color: var(--ink);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
label .muted { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 16px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  display: inline-block; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: none; font-size: 20px; padding: 4px 8px; cursor: pointer; }

.video-slot {
  display: flex; gap: 12px; align-items: center; padding: 14px; margin: 4px 0 14px;
  border: 1px dashed var(--line); border-radius: 10px; background: #fafcfd;
}
.video-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }

.list .item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list .item:last-child { border-bottom: none; }
.item .meta { font-size: 13px; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef4f6; color: var(--brand); margin-right: 4px; }
.pill.bad { background: #fde8e6; color: var(--danger); }

.sheet { position: fixed; inset: 0; background: rgba(10,20,28,.5); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { width: 100%; max-width: 560px; margin: 0; border-radius: 16px 16px 0 0; max-height: 92vh; overflow: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-body { border-radius: 16px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.linkbox { font-size: 13px; background: #f3f6f8; border-radius: 8px; padding: 8px 10px; word-break: break-all; margin-bottom: 12px; }
.sendgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 8px; }
.filters label { margin: 0; flex: 1; min-width: 130px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: right; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tr.store-row td { background: #eef4f6; font-weight: 700; }
tr.rep-row td:first-child { padding-left: 20px; }
tr.rep-row { cursor: pointer; }
tr.rep-row:hover td { background: #fafcfd; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 30; font-size: 14px; max-width: 90vw; }

@media (max-width: 480px) {
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .sendgrid { grid-template-columns: 1fr; }
}
