* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f5f7;
  color: #1f2933;
  line-height: 1.5;
}

h1, h2, h3 {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

h2 {
  font-size: 1.1rem;
}

.muted {
  color: #6b7280;
  font-weight: 400;
  font-size: 0.85em;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #6b7280;
}
label input, label select, label textarea {
  margin-top: 0.25rem;
}

input[type=text], input[type=password], select, textarea {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  background: #fff;
  color: #1f2933;
}
input[type=text]:focus, input[type=password]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
}

.btn {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  border: 1px solid #e1e4e8;
  background: #fff;
  color: #1f2933;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: #f9fafb;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.btn--primary:hover {
  background: #1d4ed8;
}
.btn--ghost {
  background: transparent;
}
.btn--ghost:hover {
  background: #f3f4f6;
}
.btn--danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.4);
}
.btn--danger:hover {
  background: rgba(220, 38, 38, 0.06);
}
.btn--small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}
.btn--record {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.4rem;
  font-size: 1rem;
  font-weight: 600;
  border-color: #e11d48;
  color: #e11d48;
}
.btn--record__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e11d48;
}
.btn--record.is-recording {
  background: #e11d48;
  color: #fff;
}
.btn--record.is-recording .btn--record__dot {
  background: #fff;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}
.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e1e4e8;
  padding: 1rem 1.5rem;
}
.topbar h1 {
  font-size: 1.4rem;
  margin: 0;
}
.topbar p {
  margin: 0.15rem 0 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-areas: "clients recorder" "clients notes";
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "clients" "recorder" "notes";
  }
}

.panel {
  background: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  padding: 1.25rem;
}
.panel--clients {
  grid-area: clients;
  align-self: start;
}
.panel--recorder {
  grid-area: recorder;
}
.panel--notes {
  grid-area: notes;
}

.client-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.client-form input {
  flex: 1;
}

.client-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.client-list__empty {
  color: #6b7280;
  font-size: 0.85rem;
}
.client-list__item {
  display: flex;
  align-items: center;
  border-radius: 6px;
}
.client-list__item:hover {
  background: #f3f4f6;
}
.client-list__item:hover .client-list__tools {
  opacity: 1;
}
.client-list__item.is-active {
  background: rgba(37, 99, 235, 0.08);
}
.client-list__item.is-active .client-list__name {
  color: #2563eb;
  font-weight: 600;
}
.client-list__name {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  padding: 0.5rem 0.6rem;
  color: #1f2933;
  cursor: pointer;
}
.client-list__count {
  font-size: 0.75rem;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 999px;
  padding: 0 0.5rem;
  min-width: 1.5rem;
  text-align: center;
}
.client-list__tools {
  opacity: 0;
  transition: opacity 0.15s;
  padding-right: 0.3rem;
}
.client-list__tools button {
  background: none;
  border: 0;
  cursor: pointer;
  color: #6b7280;
  padding: 0.25rem 0.35rem;
  font-size: 0.85rem;
}
.client-list__tools button:hover {
  color: #dc2626;
}

.recorder__meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) {
  .recorder__meta {
    grid-template-columns: 1fr;
  }
}
.recorder__controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.recorder__status {
  color: #6b7280;
  font-size: 0.9rem;
}
.recorder__status.is-live {
  color: #e11d48;
  font-weight: 600;
}
.recorder__interim {
  min-height: 1.4rem;
  color: #6b7280;
  font-style: italic;
  font-size: 0.9rem;
  padding: 0.25rem 0.1rem;
}
.recorder__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-top: 1rem;
}
.alert--warn {
  background: #fef3c7;
  color: #92400e;
}

.notes__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.notes__filter {
  min-width: 220px;
}
.notes__excerpt {
  cursor: pointer;
  color: #1f2933;
}
.notes__excerpt:hover {
  color: #2563eb;
}

table.dataTable {
  font-size: 0.9rem;
  border-collapse: collapse !important;
}
table.dataTable thead th {
  border-bottom: 2px solid #e1e4e8 !important;
  font-weight: 600;
  color: #6b7280;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
table.dataTable tbody td {
  border-top: 1px solid #e1e4e8;
  vertical-align: top;
}
table.dataTable.no-footer {
  border-bottom: 1px solid #e1e4e8 !important;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  font: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  margin-left: 0.5rem;
}
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 0.5rem;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 6px !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #2563eb !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal[hidden] {
  display: none;
}
.modal__box {
  background: #ffffff;
  border-radius: 10px;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.modal__box label {
  margin-top: 0.75rem;
}
.modal__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal__close {
  background: none;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}
.modal__close:hover {
  color: #1f2933;
}
.modal__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.modal__actions .spacer {
  flex: 1;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2933;
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 200;
}
.toast--ok {
  background: #16a34a;
}
.toast--err {
  background: #dc2626;
}
.toast[hidden] {
  display: none;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login {
  width: 100%;
  max-width: 380px;
}
.login h1 {
  font-size: 1.5rem;
}
.login label {
  margin-top: 1rem;
}

.btn--block {
  display: block;
  width: 100%;
  margin-top: 1.25rem;
}

.alert--error {
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
}

.topbar {
  position: relative;
}
.topbar a {
  color: #2563eb;
  text-decoration: none;
}
.topbar a:hover {
  text-decoration: underline;
}
.topbar__nav {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.85rem;
}
.topbar__nav a {
  color: #6b7280;
}
.topbar__nav a:hover {
  color: #1f2933;
  text-decoration: none;
}
@media (max-width: 700px) {
  .topbar__nav {
    position: static;
    transform: none;
    margin-top: 0.5rem;
  }
}

.layout--account {
  grid-template-columns: 1fr;
  grid-template-areas: none;
  max-width: 960px;
}

.stack {
  display: grid;
  gap: 0.75rem;
  max-width: 380px;
}

.user-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto auto;
  gap: 0.5rem;
  margin: 1rem 0;
}
@media (max-width: 800px) {
  .user-form {
    grid-template-columns: 1fr 1fr;
  }
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.users-table th {
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6b7280;
  border-bottom: 2px solid #e1e4e8;
  padding: 0.5rem 0.4rem;
}
.users-table td {
  padding: 0.5rem 0.4rem;
  border-top: 1px solid #e1e4e8;
  vertical-align: middle;
}
.users-table select {
  width: auto;
  padding: 0.3rem 0.5rem;
}
.users-table code {
  background: #f3f4f6;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.users-table__tools {
  white-space: nowrap;
  text-align: right;
}
.users-table__tools .btn {
  margin-left: 0.25rem;
}
