:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --line: #d8e0e8;
  --text: #17202a;
  --muted: #637083;
  --blue: #1769e0;
  --blue-2: #0d4fb4;
  --green: #14845b;
  --amber: #a76200;
  --red: #c22a3f;
  --shadow: 0 18px 55px rgba(22, 31, 43, 0.11);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: var(--blue);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #e62117;
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  width: max-content;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.nav-tabs button {
  min-width: 74px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.nav-tabs button.active {
  color: var(--text);
  background: white;
  box-shadow: 0 5px 16px rgba(31, 44, 61, 0.08);
}

.user-pill,
.status-pill,
.status-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: white;
  white-space: nowrap;
}

.user-pill {
  cursor: pointer;
}

.status-pill.ok,
.status-chip.ok {
  color: var(--green);
  background: #e9f7f0;
  border-color: #bfe8d3;
}

.status-pill.warn,
.status-chip.warn {
  color: var(--amber);
  background: #fff4de;
  border-color: #f3d49d;
}

.status-chip.danger {
  color: var(--red);
  background: #fff0f2;
  border-color: #f3bdc6;
}

main {
  padding: 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: 38px;
  line-height: 1.12;
}

.hero-copy p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-stats span {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 120px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.hero-stats strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span,
.check-line span {
  color: #455468;
  font-weight: 700;
  font-size: 13px;
}

.check-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 14px;
}

.check-line input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.price-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.price-card.featured {
  border-color: #91b9ff;
  box-shadow: 0 18px 55px rgba(23, 105, 224, 0.16);
}

.price-card span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.price-card strong {
  font-size: 32px;
}

.price-card ul {
  display: grid;
  gap: 8px;
  min-height: 118px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.price-card button,
.button-row button {
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--blue);
  color: white;
  font-weight: 700;
}

.account-grid,
.admin-panels {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.user-row {
  gap: 8px;
}

.user-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.user-main img,
.avatar-fallback {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  background: #e8edf3;
  color: var(--muted);
  font-weight: 800;
}

.user-main code,
.list-item code {
  overflow-wrap: anywhere;
  color: #566579;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.email-login-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #bfe8d3;
  border-radius: 8px;
  background: #e9f7f0;
}

.email-login-box button,
.google-button {
  border-radius: 8px;
  padding: 12px 14px;
  background: #17a65a;
  color: white;
  font-weight: 800;
}

.google-button {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
}

.email-login-box p {
  margin: 0;
  color: #246348;
  line-height: 1.45;
}

.button-row {
  display: flex;
  gap: 10px;
}

.button-row button {
  flex: 1;
}

.button-row .secondary {
  color: var(--text);
  background: white;
}

.entitlement-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.entitlement-card span {
  color: var(--muted);
}

.entitlement-card strong {
  font-size: 26px;
}

.entitlement-card p {
  margin: 0;
  color: var(--muted);
}

.quota-list,
.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.list-item span {
  color: var(--muted);
}

.panel,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.panel-head,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head {
  margin: 0 0 18px;
}

.panel-head.compact {
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.url-form {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--text);
  background: white;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, 0.12);
}

.url-form button,
.claim-form button,
.download-button,
.secondary,
.review-actions button {
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--blue);
  color: white;
  font-weight: 700;
}

.url-form button:hover,
.claim-form button:hover,
.download-button:hover,
.review-actions button:hover {
  background: var(--blue-2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary {
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
}

.notice {
  margin: 14px 0;
  padding: 12px 13px;
  border-radius: 8px;
  color: #4d5b6b;
  background: #f6f8fb;
  border: 1px solid var(--line);
  line-height: 1.55;
}

.empty-state {
  display: grid;
  gap: 6px;
  place-items: center;
  min-height: 170px;
  padding: 24px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed #c9d4df;
  border-radius: 8px;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.hidden {
  display: none !important;
}

.video-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.video-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
}

.video-info h2 {
  margin-bottom: 8px;
}

.video-info p {
  color: var(--muted);
  line-height: 1.5;
}

.claim-form {
  display: grid;
  gap: 13px;
}

.claim-form label span {
  display: block;
  margin-bottom: 7px;
  color: #455468;
  font-weight: 700;
  font-size: 13px;
}

.claim-form .check-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.claim-form .check-line input {
  width: 16px;
  height: 16px;
}

.claim-form .check-line span {
  margin: 0;
}

.cookie-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.cookie-box strong,
.cookie-box span {
  display: block;
}

.cookie-box span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.ok-text {
  color: var(--green) !important;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  padding: 9px 11px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 700;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.file-button span {
  margin: 0;
  color: white;
}

.advanced-box {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.advanced-box summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.advanced-box label {
  display: block;
  margin-top: 12px;
}

.advanced-box .cookie-box {
  margin-top: 12px;
}

.decision-box {
  display: grid;
  gap: 5px;
  margin: 14px 0;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
}

.decision-box strong {
  color: var(--text);
}

.decision-box.ok {
  background: #e9f7f0;
  border-color: #bfe8d3;
}

.decision-box.warn {
  background: #fff4de;
  border-color: #f3d49d;
}

.decision-box.danger {
  background: #fff0f2;
  border-color: #f3bdc6;
}

.hint-box {
  margin: 0 0 14px;
  padding: 11px 12px;
  border-radius: 8px;
  color: #536172;
  background: #f8fafc;
  border: 1px solid var(--line);
  line-height: 1.5;
  font-size: 13px;
}

.quality-field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.quality-field span {
  color: #455468;
  font-weight: 700;
  font-size: 13px;
}

.quality-field small {
  color: var(--muted);
  line-height: 1.45;
}

.download-button {
  width: 100%;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: #506072;
  background: #f8fafc;
  font-size: 13px;
}

td strong,
td span {
  display: block;
}

td span,
.muted,
.muted-row {
  color: var(--muted);
}

td code {
  display: block;
  max-width: 420px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #4a5568;
}

.path-code {
  max-width: 360px;
  margin-top: 6px;
}

.log-button {
  margin-bottom: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--blue);
  background: #eef5ff;
  border: 1px solid #cfe2ff;
  font-weight: 700;
}

.progress {
  width: 160px;
  height: 8px;
  margin: 4px 0 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.download-link {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 5px;
  padding: 7px 10px;
  border-radius: 6px;
  color: white;
  background: var(--green);
  text-decoration: none;
  font-weight: 700;
}

.review-list,
.audit-list {
  display: grid;
  gap: 12px;
}

.review-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.review-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
}

.review-card p {
  color: var(--muted);
}

blockquote {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: #f8fafc;
  color: #39485a;
}

.review-actions {
  display: flex;
  gap: 8px;
}

.review-actions .danger {
  background: var(--red);
}

.audit-item {
  display: grid;
  grid-template-columns: 190px 220px 1fr;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.audit-item span {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  color: white;
  background: #1f2937;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

.log-dialog {
  width: min(980px, calc(100vw - 36px));
  max-height: min(760px, calc(100vh - 36px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.log-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
}

.dialog-head button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--muted);
  background: #f2f5f8;
  font-size: 22px;
  line-height: 1;
}

.log-meta {
  display: grid;
  gap: 6px;
  padding: 12px 20px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.log-meta span {
  overflow-wrap: anywhere;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.analytics-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.analytics-panels .panel h2 {
  margin-top: 0;
}

.analytics-list,
.analytics-events {
  display: grid;
  gap: 10px;
}

.analytics-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  overflow: hidden;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.analytics-row span,
.analytics-row strong {
  position: relative;
  z-index: 1;
}

.analytics-row span {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-row i {
  position: absolute;
  inset: auto auto 0 0;
  height: 3px;
  border-radius: 999px;
  background: var(--blue);
}

.analytics-event {
  display: grid;
  gap: 5px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.analytics-event span {
  color: var(--muted);
  font-size: 12px;
}

.analytics-event strong,
.analytics-event code {
  overflow-wrap: anywhere;
}

#logContent {
  margin: 0;
  padding: 18px 20px;
  max-height: 560px;
  overflow: auto;
  color: #0f172a;
  background: #f8fafc;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .nav-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .account-grid,
  .admin-panels {
    grid-template-columns: 1fr;
  }

  .analytics-grid,
  .analytics-panels,
  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  main {
    padding: 14px;
  }

  .url-form,
  .video-card,
  .review-card,
  .audit-item,
  .hero-stats,
  .analytics-grid,
  .analytics-panels,
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .hero-copy h1 {
    font-size: 28px;
  }
}
