:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17202a;
  background: #f4f6f8;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar {
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: #18324a;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; }
.topbar p { margin: 2px 0 0; color: #b9c8d5; font-size: 12px; }
.topbar button { color: #fff; background: transparent; border: 1px solid #70859a; padding: 7px 12px; border-radius: 4px; }

main { max-width: 1180px; margin: 0 auto; padding: 28px 24px; }
.hidden { display: none !important; }
.login-panel { min-height: calc(100vh - 120px); display: grid; place-items: center; }
.panel { background: #fff; border: 1px solid #d9e0e6; border-radius: 6px; padding: 24px; box-shadow: 0 6px 18px rgb(23 32 42 / 8%); }
.compact { width: min(380px, 100%); }
.compact h2 { margin: 0 0 20px; font-size: 20px; }
label { display: grid; gap: 6px; color: #425466; font-size: 13px; }
input, textarea { width: 100%; border: 1px solid #c6d0d9; border-radius: 4px; padding: 10px 11px; color: #17202a; background: #fff; }
input:focus, textarea:focus { outline: 2px solid #3c80bd; outline-offset: 1px; }
button[type="submit"], #newAppButton, #publishCoreUpdateButton { border: 0; border-radius: 4px; padding: 10px 16px; color: #fff; background: #167052; font-weight: 600; }
.compact button { margin-top: 16px; width: 100%; }
.error { min-height: 18px; margin: 10px 0 0; color: #b42318; font-size: 13px; }
.form-status { min-height: 18px; margin: 10px 0 0; color: #176348; font-size: 13px; }

.summary-band { display: flex; align-items: center; gap: 42px; padding: 18px 20px; color: #fff; background: #21615a; border-radius: 6px 6px 0 0; }
.summary-band div { display: grid; min-width: 72px; }
.summary-band span { font-size: 24px; font-weight: 650; }
.summary-band small { color: #c5e1dc; }
.summary-band button { margin-left: auto; background: #fff; color: #174e48; }
.core-update-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 20px; background: #fff; border: 1px solid #d9e0e6; border-top: 0; }
.core-update-bar strong, .core-update-bar small { display: block; }
.core-update-bar small { margin-top: 4px; color: #667789; }
.core-update-actions { display: flex; gap: 8px; }
.core-update-actions .danger { border: 1px solid #e5b8b3; border-radius: 4px; padding: 9px 12px; color: #b42318; background: #fff; }
.server-diagnostics { padding: 18px 20px; background: #f8fafb; border-right: 1px solid #d9e0e6; border-left: 1px solid #d9e0e6; }
.server-diagnostics-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.server-diagnostics-head > div { display: flex; align-items: center; gap: 12px; }
.server-diagnostics h2 { margin: 0; font-size: 16px; }
.diagnostics-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 18px 28px; margin: 18px 0 0; }
.diagnostics-grid div { min-width: 0; }
.diagnostics-grid dt { color: #667789; font-size: 12px; }
.diagnostics-grid dd { margin: 5px 0 0; overflow: hidden; color: #17202a; font-size: 15px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.diagnostics-checked { margin: 14px 0 0; color: #7b8794; font-size: 12px; }
.table-wrap { min-height: 220px; overflow-x: auto; background: #fff; border: 1px solid #d9e0e6; border-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e7ebef; text-align: left; white-space: nowrap; }
th { color: #667789; background: #f8fafb; font-size: 12px; text-transform: uppercase; }
td { font-size: 14px; }
.app-cell { display: flex; align-items: center; gap: 12px; }
.app-cell img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: #eef1f4; }
.app-cell strong, .app-cell small { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.app-cell small { margin-top: 3px; color: #748291; }
.status { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 12px; color: #176348; background: #dff3ea; }
.status.off { color: #6b7280; background: #eceff2; }
.actions { display: flex; gap: 8px; }
.actions button { border: 1px solid #c6d0d9; border-radius: 4px; padding: 6px 9px; color: #33485b; background: #fff; }
.actions .danger { color: #b42318; border-color: #e5b8b3; }
.empty { text-align: center; color: #7b8794; padding: 50px; }

dialog { width: min(720px, calc(100% - 32px)); border: 0; border-radius: 6px; padding: 0; box-shadow: 0 18px 50px rgb(0 0 0 / 25%); }
dialog::backdrop { background: rgb(15 23 32 / 55%); }
dialog form { padding: 22px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.dialog-head h2 { margin: 0; font-size: 20px; }
.close { border: 0; color: #52616f; background: transparent; font-size: 28px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.single-column { grid-template-columns: 1fr; }
.wide { grid-column: 1 / -1; }
.toggle { display: flex; align-items: center; align-self: end; height: 40px; }
.toggle input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.secondary { border: 1px solid #c6d0d9; border-radius: 4px; padding: 9px 16px; background: #fff; }
.form-note { margin: 16px 0 0; color: #667789; font-size: 12px; line-height: 1.6; }

@media (max-width: 640px) {
  .topbar { padding: 0 18px; }
  main { padding: 18px 12px; }
  .summary-band { gap: 18px; flex-wrap: wrap; }
  .summary-band button { margin-left: 0; }
  .core-update-bar { align-items: flex-start; flex-direction: column; }
  .diagnostics-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
}
