:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee5;
  --blue: #1769aa;
  --green: #137a4a;
  --red: #b42318;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: #101820;
  color: #fff;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

p {
  margin: 0;
}

#status {
  margin-top: 4px;
  color: #c8d3df;
  font-size: 12px;
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}

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

.summary div,
.editor,
.settings,
.entry,
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary div {
  padding: 12px;
}

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

.summary strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  margin-bottom: 14px;
}

.editor,
.settings {
  padding: 14px;
  margin-bottom: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
textarea,
button,
.linkBtn {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

button,
.linkBtn {
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  text-align: center;
  text-decoration: none;
  font-weight: 700;
}

.iconBtn {
  width: 42px;
  min-width: 42px;
  font-size: 20px;
}

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

#clearBtn {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.entry {
  padding: 12px;
  margin-bottom: 10px;
}

.entryMain,
.entryNumbers,
.entryActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.entryTitle {
  font-size: 15px;
}

.entryMeta,
.invest,
.entryMemo {
  color: var(--muted);
  font-size: 12px;
}

.entryNumbers {
  margin-top: 8px;
}

.profit {
  font-size: 20px;
  font-weight: 800;
}

.profit.win {
  color: var(--green);
}

.profit.lose {
  color: var(--red);
}

.entryMemo {
  margin-top: 8px;
  white-space: pre-wrap;
}

.entryActions {
  margin-top: 10px;
  justify-content: flex-end;
}

.entryActions button {
  width: auto;
  min-width: 72px;
  min-height: 34px;
}

.deleteBtn {
  background: #fff;
  color: var(--red);
  border-color: #f3b8b3;
}

@media (max-width: 720px) {
  main {
    padding: 10px;
  }

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

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

