:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #202523;
  --muted: #64716b;
  --line: #dfe6df;
  --accent: #256f5b;
  --accent-strong: #185844;
  --accent-soft: #dcebe5;
  --danger: #a73535;
  --shadow: 0 18px 50px rgba(34, 43, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.auth-view {
  min-height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 64px;
}

.brand-block h1,
.topbar h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0;
}

.subcopy {
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.panel,
.composer {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 20px;
  background: #edf2ed;
  border-radius: 8px;
}

.segment {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(32, 37, 35, 0.08);
}

.field,
.select-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.field input,
.select-field select,
.select-field input,
.note-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  outline: 0;
}

.field input {
  height: 48px;
  padding: 0 14px;
  font-size: 17px;
}

.select-field select,
.select-field input,
.note-input {
  height: 42px;
  padding: 0 12px;
}

.field input:focus,
textarea:focus,
.select-field select:focus,
.select-field input:focus,
.note-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-button,
.ghost-button,
.copy-button,
.delete-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.copy-button {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.delete-button {
  background: #fff;
  border-color: #ebd4d4;
  color: var(--danger);
}

.note,
.message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.message.error {
  color: var(--danger);
}

.clip-view {
  display: grid;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 8px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-link {
  display: inline-grid;
  place-items: center;
  min-width: 92px;
  text-decoration: none;
}

.auth-tool-link {
  width: max-content;
  margin-top: 18px;
}

.composer {
  padding: 16px;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfb;
  color: var(--text);
  outline: 0;
  line-height: 1.6;
}

.note-input {
  margin-top: 12px;
}

.composer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 16px;
}

.composer-actions .primary-button {
  margin-top: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.search-field {
  grid-column: span 1;
}

.date-group {
  margin-top: 24px;
}

.date-group h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

.device-group {
  margin-bottom: 18px;
}

.device-group h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.item-list {
  display: grid;
  gap: 12px;
}

.item-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.type-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

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

pre {
  max-height: 320px;
  margin: 0;
  white-space: pre-wrap;
  overflow: auto;
  color: var(--text);
  line-height: 1.65;
  word-break: break-word;
}

.item-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: #f0f5f1;
  color: var(--muted);
  line-height: 1.55;
  word-break: break-word;
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 30, 26, 0.45);
}

.onboarding-card {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.onboarding-card h2 {
  margin: 0 0 18px;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

.onboarding-steps {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.onboarding-steps div {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.onboarding-steps strong {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.onboarding-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.onboarding-actions .primary-button {
  margin-top: 0;
}

@media (max-width: 780px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding: 24px 0;
  }

  .auth-view {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .brand-block h1 {
    font-size: 40px;
  }

  .subcopy {
    font-size: 16px;
  }

  .toolbar,
  .composer-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

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

  .item-actions {
    justify-content: stretch;
  }

  .copy-button,
  .delete-button {
    flex: 1;
  }

  .onboarding-actions {
    grid-template-columns: 1fr;
  }
}
