:root {
  --bg: #0f1419;
  --card: #1a2332;
  /* Filmaniak AppColors.secondary (#E40098) */
  --accent: #e40098;
  --on-accent: #ffffff;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --danger: #f07178;
  --ok: #7fd962;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #2a3548;
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.locale-picker {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.locale-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  margin: 0;
  padding: 0.3rem 1.55rem 0.3rem 0.55rem;
  min-width: 0;
  width: auto;
  max-width: 9rem;
  font-size: 0.82rem;
  line-height: 1.2;
  border: 1px solid #3d4f6a;
  border-radius: 999px;
  background-color: #1a2332;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238b9cb3' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.55rem;
  color: var(--text);
  cursor: pointer;
}

.locale-select:hover {
  border-color: #516786;
}

.locale-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.locale-select option {
  background: #1a2332;
  color: var(--text);
}

@media (max-width: 640px) {
  .site-header {
    flex-direction: column;
    padding-top: 2.75rem;
  }

  .locale-picker {
    position: absolute;
    right: 0.75rem;
    top: 0.65rem;
    transform: none;
  }

  .locale-select {
    max-width: 7.5rem;
    font-size: 0.78rem;
    padding-right: 1.45rem;
  }
}

.brand-logo {
  border-radius: 12px;
  flex-shrink: 0;
}

.site-header h1 { margin: 0; font-size: 1.6rem; text-align: left; }
.site-header .tagline { color: var(--muted); margin: 0.25rem 0 0; font-size: 0.9rem; text-align: left; }

.subheading {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}

.url-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.url-card {
  background: #0f1419;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.url-card strong {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.url-card .url-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.url-card code {
  flex: 1;
  word-break: break-all;
  font-size: 0.82rem;
  color: var(--accent);
}

.port-check-result.ok { color: var(--ok); }
.port-check-result.err { color: var(--danger); }
.port-check-result.pending { color: var(--muted); }

.url-card .url-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.url-card-hint {
  margin: 0.65rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid #2a3548;
}

.url-card-hint .tab-link {
  font-size: inherit;
  font-weight: 600;
  color: var(--accent);
}

.advanced-block {
  margin: 1rem 0;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

.advanced-block summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.advanced-block code {
  font-size: 0.85em;
  color: var(--accent);
}

.section-divider {
  border: none;
  border-top: 1px solid #2a3548;
  margin: 1.5rem 0;
}

.router-guide {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0;
}

.router-tip {
  background: rgba(228, 0, 152, 0.08);
  border: 1px solid rgba(228, 0, 152, 0.35);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.router-tip strong {
  color: var(--accent);
}

.router-scenario {
  background: #0f1419;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.router-scenario h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text);
}

.router-scenario p {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.router-rule {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.router-rule li {
  display: grid;
  grid-template-columns: minmax(9rem, 38%) 1fr;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px dashed #2a3548;
}

.router-rule li:last-child {
  border-bottom: none;
}

.router-rule .rule-label {
  color: var(--muted);
}

.router-rule .rule-value {
  color: var(--text);
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
}

.router-rule .rule-value.copyable,
.router-guide .copyable {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline dotted;
}

.router-rule .rule-value.copyable:hover,
.router-guide .copyable:hover {
  filter: brightness(1.15);
}

.router-setup-lead {
  margin: 0 0 0.5rem;
}

.router-scenario-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.router-scenario-tabs button {
  flex: 1;
  min-width: 7rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px solid #3d4f6a;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.router-scenario-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.router-scenario-panel {
  margin-bottom: 0.5rem;
}

.router-double-intro {
  margin: 0 0 0.75rem;
}

.router-step-block {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #2a3548;
}

.router-step-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.router-step-title {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: var(--text);
}

.router-step-block .router-rule {
  margin-top: 0;
}

.router-public-hint {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2a3548;
}

.router-access-line {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  color: var(--text);
}

.router-admin-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
}

.router-admin-link:hover {
  filter: brightness(1.12);
}

.hint-inline {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: normal;
}

.network-diagnostics-block {
  margin-top: 1.25rem;
}

.playurl-fieldset {
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

.playurl-fieldset legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-size: 0.95rem;
}

.radio-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.65rem 0 0.25rem;
  color: var(--text);
  cursor: pointer;
}

.radio-line input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.radio-hint,
.indent-hint {
  margin: 0 0 0.5rem 1.6rem;
}

.indent-select,
.indent-input {
  margin: 0.25rem 0 0.5rem 1.6rem;
  max-width: calc(100% - 1.6rem);
}

#playurl-preview {
  color: var(--accent);
  word-break: break-all;
}

main { max-width: 720px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid #2a3548;
}

.hidden { display: none !important; }

.force-password-card {
  margin-bottom: 1rem;
  border-color: rgba(228, 0, 152, 0.45);
}

h2 { margin-top: 0; font-size: 1.15rem; }

label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #3d4f6a;
  border-radius: 8px;
  background: #0f1419;
  color: var(--text);
}

button {
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  background: #3d4f6a;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.danger { background: #5c2a2a; color: #ffc8c8; font-weight: 600; }
button.link { background: transparent; color: var(--muted); text-decoration: underline; }
button:hover { filter: brightness(1.08); }

.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin: 0.75rem 0; }
.row input { flex: 1; min-width: 140px; margin-top: 0; }

.hint { font-size: 0.85rem; color: var(--muted); }
.warn { color: var(--accent); font-size: 0.85rem; }

.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  width: 100%;
}
.tabs button {
  background: transparent;
  border: 1px solid #3d4f6a;
  text-align: center;
  padding: 0.55rem 0.35rem;
  font-size: 0.85rem;
}
.tabs button.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

@media (max-width: 520px) {
  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }
}

ul { list-style: none; padding: 0; margin: 0 0 1rem; }
.admin-account-block,
.panel-section {
  background: #0f1419;
  border: 1px solid #2a3548;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
}

.users-tab .panel-section:last-child,
.library-tab .panel-section:last-child {
  margin-bottom: 0;
}

.tab-lead {
  margin-bottom: 1rem !important;
}

.panel-section .subheading,
.admin-account-block .subheading {
  margin-top: 0;
}

.panel-section .section-hint,
.admin-account-block .hint {
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.panel-section .inline-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2a3548;
}

.users-list,
#users-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
}

#users-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  background: #161d28;
  border: 1px solid #2a3548;
  border-radius: 6px;
  gap: 0.5rem;
  word-break: break-all;
}

#users-list li.users-empty {
  display: block;
  background: transparent;
  border: none;
  padding: 0.25rem 0;
  margin-bottom: 0;
}

#users-list li .user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex-shrink: 0;
}

.sessions-list,
#sessions-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#sessions-list li {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  background: #161d28;
  border: 1px solid #2a3548;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#sessions-list li:last-child {
  margin-bottom: 0;
}

#sessions-list .session-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  flex-wrap: wrap;
}

#sessions-list .session-meta {
  font-size: 0.85rem;
  color: #9aa8bc;
  word-break: break-all;
}

#sessions-list .session-times {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

#sessions-list .session-time-last {
  text-align: right;
  flex-shrink: 0;
}

#sessions-list li.sessions-empty {
  background: transparent;
  border: none;
  padding: 0.25rem 0;
  margin-bottom: 0;
}

#sessions-list li.session-item-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.session-current-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  white-space: nowrap;
}

.play-log-list,
#play-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.log-tab .tab-lead {
  margin-bottom: 0.75rem !important;
}

#play-log-list .play-log-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.4rem;
  background: #161d28;
  border: 1px solid #2a3548;
  border-radius: 6px;
}

#play-log-list .play-log-file {
  font-weight: 600;
  word-break: break-all;
}

#play-log-list .play-log-meta {
  font-size: 0.85rem;
  color: #9aa8bc;
}

#play-log-list .play-log-empty {
  padding: 0.25rem 0;
}

.roots-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.roots-list .root-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid #2a3548;
  margin: 0;
}

.roots-list .root-item:last-child {
  border-bottom: none;
}

.roots-list .root-item .root-path-input {
  flex: 1;
  min-width: 10rem;
  margin-top: 0;
}

.roots-list .root-item--saved .root-path-input {
  cursor: default;
  opacity: 0.92;
}

.roots-list .root-item--saved .root-scope-select:disabled {
  opacity: 0.92;
  cursor: default;
}

#new-root.root-access-ok {
  border-color: var(--ok);
}

#new-root.root-access-bad {
  border-color: var(--danger);
}

.browse-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
}

.folder-browser {
  border: 1px solid #3d4f6a;
  border-radius: 12px;
  padding: 0;
  max-width: min(32rem, 92vw);
  width: 100%;
  background: var(--card);
  color: var(--text);
}

.folder-browser::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.folder-browser-inner {
  padding: 1rem 1.1rem 1.1rem;
  margin: 0;
}

.folder-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.folder-browser-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.folder-browser-path {
  word-break: break-all;
  margin: 0 0 0.65rem;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.folder-browser-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid #2a3548;
  border-radius: 8px;
  background: #0f1419;
}

.folder-browser-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-bottom: 1px solid #2a3548;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.folder-browser-item:hover {
  background: #1a2332;
}

.folder-browser-list li:last-child .folder-browser-item,
.folder-browser-empty {
  border-bottom: 0;
}

.folder-browser-footer {
  justify-content: flex-end;
  gap: 0.5rem;
}

.test-results {
  margin-top: 1rem;
}

.test-results-lead {
  margin: 0 0 0.65rem;
}

.test-results-empty {
  margin: 0;
  padding: 0.75rem;
  background: #0f1419;
  border-radius: 8px;
  border: 1px solid #2a3548;
}

.test-match-card {
  background: #0f1419;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.65rem;
}

.test-match-card:last-child {
  margin-bottom: 0;
}

.test-match-card strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.test-match-path {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  word-break: break-all;
}

.test-match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.test-search-row .panel-select {
  flex: 0 1 11rem;
}

.panel-select,
.roots-list .root-item .root-scope-select {
  flex: 0 1 11rem;
  min-width: 9rem;
  margin-top: 0;
  padding: 0.55rem 0.5rem;
  border: 1px solid #3d4f6a;
  border-radius: 8px;
  background: #0f1419;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.roots-list .root-item.root-access-ok .root-path-input {
  border-color: var(--ok);
}

.roots-list .root-item.root-access-bad .root-path-input {
  border-color: var(--danger);
}

pre {
  background: #0f1419;
  padding: 0.75rem;
  border-radius: 8px;
  overflow: auto;
  font-size: 0.8rem;
  max-height: 320px;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.session-label {
  color: var(--muted);
}

.snackbar-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.snackbar {
  pointer-events: auto;
  min-height: 3.25rem;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  animation: snack-in 0.22s ease-out;
}

.snackbar-ok {
  background: #2d7a3e;
  color: #fff;
}

.snackbar-err {
  background: #8b2e2e;
  color: #fff;
}

.snackbar-neutral {
  background: #3d4f6a;
  color: var(--text);
}

.snackbar.snackbar-hide {
  animation: snack-out 0.28s ease-in forwards;
}

@keyframes snack-in {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes snack-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .snackbar {
    animation: none;
  }
  .snackbar.snackbar-hide {
    animation: none;
    opacity: 0;
  }
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
  margin: 1rem 0;
}

.stat-card {
  background: #0f1419;
  border: 1px solid #2a3548;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
}

.stat-card strong {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.stat-card span {
  font-size: 0.95rem;
  word-break: break-word;
}

.stat-card span.ok-text { color: var(--ok); }
.stat-card span.warn-text { color: var(--accent); }

.admin-badge {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid rgba(228, 0, 152, 0.45);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.25rem;
}

.system-actions {
  margin-top: 0.5rem;
}

.action-help {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
}

.action-help li {
  display: block;
  padding: 0.45rem 0;
  border-bottom: 1px solid #2a3548;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.action-help li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.action-help strong {
  color: var(--text);
}

