:root {
  --bg: #000000;
  --panel: rgba(255, 255, 255, 0.08);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --faint: rgba(255, 255, 255, 0.38);
  --accent: #ef6a00;
  --accent-soft: rgba(239, 106, 0, 0.18);
  --corporate-blue: #0a84ff;
  --emerald: #30d158;
  --crimson: #ff453a;
  --charcoal: #8e8e93;
  --danger: #ff453a;
  --radius: 8px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 26rem),
    #000000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 28px) 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
}

.topbar h1,
.section-heading h2,
.result-header h2,
.settings-card h2,
.panel-copy h2 {
  margin: 0;
  line-height: 1.05;
  font-weight: 700;
}

.topbar h1 {
  font-size: clamp(26px, 8vw, 44px);
}

.panel-copy h2 {
  max-width: 13ch;
  font-size: clamp(34px, 11vw, 64px);
}

.section-heading h2,
.result-header h2,
.settings-card h2 {
  font-size: clamp(24px, 7vw, 34px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.version-pill {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.68rem;
  font-weight: 700;
}

main {
  display: grid;
  gap: 18px;
}

.hero-panel,
.result-panel,
.history-panel,
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
}

.hero-panel {
  display: grid;
  gap: 24px;
  min-height: 420px;
  padding: clamp(20px, 6vw, 34px);
}

.upload-zone {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 16px;
  min-height: 112px;
  margin-top: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: rgba(239, 106, 0, 0.8);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.upload-zone input {
  display: none;
}

.upload-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #000000;
  font-size: 2rem;
  font-weight: 300;
}

.upload-zone strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1.06rem;
}

.upload-zone span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.action-row,
.export-row,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.close-button,
.tab,
.history-action {
  min-height: 44px;
  border-radius: var(--radius);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  padding: 0 18px;
  font-weight: 700;
}

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

.secondary-button {
  border: 1px solid rgba(239, 106, 0, 0.65);
  background: var(--accent-soft);
  color: #ffffff;
}

.ghost-button,
.icon-button,
.close-button,
.tab,
.history-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.compact {
  min-height: 38px;
  padding-inline: 14px;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.result-panel,
.history-panel {
  padding: clamp(18px, 5vw, 26px);
}

.result-header,
.section-heading,
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 22px 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.42);
}

.tab {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: #ffffff;
  color: #000000;
}

.markdown-surface {
  min-height: 260px;
  max-height: 58vh;
  overflow: auto;
  padding: clamp(16px, 5vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.34);
  -webkit-overflow-scrolling: touch;
}

.mom-document {
  display: grid;
  gap: 18px;
}

.mom-cover {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(10, 132, 255, 0.38);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(10, 132, 255, 0.24), rgba(239, 106, 0, 0.14)),
    rgba(255, 255, 255, 0.04);
}

.mom-kicker {
  color: #92c9ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.mom-title {
  margin: 0;
  font-size: clamp(24px, 7vw, 38px);
  line-height: 1.05;
}

.mom-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.mom-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.mom-section.primary {
  border-color: rgba(10, 132, 255, 0.35);
  background: linear-gradient(180deg, rgba(10, 132, 255, 0.11), rgba(255, 255, 255, 0.035));
}

.mom-section.success {
  border-color: rgba(48, 209, 88, 0.36);
  background: linear-gradient(180deg, rgba(48, 209, 88, 0.12), rgba(255, 255, 255, 0.035));
}

.mom-section.danger {
  border-color: rgba(255, 69, 58, 0.42);
  background: linear-gradient(180deg, rgba(239, 106, 0, 0.16), rgba(255, 69, 58, 0.06));
}

.mom-section.secondary {
  border-color: rgba(142, 142, 147, 0.35);
  background: linear-gradient(180deg, rgba(142, 142, 147, 0.13), rgba(255, 255, 255, 0.035));
}

.mom-section > h2:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: #ffffff;
  font-size: 1.05rem;
}

.mom-section > h2:first-child::before {
  content: "";
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: var(--corporate-blue);
}

.mom-section.success > h2:first-child::before {
  background: var(--emerald);
}

.mom-section.danger > h2:first-child::before {
  background: linear-gradient(180deg, var(--crimson), var(--accent));
}

.mom-section.secondary > h2:first-child::before {
  background: var(--charcoal);
}

.mom-section ul,
.mom-section ol {
  margin: 0;
  padding-left: 1.15rem;
}

.mom-section li + li {
  margin-top: 8px;
}

.mom-details-grid,
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.detail-card,
.attendance-card,
.agenda-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  padding: 12px;
}

.detail-card span,
.attendance-card h3,
.agenda-card h3 {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-card strong {
  display: block;
  overflow-wrap: anywhere;
  color: #ffffff;
  line-height: 1.35;
}

.discussion-stack {
  display: grid;
  gap: 10px;
}

.styled-list {
  margin: 0;
  padding-left: 1.1rem;
}

.styled-list li {
  padding-left: 2px;
}

.responsive-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mom-table {
  width: 100%;
  min-width: 620px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
}

.mom-table th,
.mom-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

.mom-table th {
  background: rgba(10, 132, 255, 0.22);
  color: #ffffff;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.action-table th {
  background: rgba(239, 106, 0, 0.26);
}

.mom-table tr:last-child td {
  border-bottom: 0;
}

.mom-table td:last-child,
.mom-table th:last-child {
  border-right: 0;
}

.critical-row td {
  background: rgba(255, 69, 58, 0.12);
}

.speaker-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.speaker-chip {
  background: rgba(10, 132, 255, 0.18);
  color: #92c9ff;
}

.status-pill.open {
  background: rgba(239, 106, 0, 0.18);
  color: #ffb46f;
}

.status-pill.done {
  background: rgba(48, 209, 88, 0.18);
  color: #7cf29a;
}

.status-pill.critical {
  background: rgba(255, 69, 58, 0.2);
  color: #ff9b94;
}

.speaker-text {
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.6;
}

.chat-section {
  padding: 16px;
  border: 1px solid rgba(10, 132, 255, 0.35);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(10, 132, 255, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.04);
}

.chat-section > h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.chat-section > h2::before {
  content: "";
  width: 6px;
  height: 24px;
  border-radius: 999px;
  background: var(--corporate-blue);
}

.chat-thread {
  display: grid;
  gap: 12px;
}

.chat-message {
  display: flex;
}

.chat-message.left {
  justify-content: flex-start;
}

.chat-message.right {
  justify-content: flex-end;
}

.chat-bubble {
  width: min(86%, 680px);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.chat-message.left .chat-bubble {
  border-bottom-left-radius: 6px;
  background: rgba(255, 255, 255, 0.105);
}

.chat-message.right .chat-bubble {
  border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, rgba(10, 132, 255, 0.38), rgba(239, 106, 0, 0.18));
}

.chat-speaker {
  display: block;
  margin-bottom: 5px;
  color: #9ed0ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-bubble p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.55;
}

.markdown-surface > :first-child {
  margin-top: 0;
}

.markdown-surface h1,
.markdown-surface h2,
.markdown-surface h3 {
  margin: 1.1em 0 0.48em;
  line-height: 1.1;
}

.markdown-surface p,
.markdown-surface li {
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.62;
}

.markdown-surface code,
.markdown-surface pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.markdown-surface table {
  width: 100%;
  border-collapse: collapse;
}

.markdown-surface th,
.markdown-surface td {
  padding: 10px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.export-row {
  margin-top: 14px;
}

.history-panel {
  margin-top: 4px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.history-main {
  min-width: 0;
  text-align: left;
  background: transparent;
}

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

.history-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-main span,
.empty-state {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-controls {
  display: flex;
  gap: 8px;
}

.history-action {
  min-width: 44px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.history-action.danger {
  color: var(--danger);
}

.modal-backdrop,
.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.settings-card {
  width: min(100%, 480px);
  padding: 22px;
}

.field-label {
  display: block;
  margin: 22px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.text-field {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;
  padding: 0 14px;
}

.text-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.api-key-link {
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.api-key-link:hover {
  text-decoration: underline;
}

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

.close-button {
  width: 42px;
  color: var(--muted);
  font-size: 1.1rem;
}

.processing-overlay {
  z-index: 30;
  text-align: center;
}

.orb-wrap {
  position: relative;
  width: 148px;
  height: 148px;
  margin: 0 auto 26px;
}

.ai-orb,
.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.ai-orb {
  background:
    radial-gradient(circle at 32% 26%, #ffffff 0 5%, rgba(255, 255, 255, 0) 18%),
    radial-gradient(circle at 28% 34%, #ffb46f 0 14%, rgba(255, 180, 111, 0) 36%),
    conic-gradient(from 120deg, #ef6a00, #ffb000, #ffffff, #ef6a00);
  filter: blur(0.2px) saturate(145%);
  animation: orbPulse 2.2s ease-in-out infinite, orbSpin 6s linear infinite;
  box-shadow:
    0 0 34px rgba(239, 106, 0, 0.78),
    0 0 86px rgba(239, 106, 0, 0.34);
}

.orb-ring {
  border: 1px solid rgba(255, 255, 255, 0.32);
  animation: ringPulse 2.2s ease-in-out infinite;
}

.processing-overlay p {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
}

progress {
  width: min(100%, 320px);
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.12);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(92vw, 360px);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(22, 22, 22, 0.92);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@keyframes orbPulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes orbSpin {
  to {
    rotate: 360deg;
  }
}

@keyframes ringPulse {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.18);
    opacity: 0.85;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .hero-panel {
    min-height: 520px;
  }

  .action-row > *,
  .export-row > *,
  .modal-actions > * {
    flex: 1 1 145px;
  }

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

  .history-controls {
    justify-content: stretch;
  }

  .history-action {
    flex: 1;
  }
}
