:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --panel: #fff;
  --text: #202637;
  --muted: #606b7d;
  --border: #dce1eb;
  --accent: #6741d9;
  --accent-soft: #eee9fb;
  --danger: #b42335;
  --success: #18734e;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
.storage-alert {
  padding: 12px 16px;
  border: 1px solid #d89b24;
  border-radius: 8px;
  color: #764900;
  background: #fff6dc;
}
.storage-alert.critical {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff0f1;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 42px;
  padding: 9px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  transition: background 0.15s;
}
button:hover {
  background: var(--accent-soft);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.primary:hover {
  background: #5230ba;
}
input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 10px 12px;
  min-width: 0;
}
input {
  width: 100%;
}
label {
  display: block;
  font-weight: 600;
}
label input,
label select {
  display: block;
  margin-top: 7px;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
pre:focus-visible {
  outline: 3px solid #8d70e4;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 27px;
  letter-spacing: -0.6px;
  margin-bottom: 0;
}
h2 {
  font-size: 17px;
  margin-bottom: 16px;
}
h3 {
  font-size: 14px;
}
.muted,
.hint,
.intro {
  color: var(--muted);
}
.hint {
  font-size: 12px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: var(--muted);
}
.mono,
pre,
textarea {
  font-family: Consolas, "SFMono-Regular", monospace;
}
.mono {
  overflow-wrap: anywhere;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 450px;
  padding: 38px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 70px #2026370d;
}
.login-card h1 {
  margin: 12px 0;
}
.login-card button {
  width: 100%;
}
.login-card > input {
  margin: 8px 0;
}
.login-card .hint {
  margin-top: 8px;
}
.login-card [role="alert"] {
  color: var(--danger);
  margin: 12px 0 0;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 222px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 700;
  margin-bottom: 42px;
}
.brand div span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--accent);
  color: #fff;
  border-radius: 11px;
  font-size: 24px;
}
nav {
  display: grid;
  gap: 8px;
}
nav button {
  text-align: left;
  border-color: transparent;
  background: transparent;
  padding: 12px 16px;
}
nav button[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}
.sidebar-bottom {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}
.sidebar-bottom button {
  width: 100%;
  margin-top: 14px;
}
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 100%;
  background: var(--success);
  margin-right: 5px;
}
main {
  margin-left: 222px;
  padding: 30px 36px;
  max-width: 1720px;
}
.page-header,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.page-header {
  margin-bottom: 22px;
}
.section-head h2 {
  margin: 0;
}
.section-head {
  margin-bottom: 18px;
}
.intro {
  max-width: 850px;
  margin-bottom: 20px;
}
.section-head .intro {
  margin: 0;
}
#notice {
  min-height: 0;
  margin: 0 0 16px;
  color: var(--success);
}
#notice:empty {
  display: none;
}
#notice.error {
  color: var(--danger);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.metric span {
  color: var(--muted);
  display: block;
}
.metric strong {
  font-size: 30px;
  font-weight: 600;
  display: block;
  margin: 10px 0;
}
.metric small {
  color: var(--muted);
}
.panel {
  margin-bottom: 20px;
}
.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
dl {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 10px;
  margin: 0 0 18px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 20px;
}
.search-label {
  flex: 1;
}
.toolbar select {
  max-width: 100%;
}
.table-panel {
  padding: 0;
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}
th {
  background: #fafbfe;
  color: var(--muted);
  font-weight: 500;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
td small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
tr:last-child td {
  border-bottom: 0;
}
.badge {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
}
.badge.error {
  color: var(--danger);
  background: #fce9ec;
}
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: end;
  margin-bottom: 24px;
}
.pagination span {
  margin-right: auto;
  color: var(--muted);
}
.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 580px;
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfe;
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 0;
}
.prompt-grid {
  display: grid;
  grid-template-columns: 235px minmax(0, 1fr);
  gap: 20px;
}
.module-panel {
  padding: 18px;
}
.module-panel .section-head {
  margin-bottom: 10px;
}
#module-search {
  margin: 5px 0 12px;
}
#module-list {
  max-height: calc(100vh - 390px);
  min-height: 240px;
  overflow-y: auto;
}
.module-group h3 {
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0 6px;
}
.module-group button {
  overflow-wrap: anywhere;
  display: block;
  width: 100%;
  text-align: left;
  border-color: transparent;
  padding: 7px 10px;
  min-height: 36px;
  font-weight: 500;
}
.module-group button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #c4b4ef;
  font-weight: 700;
}
.editor-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.editor-heading {
  margin-bottom: 12px;
}
.editor-heading button {
  flex-shrink: 0;
}
.policy-context {
  padding: 10px 12px;
  background: #f5f3fc;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 13px;
}
#prompt-editor {
  flex: 1;
  min-height: 450px;
}
.release-panel summary {
  cursor: pointer;
  font-weight: 600;
}
.release-panel summary span {
  margin-left: 12px;
  font-weight: 400;
}
.release-panel summary:focus-visible {
  outline: 3px solid #8d70e4;
  outline-offset: 3px;
}
.release-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 20px;
}
.release-grid .publish-area {
  border: 0;
  padding: 0;
}
#revision-list {
  max-height: 360px;
  overflow: auto;
}
textarea {
  width: 100%;
  min-height: 390px;
  resize: vertical;
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.7;
}
.editor-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 22px;
}
.publish-area {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.publish-area input {
  margin: 8px 0 14px;
}
.history-panel {
  align-self: start;
}
.revision {
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.revision:last-child {
  border: 0;
}
.revision p {
  font-size: 12px;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.revision button {
  width: 100%;
}
.revision .mono {
  font-weight: 600;
}
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.comparison > div {
  min-width: 0;
}
#capture-warning {
  color: var(--danger);
}
@media (max-width: 1100px) {
  main {
    padding: 24px;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .prompt-grid {
    grid-template-columns: 205px minmax(0, 1fr);
    gap: 14px;
  }
  .history-panel {
    width: 100%;
  }
  #revision-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}
@media (max-width: 1100px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 8px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand {
    display: none;
  }
  .sidebar nav {
    display: flex;
  }
  .sidebar nav button {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
  }
  .sidebar-bottom {
    display: none;
  }
  main {
    margin-left: 0;
    padding: 20px 14px;
  }
  .overview-grid,
  .comparison {
    grid-template-columns: 1fr;
  }
  .page-header h1 {
    font-size: 23px;
  }
  .metric,
  .panel {
    padding: 18px;
  }
  .table-panel {
    padding: 0;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search-label {
    flex-basis: 100%;
  }
  .section-head {
    align-items: start;
    flex-wrap: wrap;
  }
  #revision-list {
    grid-template-columns: 1fr;
  }
  .editor-footer {
    flex-direction: column;
  }
  textarea {
    min-height: 330px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (max-width: 600px) {
  main {
    padding: 14px 10px;
  }
  .page-header {
    margin-bottom: 12px;
  }
  .page-header .eyebrow {
    display: none;
  }
  .prompt-grid,
  .release-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .module-panel {
    padding: 12px;
    margin-bottom: 0;
  }
  .module-panel .section-head {
    display: none;
  }
  #module-search {
    margin-bottom: 6px;
  }
  #module-list {
    max-height: 145px;
    min-height: 0;
    overflow: auto;
  }
  .module-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .module-group h3 {
    width: 100%;
    margin: 6px 0 2px;
  }
  .module-group button {
    width: auto;
    padding: 5px 9px;
    min-height: 34px;
    font-size: 12px;
  }
  .editor-heading {
    flex-wrap: nowrap;
  }
  #prompt-editor {
    min-height: 360px;
  }
  .release-panel summary span {
    display: block;
    margin-left: 0;
  }
}
