:root {
  font-family: Inter, "Segoe UI", sans-serif;
  color: #17202a;
  background: #f4f6f8;
}

* { box-sizing: border-box; }
body { margin: 0; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 10px; }
.muted { color: #6d7c89; font-size: 14px; }

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #edf2f7;
}

.auth-card,
.panel {
  background: #fff;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(18, 35, 52, 0.06);
}

.auth-card { width: min(420px, 100%); padding: 32px; }
.eyebrow { font-size: 12px; font-weight: 700; color: #39708f; }
.auth-card form,
.form-grid { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; color: #3d4b57; font-size: 14px; font-weight: 600; }
input, textarea, select, button { font: inherit; }
input, textarea, select {
  width: 100%;
  border: 1px solid #ccd6df;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: #17202a;
}
textarea { min-height: 90px; resize: vertical; }
button {
  border: 1px solid #c8d2da;
  border-radius: 6px;
  padding: 10px 14px;
  background: #fff;
  color: #324452;
  cursor: pointer;
}
button:hover { background: #f0f5f8; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { border-color: #256b87; background: #256b87; color: #fff; }
.primary:hover { background: #1e5970; }
.captcha-row { display: grid; grid-template-columns: 1fr 140px; gap: 8px; }
.captcha-row button { padding: 0; overflow: hidden; }
.captcha-row img { display: block; width: 100%; height: 42px; }
.message { min-height: 22px; margin-top: 12px; color: #b42318; }
.message.ok { color: #18794e; }

.app-view { min-height: 100vh; }
.topbar {
  height: 78px;
  background: #fff;
  border-bottom: 1px solid #dce3ea;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h1 { font-size: 20px; margin: 2px 0 0; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.developer-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 78px); }
.developer-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid #dce3ea;
  background: #fff;
  padding: 24px 14px;
}
.developer-nav { display: grid; gap: 4px; }
.developer-nav button {
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 4px;
  padding: 11px 14px;
  text-align: left;
  background: transparent;
  color: #536270;
}
.developer-nav button:hover { background: #f0f5f8; }
.developer-nav button.active { border-left-color: #256b87; background: #eaf2f6; color: #174f66; font-weight: 700; }
.sidebar-version { margin-top: auto; padding: 18px 14px 0; color: #87939d; font-size: 12px; }
.developer-workspace { min-width: 0; padding: 28px 32px 40px; }
.developer-page { display: none; max-width: 1360px; margin: 0 auto; }
.developer-page.active { display: block; }
.global-message { max-width: 1360px; margin: 0 auto 8px; }

.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.panel { padding: 20px; margin-bottom: 20px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 12px; }
.wide { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { background: #fff; border: 1px solid #dce3ea; border-radius: 8px; padding: 17px; }
.metric span, .metric small { display: block; color: #6d7c89; }
.metric span { font-size: 13px; }
.metric strong { display: block; margin: 8px 0 5px; font-size: 21px; }
.metric small { font-size: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 10px; border-bottom: 1px solid #edf0f2; text-align: left; white-space: nowrap; }
th { color: #6d7c89; font-weight: 600; background: #f8fafb; }
td.note { white-space: normal; min-width: 180px; }
.empty { text-align: center; color: #6d7c89; padding: 24px; }

.package-list { display: grid; gap: 16px; }
.package-card { background: #fff; border: 1px solid #dce3ea; border-radius: 8px; padding: 20px; }
.package-header { display: flex; justify-content: space-between; gap: 16px; }
.status {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #536270;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
.status.published, .status.paid, .status.available { background: #e7f6ed; color: #18794e; }
.status.processing, .status.pending, .status.pending_review { background: #fff4d6; color: #8a5b00; }
.status.rejected { background: #fdecec; color: #b42318; }
.package-current-label { display: block; margin: 14px 0 8px; color: #6d7c89; font-size: 12px; font-weight: 600; }
.version-row { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-top: 1px solid #edf0f2; padding: 14px 0 0; font-size: 14px; }
.version-main { min-width: 0; flex: 1; }
.version-meta { display: flex; gap: 12px; flex-wrap: wrap; color: #6d7c89; }
.version-actions { display: flex; flex-shrink: 0; gap: 8px; }
.version-actions button { padding: 7px 10px; font-size: 13px; }
.version-review { margin-top: 10px; }
.review-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-tag { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.review-tag.passed { background: #e7f6ed; color: #18794e; }
.review-tag.failed { background: #fdecec; color: #b42318; }
.review-tag.neutral { background: #eef2f5; color: #536270; }
.review-detail { font-size: 12px; color: #6d7c89; }
.review-note { margin: 8px 0 0; max-width: 760px; color: #536270; line-height: 1.55; white-space: pre-wrap; }
.review-note.failed { color: #b42318; }
.package-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.package-actions button:first-child { border-color: #256b87; color: #256b87; }
.plan-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.plan-summary span { padding: 6px 9px; border: 1px solid #dce3ea; border-radius: 6px; background: #f8fafb; color: #536270; font-size: 12px; }
.plan-empty { margin: 12px 0 0; color: #b42318; font-size: 13px; }
.plan-list { display: grid; gap: 10px; margin: 16px 0 20px; }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px; border: 1px solid #dce3ea; border-radius: 6px; }
.plan-row-title { display: flex; align-items: center; gap: 10px; }
.plan-row p { margin: 6px 0 0; color: #3d4b57; }
.plan-row small { display: block; margin-top: 5px; color: #6d7c89; }
.plan-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.plan-actions .danger { color: #b42318; border-color: #efb9b5; }

dialog { border: 0; border-radius: 8px; padding: 24px; width: min(500px, calc(100% - 32px)); box-shadow: 0 20px 60px rgba(18, 35, 52, 0.22); }
dialog::backdrop { background: rgba(18, 35, 52, 0.35); }
dialog form { display: grid; gap: 16px; }
.wide-dialog { width: min(940px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.dialog-heading h3 { margin-bottom: 4px; }
.dialog-heading p { margin: 0; }
.wide-dialog td:last-child { white-space: nowrap; }
.version-history-current { color: #18794e; font-weight: 700; }

.release-panel { max-width: 920px; }
.release-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.release-heading h3 { margin-top: 6px; font-size: 24px; }
.release-download { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 132px; padding: 10px 16px; border: 1px solid #256b87; border-radius: 6px; text-decoration: none; }
.release-download:hover { background: #1e5970; }
.release-meta { display: grid; grid-template-columns: minmax(140px, 0.35fr) minmax(0, 1fr); gap: 12px 28px; margin: 24px 0 0; padding: 18px 0; border-top: 1px solid #edf0f2; border-bottom: 1px solid #edf0f2; }
.release-meta div { min-width: 0; }
.release-meta dt { color: #6d7c89; font-size: 12px; }
.release-meta dd { margin: 6px 0 0; font-size: 14px; }
.release-hash { overflow-wrap: anywhere; font-family: Consolas, monospace; }
.release-notes { padding-top: 20px; }
.release-notes h3 { font-size: 16px; }
.release-notes p { margin: 0; color: #3d4b57; line-height: 1.7; white-space: pre-wrap; }
.release-state, .release-empty { padding: 48px 16px; text-align: center; color: #6d7c89; }
.release-empty strong { color: #324452; }
.release-empty p { margin: 8px 0 18px; }
.release-empty.error strong { color: #b42318; }

@media (max-width: 1000px) {
  .developer-shell { grid-template-columns: 180px minmax(0, 1fr); }
  .developer-workspace { padding: 24px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .topbar { padding: 14px 20px; }
  .developer-shell { display: block; }
  .developer-sidebar { position: sticky; top: 0; z-index: 5; padding: 8px 12px; border-right: 0; border-bottom: 1px solid #dce3ea; }
  .developer-nav { display: flex; overflow: auto; }
  .developer-nav button { width: auto; flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; }
  .developer-nav button.active { border-left: 0; border-bottom-color: #256b87; }
  .sidebar-version { display: none; }
  .developer-workspace { padding: 20px; }
  .form-grid, .metric-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .page-head, .package-header, .version-row { display: block; }
  .page-head button { margin-top: 14px; }
  .version-actions { margin-top: 10px; }
  .package-actions { justify-content: stretch; flex-wrap: wrap; }
  .package-actions button { flex: 1; }
  .plan-row { display: block; }
  .plan-actions { margin-top: 12px; }
  .wide-dialog { padding: 18px; }
  .release-heading { display: block; }
  .release-download, .release-heading button { width: 100%; margin-top: 14px; }
  .release-meta { grid-template-columns: 1fr; }
}
