:root {
  --ink: rgba(0, 0, 0, 0.88);
  --muted: #8a92a6;
  --line: #e5e7eb;
  --page: #e7eef6;
  --card: #fff;
  --card-hover: #f4f7fb;
  --pill: #7c7c7c;
  --prod: #067647;
  --test: #b85c00;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid #8a92a6; outline-offset: 2px; }

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

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 20px 40px;
}

.brand {
  margin: 0;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #1f2a37;
}

.topbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search {
  display: flex;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(36, 72, 120, 0.06);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  background: transparent;
  padding: 0 16px;
  font-size: 15px;
  outline: none;
}

.search input::placeholder { color: #98a2b3; }

.search button {
  flex: none;
  width: 72px;
  border: 0;
  background: #4c7dff;
  color: #fff;
  cursor: pointer;
}

.search button:hover { background: #3d6ef0; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  height: 28px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 16px;
  background: #fff;
  color: #333;
  cursor: pointer;
}

.pill.is-on {
  background: var(--pill);
  border-color: var(--pill);
  color: #fff;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #d5e0ec;
}

.tab {
  margin-bottom: -1px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #667085;
  font-size: 16px;
  cursor: pointer;
}

.tab + .tab { margin-left: 18px; }

.tab.is-on {
  border-bottom-color: #4c7dff;
  color: #1f2a37;
  font-weight: 700;
}

.secret-open {
  margin-left: auto;
  margin-bottom: -1px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid #d5e0ec;
  border-radius: 16px;
  background: #fff;
  color: #344054;
  cursor: pointer;
}

.secret-open:hover { border-color: #4c7dff; color: #1f2a37; }

.panels { display: flex; flex-direction: column; gap: 22px; padding-top: 18px; }

.panel {
  padding: 18px 16px 16px;
  border: 1px solid #d5e0ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(36, 72, 120, 0.08);
}

.panel-title {
  margin: 0 6px 6px;
  font-size: 15px;
  font-weight: 700;
}

.sites {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 6px 8px;
}

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #fafbfc;
  color: inherit;
}

.card:hover { background: #f3f4f6; }

.card-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.card-body {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 28px;
}

.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.card-title {
  overflow: hidden;
  font-size: 15px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-tag {
  flex: none;
  max-width: 46%;
  overflow: hidden;
  padding: 0 6px;
  border-radius: 4px;
  background: #f0f1f4;
  color: var(--muted);
  font-size: 12px;
  line-height: 20px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-tag.tag-prod { color: var(--prod); background: #e9f7ef; }
.card-tag.tag-test { color: var(--test); background: #fff3e4; }

.card-desc {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 12px;
  cursor: pointer;
}

.card-copy:hover { color: #111; border-color: #ccc; }

.card-account {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 12px;
  cursor: pointer;
}

.card-account:hover { color: #111; border-color: #ccc; }

.mask {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(20, 32, 48, 0.45);
}

.mask[hidden] { display: none; }

.dialog {
  width: min(440px, 100%);
  max-height: min(78vh, 720px);
  overflow: auto;
  padding: 20px 20px 16px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(36, 72, 120, 0.18);
}

.dialog.is-wide { width: min(760px, 100%); }

.dialog h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.dialog-tip,
.dialog-error {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-error { color: #b42318; }

.dialog input {
  width: 100%;
  height: 42px;
  margin-bottom: 12px;
  padding: 0 12px;
  border: 1px solid #d5e0ec;
  border-radius: 8px;
  outline: none;
}

.dialog input:focus { border-color: #4c7dff; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions button {
  height: 34px;
  padding: 0 14px;
  border: 1px solid #d5e0ec;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.dialog-actions button[type="submit"],
.dialog-actions .is-primary {
  border-color: #4c7dff;
  background: #4c7dff;
  color: #fff;
}

.secret-group { margin-top: 16px; }

.secret-group h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.secret-item {
  padding: 10px 12px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  background: #fafbfc;
}

.secret-item + .secret-item { margin-top: 8px; }

.secret-item p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.secret-item span {
  flex: none;
  width: 72px;
  color: var(--muted);
}

.secret-item code {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
}

.secret-item button {
  margin-left: auto;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  background: #fff;
  color: #666;
  font-size: 12px;
  cursor: pointer;
}

.empty,
.error {
  grid-column: 1 / -1;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

.foot {
  margin-top: 28px;
  color: #b0b6c3;
  font-size: 12px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  padding: 8px 14px;
  border-radius: 4px;
  background: #222;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .sites { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .page { padding-top: 24px; }
  .brand { font-size: 24px; }
  .sites { grid-template-columns: 1fr; }
}
