* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1f2937;
  line-height: 1.5;
}

a { color: #0284c7; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { background: #0c0c0c; color: #fff; }
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { color: #fff; font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand span { color: #38bdf8; font-weight: 600; }
.topnav { display: flex; align-items: center; gap: 12px; }
.user-email { color: #d1d5db; font-size: 14px; }

.container { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 24px;
  margin-bottom: 20px;
}

h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.muted { color: #6b7280; font-size: 14px; }
.small { font-size: 13px; }

.btn {
  display: inline-block;
  background: #0284c7;
  color: #fff;
  border: 1px solid #0284c7;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: #0369a1; text-decoration: none; }
.btn-secondary {
  background: #fff;
  color: #1f2937;
  border: 1px solid #d1d5db;
}
.btn-secondary:hover { background: #f9fafb; }
.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background: #fef2f2; }
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid #4b5563;
  padding: 6px 12px;
  font-size: 14px;
}
.btn-ghost:hover { background: #1f2937; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

label { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
input[type="text"], input[type="email"], input[type="number"],
input[type="password"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  color: #1f2937;
}
input:focus, textarea:focus { outline: 2px solid #38bdf8; border-color: #38bdf8; }
textarea { min-height: 80px; resize: vertical; }
.hint { color: #6b7280; font-size: 13px; margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; align-items: center; }

.flash {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.flash p { margin: 0; }

.notice {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.notice p { margin: 0; }
.notice.warn { background: #fffbeb; border-color: #fde68a; }

.profile-list { list-style: none; margin: 0; padding: 0; }
.profile-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #f3f4f6;
}
.profile-list li:last-child { border-bottom: none; }
.profile-name { font-weight: 700; font-size: 16px; }
.profile-meta { color: #6b7280; font-size: 13px; margin-top: 2px; }
.profile-actions { display: flex; gap: 8px; flex-shrink: 0; }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: #6b7280; font-size: 14px; }
.kv dd { margin: 0; font-size: 14px; word-break: break-all; }
code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 2px 6px;
}
pre.mono {
  display: block;
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad { background: #fee2e2; color: #991b1b; }

.footer { text-align: center; color: #9ca3af; font-size: 13px; padding: 0 20px 32px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 4px; }

@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .profile-list li { flex-direction: column; align-items: flex-start; }
  .page-head { flex-direction: column; }
}
