:root {
  --bg: #f5f6f5;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --text: #202923;
  --muted: #6b756e;
  --line: #dee4df;
  --accent: #18684f;
  --accent-soft: #e8f3ee;
  --danger: #9d3a2f;
  --danger-soft: #fbefed;
  --public-bg: #e8f3ee;
  --public-text: #18684f;
  --private-bg: #f6efe4;
  --private-text: #8b5921;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

body {
  padding: 14px;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.hidden {
  display: none !important;
}

.topbar,
.header,
.panel,
.tab-panel,
.login-card,
.empty {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-bottom: 12px;
  padding: 10px;
  background: rgba(245, 246, 245, 0.96);
  backdrop-filter: blur(8px);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.search span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #909991;
}

.meta-row,
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-row {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.meta-row a,
.header a {
  color: var(--accent);
  font-weight: 600;
}

.group-list,
.list,
.stack {
  display: grid;
  gap: 10px;
}

.group {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  overflow: hidden;
}

.group-head,
.panel-head,
.subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #eef2ee;
  background: var(--panel-soft);
}

.group-title,
.panel-title,
.subpanel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.group-count,
.item-subtitle,
.panel-desc,
.subtitle,
.field label {
  color: var(--muted);
  font-size: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
}

.card,
.item,
.subpanel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel);
}

.card {
  padding: 9px;
  display: grid;
  gap: 7px;
  min-width: 0;
}

.card-top,
.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-main {
  min-width: 0;
}

.card-title,
.item-title,
.title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.title {
  font-size: 16px;
}

.card-desc {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge.public {
  background: var(--public-bg);
  color: var(--public-text);
}

.badge.private {
  background: var(--private-bg);
  color: var(--private-text);
}

.badge.plain {
  background: var(--panel-soft);
  color: var(--muted);
  border-color: var(--line);
}

.url,
.mono {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.actions a,
.actions button,
.button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 11px;
  padding: 7px 9px;
  text-align: center;
}

.actions a,
.button.primary,
.actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button.danger,
.actions .danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f2d3ce;
}

.empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.toast,
.notice {
  font-size: 11px;
  border-radius: var(--radius-sm);
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: rgba(32, 41, 35, 0.96);
  color: #fff;
  padding: 9px 11px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.notice {
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
}

.notice.error {
  border-color: #f2d3ce;
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.success {
  border-color: #cfe4da;
  background: var(--accent-soft);
  color: var(--accent);
}

.field {
  display: grid;
  gap: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: 0;
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 9px 14px;
  font-size: 12px;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tab-panel {
  display: none;
  overflow: hidden;
}

.tab-panel.active {
  display: block;
}

.panel-body,
.subpanel-body {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.subpanel {
  align-self: start;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.login-shell {
  min-height: calc(100vh - 28px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  padding: 16px;
  display: grid;
  gap: 12px;
}

@media (max-width: 920px) {
  .grid,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    padding: 10px;
  }

  .cards {
    grid-template-columns: 1fr;
  }
}
