:root {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --line: #e5e5e5;
  --text: #333333;
  --muted: #999999;
  --accent: #18a058;
  --accent-soft: rgba(24, 160, 88, 0.1);
  --danger: #ff4d4f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f5f5f5;
  color: var(--text);
}

.shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar,
.panel,
.summary-card,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  margin-bottom: 20px;
}

.topbar h1,
.panel h2,
.login-card h2 {
  margin: 0;
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #999999;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.topbar-actions,
.tab-row,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.tab-chip {
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.ghost-button,
.tab-chip {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  background: rgba(255, 77, 79, 0.1);
  color: var(--danger);
}

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

button:hover {
  transform: translateY(-1px);
}

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

.login-card {
  width: min(520px, 100%);
  padding: 28px;
}

.app-view.is-hidden,
.login-view.is-hidden {
  display: none;
}

.summary-grid,
.workspace,
.settings-grid {
  display: grid;
  gap: 20px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
}

.summary-card {
  padding: 20px;
}

.summary-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.summary-value {
  font-size: 34px;
}

.summary-value.is-small {
  font-size: 20px;
  line-height: 1.5;
}

.sunrise {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.mint {
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.ocean {
  background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.ember {
  background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
}

.workspace {
  grid-template-columns: 1.05fr 1.35fr;
  margin-bottom: 20px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head.compact {
  margin-bottom: 8px;
}

.search-block,
.stack-form label,
.editor-grid label {
  display: grid;
  gap: 8px;
}

.stack-form,
.editor-grid {
  display: grid;
  gap: 16px;
}

.editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-grid .full {
  grid-column: 1 / -1;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
}

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

.inline-row input {
  flex: 1;
}

.inline-sep {
  font-weight: 600;
  color: var(--muted);
}

textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.6;
}

.item-list {
  display: grid;
  gap: 12px;
  max-height: 880px;
  overflow: auto;
  padding-right: 4px;
}

.item-card {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.item-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.item-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.item-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.item-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.item-tags span {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(45, 36, 25, 0.92);
  color: #fff8ee;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .summary-grid,
  .workspace,
  .settings-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}
