:root {
  --ink: #18323a;
  --muted: #6b7f85;
  --line: #dce8e8;
  --soft: #f4f8f7;
  --paper: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0a5b55;
  --teal-soft: #e6f5f1;
  --amber-soft: #fff5e5;
  --shadow: 0 16px 45px rgba(28, 71, 74, 0.08);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #edf4f3;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% -10%, rgba(167, 225, 213, 0.35), transparent 33rem),
    #edf4f3;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 30px 18px 22px;
  color: #d9eeee;
  background: #12353c;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 11px 32px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #0e5d58;
  background: #a7ded4;
  font-size: 21px;
  font-weight: 800;
}

.brand-name {
  color: #f5fffd;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-caption {
  margin-top: 2px;
  color: #94b5b6;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-radius: 11px;
  color: #9db9ba;
  background: transparent;
  text-align: left;
  font-size: 13px;
  transition: 160ms ease;
}

.nav-item:hover {
  color: #f4fffd;
  background: rgba(255, 255, 255, 0.07);
}

.nav-item.active {
  color: #f4fffd;
  background: #25545a;
  box-shadow: inset 3px 0 0 #91d7ca;
}

.nav-icon {
  width: 19px;
  color: #a9d9d1;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.nav-count {
  min-width: 21px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 10px;
  color: #c0e7df;
  background: rgba(145, 215, 202, 0.15);
  font-size: 11px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px 12px 0;
  border-top: 1px solid rgba(200, 233, 229, 0.12);
}

.prototype-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  color: #b8e4dd;
  background: rgba(151, 216, 205, 0.1);
  font-size: 11px;
  font-weight: 650;
}

.status-dot,
.draft-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ed1a1;
}

.sidebar-footer p {
  margin: 12px 0 0;
  color: #7d9fa2;
  font-size: 11px;
  line-height: 1.55;
}

.main-content {
  min-width: 0;
  padding: 38px clamp(22px, 4vw, 58px) 58px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  max-width: 1430px;
  margin: 0 auto 22px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: #17363d;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  color: #1a3a40;
  font-size: 18px;
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 3px;
  font-size: 14px;
}

.topbar-actions,
.document-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  transition: 160ms ease;
}

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

.button-primary {
  color: #ffffff;
  background: var(--teal);
  box-shadow: 0 5px 14px rgba(15, 118, 110, 0.16);
}

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

.button-secondary {
  color: var(--teal-dark);
  border-color: #c7dfdc;
  background: #ffffff;
}

.button-secondary:hover {
  border-color: #8fcac0;
  background: #f8fffd;
}

.button-ghost {
  color: var(--muted);
  border-color: transparent;
  background: var(--soft);
}

.button-small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
}

.privacy-banner {
  max-width: 1430px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 auto 22px;
  padding: 12px 14px;
  border: 1px solid #eadbbd;
  border-radius: 11px;
  color: #805921;
  background: #fffaf0;
  font-size: 11px;
  line-height: 1.5;
}

.privacy-banner strong {
  display: block;
  margin-bottom: 1px;
  color: #65430f;
}

.banner-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff8e9;
  background: #c18a3c;
  font-size: 11px;
  font-weight: 800;
}

.workflow-grid {
  max-width: 1430px;
  display: grid;
  grid-template-columns: minmax(420px, 0.91fr) minmax(500px, 1.09fr);
  align-items: start;
  gap: 22px;
  margin: 0 auto;
}

.left-column,
.right-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.patient-panel,
.source-panel,
.extraction-panel,
.secondary-view {
  padding: 22px;
}

.panel-heading,
.document-toolbar,
.review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.step-badge,
.confidence-pill {
  padding: 5px 8px;
  border-radius: 6px;
  color: #47817a;
  background: var(--teal-soft);
  font-size: 10px;
  font-weight: 750;
}

.confidence-pill {
  color: #996628;
  background: var(--amber-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.field-wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #d9e6e5;
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: #fbfdfd;
  font-size: 13px;
  transition: 150ms ease;
}

.field input,
.field select {
  height: 39px;
  padding: 0 11px;
}

.field textarea {
  min-height: 108px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #75bbb0;
  box-shadow: 0 0 0 3px rgba(98, 185, 171, 0.12);
  background: #ffffff;
}

.source-panel {
  display: grid;
  gap: 16px;
}

.source-card {
  padding: 15px;
  border: 1px solid #e0eaea;
  border-radius: 12px;
  background: #fcfefe;
}

.source-card-heading {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.source-card-heading > .upload-button,
.source-card-heading > .recording-indicator {
  margin-left: auto;
}

.source-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #0d7169;
  background: #e6f6f2;
  font-size: 19px;
}

.audio-icon {
  color: #8260a9;
  background: #f1ebf9;
}

.source-card h3 {
  color: #25464b;
}

.source-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  color: #779092;
  background: #f2f7f6;
  font-size: 10px;
  font-weight: 700;
}

.recording-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #93aaa9;
}

.recording-indicator.recording {
  color: #a43c4e;
  background: #fff0f1;
}

.recording-indicator.recording span {
  background: #d9576a;
  box-shadow: 0 0 0 4px rgba(217, 87, 106, 0.13);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

.upload-button {
  cursor: pointer;
}

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 82px;
  margin-top: 14px;
  padding: 10px;
  border: 1px dashed #c9dddd;
  border-radius: 9px;
}

.empty-state {
  align-items: center;
  justify-content: center;
  color: #94a9aa;
  background: #fbfdfd;
  font-size: 11px;
}

.empty-icon {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  margin-right: 5px;
  border-radius: 50%;
  color: #65a9a0;
  background: #eaf6f4;
  font-size: 16px;
}

.photo-thumb {
  position: relative;
  width: 66px;
  height: 60px;
  overflow: hidden;
  border: 1px solid #d2e5e3;
  border-radius: 7px;
  background: #eaf3f2;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb span {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff;
  background: rgba(13, 61, 65, 0.68);
  font-size: 8px;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.record-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #9a5365;
  font-size: 11px;
  font-weight: 750;
}

.record-button:hover {
  background: #824456;
}

.record-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffd8dd;
}

audio {
  width: 100%;
  height: 35px;
  margin-top: 12px;
}

.audio-status {
  margin: 10px 0 12px;
  color: #829697;
  font-size: 10px;
  line-height: 1.45;
}

.transcript-field textarea {
  min-height: 120px;
}

.process-button {
  width: 100%;
  min-height: 51px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  color: #eafff9;
  background: linear-gradient(105deg, #0f766e, #1a9485);
  box-shadow: 0 10px 23px rgba(15, 118, 110, 0.2);
  font-size: 13px;
  font-weight: 750;
  text-align: left;
}

.process-button:hover {
  background: linear-gradient(105deg, #0c675f, #168275);
  transform: translateY(-1px);
}

.process-icon {
  color: #a9e9dc;
  font-size: 19px;
}

.process-button .arrow {
  margin-left: auto;
  color: #a9e9dc;
  font-size: 19px;
}

.extraction-panel {
  display: grid;
  gap: 17px;
}

.extraction-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.summary-card {
  padding: 11px;
  border: 1px solid #e0eaea;
  border-radius: 9px;
  background: #fbfdfd;
}

.summary-card strong {
  display: block;
  color: #1a5958;
  font-size: 19px;
}

.summary-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 1.45;
}

.notice > span {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #c18a3c;
  font-size: 10px;
  font-weight: 800;
}

.notice p {
  margin: 0;
  color: #75592d;
}

.notice-warning {
  background: #fff9ee;
}

.document-panel {
  min-height: 820px;
  padding: 28px 30px 25px;
  border-top: 4px solid #7cc9bd;
}

.document-toolbar h2 {
  font-size: 22px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #d9e7e6;
  border-radius: 8px;
  color: #47716f;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.icon-button:hover {
  border-color: #8fcac0;
  color: var(--teal-dark);
  background: #f4fbf9;
}

.draft-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 17px;
  padding: 6px 9px;
  border-radius: 6px;
  color: #8b6b31;
  background: #fff8eb;
  font-size: 10px;
  font-weight: 700;
}

.draft-status-dot {
  background: #d59a3e;
}

.document-meta {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 0.9fr;
  gap: 9px;
  margin: 21px 0 23px;
  padding: 13px 0;
  border-top: 1px solid #e6eeee;
  border-bottom: 1px solid #e6eeee;
}

.document-meta div {
  min-width: 0;
}

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

.document-meta span {
  margin-bottom: 4px;
  color: #91a3a5;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.document-meta strong {
  color: #38575b;
  font-size: 11px;
}

.document-sections {
  display: grid;
  gap: 17px;
}

.document-section {
  display: grid;
  gap: 6px;
}

.document-section label {
  color: #4a6d70;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.document-section textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid #e1eaea;
  border-radius: 8px;
  outline: 0;
  color: #314c50;
  background: #fcfefe;
  font-size: 12px;
  line-height: 1.55;
}

.document-section textarea:focus {
  border-color: #83c6bc;
  box-shadow: 0 0 0 3px rgba(98, 185, 171, 0.1);
  background: #ffffff;
}

.review-panel {
  margin-top: 25px;
  padding-top: 18px;
  border-top: 1px solid #e2eceb;
}

.review-heading {
  align-items: center;
  margin-bottom: 11px;
}

.review-heading h3 {
  margin-bottom: 0;
  color: #33565b;
  font-size: 13px;
}

.review-heading > span {
  color: #638080;
  font-size: 11px;
  font-weight: 750;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  color: #607679;
  font-size: 11px;
  line-height: 1.45;
}

.check-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--teal);
}

.secondary-view {
  max-width: 1430px;
  margin: 0 auto;
}

.drafts-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.draft-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border: 1px solid #e0eaea;
  border-radius: 10px;
  background: #fcfefe;
}

.draft-item-icon {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #0d7169;
  background: #e8f6f2;
  font-size: 11px;
  font-weight: 800;
}

.draft-item-main {
  min-width: 0;
  flex: 1;
}

.draft-item-main strong,
.draft-item-main span {
  display: block;
}

.draft-item-main strong {
  overflow: hidden;
  color: #315359;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-item-main span {
  margin-top: 3px;
  color: #849899;
  font-size: 10px;
}

.draft-item button {
  flex: 0 0 auto;
}

.empty-list {
  padding: 38px 15px;
  border: 1px dashed #c9dddd;
  border-radius: 10px;
  color: #839899;
  background: #fbfdfd;
  font-size: 12px;
  text-align: center;
}

.template-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.template-card {
  display: flex;
  gap: 12px;
  padding: 15px;
  border: 1px solid #e0eaea;
  border-radius: 10px;
  background: #fcfefe;
}

.template-card > span {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #0d7169;
  background: #e8f6f2;
  font-size: 10px;
  font-weight: 800;
}

.template-card strong {
  display: block;
  color: #315359;
  font-size: 12px;
}

.template-card p {
  margin: 4px 0 0;
  color: #849899;
  font-size: 10px;
  line-height: 1.4;
}

.demo-source {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 60px;
  border-radius: 7px;
  color: #4e827d;
  background: #eef9f5;
  font-size: 11px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  max-width: 340px;
  padding: 12px 15px;
  border: 1px solid #c8e0dc;
  border-radius: 9px;
  color: #eafff9;
  background: #164f51;
  box-shadow: 0 13px 30px rgba(17, 57, 59, 0.22);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .main-content {
    padding-right: 24px;
    padding-left: 24px;
  }

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

  .document-panel {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    min-height: auto;
    padding: 15px;
  }

  .brand {
    padding-bottom: 15px;
  }

  .main-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-item {
    justify-content: center;
    padding: 9px 5px;
    font-size: 10px;
  }

  .nav-item span:last-of-type {
    display: none;
  }

  .nav-count {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    padding: 24px 14px 34px;
  }

  .topbar {
    display: block;
  }

  .topbar-actions {
    margin-top: 15px;
  }

  .topbar-actions .button {
    flex: 1;
  }

  .privacy-banner {
    font-size: 10px;
  }

  .patient-panel,
  .source-panel,
  .extraction-panel,
  .secondary-view,
  .document-panel {
    padding: 17px;
  }

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

  .document-meta {
    grid-template-columns: repeat(2, 1fr);
    gap: 13px;
  }

  .document-toolbar h2 {
    font-size: 18px;
  }

  .extraction-summary {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .privacy-banner,
  .left-column,
  .document-actions,
  .review-panel,
  .draft-status {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main-content {
    padding: 0;
  }

  .workflow-grid {
    display: block;
  }

  .document-panel {
    min-height: auto;
    border: 0;
    box-shadow: none;
  }

  .document-section textarea {
    min-height: 0;
    resize: none;
    border: 0;
    padding: 0;
    background: #ffffff;
  }
}
