:root {
  color-scheme: light;
  --bg: #eef2f1;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --text: #17211f;
  --muted: #66736f;
  --line: #dbe4e1;
  --primary: #0f766e;
  --primary-strong: #0b5d57;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 50px rgba(22, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

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", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 42px);
  background: rgba(238, 242, 241, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.topbar h1,
.section-header h2,
.daily-copy h2,
.login-box h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions,
.form-actions,
.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.45fr);
  gap: 18px;
}

.daily-panel,
.capture-panel,
.list-panel,
.stat,
.login-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.daily-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 124px;
  padding: 20px;
}

.daily-copy p:last-child {
  max-width: 820px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.stat {
  min-height: 104px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat span {
  font-size: 2rem;
  font-weight: 850;
}

.stat small {
  color: var(--muted);
  font-weight: 700;
}

.capture-panel {
  grid-column: 1;
  grid-row: 3;
  padding: 18px;
}

.list-panel {
  grid-column: 2;
  grid-row: 2 / span 2;
  min-height: 520px;
  padding: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.record-state {
  min-width: 92px;
  padding: 8px 10px;
  border-radius: 999px;
  background: #e9f7f4;
  color: var(--primary-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

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

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 132px;
  padding: 14px;
  line-height: 1.45;
}

input {
  height: 44px;
  padding: 0 12px;
}

textarea:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.audio-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.audio-preview audio {
  width: min(100%, 340px);
}

.primary-button,
.secondary-button,
.ghost-button,
.tab,
.item-action {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  white-space: nowrap;
}

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

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

.secondary-button {
  background: #dff1ee;
  color: var(--primary-strong);
}

.ghost-button,
.tab,
.item-action {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.tab {
  min-height: 34px;
  padding: 0 11px;
  color: var(--muted);
}

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

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

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.item.done {
  opacity: 0.62;
}

.item-main h3 {
  margin: 0 0 7px;
  font-size: 1rem;
  line-height: 1.25;
}

.item-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #e8edf7;
  color: #274165;
  font-size: 0.74rem;
  font-weight: 800;
}

.chip.high {
  background: #fff1dc;
  color: var(--amber);
}

.chip.late {
  background: #ffe8e5;
  color: var(--red);
}

.chip.done {
  background: #e8f4ed;
  color: #166534;
}

.empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(238, 242, 241, 0.9);
  backdrop-filter: blur(10px);
}

.login-box {
  width: min(360px, 100%);
  padding: 22px;
  display: grid;
  gap: 12px;
}

.login-box label {
  color: var(--muted);
  font-weight: 800;
}

.login-error {
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--text);
  color: #ffffff;
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .list-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .stats-grid,
  .capture-panel {
    grid-column: auto;
    grid-row: auto;
  }

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

@media (max-width: 520px) {
  .topbar-actions,
  .form-actions,
  .tabs {
    width: 100%;
  }

  .topbar-actions > *,
  .form-actions > * {
    flex: 1 1 120px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .item {
    grid-template-columns: 1fr;
  }
}
