:root {
  color-scheme: dark;
  --bg: #030403;
  --surface: #0b0d0b;
  --surface-2: #121612;
  --surface-3: #1d2418;
  --line: #303b24;
  --line-strong: #c9ff23;
  --green: #c9ff23;
  --green-2: #aeea16;
  --green-dark: #26380d;
  --text: #f8ffe8;
  --muted: #b6c2a5;
  --danger: #ff5d5d;
  --warning: #ffd166;
  --shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(201, 255, 35, 0.16), transparent 34rem),
    linear-gradient(180deg, #020503 0%, #000 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

a {
  color: inherit;
}

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

.login-panel {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 11, 0.94);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 36px);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(201, 255, 35, 0.38), 0 0 28px rgba(201, 255, 35, 0.2);
  flex: 0 0 auto;
}

.login-logo-wrap {
  display: grid;
  place-items: center;
  min-height: 290px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(201, 255, 35, 0.08), transparent 38%),
    repeating-linear-gradient(90deg, rgba(201, 255, 35, 0.04) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(0deg, rgba(201, 255, 35, 0.03) 0 1px, transparent 1px 56px),
    #0b0d0b;
  overflow: hidden;
  perspective: 1000px;
  position: relative;
}

.brand-coin {
  width: min(58vw, 230px);
  aspect-ratio: 1;
  position: relative;
  transform-style: preserve-3d;
  animation: coinSpin 10.5s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  filter: drop-shadow(0 0 30px rgba(201, 255, 35, 0.34));
  z-index: 2;
}

.brand-coin-face,
.brand-coin-edge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.brand-coin-face {
  overflow: hidden;
  backface-visibility: hidden;
  background: var(--green);
  border: 3px solid rgba(225, 255, 114, 0.78);
  box-shadow:
    inset 0 0 28px rgba(255, 255, 255, 0.26),
    inset 0 -28px 38px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(201, 255, 35, 0.34),
    0 26px 90px rgba(201, 255, 35, 0.12);
}

.brand-coin-face.back {
  transform: rotateY(180deg);
}

.brand-coin-face img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-coin-edge {
  width: 34px;
  left: 50%;
  right: auto;
  transform: translateX(-50%) rotateY(90deg);
  background: linear-gradient(90deg, #6e8d08, #e3ff57, #7a9b0e);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.32);
}

.coin-ring {
  width: min(72vw, 300px);
  aspect-ratio: 1;
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(201, 255, 35, 0.28);
  box-shadow:
    inset 0 0 42px rgba(201, 255, 35, 0.08),
    0 0 64px rgba(201, 255, 35, 0.1);
  transform: rotateX(64deg) rotateZ(-16deg);
}

.coin-shadow {
  width: min(54vw, 220px);
  height: 28px;
  position: absolute;
  bottom: 16%;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.52);
  filter: blur(12px);
}

@keyframes coinSpin {
  from {
    transform: rotateY(-22deg) rotateX(0deg);
  }

  to {
    transform: rotateY(338deg) rotateX(0deg);
  }
}

.brand-title {
  margin: 0;
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1;
  letter-spacing: 0;
}

.login-panel p,
.muted {
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 14px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #020704;
  color: var(--text);
  outline: none;
  padding: 12px 13px;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(201, 255, 35, 0.16);
}

.primary-btn,
.button.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--green);
  color: #090b04;
  text-decoration: none;
  padding: 0 18px;
}

.primary-btn:hover,
.button.primary-btn:hover {
  background: #dcff5b;
}

.ghost-btn {
  background: rgba(201, 255, 35, 0.08);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0 16px;
}

.danger-btn {
  background: rgba(255, 93, 93, 0.1);
  color: #ffd2d2;
  border: 1px solid rgba(255, 93, 93, 0.38);
  padding: 0 16px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: rgba(0, 0, 0, 0.86);
  border-right: 1px solid var(--line);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.sidebar-brand strong {
  font-size: 22px;
}

.sidebar-brand span {
  color: var(--muted);
  font-size: 13px;
}

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

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 0 12px;
}

.nav-btn.active {
  background: var(--green-dark);
  color: var(--text);
  border-color: var(--line-strong);
}

.main {
  min-width: 0;
  padding: 24px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(24px, 5vw, 34px);
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
}

.user-chip {
  min-width: 210px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.user-chip strong {
  display: block;
}

.user-chip span {
  color: var(--muted);
  font-size: 13px;
}

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

.panel,
.item-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 17, 11, 0.88);
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 20px;
}

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

.panel-head h2 {
  margin: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.list {
  display: grid;
  gap: 10px;
}

.item-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.item-card header,
.item-actions,
.row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-card h3,
.item-card p {
  margin: 0;
}

.item-card h3 {
  font-size: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  background: var(--green-dark);
  color: #d9ffe6;
  border: 1px solid var(--line);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 900;
}

.table-like {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.table-row strong,
.table-row span {
  overflow-wrap: anywhere;
}

.file-input {
  border: 1px dashed var(--line-strong);
  background: rgba(201, 255, 35, 0.06);
}

.alert {
  display: none;
  border-radius: 8px;
  padding: 12px;
  font-weight: 800;
}

.alert.show {
  display: block;
}

.alert.ok {
  color: #d9ffe6;
  background: rgba(201, 255, 35, 0.1);
  border: 1px solid rgba(201, 255, 35, 0.38);
}

.alert.error {
  color: #ffd2d2;
  background: rgba(255, 93, 93, 0.1);
  border: 1px solid rgba(255, 93, 93, 0.38);
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 20px;
}

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.94);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.reader-bar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #020503;
  padding: 12px clamp(12px, 3vw, 24px);
}

.reader-file {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 800;
}

.reader-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reader-stage {
  min-height: 0;
  padding: clamp(8px, 2vw, 18px);
}

.reader-frame,
.video-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

.video-frame {
  object-fit: contain;
}

.loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

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

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

  .sidebar-brand {
    margin-bottom: 12px;
  }

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

  .nav-btn {
    justify-content: center;
  }

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

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

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .login-screen {
    padding: 16px;
  }

  .login-panel {
    padding: 22px;
  }

  .login-logo-wrap {
    min-height: 240px;
  }

  .brand-coin {
    width: min(68vw, 190px);
  }

  .brand-coin-edge {
    width: 28px;
  }

  .coin-ring {
    width: min(82vw, 250px);
  }

  .topbar,
  .panel-head,
  .item-card header,
  .item-actions,
  .row-actions,
  .reader-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .user-chip,
  .row-actions select,
  .row-actions button,
  .item-actions button,
  .item-actions a,
  .reader-actions,
  .reader-actions button,
  .reader-actions a {
    width: 100%;
  }

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

  .table-row {
    grid-template-columns: 1fr;
  }

  .reader-overlay {
    grid-template-rows: auto minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand-coin {
    animation: none;
  }
}
