@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: 'DM Sans', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #f4f7f7;
  --muted: #93a1a7;
  --accent: #48dfc0;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 17% 45%, rgba(29, 117, 107, .22), transparent 38%),
    radial-gradient(ellipse at 88% 12%, rgba(45, 88, 112, .2), transparent 34%),
    #101820;
}

.page-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 410px;
  align-items: center;
  gap: clamp(48px, 9vw, 140px);
  width: min(1180px, calc(100% - 64px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 112px 0 100px;
}

.brand {
  position: absolute;
  top: 38px;
  left: 0;
  display: flex;
  align-items: center;
  letter-spacing: .12em;
  font-size: 14px;
  font-weight: 700;
}

.brand-home { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-home:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 3px; }
.brand-logo {
  display: block;
  width: 42px;
  height: 38px;
  object-fit: contain;
}

.brand-name span { color: var(--accent); margin-left: 4px; }

.welcome { max-width: 650px; padding-bottom: 20px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: #a9b8bd; font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(72, 223, 192, .8); }
h1 { margin: 26px 0 22px; font: 700 clamp(42px, 5.2vw, 68px)/1.08 Manrope, sans-serif; letter-spacing: -.055em; }
h1 span { color: var(--accent); }
.intro { max-width: 440px; color: #a9b6bb; font-size: 16px; line-height: 1.7; }

.login-card {
  position: relative;
  padding: 36px;
  border: 1px solid rgba(214, 235, 232, .12);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .025));
  box-shadow: 0 24px 90px rgba(0, 0, 0, .28);
  backdrop-filter: blur(16px);
}

.login-logo {
  position: absolute;
  top: 22px;
  right: 24px;
  display: block;
  width: 42px;
  height: 34px;
  object-fit: contain;
  filter: none;
  opacity: .9;
}
h2 { margin: 0 0 7px; font: 700 25px Manrope, sans-serif; letter-spacing: -.03em; }
.card-subtitle { margin: 0 0 28px; color: var(--muted); font-size: 13px; }
form { display: grid; }
label { margin: 0 0 8px; color: #dce5e5; font-size: 12px; font-weight: 600; }
input { width: 100%; height: 48px; margin: 0 0 19px; padding: 0 14px; border: 1px solid rgba(203, 224, 223, .15); border-radius: 8px; outline: none; background: rgba(8, 15, 21, .48); color: var(--ink); font: inherit; font-size: 13px; }
select { width: 100%; height: 48px; margin: 0 0 19px; padding: 0 14px; border: 1px solid rgba(203, 224, 223, .15); border-radius: 8px; outline: none; background: #121d24; color: var(--ink); font: inherit; font-size: 13px; }
input::placeholder { color: #728187; }
input:focus { border-color: rgba(72, 223, 192, .75); box-shadow: 0 0 0 3px rgba(72, 223, 192, .1); }
select:focus { border-color: rgba(72, 223, 192, .75); box-shadow: 0 0 0 3px rgba(72, 223, 192, .1); }
button { display: flex; align-items: center; justify-content: space-between; height: 49px; margin-top: 5px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--accent); color: #10221f; font: 700 13px 'DM Sans', sans-serif; cursor: pointer; }
button span { font-size: 19px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.note { display: flex; justify-content: center; gap: 8px; margin: 21px 0 0; color: #849398; font-size: 11px; }
.note span { color: #a5b5b7; }
.login-reset { margin: 16px 0 0; text-align: center; font-size: 12px; }
.login-reset a { color: #a9e9dc; text-decoration: none; }
.login-reset a:hover { color: var(--accent); text-decoration: underline; }
footer { position: absolute; bottom: 34px; left: 0; color: #748188; font-size: 11px; }
footer span { padding: 0 6px; color: var(--accent); }

.alert { margin: 0 0 20px; padding: 12px 14px; border: 1px solid transparent; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.alert-error { border-color: rgba(255, 116, 116, .28); background: rgba(135, 34, 40, .18); color: #ffc2c2; }
.alert-success { border-color: rgba(72, 223, 192, .25); background: rgba(27, 106, 92, .18); color: #b9f3e8; }
.button-secondary { height: 42px; margin: 0; border: 1px solid rgba(214, 235, 232, .16); background: rgba(255, 255, 255, .04); color: #dbe5e5; }
.button-secondary:hover { border-color: rgba(72, 223, 192, .5); }
.button-as-link { display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; text-decoration: none; font: 600 12px 'DM Sans', sans-serif; }

.dashboard-shell { position: relative; width: min(1180px, calc(100% - 64px)); min-height: 100vh; margin: 0 auto; padding: 112px 0 100px; }
.dashboard-topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 0 0 34px; }
.dashboard-actions { display: flex; align-items: center; gap: 12px; }
.dashboard-actions form { display: grid; }
.dashboard-topbar .eyebrow { margin-top: 0; }
.dashboard-title { margin: 12px 0 0; font: 700 clamp(30px, 4vw, 46px)/1.1 Manrope, sans-serif; letter-spacing: -.05em; }
.dashboard-title span { color: var(--accent); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: center; gap: 42px; margin-bottom: 48px; }
.dashboard-intro h2, .stream-section h2 { margin: 0 0 10px; font: 700 24px Manrope, sans-serif; letter-spacing: -.03em; }
.dashboard-intro p, .section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.role-badge { display: inline-flex; margin-top: 22px; padding: 7px 11px; border: 1px solid rgba(72, 223, 192, .22); border-radius: 999px; color: #a9e9dc; font-size: 11px; }
.create-card { padding: 25px; border: 1px solid rgba(214, 235, 232, .12); border-radius: 16px; background: linear-gradient(145deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .025)); box-shadow: 0 18px 60px rgba(0, 0, 0, .2); }
.create-card h2 { margin: 0 0 6px; font: 700 20px Manrope, sans-serif; }
.create-card .card-subtitle { margin-bottom: 20px; }
.create-card label { display: block; }
.create-card input { margin-bottom: 12px; }
.stream-section { padding-top: 30px; border-top: 1px solid rgba(214, 235, 232, .1); }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { font-size: 12px; }
.stream-list { display: grid; gap: 8px; }
.stream-card { min-width: 0; border: 1px solid rgba(214, 235, 232, .12); border-radius: 12px; background: rgba(255, 255, 255, .035); }
.stream-disclosure > summary, .stream-group > summary, .destination-details > summary { list-style: none; cursor: pointer; }
.stream-disclosure > summary::-webkit-details-marker, .stream-group > summary::-webkit-details-marker, .destination-details > summary::-webkit-details-marker { display: none; }
.stream-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto auto; align-items: center; gap: 22px; min-height: 60px; padding: 12px 18px; }
.stream-row-name { overflow: hidden; font: 700 15px Manrope, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.stream-row-hint { color: #93a1a7; font-size: 11px; }
.stream-row-hint span { display: inline-block; margin-left: 5px; transition: transform .2s ease; }
.stream-disclosure[open] > .stream-row .stream-row-hint span, .stream-group[open] > summary .group-mark, .destination-details[open] > summary .group-mark { transform: rotate(180deg); }
.stream-status { display: inline-flex; align-items: center; gap: 7px; color: #a9b8bd; font-size: 11px; }
.stream-status > span:first-child { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: #e0ae5a; }
.stream-status.is-live { color: #b9f3e8; }
.stream-status.is-live > span:first-child { background: var(--accent); box-shadow: 0 0 10px rgba(72, 223, 192, .7); }
.stream-status.is-unknown > span:first-child { background: #8d9a9f; }
.stream-status.is-waiting > span:first-child { background: #e0ae5a; }
.stream-owner { margin: 0; color: #8c9ba0; font-size: 10px; }
.stream-id { display: flex; align-items: baseline; gap: 7px; margin: 0 0 8px; color: #829197; font-size: 9px; }
.stream-id span { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stream-id code { color: #9aa8ad; font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.stream-meta { margin: 0 0 18px; color: #839197; font-size: 11px; }
.stream-details { padding: 0 18px 18px; border-top: 1px solid rgba(214, 235, 232, .08); }
.stream-details > .stream-id { margin-top: 12px; }
.stream-details .stream-meta { margin: 0 0 0 auto; }
.inline-preview-frame { width: min(100%, 356px); height: 200px; margin: 12px 0 16px; overflow: hidden; border: 1px solid rgba(174, 201, 201, .2); border-radius: 9px; background: #000; }
.inline-preview-player { width: 100%; height: 100%; background: #000; }
.inline-preview-player video, .inline-preview-player iframe { display: block; width: 100%; height: 100%; object-fit: contain; }
.stream-group { margin-top: 14px; overflow: hidden; border: 1px solid rgba(174, 201, 201, .26); border-radius: 11px; background: rgba(9, 19, 25, .72); box-shadow: inset 4px 0 0 rgba(72, 223, 192, .55); }
.stream-group > summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 68px; padding: 14px 18px 14px 21px; background: linear-gradient(100deg, rgba(72, 223, 192, .09), rgba(255, 255, 255, .045) 65%); }
.stream-group > summary strong, .stream-group > summary small, .feature-row strong, .feature-row small, .destination-name strong, .destination-name small { display: block; }
.stream-group > summary strong { color: #f5fbfa; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.feature-row strong, .destination-name strong { color: #dce5e6; font-size: 12px; font-weight: 600; }
.stream-group > summary small { margin-top: 5px; color: #9eb2b4; font-size: 11px; }
.feature-row small, .destination-name small { margin-top: 4px; color: #a0adb1; font-size: 10px; }
.group-mark { color: #a9bbb9; transition: transform .2s ease; }
.stream-group > summary .group-mark { color: var(--accent); font-size: 15px; }
.stream-group-content { border-top: 1px solid rgba(174, 201, 201, .2); padding: 7px 3px 9px; background: rgba(3, 9, 13, .32); }
.feature-row, .destination-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 9px 13px; }
.feature-row + .feature-row, .destination-row + .destination-row { border-top: 1px solid rgba(214, 235, 232, .06); }
.feature-unavailable { flex: 0 0 auto; color: #87969c; font-size: 10px; }
.destination-state { display: inline-flex; align-items: center; gap: 6px; color: #a6b1b4; font-size: 10px; white-space: nowrap; }
.destination-state i { width: 6px; height: 6px; border-radius: 50%; background: #89969a; }
.destination-state.is-ready { color: #a6b1b4; }
.destination-state.is-ready i { background: #e0ae5a; box-shadow: 0 0 7px rgba(224, 174, 90, .42); }
.destination-state.is-active { color: var(--accent); }
.destination-state.is-active i { background: var(--accent); box-shadow: 0 0 9px rgba(72, 223, 192, .75); }
.destination-state.is-unknown i { background: #89969a; }
.destination-state.is-pending i { background: #e0ae5a; }
.destination-placeholder { opacity: .75; }
.destination-details, .destination-placeholder { margin: 9px 12px; overflow: hidden; border: 1px solid rgba(187, 203, 207, .2); border-radius: 8px; background: rgba(138, 158, 164, .09); }
.destination-details > .destination-row { min-height: 58px; padding: 11px 13px; list-style: none; }
.destination-placeholder { margin-bottom: 10px; }
.destination-details .group-mark { flex: 0 0 auto; }
.stream-group-wrap { position: relative; }
.stream-destination-group > .stream-group > summary { padding-right: 62px; }
.stream-group-add { position: absolute; z-index: 2; top: 15px; right: 42px; display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid rgba(72, 223, 192, .42); border-radius: 9px; background: rgba(72, 223, 192, .1); color: var(--accent); font-size: 22px; line-height: 1; cursor: pointer; }
.stream-group-add:hover { background: rgba(72, 223, 192, .2); }
.managed-destination { display: grid; grid-template-columns: 36px minmax(0, 1fr) 34px; align-items: start; gap: 9px; margin: 9px 10px; padding: 10px; border: 1px solid rgba(187, 203, 207, .18); border-radius: 9px; background: rgba(138, 158, 164, .08); }
.destination-switch-form, .destination-delete-form { margin: 0; }
.destination-switch { position: relative; width: 34px; height: 20px; margin: 5px 0 0; padding: 0; border: 1px solid #69787c; border-radius: 20px; background: #344247; cursor: pointer; }
.destination-switch > span { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c4ced0; transition: transform .18s ease, background .18s ease; }
.destination-switch.is-on { border-color: var(--accent); background: rgba(72, 223, 192, .32); }
.destination-switch.is-on > span { transform: translateX(14px); background: var(--accent); box-shadow: 0 0 8px rgba(72, 223, 192, .55); }
.destination-switch:disabled { opacity: .55; cursor: not-allowed; }
.managed-destination-details { min-width: 0; margin: 0; overflow: hidden; border: 0; background: transparent; }
.managed-destination-summary { display: flex; min-height: 32px; align-items: center; justify-content: space-between; gap: 10px; list-style: none; cursor: pointer; }
.managed-destination-summary::-webkit-details-marker { display: none; }
.managed-destination-summary .destination-name { min-width: 0; overflow: hidden; }
.managed-destination-summary .destination-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.managed-destination-summary .destination-state { flex: 0 0 auto; }
.managed-destination-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; padding: 5px 0 2px; }
.managed-destination-options .credential { min-width: 0; }
.managed-destination-options code { overflow-wrap: anywhere; }
.destination-delete-button { display: grid; width: 32px; height: 32px; place-items: center; margin: 0; padding: 0; border: 1px solid rgba(234, 103, 111, .3); border-radius: 8px; background: rgba(234, 103, 111, .08); color: #e99a9e; font-size: 16px; cursor: pointer; }
.destination-delete-button:hover { background: rgba(234, 103, 111, .18); }
.destination-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 24px; border: 1px solid rgba(174, 201, 201, .28); border-radius: 16px; background: #17242d; color: #edf5f4; box-shadow: 0 24px 80px rgba(0, 0, 0, .6); }
.destination-dialog::backdrop { background: rgba(4, 10, 15, .76); backdrop-filter: blur(3px); }
.destination-dialog h2 { margin: 0 0 8px; font-size: 22px; }
.destination-dialog .card-subtitle { margin: 0 0 20px; }
.destination-dialog label { display: block; margin: 13px 0 6px; color: #c8d4d5; font-size: 12px; font-weight: 600; }
.destination-dialog input, .destination-dialog select { width: 100%; min-height: 42px; }
.destination-dialog [hidden] { display: none; }
.destination-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.destination-dialog-actions button { width: auto; min-width: 120px; }
.feature-row { margin: 8px 12px; padding: 11px 13px; border: 1px solid rgba(187, 203, 207, .17); border-radius: 8px; background: rgba(138, 158, 164, .075); }
.feature-row + .feature-row { border-top: 1px solid rgba(187, 203, 207, .17); }
.input-method { margin: 8px 12px; padding: 12px 13px; border: 1px solid rgba(187, 203, 207, .17); border-radius: 8px; background: rgba(138, 158, 164, .075); }
.input-method + .input-method { border-top: 1px solid rgba(187, 203, 207, .17); }
.input-method-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.input-method-heading strong { font-size: 12px; font-weight: 700; }
.input-method .stream-settings { margin-top: 0; }
.input-method .credential { margin-top: 9px; }
.input-method-srt .credential { margin-top: 9px; }
.embed-content { padding: 12px 13px; border-top: 1px solid rgba(214, 235, 232, .07); }
.destination-preview-link { margin-bottom: 12px; }
.player-options-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 18px; }
.player-options-form label { display: flex; align-items: center; gap: 8px; color: #c3cecf; font-size: 11px; }
.player-options-form input[type="checkbox"] { flex: 0 0 15px; width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.player-options-form .poster-field { grid-column: 1 / -1; display: block; color: #98a7ac; }
.player-options-form .poster-field input { height: 36px; margin: 6px 0 0; }
.player-options-form button, .copy-embed-button { width: max-content; height: 34px; margin: 0; padding: 0 12px; font-size: 11px; }
.embed-code-label { display: block; margin: 15px 0 6px; color: #98a7ac; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.embed-code { display: block; width: 100%; min-height: 230px; resize: vertical; padding: 10px; border: 1px solid rgba(203, 224, 223, .1); border-radius: 7px; background: rgba(8, 15, 21, .5); color: #dfe8e7; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy-embed-button { margin-top: 8px; }
.embed-not-configured { padding: 14px; border: 1px dashed rgba(214, 235, 232, .12); border-radius: 8px; color: #87969c; font-size: 11px; }
.stream-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.credential { display: grid; gap: 6px; margin-top: 12px; }
.credential span { color: #98a7ac; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.credential code { display: block; overflow-wrap: anywhere; padding: 10px 11px; border: 1px solid rgba(203, 224, 223, .1); border-radius: 7px; background: rgba(8, 15, 21, .5); color: #dfe8e7; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.stream-actions { margin-top: 17px; }
.stream-actions form { display: inline-grid; margin-top: 14px; }
.button-danger { width: auto; height: 34px; margin: 0; padding: 0 12px; border: 1px solid rgba(255, 116, 116, .3); background: rgba(135, 34, 40, .16); color: #ffc2c2; font-size: 11px; }
.button-danger:hover { border-color: rgba(255, 116, 116, .65); background: rgba(135, 34, 40, .3); }
.button-link { display: inline-flex; align-items: center; gap: 9px; color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.button-link:hover { color: #9bf3df; }
.preview-pending { color: #8d9a9f; font-size: 11px; }
.empty-state { padding: 26px; border: 1px dashed rgba(214, 235, 232, .15); border-radius: 12px; color: #8d9a9f; text-align: center; font-size: 13px; }
.user-create-card { max-width: 680px; margin: 0 0 38px; }
.user-create-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.user-create-form label { align-self: end; }
.user-create-form button { grid-column: 1 / -1; }
.user-list-section { padding-top: 28px; border-top: 1px solid rgba(214, 235, 232, .1); }
.user-list-section h2 { margin: 0 0 10px; font: 700 24px Manrope, sans-serif; letter-spacing: -.03em; }
.user-list { display: grid; gap: 12px; }
.user-row { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(260px, 1.5fr) auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid rgba(214, 235, 232, .12); border-radius: 12px; background: rgba(255, 255, 255, .035); }
.user-summary h3 { margin: 0 0 5px; font: 700 15px Manrope, sans-serif; overflow-wrap: anywhere; }
.user-summary p { margin: 0; color: #87969c; font-size: 11px; }
.user-email-form { display: grid; grid-template-columns: minmax(140px, 1fr) auto; align-items: center; gap: 8px; }
.user-email-form input { height: 40px; margin: 0; }
.user-email-form button, .user-actions button { height: 40px; padding: 0 11px; font-size: 11px; }
.user-actions { display: flex; justify-content: end; }
.user-actions form { display: grid; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.dashboard-shell footer { bottom: 30px; }

@media (max-width: 820px) {
  .page-shell { grid-template-columns: 1fr; gap: 34px; width: min(520px, calc(100% - 40px)); padding: 112px 0 92px; }
  .welcome { padding-bottom: 0; }
  h1 { font-size: clamp(40px, 9vw, 58px); }
  .login-card { padding: 30px; }
  .dashboard-shell { width: min(620px, calc(100% - 40px)); padding-top: 112px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 25px; }
  .dashboard-actions { flex-wrap: wrap; justify-content: end; }
  .user-row { grid-template-columns: 1fr; }
  .user-actions { justify-content: start; }
  .stream-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .stream-owner { display: none; }
  .stream-row-hint { justify-self: end; }
}

@media (max-width: 420px) {
  .page-shell { width: calc(100% - 32px); padding-top: 100px; }
  .brand { top: 28px; }
  .login-card { padding: 25px 22px; }
  .dashboard-shell { width: calc(100% - 32px); padding-top: 100px; }
  .dashboard-topbar { align-items: start; }
  .dashboard-actions { gap: 7px; }
  .dashboard-actions .button-secondary { padding: 0 11px; font-size: 11px; }
  .stream-details { padding: 0 12px 12px; }
  .stream-settings { grid-template-columns: 1fr; gap: 0; }
  .player-options-form { grid-template-columns: 1fr; }
  .player-options-form .poster-field { grid-column: auto; }
  .stream-id { flex-wrap: wrap; }
  .stream-details .stream-meta { flex-basis: 100%; margin: 0; }
  .destination-row { flex-wrap: wrap; }
  .feature-row, .destination-row { gap: 8px; }
  .user-create-form { grid-template-columns: 1fr; }
  .user-create-form button { grid-column: auto; }
  .user-email-form { grid-template-columns: 1fr; }
}
