:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #17202f;
  --muted: #647084;
  --line: #d9e0ec;
  --brand: #1f6feb;
  --brand-dark: #174ea6;
  --accent: #0f9f8f;
  --danger: #c93535;
  --shadow: 0 18px 40px rgba(25, 37, 61, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: #111827;
  color: #f7f9fc;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #2f80ed;
  font-weight: 800;
}

.brand h1 {
  font-size: 20px;
  margin: 0;
}

.brand p,
.hint {
  margin: 4px 0 0;
  color: #aab4c5;
  font-size: 13px;
  line-height: 1.5;
}

.account-list,
.portfolio-list {
  display: grid;
  gap: 8px;
}

.nav-title {
  font-size: 12px;
  color: #9aa6bb;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-button,
.portfolio-button {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  color: #f7f9fc;
  padding: 12px;
  border-radius: 8px;
  display: grid;
  gap: 4px;
}

.account-button.active,
.portfolio-button.active {
  background: #2f80ed;
}

.account-button span,
.portfolio-button span {
  color: #c7d1e2;
  font-size: 12px;
}

.sidebar-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.main {
  padding: 28px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 22px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  background: #e8eef8;
  color: var(--text);
  font-weight: 700;
}

.btn.primary {
  background: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn.danger {
  background: #fde8e8;
  color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 22px;
  align-items: start;
}

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

.editor {
  padding: 22px;
  display: grid;
  gap: 18px;
}

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

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

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
}

.field textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-header h3 {
  margin: 0;
  font-size: 18px;
}

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

.entry-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  background: #fbfcff;
}

.preview {
  overflow: hidden;
}

.cover {
  min-height: 170px;
  padding: 28px;
  color: white;
  background:
    linear-gradient(rgba(15, 23, 42, 0.25), rgba(15, 23, 42, 0.65)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80");
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.cover h2 {
  margin: 0;
  font-size: 32px;
}

.cover p {
  margin: 8px 0 0;
  max-width: 680px;
  line-height: 1.6;
}

.preview-body {
  padding: 24px;
  display: grid;
  gap: 22px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.meta {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.meta span {
  color: var(--muted);
  font-size: 12px;
}

.meta strong {
  display: block;
  margin-top: 4px;
}

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

.tag {
  background: #eaf7f5;
  color: #087f73;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

.timeline {
  display: grid;
  gap: 16px;
}

.timeline-item {
  border-left: 3px solid var(--accent);
  padding-left: 14px;
}

.timeline-item h4 {
  margin: 0;
  font-size: 17px;
}

.timeline-item time {
  display: block;
  margin: 5px 0;
  color: var(--muted);
  font-size: 13px;
}

.timeline-item p {
  margin: 0;
  line-height: 1.6;
  color: #384254;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.public-page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 32px 18px;
}

.public-page .preview {
  width: min(980px, 100%);
}

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
}

.login-panel {
  padding: 42px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}

.login-panel h1 {
  margin: 0;
  font-size: 34px;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.login-art {
  min-height: 100vh;
  background:
    linear-gradient(rgba(12, 18, 30, 0.35), rgba(12, 18, 30, 0.35)),
    url("https://images.unsplash.com/photo-1523580846011-d3a5bc25702b?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
}

@media (max-width: 980px) {
  .shell,
  .workspace,
  .login {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .login-art {
    display: none;
  }
}

@media (max-width: 640px) {
  .main,
  .sidebar,
  .login-panel {
    padding: 18px;
  }

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

  .toolbar {
    justify-content: stretch;
  }

  .btn {
    width: 100%;
  }

  .field-row,
  .meta-grid {
    grid-template-columns: 1fr;
  }
}
