:root {
  color-scheme: light;
  --accent: #b51f3b;
  --accent-strong: #8f142c;
  --accent-soft: #fbeef1;
  --canvas: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #f8f9fa;
  --text: #20252a;
  --text-muted: #626b73;
  --border: #d9dde1;
  --border-strong: #b8bec4;
  --success: #22623b;
  --success-soft: #edf7f0;
  --warning: #8a5a12;
  --warning-soft: #fff6e5;
  --danger: #a4152e;
  font-family: Arial, "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent-strong); }

button,
input { font: inherit; }

button:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgb(181 31 59 / 24%);
  outline-offset: 2px;
}

code {
  overflow-wrap: anywhere;
  color: #3d454c;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.topbar {
  position: relative;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  content: "";
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand strong {
  color: var(--accent);
  font-size: 22px;
  letter-spacing: 0;
}

.brand span {
  color: var(--text-muted);
  font-size: 13px;
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.account-menu > span {
  overflow: hidden;
  max-width: 240px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button:active { transform: translateY(1px); }

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.button-primary:hover { background: var(--accent-strong); }

.button-secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.button-secondary:hover { border-color: var(--accent); color: var(--accent-strong); }

.button-compact { min-height: 34px; padding: 6px 12px; font-size: 13px; }

.button-text-danger {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--danger);
  padding: 6px 8px;
  font-size: 13px;
}

.button-text-danger:hover { background: var(--accent-soft); }

.login-shell,
.error-shell {
  display: grid;
  min-height: calc(100dvh - 65px);
  place-items: center;
  padding: 32px 20px;
}

.login-panel,
.error-panel {
  width: min(100%, 520px);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  padding: 40px;
  box-shadow: 0 14px 36px rgb(44 52 59 / 8%);
}

.product-name {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.login-panel h1,
.error-panel h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 38px);
  line-height: 1.2;
  letter-spacing: 0;
}

.login-copy {
  max-width: 42ch;
  margin: 16px 0 28px;
  color: var(--text-muted);
}

.endpoint-list { margin: 36px 0 0; border-top: 1px solid var(--border); }

.endpoint-list > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding-top: 14px;
}

.endpoint-list dt { color: var(--text-muted); }
.endpoint-list dd { min-width: 0; margin: 0; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  width: min(100%, 1180px);
  min-height: calc(100dvh - 65px);
  margin: 0 auto;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.workspace { min-width: 0; padding: 42px 48px 64px; }

.workspace-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.workspace-header h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.workspace-header p { margin: 5px 0 0; color: var(--text-muted); }

.messages { margin-bottom: 18px; }

.message {
  margin: 0 0 8px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 12px;
}

.message-success { border-color: var(--success); background: var(--success-soft); }

.todo-composer { margin-bottom: 28px; }
.todo-composer > label { display: block; margin-bottom: 8px; font-weight: 700; }

.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }

.composer-row input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
}

.composer-row input::placeholder { color: #737c84; }
.composer-row input:focus { border-color: var(--accent); }

.todo-list { border-top: 1px solid var(--border); }

.todo-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  border-bottom: 1px solid var(--border);
}

.todo-toggle {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: #fff;
  cursor: pointer;
}

.todo-toggle:hover { border-color: var(--accent); }
.is-complete .todo-toggle { border-color: var(--accent); background: var(--accent); }

.todo-content { min-width: 0; padding: 12px 0; }
.todo-content p { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.todo-content time { color: var(--text-muted); font-size: 12px; }
.is-complete .todo-content p { color: var(--text-muted); text-decoration: line-through; }

.empty-state {
  padding: 52px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.empty-state h2 { margin: 0; font-size: 18px; }
.empty-state p { margin: 7px auto 0; color: var(--text-muted); }

.history { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border-strong); }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading span { color: var(--text-muted); font-size: 13px; }

.history-list { margin: 0; padding: 0; list-style: none; }

.history-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 10px 0;
}

.history-list li + li { border-top: 1px solid #eceff1; }
.history-list li div { min-width: 0; }
.history-list strong { margin-right: 10px; font-size: 13px; }
.history-list li span { color: var(--text-muted); overflow-wrap: anywhere; }
.history-list time { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.identity-panel {
  min-width: 0;
  border-left: 1px solid var(--border);
  background: var(--surface-muted);
  padding: 42px 28px;
}

.identity-header > p { margin: 0 0 6px; color: var(--text-muted); font-size: 13px; }
.identity-header h2 { margin: 0 0 12px; overflow-wrap: anywhere; font-size: 20px; }

.status {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 700;
}

.status-ok { background: var(--success-soft); color: var(--success); }
.status-warn { background: var(--warning-soft); color: var(--warning); }

.identity-facts { margin: 28px 0 0; }
.identity-facts > div { margin-bottom: 16px; }
.identity-facts dt { margin-bottom: 3px; color: var(--text-muted); font-size: 12px; }
.identity-facts dd { margin: 0; overflow-wrap: anywhere; }

.groups { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border); }
.groups h3 { margin: 0 0 12px; font-size: 14px; }
.groups ul { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.groups li { border-left: 3px solid var(--accent); background: var(--surface); padding: 7px 9px; overflow-wrap: anywhere; }

.claims { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 20px; }
.claims summary { color: var(--accent-strong); font-weight: 700; cursor: pointer; }
.claims dl { margin-bottom: 0; }
.claims dl > div { margin-top: 13px; }
.claims dt { color: var(--text-muted); font-size: 11px; overflow-wrap: anywhere; }
.claims dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: 13px; }

.diagnostic-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.diagnostic-links a { font-size: 13px; font-weight: 700; }

.muted { color: var(--text-muted); }

.error-panel p:not(.product-name) { color: var(--text-muted); margin: 16px 0 24px; }

@media (max-width: 820px) {
  .topbar { padding: 0 18px; }
  .brand span { display: none; }
  .account-menu > span { max-width: 140px; }
  .app-shell { grid-template-columns: 1fr; border: 0; }
  .workspace { padding: 30px 20px 48px; }
  .identity-panel { border-top: 1px solid var(--border); border-left: 0; padding: 30px 20px 48px; }
}

@media (max-width: 520px) {
  .account-menu > span { display: none; }
  .login-panel,
  .error-panel { padding: 28px 22px; }
  .composer-row { grid-template-columns: 1fr; }
  .composer-row .button { width: 100%; }
  .todo-row { grid-template-columns: 32px minmax(0, 1fr); }
  .todo-row > form:last-child { grid-column: 2; justify-self: start; margin-top: -10px; margin-bottom: 8px; }
  .history-list li { grid-template-columns: 1fr; gap: 3px; }
}
