* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica", "Arial", sans-serif;
  background-color: #f5f5f5;
  color: #2e2e38;
}

.app-container { display: flex; height: 100vh; }

.logo { display: flex; align-items: center; gap: 8px; }

.header-logo {
  background-color: #1a1a24;
  display: flex;
  height: 2.857rem;
  min-width: 2.857rem;
  width: 2.857rem;
}
.header-logo a {
  display: inline-flex;
  height: 100%;
  padding: 0.357rem 5px;
  text-decoration: none;
  width: 100%;
  align-items: center;
  justify-content: center;
}

.app-title { font-size: 18px; font-weight: 500; white-space: nowrap; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }

.top-header {
  background-color: #ffffff;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions { display: flex; align-items: center; gap: 16px; }
.toggle-switch { display: flex; align-items: center; gap: 8px; }
.toggle-label { font-size: 14px; color: #747480; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e0e0e0; transition: 0.3s; border-radius: 24px;
}
.slider:before {
  position: absolute; content: ""; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background-color: white; transition: 0.3s; border-radius: 50%;
}
input:checked + .slider { background-color: #2e2e38; }
input:checked + .slider:before { transform: translateX(20px); }

.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden; cursor: default;
  transition: box-shadow 0.3s;
}
.user-avatar svg { width: 100%; height: 100%; }

.settings-container { max-width: 1200px; margin: 0 auto; padding: 16px 24px; width: 100%; }
.settings-title { font-size: 32px; font-weight: 600; margin-bottom: 24px; color: #2e2e38; margin-top: 25px; }

.personal-info { background-color: #ffffff; padding: 32px; border-radius: 12px; margin-bottom: 24px; }
.section-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; color: #2e2e38; }
.section-description { font-size: 14px; color: #747480; margin-bottom: 24px; }

.form-group { display: flex; flex-direction: column; }
.form-input {
  width: 100%; padding: 12px 16px; border: 1px solid #e0e0e0; border-radius: 8px;
  font-size: 15px; color: #2e2e38; outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: #2e2e38; }
.form-input::placeholder { color: #c4c4c4; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }

.btn {
  padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s; border: none;
}
.btn-secondary { background-color: #f5f5f5; color: #2e2e38; border: 1px solid #e0e0e0; }
.btn-secondary:hover { background-color: #ebebeb; }
.btn-primary { background-color: #2e2e38; color: #ffffff; }
.btn-primary:hover { background-color: #1e1e28; }

.design-section { background-color: #ffffff; padding: 32px; border-radius: 12px; }
.section-label { font-size: 12px; color: #747480; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.design-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: #2e2e38; }
.design-description { font-size: 14px; color: #747480; line-height: 1.6; }

.api-result {
  margin-top: 16px; padding: 16px; background: #f0f0f2; border-radius: 8px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace; font-size: 12px;
  line-height: 1.6; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
  max-height: 400px; overflow-y: auto; color: #2e2e38;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.demo-card {
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
}

.demo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.demo-card-title {
  font-size: 16px;
  font-weight: 600;
  color: #2e2e38;
}

.demo-operation {
  font-size: 13px;
  line-height: 1.5;
  color: #747480;
  margin-bottom: 12px;
}

.demo-details {
  min-height: 126px;
  background: #f0f0f2;
  border-radius: 8px;
  padding: 12px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-ok {
  background: #dcfce7;
  color: #166534;
}

.status-error {
  background: #fee2e2;
  color: #991b1b;
}

.status-skipped,
.status-pending,
.status-unknown {
  background: #e5e7eb;
  color: #374151;
}

.status-info {
  background: #dbeafe;
  color: #1e40af;
}

footer {
  background-color: #fff; border-color: #e6e6e9; border-width: 1px 0 0 0;
  padding: 0.714rem 2.286rem; color: #2e2e38;
}
.text-link { color: #2e2e38; text-decoration: none; font-size: 14px; }
.body-3-light { font-weight: 300; font-size: 0.857rem; }
.mt-5 { margin-top: 5px; }

/* ── Diagnostic Box (fixed at bottom) ── */
.diag-box {
  position: sticky; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #1e1e2e; color: #94a3b8; font-size: 12px;
  border-top: 2px solid #ffe600; font-family: 'SF Mono', 'Consolas', monospace;
}
.diag-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 16px; cursor: pointer;
}
.diag-title { font-weight: 600; color: #ffe600; font-size: 13px; letter-spacing: 0.5px; }
.diag-toggle {
  background: none; border: none; color: #ffe600; cursor: pointer; font-size: 14px;
}
.diag-body { padding: 8px 16px 12px; }
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.diag-cell { display: flex; gap: 8px; }
.diag-label { color: #64748b; min-width: 110px; flex-shrink: 0; }
.diag-value { color: #e2e8f0; word-break: break-all; }
.diag-log-header { margin-top: 10px; font-weight: 600; color: #64748b; margin-bottom: 4px; }
.diag-log {
  max-height: 120px; overflow-y: auto; background: #16161e; padding: 8px 10px;
  border-radius: 4px; white-space: pre-wrap; word-break: break-word;
  color: #94a3b8; line-height: 1.5;
}

/* ── Dark Mode ── */
body.dark { background-color: #1a1a24; color: #e0e0e0; }
body.dark .top-header { background-color: #23232f; border-bottom-color: #333; }
body.dark .settings-title { color: #e0e0e0; }
body.dark .personal-info, body.dark .design-section { background-color: #23232f; }
body.dark .section-title, body.dark .design-title { color: #e0e0e0; }
body.dark .section-description, body.dark .design-description, body.dark .section-label { color: #999; }
body.dark .btn-primary { background-color: #ffe600; color: #1a1a24; }
body.dark .btn-primary:hover { background-color: #e6cf00; }
body.dark .btn-secondary { background-color: #2e2e38; color: #e0e0e0; border-color: #444; }
body.dark .btn-secondary:hover { background-color: #3a3a48; }
body.dark .form-input { background-color: #2e2e38; border-color: #444; color: #e0e0e0; }
body.dark .form-input:focus { border-color: #ffe600; }
body.dark .api-result { background: #16161e; color: #94a3b8; }
body.dark .demo-card { background-color: #1f1f2a; border-color: #333; }
body.dark .demo-card-title { color: #e0e0e0; }
body.dark .demo-operation { color: #999; }
body.dark .demo-details { background: #16161e; color: #94a3b8; }
body.dark .status-ok { background: #14532d; color: #dcfce7; }
body.dark .status-error { background: #7f1d1d; color: #fee2e2; }
body.dark .status-skipped,
body.dark .status-pending,
body.dark .status-unknown { background: #374151; color: #e5e7eb; }
body.dark .status-info { background: #1e3a5f; color: #93c5fd; }
body.dark footer { background-color: #23232f; border-color: #333; color: #e0e0e0; }
body.dark .text-link { color: #e0e0e0; }
body.dark .ey-footer-text { fill: #ffffff; }
body.dark .toggle-label { color: #999; }
body.dark .slider { background-color: #4a4a5a; }
body.dark input:checked + .slider { background-color: #555; }
body.dark .app-title { color: #e0e0e0; }

/* ── Access Gate ── */
.access-gate {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; text-align: center; padding: 48px 24px;
}
.access-gate .gate-spinner {
  width: 40px; height: 40px; border: 3px solid #e0e0e0; border-top-color: #2e2e38;
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.access-gate .gate-title { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.access-gate .gate-subtitle { font-size: 14px; color: #747480; margin-bottom: 24px; }
.access-gate .gate-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
body.dark .access-gate .gate-spinner { border-color: #444; border-top-color: #ffe600; }
body.dark .access-gate .gate-title { color: #e0e0e0; }
body.dark .access-gate .gate-subtitle { color: #999; }

/* ── Identity Banner ── */
.identity-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  font-size: 13px; border-bottom: 1px solid rgba(0,0,0,0.08);
}
.identity-banner .banner-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.identity-banner .banner-dot.green { background: #22c55e; }
.identity-banner .banner-dot.yellow { background: #eab308; }
.identity-banner .banner-dot.red { background: #ef4444; }
.identity-banner .banner-text { flex: 1; }
.identity-banner .banner-method {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 4px; background: #f0f0f2; color: #555;
}
body.dark .identity-banner { border-bottom-color: rgba(255,255,255,0.08); }
body.dark .identity-banner .banner-method { background: #2e2e38; color: #aaa; }

.gated-content { display: none; }
.gated-content.visible { display: block; }

@media (max-width: 768px) {
  .settings-container { padding: 20px 16px; }
  .diag-grid { grid-template-columns: 1fr; }
  .identity-banner { flex-wrap: wrap; }
}
