:root {
  color-scheme: light;
  --bg: #b7c9d1;
  --paper: #f7f1e2;
  --paper-2: #e8dcc6;
  --surface: rgba(247, 241, 226, 0.9);
  --surface-strong: rgba(247, 241, 226, 0.96);
  --surface-soft: rgba(255, 255, 255, 0.48);
  --ink: #17211c;
  --muted: #65736c;
  --line: rgba(23, 33, 28, 0.13);
  --accent: #244638;
  --accent-dark: #10251f;
  --sage: #9fb39b;
  --gold: #c79a3a;
  --rust: #a84e33;
  --danger: #b1444a;
  --glass: rgba(247, 241, 226, 0.78);
  --shadow: 0 20px 56px rgba(16, 37, 31, 0.18);
  --serif: Georgia, "Times New Roman", serif;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgba(183, 201, 209, 0.56), rgba(247, 241, 226, 0.78)),
    url("assets/botanical-atlas-bg.webp") center top / cover fixed,
    var(--bg);
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 11% 28%, rgba(23, 33, 28, 0.14) 1px, transparent 1.8px) 0 0 / 31px 27px,
    radial-gradient(circle at 67% 73%, rgba(199, 154, 58, 0.14) 1px, transparent 1.9px) 0 0 / 43px 36px,
    linear-gradient(rgba(247, 241, 226, 0.18), rgba(247, 241, 226, 0.3));
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.topbar,
.hero-panel,
.capture-form,
.audio-panel,
.list-panel,
.settings-card,
.contract-card,
.view > .top {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
}

.topbar::after {
  position: absolute;
  right: -24px;
  bottom: -36px;
  width: 138px;
  height: 138px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(247, 241, 226, 0.5), transparent 28%),
    radial-gradient(circle, rgba(36, 70, 56, 0.22), transparent 64%);
  content: "";
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
  line-height: 1.18;
  letter-spacing: 0;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.status-pill {
  min-width: 82px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--paper);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.status-pill.muted {
  background: rgba(247, 241, 226, 0.82);
  color: var(--muted);
  border: 1px solid var(--line);
}

.status-pill.offline {
  background: var(--danger);
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 0 12px;
  background: linear-gradient(rgba(247, 241, 226, 0.86), rgba(247, 241, 226, 0.16));
  backdrop-filter: blur(14px);
}

.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 241, 226, 0.82);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  border-color: rgba(16, 37, 31, 0.2);
  background: var(--accent-dark);
  color: var(--paper);
}

.view {
  display: none;
  gap: 12px;
}

.view.active {
  display: grid;
}

.hero-panel,
.audio-panel,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hero-panel,
.audio-panel,
.list-panel,
.settings-card,
.contract-card,
.view > .top {
  border-radius: 8px;
  padding: 16px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 116px;
  color: var(--paper);
  background:
    linear-gradient(110deg, rgba(16, 37, 31, 0.92), rgba(36, 70, 56, 0.72) 58%, rgba(247, 241, 226, 0.18)),
    url("assets/botanical-atlas-bg.webp") center / cover;
}

.hero-panel h2 {
  max-width: 330px;
}

.hero-panel .section-kicker {
  color: #e8c978;
}

.hero-panel::after {
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(247, 241, 226, 0.28);
  border-radius: 50%;
  background:
    linear-gradient(160deg, rgba(247, 241, 226, 0.2), rgba(199, 154, 58, 0.28)),
    radial-gradient(circle at 52% 34%, rgba(247, 241, 226, 0.42), transparent 4px);
  content: "";
  pointer-events: none;
}

.icon-action {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(16, 37, 31, 0.22);
}

.capture-form {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 8px;
}

.input-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

textarea,
input[type="url"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 174px;
  resize: vertical;
  padding: 14px;
  font-size: 18px;
  line-height: 1.45;
}

input[type="url"],
input[type="password"] {
  height: 46px;
  padding: 0 12px;
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(36, 70, 56, 0.16);
}

.capture-actions {
  display: grid;
  grid-template-columns: minmax(118px, 0.9fr) 1.1fr;
  gap: 10px;
}

.record-button,
.primary-button,
.secondary-button,
.text-button {
  min-height: 48px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.record-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.record-button.recording {
  border-color: var(--danger);
  background: #fff5f5;
  color: var(--danger);
}

.record-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--danger);
}

.record-button.recording .record-dot {
  animation: pulse 1s infinite;
}

.primary-button {
  border: 0;
  background: var(--accent-dark);
  color: var(--paper);
  box-shadow: 0 10px 24px rgba(16, 37, 31, 0.18);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.secondary-button,
.text-button {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.text-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.full {
  width: 100%;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.safety-note {
  padding: 10px 12px;
  border: 1px solid rgba(199, 154, 58, 0.42);
  border-radius: 8px;
  background: rgba(247, 241, 226, 0.84);
  color: #6d4d12;
  font-size: 12px;
  line-height: 1.45;
}

.audio-panel {
  align-items: flex-start;
}

audio {
  width: 162px;
  max-width: 45%;
}

.panel-heading.top {
  align-items: flex-start;
}

.inbox-list,
.approval-list,
.overview-grid {
  display: grid;
  gap: 10px;
}

.list-panel .panel-heading {
  margin-bottom: 12px;
}

.note-card,
.approval-card,
.overview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.52);
  padding: 13px;
}

.note-card {
  display: grid;
  gap: 8px;
}

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

.note-text {
  font-size: 15px;
  line-height: 1.38;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(36, 70, 56, 0.12);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.badge.warn {
  background: #fff3dd;
  color: #77520d;
}

.approval-card {
  display: grid;
  gap: 12px;
}

.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 241, 226, 0.7);
}

.action-row input {
  margin-top: 2px;
}

.settings-card,
.contract-card {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

pre {
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-dark);
  color: var(--paper);
  font-size: 12px;
}

.empty-state {
  padding: 18px 8px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(177, 68, 74, 0.42);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(177, 68, 74, 0);
  }
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 26px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .tab {
    font-size: 12px;
  }

  .capture-actions {
    grid-template-columns: 1fr;
  }
}
