:root {
  --bg-main: #070c2a;
  --bg-soft: #0d1742;
  --bg-card: #111f56;
  --bg-card-2: #122564;
  --bg-rail: #0a143d;
  --ink-main: #f2f6ff;
  --ink-soft: #9db1e6;
  --ink-muted: #6c83bc;
  --cyan: #25d7f7;
  --blue: #4f6dff;
  --green: #3bf2ae;
  --warn: #ff6e7d;
  --line: rgba(151, 174, 243, 0.22);
  --shadow-main: 0 22px 60px rgba(3, 6, 23, 0.6);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  font-family: "Avenir Next", "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink-main);
  background:
    radial-gradient(circle at 8% 10%, rgba(255, 142, 122, 0.45), transparent 28%),
    radial-gradient(circle at 94% 88%, rgba(132, 120, 255, 0.38), transparent 34%),
    linear-gradient(130deg, #7f8ad7 0%, #f4a3ad 50%, #8d84d8 100%);
  padding: 36px 18px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: soft-light;
}

.dashboard-shell {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: auto;
  border-radius: 28px;
  border: 1px solid rgba(170, 189, 255, 0.32);
  box-shadow: var(--shadow-main);
  background: linear-gradient(140deg, var(--bg-main), #081237 46%, #0c1a4d 100%);
  display: grid;
  grid-template-columns: 88px 1.15fr 1.35fr;
  overflow: hidden;
  animation: shell-enter 560ms ease-out;
}

.permission-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
}

.permission-gate__box {
  width: min(100%, 460px);
  border: 1px solid rgba(170, 189, 255, 0.32);
  border-radius: 24px;
  padding: 28px 24px;
  background: linear-gradient(150deg, rgba(7, 15, 48, 0.96), rgba(10, 24, 72, 0.96));
  box-shadow: 0 22px 60px rgba(3, 6, 23, 0.48);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.permission-gate__box h2 {
  margin: 0;
  font-size: 1.28rem;
}

.permission-gate__box p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.permission-gate__icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #dff7ff;
  background: linear-gradient(135deg, rgba(37, 215, 247, 0.28), rgba(79, 109, 255, 0.28));
  border: 1px solid rgba(113, 213, 249, 0.32);
}

.permission-gate__icon--warn {
  color: #ffe4ea;
  background: linear-gradient(135deg, rgba(255, 110, 125, 0.22), rgba(176, 61, 83, 0.26));
  border-color: rgba(255, 154, 170, 0.34);
}

.permission-gate__icon svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

#retry-microphone-access-btn {
  margin-top: 4px;
  min-width: 220px;
  background: linear-gradient(120deg, #2f61c6, #3b88df);
  border-color: rgba(150, 196, 255, 0.72);
}

@keyframes shell-enter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nav-rail {
  background: linear-gradient(180deg, var(--bg-rail), #091031 80%);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.brand-block {
  width: 100%;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 0 4px rgba(79, 109, 255, 0.2);
}

.brand-block strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.brand-block small {
  color: var(--ink-muted);
  font-size: 0.63rem;
}

.rail-icons {
  display: grid;
  gap: 10px;
  width: 100%;
}

.rail-btn {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(118, 145, 218, 0.08);
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 10px 4px;
  cursor: default;
}

.rail-btn.is-active {
  color: #fff;
  border-color: rgba(82, 128, 255, 0.5);
  background: linear-gradient(140deg, rgba(74, 112, 255, 0.35), rgba(37, 215, 247, 0.22));
}

.rail-footer {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8f1ff;
}

.panel {
  padding: 22px;
  border-right: 1px solid var(--line);
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel:last-child {
  border-right: none;
}

.panel-center.is-terminal-state {
  align-content: center;
}

.recording-id-badge {
  justify-self: end;
  width: min(100%, 420px);
  border: 1px solid rgba(130, 157, 232, 0.35);
  border-radius: 10px;
  padding: 6px 8px;
  background: rgba(6, 15, 48, 0.86);
  backdrop-filter: blur(4px);
  display: grid;
  gap: 4px;
  min-width: 240px;
}

.recording-id-label {
  color: var(--ink-muted);
  font-size: 0.63rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.recording-id-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

#recording-id-value {
  font-family: "Menlo", "Consolas", monospace;
  font-size: 0.66rem;
  color: #d8e5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(9, 22, 66, 0.92);
  border: 1px solid rgba(130, 157, 232, 0.24);
  border-radius: 7px;
  padding: 5px 6px;
  user-select: text;
}

#copy-recording-id-btn {
  font-size: 0.7rem;
  padding: 5px 8px;
  border-radius: 7px;
  background: linear-gradient(120deg, #26439e, #385dd0);
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.confirm-dialog.is-open {
  opacity: 1;
  pointer-events: auto;
}

.confirm-dialog__overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 22, 0.7);
  backdrop-filter: blur(4px);
}

.copy-url-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  max-width: min(92vw, 420px);
  border: 1px solid rgba(130, 157, 232, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(155deg, rgba(22, 45, 120, 0.96), rgba(13, 28, 79, 0.96));
  color: #e8f1ff;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 16px 36px rgba(2, 6, 20, 0.45);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.copy-url-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.confirm-dialog__panel {
  position: relative;
  width: min(460px, calc(100vw - 28px));
  border: 1px solid rgba(130, 157, 232, 0.42);
  border-radius: 14px;
  padding: 18px;
  background: linear-gradient(155deg, rgba(22, 42, 110, 0.97), rgba(14, 27, 78, 0.97));
  box-shadow: 0 22px 56px rgba(2, 6, 20, 0.58);
  animation: confirm-in 180ms ease-out;
}

.confirm-dialog__panel h3 {
  margin: 0;
  font-size: 1.1rem;
}

.confirm-dialog__panel p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  line-height: 1.45;
  font-size: 0.93rem;
}

.confirm-dialog__actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#confirm-new-meeting-ok {
  background: linear-gradient(120deg, #2856d5, #2f84ef);
}

#confirm-new-meeting-cancel {
  background: rgba(15, 29, 79, 0.85);
}

#confirm-stop-recording-ok {
  background: linear-gradient(120deg, #8e2c58, #b43d53);
}

#confirm-stop-recording-cancel {
  background: rgba(15, 29, 79, 0.85);
}

@keyframes confirm-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2rem);
}

.panel-header p {
  margin: 7px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(30, 50, 121, 0.9), rgba(18, 30, 81, 0.9));
  padding: 10px 11px;
  display: grid;
  gap: 4px;
}

.mini-label {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.mini-card strong {
  font-size: 1.05rem;
}

.mini-card small {
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(165deg, var(--bg-card), var(--bg-card-2));
  padding: 15px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title-row h2,
.section-title-row h3 {
  margin: 0;
  font-size: 1.12rem;
}

.select-wrap {
  margin-top: 12px;
}

.select-wrap label {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.select-line {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

select,
button {
  border-radius: 10px;
  border: 1px solid rgba(147, 171, 241, 0.35);
  background: rgba(11, 24, 72, 0.9);
  color: var(--ink-main);
  font-family: inherit;
  font-size: 0.92rem;
  padding: 10px 12px;
}

button {
  font-weight: 650;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

button:hover:enabled {
  border-color: rgba(108, 226, 255, 0.8);
  transform: translateY(-1px);
}

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

#start-btn {
  background: linear-gradient(120deg, #2776ff, #2ad4ff);
  border-color: rgba(73, 191, 255, 0.8);
}

#pause-btn {
  background: linear-gradient(120deg, #3c53aa, #2b3f8f);
}

#resume-btn {
  background: linear-gradient(120deg, #1b8d6a, #1dc294);
}

#stop-btn {
  background: linear-gradient(120deg, #912f5a, #bb3f55);
}

#new-meeting-btn {
  background: rgba(15, 29, 79, 0.82);
  color: var(--ink-soft);
  white-space: nowrap;
}

#new-meeting-terminal-btn {
  background: rgba(15, 29, 79, 0.82);
  color: var(--ink-soft);
  white-space: nowrap;
}

#copy-processing-recording-id-btn {
  background: rgba(15, 29, 79, 0.82);
  color: var(--ink-soft);
  white-space: nowrap;
}

.control-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

#audio-meter {
  width: 100%;
  height: 166px;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid rgba(145, 167, 235, 0.36);
  background:
    linear-gradient(180deg, rgba(20, 38, 96, 0.78), rgba(9, 19, 60, 0.82)),
    radial-gradient(circle at 15% 15%, rgba(37, 215, 247, 0.2), transparent 35%);
}

.status {
  margin-top: 10px;
  color: #d0e1ff;
  font-weight: 650;
  font-size: 0.9rem;
}

.gradient-card {
  background:
    radial-gradient(circle at 10% 20%, rgba(75, 243, 250, 0.42), transparent 35%),
    radial-gradient(circle at 90% 80%, rgba(118, 76, 255, 0.38), transparent 35%),
    linear-gradient(130deg, #1a2d85, #0b1450 56%, #2a1460);
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #b6c8f5;
  text-transform: uppercase;
}

.gradient-card h2,
.profile-card h2 {
  margin: 8px 0 8px;
  font-size: 1.4rem;
}

.gradient-card p,
.profile-card p {
  margin: 0;
  color: #d4dfff;
  line-height: 1.4;
}

.chip-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip,
.surface-pill {
  border: 1px solid rgba(130, 157, 232, 0.4);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  color: #cae8ff;
  background: rgba(9, 20, 64, 0.45);
}

.chunk-progress-wrap {
  margin-top: 12px;
}

.chunk-progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(112, 137, 213, 0.28);
  overflow: hidden;
}

.chunk-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), #4fc2ff, #5570ff);
  transition: width 120ms linear;
}

.chunk-progress-meta {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.profile-card {
  background: linear-gradient(155deg, rgba(31, 54, 130, 0.96), rgba(16, 30, 85, 0.96));
}

.chunk-list-card {
  min-height: 208px;
}

.recording-state-box {
  min-height: 160px;
  display: grid;
  align-content: center;
  gap: 8px;
  justify-self: center;
  width: min(100%, 760px);
  text-align: center;
}

.recording-state-action {
  justify-self: center;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.recording-state-box h3 {
  margin: 0;
  font-size: 1.15rem;
}

.recording-state-box p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.processing-status-message {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #d8e7ff;
}

#processing-state-box {
  border-color: rgba(70, 202, 252, 0.45);
  background: linear-gradient(155deg, rgba(18, 48, 112, 0.96), rgba(11, 30, 84, 0.96));
}

#error-state-box {
  border-color: rgba(255, 121, 141, 0.55);
  background: linear-gradient(155deg, rgba(97, 24, 48, 0.95), rgba(66, 19, 41, 0.95));
}

#completed-state-box {
  border-color: rgba(71, 223, 163, 0.55);
  background: linear-gradient(155deg, rgba(17, 79, 63, 0.95), rgba(12, 63, 52, 0.95));
  text-align: left;
  justify-self: stretch;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 18px;
  gap: 12px;
}

#completed-state-box h3 {
  font-size: 1.24rem;
}

.completed-state-subtitle {
  color: #cde8de;
  font-size: 0.92rem;
}

.completed-audio-wrap {
  border: 1px solid rgba(124, 232, 184, 0.32);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(150deg, rgba(12, 58, 47, 0.88), rgba(9, 47, 38, 0.88));
  display: grid;
  gap: 8px;
}

.completed-audio-wrap label {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #a8dcc4;
}

#completed-audio-player {
  width: 100%;
  min-height: 44px;
  border-radius: 10px;
}

.completed-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

#download-audio-btn,
#download-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #f6fffb;
  font-weight: 700;
  padding: 10px 14px;
}

#download-audio-btn {
  border-color: rgba(139, 244, 195, 0.58);
  background: linear-gradient(120deg, #1a8d68, #24bc8b);
}

#download-report-btn {
  border-color: rgba(144, 184, 255, 0.62);
  background: linear-gradient(120deg, #2f61c6, #3b88df);
}

#download-audio-btn:hover:enabled {
  border-color: rgba(175, 255, 224, 0.92);
}

#download-report-btn:hover:enabled {
  border-color: rgba(190, 217, 255, 0.92);
}

.action-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.action-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

@media (max-width: 920px) {
  #completed-state-box {
    padding: 14px;
  }

  .completed-actions {
    width: 100%;
  }

  #download-audio-btn,
  #download-report-btn {
    width: 100%;
  }
}

.is-hidden {
  display: none !important;
}

.chunk-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.chunk-list li {
  border: 1px solid rgba(130, 156, 236, 0.22);
  border-radius: 10px;
  background: rgba(8, 19, 58, 0.55);
  padding: 8px 10px;
  color: #d7e3ff;
  font-size: 0.85rem;
}

.chunk-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--green), var(--cyan));
  display: inline-block;
  margin-right: 8px;
  vertical-align: middle;
}

.panel-left .surface,
.panel-center .surface,
.mini-card {
  animation: float-in 460ms ease-out both;
}

.panel-left .surface:nth-child(3) {
  animation-delay: 80ms;
}

.panel-left .surface:nth-child(4) {
  animation-delay: 140ms;
}

.panel-center .surface:nth-child(1) {
  animation-delay: 120ms;
}

.panel-center .surface:nth-child(2) {
  animation-delay: 180ms;
}

.panel-center .surface:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1240px) {
  .dashboard-shell {
    grid-template-columns: 74px 1fr 1.15fr;
  }

  .panel-center {
    border-right: none;
  }
}

@media (max-width: 920px) {
  body {
    padding: 16px 10px;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .nav-rail {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 12px;
    gap: 12px;
  }

  .brand-block {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-items: start;
    width: 100%;
    text-align: left;
    gap: 8px;
  }

  .rail-icons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
  }

  .rail-btn {
    min-width: 58px;
  }

  .rail-footer {
    display: none;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }

  .panel:last-child {
    border-bottom: none;
  }

  .recording-id-badge {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
  }

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

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

  .select-line {
    grid-template-columns: 1fr;
  }

  #new-meeting-btn {
    font-size: 0.86rem;
    padding: 9px 10px;
  }
}