:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #eef4f6;
  --text: #17212b;
  --muted: #667481;
  --line: #d9e2e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --cyan: #0e7490;
  --amber: #b45309;
  --rose: #be123c;
  --green: #15803d;
  --shadow: 0 20px 45px rgba(22, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(180, 83, 9, 0.10), transparent 40%),
    var(--bg);
}

.login-panel {
  width: min(100%, 520px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.login-panel h1,
.topbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.login-panel h1 {
  margin-top: 18px;
  font-size: 32px;
}

.login-panel p,
.brand-block span,
.server-box span,
.metric span,
.drop-zone small,
.form-message,
.eyebrow {
  color: var(--muted);
}

.login-form {
  margin-top: 28px;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input[type="range"] {
  accent-color: var(--accent);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.password-row button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button,
.password-row button {
  background: var(--accent);
  color: white;
  padding: 0 18px;
}

.primary-button:hover,
.password-row button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: white;
  color: var(--text);
  border-color: var(--line);
  padding: 0 16px;
}

.ghost-button {
  width: 100%;
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.icon-button {
  width: 42px;
  background: white;
  border-color: var(--line);
  color: var(--text);
  font-size: 22px;
}

.app-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  border-left: 1px solid var(--line);
  background: #fbfcfe;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.workspace {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  padding: 26px;
}

.brand-block,
.server-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block strong,
.brand-block span,
.server-box strong,
.server-box span {
  display: block;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--surface-soft);
  border-color: var(--line);
}

.server-box {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.server-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--amber);
}

.server-dot.ok {
  background: var(--green);
}

.server-dot.error {
  background: var(--rose);
}

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

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: 30px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(22, 33, 43, 0.05);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.main-column,
.player-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.player-column {
  position: sticky;
  top: 26px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 20px;
}

.limit-chip,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.limit-chip {
  background: #fef3c7;
  color: var(--amber);
}

.status-badge.ready {
  background: #dcfce7;
  color: var(--green);
}

.status-badge.processing,
.status-badge.queued {
  background: #e0f2fe;
  color: var(--cyan);
}

.status-badge.error {
  background: #ffe4e6;
  color: var(--rose);
}

.status-badge.idle {
  background: var(--surface-soft);
  color: var(--muted);
}

.drop-zone {
  min-height: 190px;
  border: 1.5px dashed #a9bbc5;
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 26px;
  background: #f8fbfc;
  transition: border-color 160ms ease, background 160ms ease;
}

.field-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.field-block {
  display: grid;
  gap: 8px;
}

.field-block span {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.drop-zone input {
  display: none;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #e8f5f3;
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 12px;
}

.drop-zone strong,
.drop-zone small {
  display: block;
}

.upload-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.progress-wrap {
  width: 100%;
  height: 8px;
  background: #e6edf1;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  transition: width 160ms ease;
}

.form-message {
  min-height: 22px;
  margin-top: 10px;
  font-size: 13px;
}

.form-message.error {
  color: var(--rose);
}

.form-message.success {
  color: var(--green);
}

.library-head {
  align-items: end;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 150px;
  gap: 10px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  font-size: 14px;
}

.video-name {
  max-width: 280px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-weight: 800;
  padding: 0 10px;
}

.mini-button.danger {
  color: var(--rose);
}

.empty-state {
  display: none;
  padding: 32px 10px 14px;
  text-align: center;
  color: var(--muted);
}

.empty-state.is-visible {
  display: block;
}

.video-shell {
  position: relative;
  background: #0d151c;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.video-shell video {
  width: 100%;
  height: 100%;
  display: block;
  background: #0d151c;
}

.player-meta {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.player-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #d6e0e6;
  padding: 18px;
  text-align: center;
  pointer-events: none;
}

.player-placeholder.is-hidden {
  display: none;
}

.player-big-button {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.92);
  color: white;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.player-big-button.is-playing {
  opacity: 0;
}

.video-shell:hover .player-big-button.is-playing {
  opacity: 1;
}

.player-controls {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 42px 12px 12px;
  background: linear-gradient(180deg, transparent, rgba(3, 7, 18, 0.82));
}

.seek-row {
  display: grid;
  margin-bottom: 8px;
}

.seek-row input {
  width: 100%;
  direction: ltr;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
}

.control-button {
  min-width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.time-label {
  min-width: 86px;
  color: #e5eef3;
  direction: ltr;
  font-size: 12px;
  text-align: right;
}

.control-spacer {
  flex: 1;
}

.volume-slider {
  width: 72px;
  min-height: 22px;
  direction: ltr;
}

.quality-select {
  width: auto;
  min-width: 82px;
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  padding: 0 8px;
}

.quality-select option {
  color: var(--text);
}

.quality-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.quality-pill {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbfc;
  color: var(--text);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.full-width {
  width: 100%;
}

.player-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 1180px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .player-column {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-view {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .workspace {
    grid-column: 1;
    grid-row: auto;
  }

  .sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .login-panel,
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .password-row,
  .filters,
  .upload-actions {
    grid-template-columns: 1fr;
  }

  .upload-actions {
    display: grid;
  }

  .player-actions {
    grid-template-columns: 1fr;
  }

  .control-row {
    flex-wrap: wrap;
  }

  .control-spacer {
    display: none;
  }

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

  .topbar,
  .panel-head,
  .library-head {
    align-items: stretch;
    flex-direction: column;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }
}
