:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #eaf1f7;
  background: #0b1016;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 15% 0%, #183044 0, transparent 38%), #0b1016; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid #31485a; border-radius: 8px; color: #eaf1f7; background: #111b24; }
input, select, textarea { width: 100%; padding: 9px 10px; margin-top: 6px; }
button { padding: 9px 14px; cursor: pointer; }
button:hover { border-color: #6aaad0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #65b9e8; outline-offset: 2px; }
label { color: #aebfcb; font-size: 13px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; letter-spacing: -.03em; }
h2 { margin-bottom: 0; font-size: 18px; }
hr { width: 100%; border: 0; border-top: 1px solid #263746; margin: 4px 0 14px; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 60px; }
.hidden { display: none !important; }
.login-card { width: min(440px, 100%); margin: 9vh auto 0; padding: 34px; border: 1px solid #294052; border-radius: 16px; background: rgba(14, 23, 31, .94); box-shadow: 0 20px 70px rgba(0,0,0,.35); }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }
.eyebrow { margin-bottom: 8px; color: #5fb8e8; font-size: 11px; font-weight: 700; letter-spacing: .16em; }
.muted { color: #8599a8; }
.small { font-size: 12px; line-height: 1.5; }
.error, .danger-text { color: #ff8f85; }
.primary { background: #146a91; border-color: #268ab6; }
.danger { background: #8d2929; border-color: #d45148; }
.quiet { background: transparent; }

.topbar, .panel-head, .action-row, .top-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topbar { margin-bottom: 24px; }
.status-strip { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(80px, .7fr)) minmax(210px, 1.5fr) minmax(90px, .7fr); gap: 1px; overflow: hidden; border: 1px solid #2a4050; border-radius: 12px; background: #2a4050; }
.status-strip > * { min-width: 0; padding: 14px 16px; background: #101923; }
.status-strip div span { display: block; margin-bottom: 6px; color: #7890a1; font-size: 10px; letter-spacing: .12em; }
.status-strip strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-strip .owner-cell strong { white-space: normal; overflow-wrap: anywhere; }
.owner-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.status-strip .inline-button { padding: 4px 7px; font-size: 11px; background: transparent; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid #273b4b; border-radius: 14px; background: rgba(14, 23, 31, .94); }
.editor-panel, .profile-panel { padding: 22px; }
.panel-head { margin-bottom: 20px; }
.pill { padding: 5px 9px; border-radius: 999px; color: #9ed9f5; background: #173447; font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.numeric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; margin: 18px 0 22px; padding-top: 18px; border-top: 1px solid #263746; }
.numeric-field { display: grid; grid-template-columns: 1fr 82px; gap: 8px; align-items: end; }
.numeric-field > label:first-child { min-width: 0; }
.profile-panel { display: flex; flex-direction: column; gap: 12px; }
.profile-panel .panel-head { margin-bottom: 4px; }
#profiles { min-height: 190px; }
.action-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#archive-profile { grid-column: 1 / -1; }
.event-panel { margin-top: 18px; padding: 18px 22px; }
.update-panel { margin-top: 18px; padding: 18px 22px; }
.update-panel button { margin: 12px 0; }
#update-result { display: block; white-space: pre-wrap; overflow-wrap: anywhere; color: #a9d7ed; }
#message { display: block; min-height: 22px; color: #a9d7ed; white-space: pre-wrap; }
dialog { max-width: 460px; border: 1px solid #753a38; border-radius: 14px; color: #eaf1f7; background: #141a20; }
dialog::backdrop { background: rgba(0,0,0,.72); }
dialog .action-row { margin-top: 20px; justify-content: flex-end; }
dialog label { display: block; margin-top: 14px; }
#owner-pair-result { white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }

@media (max-width: 850px) {
  .status-strip { grid-template-columns: 1fr 1fr; }
  .status-strip label { grid-column: 1 / -1; }
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 540px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 20px; }
  .topbar { align-items: flex-start; }
  .form-grid, .numeric-grid { grid-template-columns: 1fr; }
  .action-row { align-items: stretch; flex-direction: column; }
}

#identity-description { overflow-wrap: anywhere; }
#legacy-profile-section { border-top: 1px solid #263746; padding-top: 12px; }
