  :root {
    --bg: #060a10;
    --panel: rgba(20, 27, 36, 0.9);
    --panel-2: rgba(27, 36, 48, 0.95);
    --line: rgba(255, 255, 255, 0.12);
    --text: #f3f7fb;
    --muted: #95a3b3;
    --accent: #ff7a3d;
    --accent-2: #ffb37a;
    --accent-dim: rgba(255, 122, 61, 0.16);
    --ok: #4ade80;
    --err: #ff6b6b;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  }

  * { box-sizing: border-box; }
  html { scroll-behavior: smooth; }

  body {
    margin: 0;
    min-height: 100vh;
    background:
      radial-gradient(circle at top left, rgba(255, 122, 61, 0.22), transparent 32%),
      radial-gradient(circle at bottom right, rgba(255, 179, 122, 0.12), transparent 24%),
      linear-gradient(135deg, #060a10 0%, #0d1420 45%, #111825 100%);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
  }

  ::selection {
    background: rgba(255, 122, 61, 0.3);
    color: #fff;
  }

  .top {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: rgba(5, 9, 15, 0.82);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  }

  .top .brand {
    font-weight: 700;
    letter-spacing: 0.02em;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
  }
  .top .brand img {
    height: 24px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.36));
  }
  .top .brand span { color: var(--accent); }

  .top .top-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .top .status-pill {
    font-family: var(--mono);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.2s ease;
  }
  .top .status-pill.online {
    color: var(--ok);
    border-color: rgba(74, 222, 128, 0.25);
    background: rgba(74, 222, 128, 0.08);
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.2);
    animation: pulse-status 2.2s infinite;
  }
  .top .status-pill.offline {
    color: var(--err);
    border-color: rgba(255, 107, 107, 0.25);
    background: rgba(255, 107, 107, 0.08);
  }

  .top .logout-btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  }
  .top .logout-btn:hover:not(:disabled) {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ffb3b3;
  }
  .top .logout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

  @keyframes pulse-status {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  }

  main {
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 64px;
  }

  .eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 30px;
    margin: 0 0 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .layout-grid {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(320px, 400px) 1fr;
    gap: 20px;
    align-items: start;
  }

  .card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
  }
  .layout-grid .card {
    margin-bottom: 0;
    height: 100%;
  }
  .card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent 70%);
    opacity: 0.85;
  }

  .card h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 0 0 16px;
    font-weight: 700;
  }

  .skeleton {
    position: relative;
    overflow: hidden;
    display: inline-block;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: transparent;
  }

  .skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
    animation: skeleton-shimmer 1.1s infinite;
  }

  @keyframes skeleton-shimmer {
    100% { transform: translateX(100%); }
  }

  .skeleton-line {
    height: 12px;
    width: 72px;
    min-width: 72px;
  }

  .skeleton-line.short { width: 56px; min-width: 56px; }
  .skeleton-line.long { width: 110px; min-width: 110px; }
  .skeleton-line.date { width: 180px; min-width: 180px; }
  .skeleton-line.full { width: 100%; min-width: 0; }

  .skeleton-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,0.035);
  }

  .skeleton-thumb {
    width: 84px;
    height: 84px;
    border-radius: 10px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
  }

  .skeleton-meta {
    flex: 1;
    display: grid;
    gap: 8px;
  }

  .skeleton-preview {
    width: 100%;
    aspect-ratio: 9 / 16;
    min-height: 180px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--line);
  }

  .screen-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-wrap: wrap;
  }
  .screen-row:last-child { border-bottom: none; }
  .screen-row:hover {
    background: rgba(255, 255, 255, 0.035);
    transform: translateX(2px);
  }
  .screen-row .k { color: var(--muted); }
  .screen-row .v { text-align: right; color: #f7fbff; }

  .screen-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 16px;
    align-items: start;
  }

  .preview-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    margin: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 12px 24px rgba(0, 0, 0, 0.18);
  }

  .preview-card img {
    width: 100%;
    display: none;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    background: #0b1017;
    opacity: 0;
    transition: opacity 0.22s ease;
  }

  .preview-card img.is-loaded {
    opacity: 1;
  }

  .preview-fallback {
    width: 100%;
    aspect-ratio: 9 / 16;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
  }

  .detail-list {
    display: grid;
    gap: 8px;
  }

  .detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-size: 13px;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-wrap: wrap;
  }
  .detail-item:last-child { border-bottom: none; }
  .detail-item:hover {
    background: rgba(255,255,255,0.035);
    transform: translateX(2px);
  }
  .detail-item .label { color: var(--muted); }
  .detail-item .value { text-align: right; color: #f7fbff; }

  .media-grid {
    display: grid;
    gap: 12px;
    margin-top: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .media-card {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,0.035);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  }
  .media-card.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
  .media-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 122, 61, 0.35);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  }

  .media-card img {
    width: 84px;
    height: 84px;
    border-radius: 10px;
    object-fit: cover;
    background: #0b1017;
    border: 1px solid var(--line);
    flex-shrink: 0;
  }

  .media-card .thumb-placeholder {
    width: 84px;
    height: 84px;
    border-radius: 10px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
  }

  .media-card .meta {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .media-card .actions-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }

  .preview-btn {
    border: 1px solid rgba(255, 122, 61, 0.35);
    background: rgba(255, 122, 61, 0.12);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.18s ease;
    align-self: flex-start;
  }
  .preview-btn:hover:not(:disabled) {
    background: rgba(255, 122, 61, 0.2);
    transform: translateY(-1px);
  }
  .preview-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  .media-card .name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
  }

  .media-card .sub {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    word-break: break-word;
  }

  .dropzone {
    border: 1.5px dashed rgba(255, 122, 61, 0.45);
    border-radius: 14px;
    padding: 36px 18px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    background: linear-gradient(135deg, rgba(255, 122, 61, 0.10), rgba(255, 179, 122, 0.04));
  }
  .dropzone:hover, .dropzone.drag {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-1px);
  }
  .dropzone p { margin: 0; color: var(--muted); font-size: 14px; }
  .dropzone strong { color: var(--text); font-size: 15px; }
  .dropzone input { display: none; }

  .file-preview {
    margin-top: 14px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    display: none;
  }

  .progress-wrap {
    margin-top: 12px;
    display: none;
  }
  .progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    border: 1px solid var(--line);
  }
  .progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    transition: width 0.15s ease;
  }
  .progress-label {
    margin-top: 6px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--muted);
    text-align: right;
  }

  select, button {
    font-family: inherit;
    font-size: 14px;
  }

  select {
    width: 100%;
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    margin-bottom: 14px;
    outline: none;
    -moz-appearance: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 2px), calc(100% - 12px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
  }
  select:focus {
    border-color: rgba(255, 122, 61, 0.7);
    box-shadow: 0 0 0 3px rgba(255, 122, 61, 0.16);
  }
  select option {
    background: var(--panel-2);
    color: var(--text);
  }

  .btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 11px 18px;
    min-height: 44px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
  }
  .btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  }
  .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
  .btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #1a0e07;
    box-shadow: 0 12px 24px rgba(255, 122, 61, 0.22);
  }
  .btn-ghost {
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border: 1px solid var(--line);
  }
  .btn-ghost:hover:not(:disabled) { color: var(--text); border-color: rgba(255,255,255,0.22); }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: stretch; }

  .preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 12, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
  }

  .preview-modal[hidden] {
    display: none;
  }

  .preview-modal-content {
    width: min(780px, 100%);
    background: linear-gradient(180deg, #111827, #0b1220);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  }

  .preview-modal-content video {
    width: 100%;
    border-radius: 12px;
    background: #000;
  }

  .preview-close {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    margin-bottom: 10px;
  }

  footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 30px;
    padding: 0 16px 24px;
  }

  @media (max-width: 1100px) {
    .layout-grid {
      grid-template-columns: 1fr;
    }
    main {
      max-width: 760px;
    }
  }

  @media (min-width: 1101px) {
    .media-grid {
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
  }

  @media (max-width: 640px) {
    .top {
      padding: 14px 16px;
      align-items: flex-start;
    }
    .top .brand {
      font-size: 14px;
      line-height: 1.3;
    }
    main { padding: 22px 14px 56px; }
    .card { padding: 16px; }
    .screen-row {
      align-items: flex-start;
      flex-direction: column;
      gap: 4px;
    }
    .screen-row .v { text-align: left; }
    .actions { flex-direction: column; }
    .btn { width: 100%; }
    .detail-item {
      flex-direction: column;
      align-items: flex-start;
      gap: 4px;
    }
    .detail-item .value { text-align: left; }
    .media-card { flex-direction: column; align-items: flex-start; }
    .media-card img, .media-card .thumb-placeholder { width: 100%; height: 140px; }
    .media-grid { grid-template-columns: 1fr; }
    h1 { font-size: 24px; line-height: 1.2; }
    .dropzone { padding: 28px 14px; }
  }