* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #f5f5f5;
  --muted: #888;
  --accent: #e63946;
  --accent-hover: #ff4d5a;
  --green: #2ecc71;
  --yellow: #f1c40f;
  --radius: 12px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 24px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.brand h1 {
  font-size: 1.3rem;
  font-weight: 700;
}

.brand p {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--accent); }

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-wide { min-width: 0; }

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h2 { margin-bottom: 0; }

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.4;
}

label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

input[type="text"],
input[type="date"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.quick-expiry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

.file-drop {
  margin-top: 6px;
  padding: 28px 16px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--accent);
  background: rgba(230, 57, 70, 0.05);
}

.file-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-types {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

.upload-progress {
  margin: 16px 0;
  padding: 16px;
  background: rgba(230, 57, 70, 0.08);
  border: 1px solid rgba(230, 57, 70, 0.35);
  border-radius: 10px;
}

.upload-progress.hidden { display: none; }

.upload-progress-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.upload-progress-header strong {
  font-size: 0.95rem;
  color: var(--text);
}

.upload-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(230, 57, 70, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: upload-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes upload-spin {
  to { transform: rotate(360deg); }
}

.progress-bar {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff6b6b);
  transition: width 0.15s linear;
  border-radius: 6px;
}

#progress-fill.indeterminate {
  width: 40% !important;
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

#progress-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.progress-detail {
  font-size: 0.82rem;
  color: var(--muted);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
}

.btn-ghost:hover { background: rgba(255,255,255,0.14); }

.btn-sm {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: none;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
}

.btn-sm:hover { background: rgba(255,255,255,0.14); }

.btn-danger {
  background: rgba(230,57,70,0.15);
  color: var(--accent);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}

.btn-danger:hover { background: rgba(230,57,70,0.3); }

.status-msg {
  margin-top: 12px;
  font-size: 0.9rem;
}

.status-msg.ok { color: var(--green); }
.status-msg.err { color: var(--accent); }

.video-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.video-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.video-row-info {
  flex: 1;
  min-width: 0;
}

.video-row-info h3 {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-row-info p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
}

.badge.ok { background: rgba(46,204,113,0.15); color: var(--green); }
.badge.soon { background: rgba(241,196,15,0.15); color: var(--yellow); }
.badge.expired { background: rgba(230,57,70,0.15); color: var(--accent); }

.video-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
}

.modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--surface);
  color: var(--text);
  max-width: 420px;
  width: 90%;
}

.modal::backdrop { background: rgba(0,0,0,0.6); }

.modal form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal h2 { font-size: 1.1rem; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
}

.hidden { display: none !important; }

.tabs {
  display: flex;
  gap: 4px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 12px;
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.panel-header h2 { font-size: 1.1rem; }

.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.item-row h3 { font-size: 0.95rem; }
.item-row p { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

.row-actions { display: flex; gap: 8px; flex-shrink: 0; }

.tag {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: normal;
}

.filter-select, select {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
}

.modal-wide { max-width: 480px; }

.grade-checkboxes {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
}

.grade-checkboxes legend {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.checkbox-label input { width: auto; margin: 0; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-user {
  font-size: 0.85rem;
  color: var(--muted);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 400px;
}

.login-brand {
  margin-bottom: 28px;
}

.login-card label {
  display: block;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}

.login-hint {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.login-error {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.45);
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 0.9rem;
  line-height: 1.4;
}

.login-error.visible {
  display: block;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -8px 0 12px;
}
