:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger-bg: #fff1f2;
  --danger: #be123c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

.form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  font-size: 16px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
  background: #ffffff;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.secondary {
  background: #eef2f6;
  color: var(--ink);
}

.secondary:hover {
  background: #dfe5ee;
}

.danger {
  background: #fff1f2;
  color: var(--danger);
}

.danger:hover {
  background: #ffe4e6;
}

.alert {
  margin-top: 18px;
  border: 1px solid #fecdd3;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger);
}

.notice {
  margin: 0 0 16px;
  border: 1px solid #99f6e4;
  border-radius: 6px;
  padding: 10px 12px;
  background: #f0fdfa;
  color: #115e59;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.narrow {
  width: min(760px, 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.table-panel {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td small {
  display: block;
  max-width: 340px;
  margin-top: 4px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.secondary-link {
  background: #eef2f6;
  color: var(--ink);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions form {
  margin: 0;
}

.small-button {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef2f6;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-recordable,
.status-active {
  background: #dcfce7;
  color: #166534;
}

.status-offline,
.status-error {
  background: #fee2e2;
  color: #991b1b;
}

.status-not_playable {
  background: #fef3c7;
  color: #92400e;
}

.empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 18px 0;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.source-form {
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.source-status {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.source-status small {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.detail-main {
  min-height: 100%;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.meta-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.link-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.link-list input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.wide-block {
  grid-column: 1 / -1;
}

.paths div {
  grid-template-columns: 100px minmax(0, 1fr);
}

.health-list div {
  grid-template-columns: 110px minmax(0, 1fr);
}

.status-ready {
  background: #dbeafe;
  color: #1d4ed8;
}

.status-recording {
  background: #dcfce7;
  color: #166534;
}

.status-stopping {
  background: #fef3c7;
  color: #92400e;
}

.status-finished {
  background: #e0f2fe;
  color: #0369a1;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.metric {
  display: grid;
  gap: 8px;
}

.metric span,
.metric small,
.empty {
  color: var(--muted);
}

.metric strong {
  font-size: 30px;
}

.wide {
  grid-column: span 2;
}

.event-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.event-list li {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.event-list span {
  color: var(--muted);
}

.event-list small {
  color: var(--muted);
}

@media (max-width: 860px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .topbar,
  .account {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .wide {
    grid-column: span 1;
  }
}
