* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #eef2f7;
  color: #1f2937;
}

.topbar {
  background: linear-gradient(135deg, #b91c1c, #1d4ed8);
  color: white;
  padding: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
}

.subtitle {
  opacity: 0.92;
  max-width: 720px;
  line-height: 1.5;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
  opacity: 0.8;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  grid-template-areas:
    "sidebar form"
    "sidebar output";
  gap: 22px;
  padding: 22px;
  max-width: 1400px;
  margin: 0 auto;
  align-items: start;
}

.card {
  background: white;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.sidebar {
  grid-area: sidebar;
  height: fit-content;
  position: sticky;
  top: 16px;
  z-index: 1;
}

.form-panel {
  grid-area: form;
  min-width: 0;
}

.output-panel {
  grid-area: output;
  min-width: 0;
  width: 100%;
  margin-top: 0;
}

.stat-card {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.stat-card span {
  display: block;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.note-box {
  background: #eff6ff;
  border-left: 4px solid #1d4ed8;
  padding: 12px;
  border-radius: 8px;
}

.archive-box {
  margin-top: 18px;
}

.archive-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.archive-list,
.file-list {
  font-size: 14px;
  color: #4b5563;
  line-height: 1.5;
}

.small-button {
  padding: 8px 10px;
  font-size: 12px;
  background: #1d4ed8;
  color: white;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.compact-heading {
  margin-bottom: 10px;
}

.compact-heading h3 {
  margin: 0;
}

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

label {
  display: block;
  font-weight: 600;
  margin-bottom: 14px;
}

.helper-text {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-weight: 400;
  line-height: 1.4;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  box-sizing: border-box;
  font-size: 16px;
  font-family: inherit;
  background: white;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

button {
  border: none;
  border-radius: 8px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
}

button:hover {
  opacity: 0.95;
}

button,
.login-button {
  background: #b91c1c;
  color: white;
}

.secondary-button {
  background: #1d4ed8;
  color: white;
}

.ghost-button {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #111827;
}

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

.minutes-output {
  background: #fff;
  border-radius: 8px;
  padding: 22px;
  border: 1px solid #cbd5e1;
  border-top: 5px solid #b91c1c;
  border-left: 5px solid #1d4ed8;
  white-space: pre-wrap;
  line-height: 1.7;
  overflow-wrap: anywhere;
  min-height: 520px;
}

.badge {
  background: #dbeafe;
  color: #1d4ed8;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.badge[data-type="success"] {
  background: #dcfce7;
  color: #166534;
}

.badge[data-type="error"] {
  background: #fee2e2;
  color: #991b1b;
}

.status-message {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #475569;
  line-height: 1.5;
  margin: 14px 0 0;
  padding: 12px;
}

.status-message[data-type="success"] {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.status-message[data-type="error"] {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.insights-panel {
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  margin-top: 16px;
  padding: 14px;
  background: #fbfdff;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: #475569;
  line-height: 1.45;
}

.insight-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}

.insight-card strong {
  display: block;
  color: #111827;
  margin-bottom: 8px;
}

.insight-card ul {
  margin: 0;
  padding-left: 18px;
}

.insight-card p {
  margin: 0;
}

.optional-section {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin: 14px 0;
  padding: 12px;
}

.optional-section summary {
  cursor: pointer;
  font-weight: 700;
}

.primary-actions {
  margin-top: 16px;
}

.voice-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: -4px 0 18px;
}

.voice-status {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.4;
}

.archive-item {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  min-height: auto;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.image-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin: 10px 0 18px;
}

.image-preview img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "sidebar"
      "form"
      "output";
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .sidebar h2,
  .note-box,
  .archive-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 24px 18px;
    align-items: flex-start;
  }

  .login-button {
    width: 100%;
  }

  .app-shell {
    padding: 14px;
    gap: 14px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .sidebar {
    display: block;
  }

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading button {
    width: 100%;
  }

  .button-row {
    flex-direction: column;
  }

  .button-row button {
    width: 100%;
  }

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

  .minutes-output {
    padding: 16px;
    font-size: 15px;
    min-height: 480px;
  }
}

@media (max-width: 420px) {
  .topbar h1 {
    font-size: 30px;
  }

  .subtitle {
    font-size: 14px;
  }

  .app-shell {
    padding: 10px;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .sidebar,
  .form-panel,
  .section-heading .badge {
    display: none !important;
  }

  .app-shell {
    display: block;
    padding: 0;
  }

  .output-panel {
    box-shadow: none;
    padding: 0;
  }

  .minutes-output {
    border: none;
    background: white;
    padding: 0;
  }
}
