/*
 * Copyright 2026, Jiku Technology (Shanghai) Co., Ltd. All rights reserved.
 * Jiku Technology (Shanghai) Co., Ltd. PROPRIETARY and CONFIDENTIAL.
 * Use is subject to license terms.
 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1b1f24;
  --muted: #666f7a;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok-bg: #e7f6ec;
  --ok-fg: #1a7f3c;
  --warn-bg: #fef6e3;
  --warn-fg: #8a5a00;
  --err-bg: #fdeceb;
  --err-fg: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 56px;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
}

/*
 * Underlined tabs sit on the header border, so they read as navigation.
 */
.tabs {
  display: flex;
  gap: 2px;
  align-self: stretch;
  margin-bottom: -1px;
}

.tab {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 550;
  border-bottom: 2px solid transparent;
}

.tab:hover { color: var(--text); border-bottom-color: var(--border); }

.tab.is-active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.who { color: var(--muted); font-size: 13px; }

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

h1 {
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.card-title { font-size: 15px; margin: 0 0 4px; }

.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 20px;
}

.rule { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/*
 * Existing-certificate import is secondary to normal user creation.
 */
.card-quiet {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.card-quiet .card-title { color: var(--muted); font-weight: 600; }

.adopt-list { list-style: none; margin: 14px 0 0; padding: 0; }

.adopt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.btn-small { padding: 6px 12px; font-size: 14px; }

.add-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 220px; }
.field-wide { flex: 1; }

.stack { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }

label { font-size: 13px; font-weight: 550; color: var(--muted); }

input[type="text"], input[type="email"], input:not([type]) {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--text);
  min-width: 200px;
}

input:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-quiet {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-quiet:hover { background: #f4f6f8; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #97231a; }

.btn-google { background: #fff; border-color: var(--border); color: var(--text); width: 100%; }
.btn-google:hover { background: #f4f6f8; }
.btn[disabled], .icon-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.g-mark {
  display: inline-flex;
  width: 20px; height: 20px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: #4285f4;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover:not([disabled]) { background: #f4f6f8; color: var(--text); }

.icon-btn-danger:hover:not([disabled]) {
  background: var(--danger-soft);
  border-color: #f3c6c2;
  color: var(--danger);
}

.table { width: 100%; border-collapse: collapse; }

.table th, .table td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.table tbody tr:last-child td { border-bottom: 0; }

.col-actions { width: 132px; text-align: right; }

.actions { display: flex; gap: 6px; justify-content: flex-end; }
.actions form { display: contents; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.empty { color: var(--muted); text-align: center; padding: 26px 10px; }

.tag {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #eef1f4;
  color: var(--muted);
}

/*
 * "Unavailable" is neutral: missing activity data is not a user problem.
 */
.pill-online { background: var(--ok-bg); color: var(--ok-fg); }
.pill-offline { background: #eef1f4; color: var(--muted); }
.pill-unavailable { background: #eef1f4; color: var(--muted); }

/*
 * Badges with extra explanation expose it through title and aria-label.
 */
.pill-note {
  cursor: help;
  text-decoration: underline dotted currentColor;
  text-underline-offset: 2px;
}

.pill-note:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.flash-success { background: var(--ok-bg); color: var(--ok-fg); }
.flash-error { background: var(--err-bg); color: var(--err-fg); }
.flash-warn { background: var(--warn-bg); color: var(--warn-fg); }

.login-card {
  max-width: 320px;
  margin: 96px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

/*
 * This is a card label, not a page heading.
 */
.login-title {
  font-size: 16px;
  font-weight: 650;
  margin: 0 0 4px;
}

.login-card .muted { font-size: 14px; }
.login-card form { margin-top: 18px; }
.login-card .flash { margin-top: 16px; text-align: left; }

/*
 * Local development login stays visually quieter than Google sign-in.
 */
.dev-login {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.dev-login input { flex: 1; min-width: 0; font-size: 13px; padding: 6px 9px; }

@media (max-width: 640px) {
  .add-row { flex-direction: column; align-items: stretch; }
  .col-actions { width: auto; }
  .topbar-inner { flex-wrap: wrap; gap: 12px; }
}

/*
 * Modals use :target so the Content-Security-Policy can keep scripts disabled.
 */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal:target { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(16, 24, 40, 0.18);
  padding: 22px;
}

.modal-title { font-size: 17px; margin: 0 0 10px; letter-spacing: -0.01em; }

.confirm-text { font-size: 14px; line-height: 1.5; }

.modal-error { margin: 0 0 16px; text-align: left; font-size: 14px; }

.modal-card .field { min-width: 0; }
.modal-card input { width: 100%; min-width: 0; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

@media (max-width: 640px) {
  .page-head { flex-direction: column; align-items: stretch; }
  .adopt-row { align-items: stretch; }
}
