:root {
  color-scheme: light dark;
  font-family: "Inter", system-ui, sans-serif;
  background-color: #0f172a;
  color: #f9fafb;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: space-around;
  padding: 2rem;
  background: radial-gradient(circle at top, #1f2937, #0f172a 65%);
  color: inherit;
  overflow-y: auto;
  flex-direction: row;
  align-items: stretch;
}

main {
  width: 100%;
  gap: 2rem;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: stretch;
}

hr {
  width: 100%;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

section {
  width: 100%;
  display: flex;
}

#tts-input-block {
  margin: 1rem 0;
}

.admin-btn-hovered {
  position: fixed;
  padding: 0.5rem;
  width: 2rem;
  top: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.card {
  display: flex;
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  padding: 1.75rem;
  border-radius: 20px;
  background: #ffffff1a;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
  gap: 1.5rem;

  pre {
    word-break: break-all;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.25);
    padding: 1.2rem 0.4rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }
}

header {
  h1,
  h2 {
    margin: 0 0 1.5rem;
    font-weight: 600;
  }

  p {
    margin-top: 0;
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.5;
    font-size: 0.95rem;
  }
}

#tts-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;

  textarea {
    height: 100%;
  }
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

input,
textarea,
button {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background-color: rgba(15, 23, 42, 0.75);
  color: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

textarea {
  resize: none;
  min-height: 220px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #fff;
  border: none;
  font-weight: 600;
  letter-spacing: 0.02em;

  &.secondary {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.5);
  }

  &:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }

  &:not(:disabled):hover {
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.75);
    background: rgba(64, 136, 162, 0.619) !important;
    transition: background-color 1s ease;
  }
}

footer {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

audio {
  width: 100%;
}

.status,
.admin-status {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.status.error,
.admin-status.error {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.5);
}

.status {
  display: none;
}

.api-cheatsheet {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.api-cheatsheet h3 {
  margin: 0 0 0.5rem;
}

.doc-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.doc-row pre {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 0.75rem;
  color: #e2e8f0;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.15);
  color: #67e8f9;
  font-size: 0.8rem;
  border: 1px solid rgba(56, 189, 248, 0.35);
  margin-bottom: 0.25rem;
}

.pill.muted {
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.35);
}

.doc-footer {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.85);
}

.api-demo {
  margin-top: 1.25rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.demo-card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.speaker-labels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#speaker-labels-container .field-group {
  margin-bottom: 0.25rem;
}

#speaker-labels-container input {
  width: 100%;
}

.speeches-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 220px;
  overflow-y: auto;
}

.speeches-list li {
  padding: 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.speeches-list code {
  word-break: break-all;
}

.stt-output {
  min-height: 64px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.realtime-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  color: #b0b5c0;
}

.realtime-meta .microcopy {
  font-size: 0.9rem;
}

.doc-link {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
  margin-left: 0.5rem;
  &:hover {
    text-decoration: underline;
  }
}

.loader {
  width: 32px;
  height: 32px;
  border: 4px solid rgba(255, 255, 255, 0.4);
  border-bottom-color: #ff3d00;
  border-radius: 50%;
  display: none;
  animation: rotation 1s linear infinite;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.logo {
  cursor: pointer;
  padding: 0.5rem 0.85rem;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.7rem;
  margin-right: 0.5rem;
  .x {
    color: rgb(37 99 235 / 1);
    font-weight: 700;
  }

  .pro {
    color: rgb(15 23 42 / 1);
    font-weight: 700;
  }
}

.stats {
  font-size: 0.9rem;
  color: rgba(148, 163, 184, 0.8);

  &.error {
    color: #fca5a5;
  }
}

.admin-panel {
  justify-content: flex-start;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 4rem);
}

#admin-content {
  height: 100%;
  overflow-y: auto;
}

.admin-auth {
  margin-bottom: 0.5rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  min-width: 220px;
}

.admin-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  flex-wrap: nowrap;
  flex-direction: row;

  button.active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
  }
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.18);
  overflow-y: auto;
}

.status-wrapper {
  position: relative;
}

.icon#refresh-accounts {
  border-radius: 2rem;
  background: transparent;
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  text-align: center;
  font-size: 2rem;
  padding: 0;
  position: absolute;
  margin: 0;
  width: 30px;
  height: 30px;
  line-height: 30px;
  top: 5px;
  right: 5px;
}

.admin-form[hidden] {
  display: none;
}

.tab-panel {
  display: none;

  &.active {
    display: block;
  }
}

#accounts-panel {
  overflow-y: auto;
}

.accounts-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
}

.accounts-actions {
  display: flex;
  gap: 0.5rem;
}

.field-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1.75rem;
  border-radius: 12px;
  box-shadow: 0px 5px 10px 10px rgba(0, 0, 0, 0.3);

  h3 {
    font-size: 1.8rem;
  }
}

.checkbox-group {
  gap: 0.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  min-width: 20px;
  height: 20px;
}

.field-hint {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  margin: 0;
}

.accounts-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
}

.account-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.account-card-header-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.status-badge {
  display: flex !important;
  justify-content: center;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 1rem;
  width: 70px !important;
  height: 32px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.2);
  &:has(.full) {
    color: rgb(229, 248, 199);
  }
  &:has(.tts) {
    color: rgb(177, 230, 247);
  }
  &:has(.stt) {
    color: rgb(233, 226, 184);
  }
  span {
    margin-left: 0.35rem;
    font-size: 0.6rem;
  }
  .full {
    color: #86efac;
  }
  .tts {
    color: #93c5fd;
  }
  .stt {
    color: #facc15;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.2);

  &.overdue {
    background: rgba(248, 113, 113, 0.15);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.35);
  }

  &.admin {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(45, 212, 191, 0.35);
  }
}

.header-action-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chevron {
  font-size: 0.95rem;
  color: rgba(148, 163, 184, 0.9);
  transition: transform 0.2s ease;
}

.account-card {
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;

  form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  details {
    font-size: 0.9rem;
  }

  &.collapsed .chevron {
    transform: rotate(0deg);
  }

  &.expanded .chevron {
    transform: rotate(90deg);
  }

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

  code {
    word-break: break-all;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.25);
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
  }
}

.icon-btn {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: rgba(226, 232, 240, 0.9);
  width: 32px;
  height: 32px;
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  border-radius: 99px;
  min-width: unset;
  flex-shrink: 0;
  cursor: pointer;
  line-height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;

  &:hover {
    border-color: rgba(148, 163, 184, 0.75);
    box-shadow: 0 4px 16px rgba(148, 163, 184, 0.35);
  }
}

.edit-btn {
  border-color: rgba(56, 189, 248, 0.6);
  color: #38bdf8;

  &:hover {
    border-color: rgba(56, 189, 248, 0.9);
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.4);
  }
}

.delete-btn {
  border-color: rgba(248, 113, 113, 0.6);
  color: #fca5a5;

  &:hover {
    border-color: rgba(248, 113, 113, 0.9);
    box-shadow: 0 4px 16px rgba(248, 113, 113, 0.35);
  }
}

.account-meta {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.78);
}

.account-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.account-card.collapsed .account-card-body {
  display: none;
}

.account-edit-panel {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.account-card.editing .account-edit-panel {
  display: flex;
}

.edit-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.admin-status {
  display: none;
}

.form-button-group {
  display: flex;
  gap: 1rem;
}

@media (max-width: 1000px) {
  body {
    padding: 1rem;
  }

  main {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}

summary {
  cursor: pointer;
}

.invoice-list,
.minutes-added-list {
  padding: unset;
  list-style: none;

  li {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;

    span:first-child {
      white-space: nowrap;
    }
    .invoice-actions {
      display: flex;
      gap: 0.35rem;
      width: calc(1.55rem + 108px);
      justify-content: space-between;
    }
  }
}
