:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --danger: #d70015;
  --danger-hover: #b50012;
  --success: #34c759;
  --border: #d2d2d7;
  --border-light: #e5e5ea;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --max-width: 680px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding: 24px 16px 48px;
}

.container { max-width: var(--max-width); margin: 0 auto; }

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}
.site-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.site-header .user-email {
  font-size: 13px;
  color: var(--text-secondary);
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-alt); }
.btn-ghost {
  background: transparent;
  color: var(--primary);
  padding: 6px 10px;
}
.btn-ghost:hover { background: rgba(0,113,227,.08); }
.btn-sm { font-size: 13px; padding: 5px 12px; }
.btn:disabled, .btn-disabled {
  opacity: .5;
  cursor: default;
  pointer-events: none;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 15px;
  font-weight: 600;
}
.card-body { padding: 20px; }

/* Sections */
.section { margin-bottom: 16px; }
.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  padding: 0 4px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
input[type="text"], input[type="email"], input[type="tel"] {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
input[readonly] { background: var(--surface-alt); color: var(--text-secondary); }
.form-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 160px; margin-bottom: 0; }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* Info rows */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value { font-weight: 500; text-align: right; word-break: break-all; }
.info-value.mono { font-family: ui-monospace, "SF Mono", "Cascadia Mono", monospace; font-size: 13px; }

/* Lists */
.item-list { list-style: none; }
.item-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.item-list li:last-child { border-bottom: none; }
.item-list .item-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.item-list .item-detail { color: var(--text-secondary); font-size: 13px; }
.empty-state { color: var(--text-tertiary); font-size: 14px; padding: 8px 0; }

/* Badge */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--border-light);
  color: var(--text-secondary);
}
.badge-success { background: rgba(52,199,89,.14); color: #1a7a34; }
.badge-current { background: rgba(0,113,227,.12); color: var(--primary); }

/* Session table */
.session-list { width: 100%; border-collapse: collapse; font-size: 14px; }
.session-list th {
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
}
.session-list td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.session-list tr:last-child td { border-bottom: none; }
.session-meta { color: var(--text-secondary); font-size: 13px; }

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-success { background: rgba(52,199,89,.1); color: #1a7a34; }
.alert-error { background: rgba(215,0,21,.08); color: var(--danger); }
.alert-info { background: rgba(0,113,227,.08); color: var(--primary); }

/* Consent */
.consent-app {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.consent-scopes {
  list-style: none;
  margin: 12px 0;
}
.consent-scopes li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.consent-scopes li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.consent-redirect {
  font-size: 13px;
  color: var(--text-tertiary);
  word-break: break-all;
  font-family: ui-monospace, monospace;
}
.consent-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* Center page (login, signed-out, error) */
.center-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}
.center-page .logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 16px;
}
.center-page h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.center-page p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  max-width: 380px;
}

/* Deletion */
.deletion-warning {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.deletion-warning strong { color: var(--text); }
.deletion-mailto {
  display: inline-block;
  margin: 16px 0;
  font-size: 15px;
}

/* Footer */
.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 32px;
}

@media (max-width: 600px) {
  body { padding: 16px 12px 32px; }
  .card-body { padding: 16px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .session-list { font-size: 13px; }
  .site-header { flex-direction: column; align-items: flex-start; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; text-align: center; }
}
/* Auth pages (login, reauth, google) — used by auth-routes.ts */
.auth-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
}
.auth-page .logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.03em;
  margin-bottom: 16px;
}
.auth-page h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}
.auth-page .auth-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 24px;
  max-width: 380px;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 360px;
  padding: 24px;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { text-align: left; }
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.auth-field input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.auth-field input[readonly] { background: var(--surface-alt); color: var(--text-secondary); }
.auth-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: background .15s;
}
.auth-btn:hover { background: var(--primary-hover); }
.auth-btn:active { transform: scale(.98); }
.btn-google {
  width: 100%;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  display: inline-block;
  transition: background .15s;
}
.btn-google:hover { background: var(--surface-alt); }
.auth-divider {
  margin: 20px 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  position: relative;
}
.auth-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
}
.auth-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: rgba(215,0,21,.08);
  color: var(--danger);
  margin-bottom: 16px;
}
.auth-success {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: rgba(52,199,89,.1);
  color: #1a7a34;
  margin-bottom: 16px;
}
.inline-form { display: inline; }
.profile-edit-link { margin-top: 16px; }
.form-actions { display: flex; gap: 8px; }
.session-card-body { overflow-x: auto; }
.logout-explanation { font-size: 14px; color: var(--text); margin-bottom: 16px; }
.logout-list { margin-top: 8px; }
.deletion-list { margin: 0 0 12px; }
.deletion-warning p { margin-bottom: 12px; }
.deletion-warning p:last-child { margin-bottom: 0; }
.center-actions { text-align: center; }
.consent-intro { color: var(--text-secondary); font-size: 14px; }
