:root {
  --app-bg: #f5f7fb;
  --app-surface: #ffffff;
  --app-text: #111827;
  --app-muted: #6b7280;
  --app-border: rgba(15, 23, 42, 0.08);
  --app-primary: #0d6efd;
  --app-success: #198754;
  --app-danger: #dc3545;
}

html[data-theme="dark"] {
  --app-bg: #0f172a;
  --app-surface: #111827;
  --app-text: #e5e7eb;
  --app-muted: #9ca3af;
  --app-border: rgba(255, 255, 255, 0.08);
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 15px;
  }
}

body.app-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--app-bg) 0%, #dfe8f5 100%);
  color: var(--app-text);
  margin: 0;
}

html[data-theme="dark"] body.app-shell {
  background: linear-gradient(180deg, #020617 0%, #111827 100%);
}

.glass-nav,
.card,
.table,
.modal-content,
.list-group-item,
.form-control,
.form-select,
.input-group-text,
.alert {
  background-color: var(--app-surface) !important;
  color: var(--app-text);
  border-color: var(--app-border) !important;
}

.navbar-brand,
.nav-link,
.table,
.form-label,
.card-title,
.card-text,
.display-6,
h1, h2, h3, h4, h5, h6,
p,
span,
small,
label {
  color: var(--app-text);
}

.text-secondary,
.text-muted {
  color: var(--app-muted) !important;
}

.glass-nav {
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.75) !important;
}

html[data-theme="dark"] .glass-nav {
  background: rgba(17, 24, 39, 0.9) !important;
}

.dashboard-stat {
  border-radius: 1rem;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.hero-panel,
.content-card {
  border-radius: 1rem;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.table-responsive {
  border-radius: 1rem;
  overflow: hidden;
}

.badge-soft-success {
  background: rgba(25, 135, 84, 0.12);
  color: var(--app-success);
}

.badge-soft-danger {
  background: rgba(220, 53, 69, 0.12);
  color: var(--app-danger);
}

.badge-soft-primary {
  background: rgba(13, 110, 253, 0.12);
  color: var(--app-primary);
}

.video-shell {
  background: #000;
  border-radius: 1rem;
  overflow: hidden;
}

.video-shell video {
  width: 100%;
  min-height: 360px;
  display: block;
}

.ad-card {
  min-height: 180px;
}

.link-copy-box {
  font-size: 0.9rem;
  word-break: break-all;
}

.page-breadcrumb {
  padding: 0 0.25rem;
}

.section-title {
  color: #153e8c;
  font-size: 1.7rem;
  font-weight: 700;
}

.form-control-lg,
.btn {
  border-radius: 0.85rem;
}

.form-control-lg {
  min-height: 54px;
}

.table-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.table-tools .tool-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.tool-input {
  min-width: 220px;
}

.icon-action-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0.8rem;
}

.form-inline-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.table-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pager-button {
  min-width: 68px;
}

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

.app-sidebar {
  width: 280px;
  background: var(--app-surface);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand a {
  color: var(--app-primary);
  font-size: 1.4rem;
  font-weight: 700;
}

.sidebar-user {
  padding: 0.95rem 1rem;
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  background: rgba(13, 110, 253, 0.05);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.sidebar-link,
.sidebar-sublink,
.sidebar-section {
  width: 100%;
  display: block;
  border: 0;
  text-align: left;
  text-decoration: none;
  color: var(--app-text);
  background: transparent;
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  font-weight: 600;
}

.sidebar-sublink {
  margin-left: 0.35rem;
  width: calc(100% - 0.35rem);
  padding-left: 1.35rem;
  font-weight: 500;
}

.sidebar-section::after {
  content: "+";
  float: right;
  color: var(--app-muted);
}

.sidebar-section:not(.collapsed)::after {
  content: "-";
}

.sidebar-link:hover,
.sidebar-sublink:hover,
.sidebar-section:hover {
  background: rgba(13, 110, 253, 0.08);
}

.sidebar-link.active,
.sidebar-sublink.active {
  background: var(--app-primary);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

html[data-theme="dark"] .app-topbar {
  background: rgba(17, 24, 39, 0.8);
}

.app-content {
  padding: 1.5rem;
}

.app-footer {
  padding: 1rem 1.5rem;
}

@media (max-width: 991.98px) {
  .app-layout {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: static;
  }

  .app-topbar {
    padding: 1rem;
  }

  .app-content {
    padding: 1rem;
  }
}
