:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #62717b;
  --line: #d9e1e5;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --blue: #1f5f8b;
  --green: #2f7d63;
  --red: #b34a3c;
  --gold: #a17424;
  --violet: #6750a4;
  --shadow: 0 18px 48px rgba(28, 42, 52, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

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

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

.sidebar {
  background: #16232b;
  color: #f7faf8;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #eaf2ee;
  color: #173029;
  font-weight: 800;
}

.brand h1,
.brand p,
.view-header h2,
.view-header p,
.prompt-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p {
  color: #aebdc4;
  font-size: 13px;
  margin-top: 5px;
}

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

.nav-item,
.nav-link {
  border: 0;
  background: transparent;
  color: #c7d4da;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover,
.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: #79b99a;
}

.stats-panel {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats-panel div {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 10px;
  background: rgba(255, 255, 255, 0.06);
}

.stats-panel span {
  display: block;
  font-size: 24px;
  font-weight: 800;
}

.stats-panel small {
  color: #b7c7ce;
}

.main {
  padding: 34px;
  overflow: auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.view-header h2 {
  font-size: 28px;
  line-height: 1.2;
  margin-top: 5px;
}

.capture-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}

.record-form,
.prompt-panel,
.output-column,
.api-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
}

.record-form {
  display: grid;
  gap: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: #33414a;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd9de;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 95, 139, 0.12);
}

.primary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
  padding: 13px 18px;
}

.icon-button {
  background: #e8f0ed;
  color: #173029;
  padding: 10px 14px;
}

.prompt-panel h3 {
  font-size: 17px;
  margin-bottom: 14px;
}

.prompt {
  border-left: 3px solid var(--green);
  padding: 10px 0 10px 12px;
  color: #41505a;
  line-height: 1.5;
}

.mobile-input-panel {
  border: 1px solid #cfd9de;
  background: #f5f8f6;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mobile-input-panel h3,
.mobile-input-panel p,
.api-panel h3,
.api-panel p {
  margin: 0;
}

.mobile-input-panel h3 {
  font-size: 17px;
  margin-top: 4px;
}

.quick-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.file-button {
  display: inline-flex;
  width: auto;
  min-height: 41px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cfd9de;
  color: #173029;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
}

.file-button input {
  display: none;
}

#voiceStatus {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.listening {
  background: var(--red);
  color: #ffffff;
}

.card-board,
.output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.memory-card {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 18px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.type-badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  background: #edf4f1;
  color: #285b49;
  font-size: 12px;
  font-weight: 800;
}

.type-badge.gold {
  background: #fff4dc;
  color: var(--gold);
}

.type-badge.red {
  background: #ffecea;
  color: var(--red);
}

.type-badge.blue {
  background: #e8f2f8;
  color: var(--blue);
}

.memory-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.memory-card p,
.output-column p,
.timeline-item p {
  margin: 0;
  color: #43525b;
  line-height: 1.65;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

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

.timeline-item {
  background: #ffffff;
  border-left: 4px solid var(--green);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.timeline-item h3,
.output-column h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.output-column {
  min-height: 310px;
}

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

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

.api-panel {
  margin-bottom: 16px;
}

.api-panel h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.api-panel p {
  color: #43525b;
  line-height: 1.7;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

pre {
  margin: 0;
  max-height: 420px;
  overflow: auto;
  background: #111b21;
  color: #e9f1ed;
  padding: 18px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty {
  border: 1px dashed #b8c5cb;
  padding: 22px;
  color: var(--muted);
  background: #ffffff;
}

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

  .sidebar {
    min-height: auto;
  }

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

  .main {
    padding: 22px;
  }

  .mobile-input-panel {
    display: grid;
  }

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

  .quick-actions .icon-button,
  .quick-actions .file-button {
    width: 100%;
    justify-content: center;
  }
}
