:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-strong: #f1f5f9;
  --ink: #172033;
  --muted: #64748b;
  --line: #d9e2ec;
  --line-strong: #bdc9d7;
  --green: #26735a;
  --green-soft: #e6f4ee;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --red: #c2413b;
  --red-soft: #fae7e5;
  --amber: #9a6a14;
  --amber-soft: #fff4d5;
  --shadow: 0 18px 48px rgba(23, 32, 51, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-root {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel,
.config-panel {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: var(--green);
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand p,
.config-panel p,
.empty-state p {
  margin: 6px 0 0;
  color: var(--muted);
}

.login-actions {
  display: grid;
  gap: 12px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease,
    transform 120ms ease;
}

.button:hover {
  border-color: var(--line-strong);
  background: #e8eef6;
}

.button:active {
  transform: translateY(1px);
}

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

.button.primary:hover {
  background: #1f614c;
}

.button.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efb6b0;
}

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-strong);
  border-color: var(--line);
}

.icon-button.danger {
  color: var(--red);
}

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

.sidebar {
  min-height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

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

.account {
  min-width: 0;
}

.account strong,
.account span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account strong {
  font-size: 0.95rem;
}

.account span {
  color: var(--muted);
  font-size: 0.82rem;
}

.search {
  position: relative;
  margin-bottom: 12px;
}

.search svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
}

.search input,
.title-input,
.composer textarea,
.caption-input {
  width: 100%;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.search input {
  height: 40px;
  padding: 0 12px 0 40px;
}

.title-input:focus,
.composer textarea:focus,
.caption-input:focus,
.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.lists {
  overflow: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.list-row {
  width: 100%;
  display: grid;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}

.list-row:hover {
  background: var(--surface-strong);
}

.list-row.active {
  background: var(--blue-soft);
  border-color: #bcd0ff;
}

.list-row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-row-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-soft);
}

.list-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.editor-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(247, 248, 251, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 18px 24px;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.status.saving {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f1cf75;
}

.status.error {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efb6b0;
}

.mode-tabs {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mode-tabs button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.mode-tabs button.active {
  color: var(--ink);
  background: var(--surface-strong);
}

.title-input {
  height: 52px;
  padding: 0 14px;
  font-size: 1.45rem;
  font-weight: 750;
  letter-spacing: 0;
}

.editor-body {
  flex: 1;
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.composer {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.composer textarea {
  min-height: 96px;
  resize: vertical;
  padding: 13px;
  line-height: 1.45;
}

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

.paste-target {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.items {
  display: grid;
  gap: 10px;
}

.item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.item.checked {
  background: #f6faf8;
}

.item.checked .item-text {
  color: var(--muted);
  text-decoration: line-through;
}

.check-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  cursor: pointer;
}

.item.checked .check-button {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.item-main {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.item-text {
  min-height: 34px;
  display: flex;
  align-items: center;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.item-text[contenteditable="true"] {
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  outline: 0;
}

.item-text[contenteditable="true"]:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-soft);
  background: #ffffff;
}

.image-frame {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f7;
}

.image-frame img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #ffffff;
}

.caption-input {
  min-height: 38px;
  padding: 8px 10px;
}

.uploading {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-strong);
}

.empty-state {
  min-height: 50vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}

.empty-state h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.empty-actions {
  margin-top: 18px;
}

.config-list {
  margin: 16px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.config-list code {
  color: var(--ink);
}

.hidden {
  display: none !important;
}

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

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .lists {
    grid-auto-flow: column;
    grid-auto-columns: minmax(240px, 78vw);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .editor-header {
    padding: 14px;
  }

  .editor-actions,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-tools {
    justify-content: space-between;
  }

  .mode-tabs {
    width: 100%;
  }

  .mode-tabs button {
    flex: 1;
    justify-content: center;
  }

  .editor-body {
    padding: 14px;
  }

  .title-input {
    height: 46px;
    font-size: 1.15rem;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .item {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .item > .icon-button {
    grid-column: 2;
    justify-self: end;
  }

  .paste-target {
    font-size: 0.8rem;
  }
}
