/* Melion Admin — Premium Dashboard UI */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: rgba(13,148,136,.12);
  --accent: #2dd4bf;
  --sidebar-bg: #0b1120;
  --sidebar-hover: rgba(255,255,255,.05);
  --sidebar-active: rgba(45,212,191,.14);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --bg: #eef2f7;
  --card: #ffffff;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --shadow-lg: 0 16px 48px rgba(15,23,42,.12);
  --sidebar-width: 256px;
  --font-main: 'UKIJ Tuz Tom', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(45,212,191,.09), transparent 50%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(13,148,136,.06), transparent 45%);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  width: var(--sidebar-width);
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(45,212,191,.06) 0%, transparent 28%),
    linear-gradient(180deg, #0b1120 0%, #0f172a 55%, #0b1120 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: 8px 0 40px rgba(0,0,0,.22);
  border-right: 1px solid rgba(255,255,255,.05);
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-image {
  display: block;
  max-width: 100%;
  width: 168px;
  height: 48px;
  object-fit: contain;
  object-position: center;
}

.brand-image--text {
  width: auto;
  height: auto;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  line-height: 1.45;
  word-break: break-word;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; overscroll-behavior: contain; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 5px;
  border-radius: 12px;
  color: rgba(255,255,255,.62);
  transition: all .22s ease;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
  border-color: rgba(255,255,255,.04);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(45,212,191,.18) 0%, rgba(13,148,136,.08) 100%);
  color: #fff;
  font-weight: 700;
  border-color: rgba(45,212,191,.22);
  box-shadow: inset 3px 0 0 var(--accent), 0 4px 16px rgba(0,0,0,.15);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .85;
}

.nav-icon img, .nav-icon svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .78;
  color: rgba(255,255,255,.78);
}
.nav-item:hover .nav-icon img,
.nav-item:hover .nav-icon svg,
.nav-item.active .nav-icon img,
.nav-item.active .nav-icon svg {
  opacity: 1;
  color: #fff;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255,255,255,.5);
  flex-shrink: 0;
}

.sidebar-footer a { color: rgba(255,255,255,.7); font-size: 13px; }
.sidebar-footer a:hover { color: #fff; }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  padding: 14px 28px;
  border-bottom: 1px solid rgba(226,232,240,.65);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-heading {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -.02em;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-meta {
  font-size: 12px;
  color: var(--text-muted);
  background: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15,23,42,.04);
}

.content { padding: 20px 24px 32px; flex: 1; width: 100%; max-width: none; margin: 0; }
.content-flash { padding-bottom: 0; }

/* Dashboard hero */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #134e4a 100%);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.dash-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(45,212,191,.35), transparent 42%),
    radial-gradient(circle at 10% 90%, rgba(13,148,136,.2), transparent 40%);
  pointer-events: none;
}

.dash-hero__text,
.dash-hero__date { position: relative; z-index: 1; }

.dash-hero__title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.dash-hero__sub {
  font-size: 13px;
  color: rgba(255,255,255,.72);
}

.dash-hero__date {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width: 1280px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.stat-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226,232,240,.85);
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card__glow {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: .35;
  filter: blur(24px);
  pointer-events: none;
}

.stat-card__icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 6px 16px rgba(15,23,42,.12);
}

.stat-card__body { min-width: 0; flex: 1; }

.stat-card--emerald .stat-card__glow { background: #0d9488; }
.stat-card--emerald .stat-card__icon { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.stat-card--green .stat-card__glow { background: #22c55e; }
.stat-card--green .stat-card__icon { background: linear-gradient(135deg, #4ade80, #16a34a); }
.stat-card--amber .stat-card__glow { background: #f59e0b; }
.stat-card--amber .stat-card__icon { background: linear-gradient(135deg, #fbbf24, #d97706); }
.stat-card--violet .stat-card__glow { background: #8b5cf6; }
.stat-card--violet .stat-card__icon { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.stat-card--cyan .stat-card__glow { background: #06b6d4; }
.stat-card--cyan .stat-card__icon { background: linear-gradient(135deg, #22d3ee, #0891b2); }
.stat-card--rose .stat-card__glow { background: #f43f5e; }
.stat-card--rose .stat-card__icon { background: linear-gradient(135deg, #fb7185, #e11d48); }

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

/* Panels */
.panel {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  border: 1px solid rgba(226,232,240,.8);
}

.panel--chart,
.panel--feed,
.panel--table {
  background: linear-gradient(180deg, #fff 0%, #fafbfc 100%);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header--line { border-bottom: none; padding-bottom: 0; margin-bottom: 16px; }

.panel-header--line .panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header--line .panel-title::before {
  content: '';
  width: 4px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

.panel-title { font-size: 17px; font-weight: 800; color: #0f172a; letter-spacing: -.01em; }
.panel-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.form-intro { margin: -8px 0 18px; padding-bottom: 0; border: none; }

.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 1024px) { .panel-grid { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); background: #fff; }
.table-wrap--modern { border: none; background: transparent; }

table { width: 100%; border-collapse: collapse; }
.table-modern thead th {
  background: #f1f5f9;
  font-weight: 700;
  color: #475569;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.table-modern tbody td {
  padding: 15px 18px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.table-modern tbody tr {
  transition: background .15s ease;
}

.table-modern tbody tr:hover td {
  background: rgba(13,148,136,.04);
}

.table-modern tbody tr:last-child td { border-bottom: none; }

th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; }
th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 13px; text-transform: none; letter-spacing: 0; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbfc; }

.order-code {
  font-size: 11px;
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 6px;
  color: #475569;
  border: 1px solid var(--border);
}

.cell-user { font-weight: 600; color: #0f172a; }
.cell-money { color: #0d9488; font-weight: 800; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-thumb { width: 72px; height: 44px; border-radius: 8px; overflow: hidden; background: #f1f5f9; border: 1px solid var(--border); }
.table-thumb img { width: 100%; height: 100%; object-fit: cover; }
.text-muted { color: var(--text-muted); }

/* Forms */
.form-panel { width: 100%; max-width: none; }
.form-panel--wide { max-width: none; }
.form-panel--course {
  max-width: none;
  margin: 0 auto;
  width: 100%;
}
.form-card { width: 100%; }
.form-panel .panel-body { padding: 16px 20px 24px; }
.panel-body { padding-top: 4px; }
.panel-header .btn-sm { flex-shrink: 0; }
.panel-body form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full,
.form-grid .upload-field.full { grid-column: 1 / -1; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-field { min-width: 0; }
.course-cover-block { margin-bottom: 16px; }
.course-cover-block .upload-inline { align-items: flex-start; }
.course-form .form-section { margin-bottom: 16px; }
.field-label, label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=email], select, textarea, button {
  font-family: var(--font-main);
}

input[type=text], input[type=password], input[type=number], input[type=date], input[type=url], input[type=email], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  transition: border .2s, box-shadow .2s;
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16,185,129,.14);
}

textarea { min-height: 110px; resize: vertical; }
.config-guide {
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

.config-guide p {
  margin: 0 0 8px;
}

.config-guide p:last-child {
  margin-bottom: 0;
}

.config-guide code {
  padding: 2px 6px;
  background: #fff;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

.form-actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.form-section {
  margin-bottom: 18px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.form-section:last-child { margin-bottom: 0; }
.form-section-title {
  font-size: 12px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 14px;
  padding-right: 12px;
  border-right: 3px solid var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-section-body { display: flex; flex-direction: column; gap: 12px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.45; }

.read-only-value { margin: 0; padding: 10px 0; font-weight: 600; color: #0f172a; }
.read-only-block {
  margin: 0;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  line-height: 1.65;
}
.read-only-grid { margin-bottom: 20px; }

/* Upload — compact inline row */
.upload-field { margin-bottom: 0; }
.upload-field-label { margin-bottom: 4px; }

.upload-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 72px;
}

.upload-inline-preview {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  cursor: pointer;
  position: relative;
}

.upload-inline-preview--cover {
  width: 200px;
  height: 112px;
  border-radius: 10px;
}

.upload-inline-preview--wide {
  width: 100%;
  max-width: 320px;
  height: 180px;
  border-radius: 10px;
}

.upload-inline-preview img,
.upload-inline-preview video,
.upload-inline-preview .upload-preview-media {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: cover;
  display: block;
}

.upload-inline-main { flex: 1; min-width: 0; }
.upload-inline-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.upload-hint { display: none; }

.stack-panels {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-guide { display: none; }
.form-hint-block { display: none; }
.banner-card-link { min-height: 0; }

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

.upload-field.mode-url .upload-inline-actions .upload-trigger,
.upload-field.mode-url .upload-inline-actions .upload-clear { display: none; }
.upload-field.mode-url .upload-url-panel { display: block !important; margin-top: 6px; }

.upload-url-panel[hidden] { display: none !important; }
.upload-url-panel input { padding: 7px 10px; font-size: 12px; }

.upload-preview-media { max-width: 100%; max-height: 100%; object-fit: cover; display: block; }
.upload-inline-preview video.upload-preview-media { width: 100%; height: 100%; max-height: 100%; }

.upload-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  cursor: pointer;
}

.upload-placeholder-icon { font-size: 22px; opacity: .5; font-weight: 300; }

/* Legacy upload card (fallback) */
.upload-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.upload-card-preview {
  width: 56px;
  height: 56px;
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.upload-card-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.upload-tabs { display: none; }
.upload-box { border: none; padding: 0; background: transparent; }
.upload-box-actions { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .upload-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  line-height: 1.2;
}

.btn:hover { text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16,185,129,.32);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #047857 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16,185,129,.4);
  transform: translateY(-1px);
}
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-gray { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }
.btn-gray:hover { background: #e2e8f0; color: #334155; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* Badges & alerts */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.search-bar { display: flex; gap: 8px; }
.search-bar input { width: 260px; }

.pagination { display: flex; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span { padding: 7px 13px; border-radius: 8px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--text); }
.pagination a:hover { background: var(--primary-light); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Messages & chart */
.msg-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.msg-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s;
}

.msg-item:hover {
  border-color: rgba(13,148,136,.25);
  box-shadow: 0 4px 12px rgba(15,23,42,.05);
}

.msg-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.msg-item__main { flex: 1; min-width: 0; }

.msg-title { font-weight: 700; color: #0f172a; font-size: 13px; line-height: 1.4; }
.msg-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-weight: 600; }
.msg-type { font-size: 11px; color: var(--primary); margin-top: 4px; font-weight: 600; }

.chart-box { height: 320px; width: 100%; }

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.chart-legend span { display: flex; align-items: center; gap: 8px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(255,255,255,.8);
}

.dot-emerald { background: #0d9488; }
.dot-green { background: #22c55e; }
.dot-amber { background: #f59e0b; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }

/* Chapter list */
.chapter-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 12px;
}

.chapter-item-info { flex: 1; min-width: 0; }
.chapter-item-title { font-weight: 600; color: #0f172a; }
.chapter-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Login — immersive background */
.login-page {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background: #e6faf2;
}

.login-scene {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.login-scene__bg {
  position: fixed;
  inset: 0;
  background:
    var(--login-bg) left center / cover no-repeat,
    linear-gradient(135deg, #d7f5ea 0%, #ecfdf5 50%, #f0fdf8 100%);
  transform: scale(1.02);
  animation: loginBgIn 1.2s ease-out both;
}

.login-scene__veil {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(255,255,255,.08) 0%, rgba(255,255,255,.45) 42%, rgba(240,253,248,.88) 58%, rgba(255,255,255,.96) 100%),
    radial-gradient(circle at 78% 22%, rgba(57,227,175,.18), transparent 42%);
  pointer-events: none;
}

.login-scene__grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(57,227,175,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57,227,175,.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, transparent 0%, black 35%, black 100%);
  opacity: .35;
  pointer-events: none;
}

.login-scene__orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  animation: loginOrb 8s ease-in-out infinite;
}

.login-scene__orb--1 {
  width: 280px;
  height: 280px;
  background: rgba(57,227,175,.35);
  top: 8%;
  left: 12%;
}

.login-scene__orb--2 {
  width: 220px;
  height: 220px;
  background: rgba(16,185,129,.22);
  bottom: 10%;
  left: 28%;
  animation-delay: -3s;
}

.login-scene__inner {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login-glass {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 32px;
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow:
    0 4px 24px rgba(16,185,129,.08),
    0 24px 64px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.9);
  backdrop-filter: blur(24px) saturate(1.2);
  animation: loginCardIn .85s cubic-bezier(.2,.8,.2,1) .25s both;
  overflow: hidden;
}

.login-glass__shine {
  position: absolute;
  top: -50%;
  right: -30%;
  width: 60%;
  height: 200%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.45), transparent);
  transform: rotate(18deg);
  pointer-events: none;
}

.login-brand { text-align: center; margin-bottom: 24px; position: relative; }

.login-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(145deg, #39e3af, #10b981);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
  box-shadow: 0 12px 28px rgba(57,227,175,.35);
}

.login-brand-logo {
  display: block;
  max-width: 168px;
  max-height: 56px;
  margin: 0 auto 12px;
  object-fit: contain;
}

.login-glass h1 {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-field { margin-bottom: 16px; }

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 14px;
  background: rgba(255,255,255,.85);
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.login-field input:focus {
  outline: none;
  border-color: #39e3af;
  box-shadow: 0 0 0 4px rgba(57,227,175,.18);
  background: #fff;
}

.login-submit {
  margin-top: 8px;
  padding: 13px 20px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #39e3af 0%, #10b981 100%);
  box-shadow: 0 10px 28px rgba(57,227,175,.35);
  transition: transform .2s, box-shadow .2s;
}

.login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(57,227,175,.42);
}

.login-page .alert {
  margin-bottom: 16px;
  border-radius: 12px;
}

.login-copyright {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  padding: 0 32px;
  pointer-events: none;
}

.login-copyright p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: rgba(15, 23, 42, 0.55);
  font-weight: 500;
}

.login-copyright p + p {
  margin-top: 4px;
}

@media (max-width: 960px) {
  .login-copyright {
    bottom: 20px;
    padding: 0 20px;
  }

  .login-copyright p {
    font-size: 11px;
  }
}

@keyframes loginBgIn {
  from { opacity: 0; transform: scale(1.06); }
  to { opacity: 1; transform: scale(1.02); }
}

@keyframes loginCopyIn {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes loginCardIn {
  from { opacity: 0; transform: translateY(20px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes loginFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes loginOrb {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: .7; }
  50% { transform: translate(12px, -16px) scale(1.06); opacity: 1; }
}

@media (max-width: 960px) {
  .login-scene__inner {
    padding: 32px 20px 48px;
  }

  .login-scene__bg {
    background-position: center top;
    background-size: cover;
  }

  .login-scene__veil {
    background: linear-gradient(180deg, rgba(255,255,255,.2) 0%, rgba(240,253,248,.92) 45%, rgba(255,255,255,.98) 100%);
  }
}

/* Legacy login selectors — unused */
.login-shell, .login-hero, .login-main, .login-iso { display: none; }

/* Config sections */
.config-section { margin-bottom: 32px; }
.config-section:last-child { margin-bottom: 0; }

/* Banner management */
.form-hint-block { margin: -8px 0 16px; }
.banner-form code {
  padding: 2px 6px;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 12px;
  color: #475569;
}

.banner-toolbar {
  align-items: center;
}

.banner-toolbar-meta {
  display: flex;
  gap: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.banner-stat strong {
  color: #0f172a;
  font-weight: 700;
}

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

.banner-card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, .8);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.banner-card-media {
  position: relative;
  aspect-ratio: 25 / 12;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

.banner-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.banner-card-media .badge {
  position: absolute;
  top: 10px;
  right: 10px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

.banner-card-sort {
  position: absolute;
  bottom: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.banner-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.banner-card-id {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.banner-card-link {
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
  min-height: 40px;
}

.banner-card-time {
  font-size: 12px;
}

.banner-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

[dir=rtl] input[type=url],
[dir=rtl] .upload-url-input,
[dir=rtl] code { direction: ltr; text-align: left; unicode-bidi: embed; }
[dir=rtl] .sidebar {
  left: auto;
  right: 0;
  box-shadow: -4px 0 32px rgba(0,0,0,.25);
  border-right: none;
  border-left: 1px solid rgba(255,255,255,.06);
}
[dir=rtl] .main { margin-left: 0; margin-right: var(--sidebar-width); }
[dir=rtl] .nav-item.active { box-shadow: inset -3px 0 0 var(--accent), 0 4px 16px rgba(0,0,0,.15); }
[dir=rtl] .panel-header--line .panel-title::before { order: 1; }
[dir=rtl] th, [dir=rtl] td { text-align: right; }
[dir=rtl] .form-section-title { padding-right: 0; padding-left: 12px; border-right: none; border-left: 3px solid var(--primary); }
[dir=rtl] .form-field label,
[dir=rtl] .field-label { text-align: right; }
[dir=rtl] .form-grid { direction: rtl; }
[dir=rtl] .upload-inline { direction: rtl; }
[dir=rtl] .form-actions { flex-direction: row-reverse; }
[dir=rtl] .stat-card__glow { right: auto; left: -20px; }

@media (max-width: 768px) {
  :root { --sidebar-width: 72px; }
  .brand-image { width: 52px; height: 36px; }
  .brand-image--text { font-size: 11px; max-width: 56px; }
  .nav-item span:not(.nav-icon), .sidebar-footer span { display: none; }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 12px; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Page compat — existing CRUD forms */
.form-group { margin-bottom: 0; min-width: 0; }
.form-group.full { grid-column: 1 / -1; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  font-family: var(--font-main);
}
.form-textarea { min-height: 110px; resize: vertical; }
.btn-light { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }
.btn-light:hover { background: #e2e8f0; color: #334155; }
.upload-box { margin-bottom: 0; }
.upload-preview {
  width: 120px; height: 120px; border-radius: 12px;
  object-fit: cover; border: 1px solid var(--border); margin-top: 10px; display: block;
}
.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  margin: 48px auto;
  padding: 32px 28px;
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 24px 64px rgba(15,23,42,.08);
  backdrop-filter: blur(24px);
}
.login-card .login-brand { text-align: center; margin-bottom: 20px; }
.login-card .login-brand h1 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-card .login-brand p { font-size: 13px; color: var(--text-muted); }

/* —— Clean list UI (Melion style) —— */
body {
  background: #f4f6f9;
  background-image: none;
}

.topbar {
  background: #fff;
  backdrop-filter: none;
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
}

.page-heading {
  color: #0f172a;
  background: none;
  -webkit-text-fill-color: currentColor;
  font-size: 18px;
  font-weight: 700;
}

.main { background: #f4f6f9; }

.content { padding: 16px 20px 28px; max-width: none; width: 100%; }

.toolbar {
  margin-bottom: 14px;
  justify-content: flex-start;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-search .form-input { min-width: 220px; }

.form-select--sm {
  width: auto;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 13px;
}

.btn-light.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: rgba(13, 148, 136, 0.25);
}

[dir=rtl] .toolbar { justify-content: flex-start; }

.panel--list {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.panel--list .table-wrap,
.panel--list .table-wrap--modern {
  border: none;
  border-radius: 0;
  margin: 0;
}

.panel--table .panel-header { display: none; }
.panel--table .panel-body { padding: 0; }

.nav-icon img,
.nav-icon svg {
  filter: brightness(0) invert(1);
  opacity: .82;
}

.nav-item.active .nav-icon img,
.nav-item.active .nav-icon svg { opacity: 1; }

.table-modern tbody td { padding: 16px 18px; }
.table-modern thead th { padding: 14px 18px; background: #f8fafc; }

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.table-actions .inline-form { display: inline; margin: 0; }

.table-actions .btn-sm {
  min-width: 64px;
  padding: 7px 14px;
}

.cell-title strong {
  display: block;
  font-size: 14px;
  color: #0f172a;
  font-weight: 700;
  margin-bottom: 4px;
}

.cell-title .text-muted { font-size: 12px; }

.thumb,
.table-thumb img {
  width: 72px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.table-thumb {
  width: 72px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.btn-light {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
}

.btn-light:hover {
  background: #e2e8f0;
  color: #334155;
}

.form-panel {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

[dir=rtl] .table-actions { flex-direction: row-reverse; justify-content: flex-start; }

/* Uyghur / Arabic script — keep letters connected */
html[lang=ug],
html[dir=rtl] body {
  font-family: var(--font-main);
  font-feature-settings: 'liga' 1, 'calt' 1;
  text-rendering: optimizeLegibility;
}

html[lang=ug] th,
html[lang=ug] .nav-item,
html[lang=ug] .panel-title,
html[lang=ug] .page-heading,
html[lang=ug] .form-label,
html[lang=ug] .field-label,
html[lang=ug] .stat-label,
html[lang=ug] .stat-card .label,
html[lang=ug] .badge {
  text-transform: none;
  letter-spacing: 0;
}

.panel--list,
.panel--table,
.form-panel {
  width: 100%;
  max-width: none;
}

/* Finance page */
.stat-grid--finance {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

@media (max-width: 960px) {
  .stat-grid--finance { grid-template-columns: 1fr; }
}

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

.finance-toolbar__meta {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
  transition: all .2s ease;
  border: 1px solid transparent;
}

.filter-tab:hover {
  color: var(--primary-dark);
  background: #f8fafc;
  text-decoration: none;
}

.filter-tab.active {
  color: #fff;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  border-color: rgba(13, 148, 136, 0.2);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.28);
}

.finance-status-form {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cell-money {
  color: #0d9488;
  font-weight: 800;
  font-size: 14px;
}

.cell-user {
  font-weight: 600;
  color: #334155;
}

.type-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.type-pill--vip {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.type-pill--coin {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

html[lang=ug] .filter-tab,
html[lang=ug] .finance-toolbar__meta,
html[lang=ug] .type-pill {
  letter-spacing: 0;
  text-transform: none;
}

/* Drama wizard */
.drama-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.drama-steps__item {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--border);
  text-decoration: none;
}

.drama-steps__item.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.drama-steps__item.is-done {
  color: var(--primary);
  border-color: rgba(13, 148, 136, 0.35);
}

.drama-steps__sep {
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-actions--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-actions--split .btn-primary { margin-inline-start: auto; }

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

.episode-toolbar__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.batch-toolbar--inline {
  margin-top: 0;
  margin-bottom: 16px;
  background: #f8fafc;
}

.batch-toolbar__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.batch-toolbar__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.batch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.batch-import-form {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.batch-import-file {
  max-width: 220px;
  font-size: 12px;
}

.batch-filters {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.batch-filters.is-open { display: flex; }

.batch-table-form { width: 100%; }

.batch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.col-check {
  width: 42px;
  text-align: center;
}

.col-check input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
