:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #66727a;
  --line: #dfe6e8;
  --brand: #0e7c66;
  --brand-dark: #075f50;
  --accent: #c7472f;
  --soft: #eaf3f0;
  --shadow: 0 18px 45px rgba(20, 35, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.shell {
  min-height: 100vh;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  margin: 12vh auto;
  padding: 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: #172026;
  color: #fff;
}

.sidebar h2 {
  margin: 0;
}

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

.nav-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #c8d2d5;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.user-box {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #dce7ea;
}

.content {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1 {
  margin-bottom: 6px;
}

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

.panel,
.video-card,
.table-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 150px 180px 140px;
  gap: 12px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.form {
  width: 100%;
}

.stack {
  display: grid;
  gap: 16px;
}

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

.form label span {
  color: var(--ink);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.file-drop {
  padding: 18px;
  border: 1px dashed #9ab4af;
  border-radius: 8px;
  background: var(--soft);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: inherit;
}

.danger {
  background: #fff3f1;
  border-color: #f0c3bc;
  color: var(--accent);
}

.message {
  min-height: 22px;
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.video-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.video-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f1518;
  border-radius: 6px;
}

.doc-preview {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: linear-gradient(135deg, #f4f0e8, #e4f1ee);
  color: var(--brand-dark);
  font-size: 28px;
  font-weight: 800;
}

.resource-image-preview {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #edf2f0;
}

.document-image {
  display: block;
  width: 100%;
  max-width: 920px;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
}


.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-head h3 {
  margin: 0;
  font-size: 17px;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.table-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px 140px auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.qr-preview {
  width: 72px;
  height: 72px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.dialog {
  width: min(520px, calc(100vw - 24px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(8, 16, 20, 0.5);
}

.watch-body {
  background: #101719;
  color: #fff;
}

.watch-page {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 14px 40px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.watch-page video {
  width: 100%;
  max-height: 72vh;
  background: #000;
  border-radius: 8px;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-viewer {
  display: grid;
  gap: 14px;
}

.pdf-page {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.watch-page .muted {
  color: #adbbbf;
}

.error-box {
  padding: 22px;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 14px;
  }

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

  .nav-item {
    text-align: center;
    padding-inline: 6px;
  }

  .content {
    padding: 18px 14px;
  }

  .toolbar,
  .form-grid,
  .inline-form,
  .table-row {
    grid-template-columns: 1fr;
  }
}
