* { box-sizing: border-box; }
:root {
  --bg: #0f1115;
  --panel: #181b22;
  --border: #2a2f3a;
  --text: #e6e8eb;
  --muted: #8a909c;
  --accent: #d77757;
  --green: #4ebb65;
  --red: #d05151;
  --yellow: #d6a64e;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; }
body.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
header h1 { margin: 0; font-size: 18px; }
#user-email { color: var(--muted); font-size: 13px; }

main { max-width: 880px; margin: 24px auto; padding: 0 24px; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
section h2 { font-size: 15px; margin: 0; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

.list { display: flex; flex-direction: column; gap: 8px; }

.session {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.session-meta { display: flex; flex-direction: column; gap: 2px; }
.session-name { font-family: ui-monospace, monospace; font-size: 13px; }
.session-time { font-size: 12px; color: var(--muted); }
.session-actions { display: flex; gap: 8px; }

.btn { background: var(--panel); color: var(--text); border: 1px solid var(--border); padding: 8px 14px; border-radius: 6px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #1a1a1a; border-color: var(--accent); font-weight: 500; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0; cursor: pointer; }
.btn-link:hover { color: var(--text); }

.badge { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.badge-ok { background: rgba(78, 187, 101, 0.15); color: var(--green); }
.badge-error { background: rgba(208, 81, 81, 0.15); color: var(--red); }
.badge-unknown { background: rgba(138, 144, 156, 0.15); color: var(--muted); }
.badge-warn { background: rgba(214, 166, 78, 0.15); color: var(--yellow); }

.hidden { display: none !important; }
.muted { color: var(--muted); }

.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 40px; max-width: 380px; text-align: center;
}
.login-card h1 { margin-top: 0; font-size: 20px; }
.login-card p { color: var(--muted); margin-bottom: 24px; }
.login-card .btn { width: 100%; padding: 12px; }

#history-section { margin-top: 32px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary h2 { color: var(--text); }

.session.closed { opacity: 0.7; }
.close-reason { font-size: 11px; padding: 2px 6px; border-radius: 3px; background: var(--bg); color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border); padding: 12px 20px;
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-width: 480px;
}
.toast.error { border-color: var(--red); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 520px; width: calc(100% - 32px); }
.modal-card h3 { margin-top: 0; }
.modal-card input { width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-family: ui-monospace, monospace; font-size: 13px; margin-bottom: 16px; }
.modal-card input:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
.url-link { display: block; word-break: break-all; padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--accent); font-family: ui-monospace, monospace; font-size: 12px; text-decoration: none; margin-bottom: 16px; }
.url-link:hover { text-decoration: underline; }
