body {
  background-color: #f5f7fb;
  min-height: 100vh;
}

.app-body {
  background: #eef2f7;
  color: #182230;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  width: 248px;
  height: 100vh;
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 0.85rem;
  background: #111827;
  color: #dbe4f0;
  box-shadow: 8px 0 24px rgba(15, 23, 42, 0.14);
  z-index: 20;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.45rem 1rem;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-brand:hover {
  color: #fff;
}

.app-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}

.app-brand-text {
  display: grid;
  line-height: 1.2;
}

.app-brand-text strong {
  font-size: 1rem;
}

.app-brand-text small {
  margin-top: 0.2rem;
  color: #94a3b8;
}

.app-nav,
.app-sidebar-section {
  display: grid;
  gap: 0.35rem;
}

.app-sidebar-title {
  padding: 0.75rem 0.75rem 0.25rem;
  color: #7f8ea3;
  font-size: 0.74rem;
  font-weight: 700;
}

.app-nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 42px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  color: #cbd5e1;
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font-size: 0.94rem;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.app-nav-link:hover,
.app-nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.app-nav-link.active {
  color: #fff;
  background: #1d4ed8;
  border-color: rgba(255, 255, 255, 0.12);
}

.app-nav-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.76rem;
  font-weight: 800;
}

.app-nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #dbe3ee;
  backdrop-filter: blur(12px);
}

.app-page-title {
  margin: 0;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 760;
}

.app-page-subtitle {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
}

.app-userbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  white-space: nowrap;
}

.app-user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.35rem 0.65rem;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 0.88rem;
}

.app-content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.app-content-fluid {
  max-width: none;
}

.app-content > .card,
.app-content .card {
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.app-content .table-responsive {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.app-content .form-label {
  color: #475569;
  font-size: 0.84rem;
  font-weight: 650;
}

.app-content .btn {
  border-radius: 7px;
}

#adminActions,
#adminRemoteActions {
  padding: 0.85rem;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.list-page-card {
  min-height: calc(100vh - 112px);
}

.list-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.inline-editor {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #f8fafc;
}

.inline-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.list-filter-bar {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.remote-messages-box {
  min-height: 320px;
  max-height: 520px;
  overflow: auto;
  padding: 0.85rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.remote-message {
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.remote-step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem 1rem;
}

.navbar {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-body {
  background: linear-gradient(135deg, #2c3e50, #4ca1af);
  min-height: 100vh;
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.table-responsive {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.drama-table {
  min-width: 1220px;
  margin-bottom: 0;
  table-layout: fixed;
}

.drama-table th,
.drama-table td {
  padding: 0.85rem 0.75rem;
}

.drama-table .col-check {
  width: 44px;
}

.drama-table .col-index {
  width: 56px;
}

.drama-table .col-date {
  width: 120px;
}

.drama-table .col-name {
  width: 220px;
}

.drama-table .col-number {
  width: 92px;
}

.drama-table .col-flag {
  width: 110px;
}

.drama-table .col-company {
  width: 164px;
}

.drama-table .col-uploader {
  width: 120px;
}

.drama-table .col-actions {
  width: 220px;
}

.table tbody tr:hover {
  background-color: #f8f9fa;
}

.badge.bg-success {
  background-color: #28a745 !important;
}

.badge.bg-secondary {
  background-color: #6c757d !important;
}

#adminActions .btn {
  min-width: 120px;
}

#dramaTableBody td,
#dramaTableBody th {
  vertical-align: middle;
}

.drama-table .cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drama-table .title-cell {
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.45;
  min-height: calc(1.45em * 2);
  word-break: break-word;
}

.drama-table .text-center-cell {
  text-align: center;
}

.drama-table .actions-col,
.drama-table .actions-cell {
  position: sticky;
  right: 0;
  z-index: 1;
}

.drama-table .actions-col {
  background-color: #f8f9fa;
  z-index: 3;
}

.drama-table .actions-cell {
  background-color: #fff;
}

.drama-table .action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.drama-detail-row td {
  background: #f8fbff;
  border-top: 0;
  padding: 0.95rem 1rem 1.1rem;
}

.drama-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1rem;
}

.drama-detail-item {
  min-width: 0;
}

.drama-detail-item.full-width {
  grid-column: 1 / -1;
}

.drama-detail-label {
  margin-bottom: 0.3rem;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.drama-detail-value {
  color: #111827;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}

.drama-detail-empty {
  color: #9ca3af;
}

@media (max-width: 768px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex: none;
    padding: 0.65rem 0.75rem;
    box-shadow: none;
    z-index: 40;
  }

  .app-brand {
    padding: 0 0 0.55rem;
  }

  .app-nav,
  .app-sidebar-section {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
  }

  .app-nav::-webkit-scrollbar,
  .app-sidebar-section::-webkit-scrollbar {
    display: none;
  }

  .app-sidebar-title,
  .app-brand-text small {
    display: none;
  }

  .app-nav-link {
    min-width: max-content;
    min-height: 38px;
    padding: 0.5rem 0.65rem;
  }

  .app-topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 0.85rem 0.9rem;
  }

  .app-content {
    padding: 0.75rem;
  }

  .app-page-title {
    font-size: 1.18rem;
  }

  .app-page-subtitle {
    font-size: 0.84rem;
  }

  .app-userbar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .list-page-toolbar,
  .inline-editor-header {
    align-items: stretch;
    flex-direction: column;
  }

  .list-page-toolbar .d-flex {
    width: 100%;
    flex-wrap: wrap;
  }

  .list-page-toolbar .d-flex > .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 42px;
  }

  .list-page-card {
    min-height: 0;
  }

  .app-content > .card,
  .app-content .card {
    border-radius: 8px;
    box-shadow: none;
  }

  .card-body {
    padding: 0.9rem;
  }

  .inline-editor,
  .list-filter-bar {
    padding: 0.85rem;
  }

  .list-filter-bar .mt-3.d-flex {
    align-items: stretch !important;
    flex-direction: column;
  }

  .list-filter-bar .mt-3.d-flex .d-flex {
    width: 100%;
  }

  .list-filter-bar .mt-3.d-flex .btn {
    flex: 1 1 0;
    min-height: 42px;
  }

  .license-batch-bar,
  .license-pager-bar {
    align-items: stretch !important;
    flex-direction: column;
  }

  .license-batch-actions,
  .license-pager-bar .btn-group {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .license-pager-bar .btn-group > .btn,
  .license-batch-actions > .btn {
    border-radius: 7px !important;
    min-height: 40px;
    white-space: normal;
  }

  .card .row > div {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .navbar .container-fluid {
    flex-direction: column;
    align-items: flex-start;
  }

  .navbar .btn {
    margin-top: 0.5rem;
  }

  .table-responsive {
    border-radius: 0;
  }

  .desktop-table.mobile-switchable {
    display: none;
  }

  .mobile-card-list {
    display: grid;
    gap: 0.75rem;
  }

  .drama-table {
    min-width: 980px;
  }
}

@media (max-width: 480px) {
  .app-brand-mark {
    width: 34px;
    height: 34px;
  }

  .app-brand-text strong {
    font-size: 0.95rem;
  }

  .app-user-chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .list-page-toolbar .d-flex > .btn,
  .mobile-record-actions {
    grid-template-columns: 1fr;
  }

  .mobile-record-grid {
    grid-template-columns: 1fr;
  }
}

.sortable-col {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-col:hover {
  color: #0d6efd;
}

.sortable-col.sort-active {
  color: #1d4ed8;
}

.sort-icon {
  font-size: 12px;
  opacity: 0.5;
  margin-left: 2px;
}

.sortable-col.sort-active .sort-icon {
  opacity: 1;
  color: #1d4ed8;
}

.license-sidebar {
  position: sticky;
  top: 1rem;
}

.license-row-active {
  background-color: #eef6ff;
}

.license-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mobile-card-list {
  display: none;
}

.mobile-record-card {
  min-width: 0;
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.mobile-record-card.is-active {
  border-color: #60a5fa;
  background: #f0f7ff;
}

.license-mobile-card {
  gap: 0.55rem;
  padding: 0.75rem;
}

.license-mobile-card .mobile-record-subtitle {
  font-size: 0.82rem;
}

.license-mobile-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.license-mobile-meta div {
  min-width: 0;
  padding: 0.45rem 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
}

.license-mobile-meta span {
  display: block;
  margin-bottom: 0.15rem;
  color: #7f8ea3;
  font-size: 0.7rem;
  font-weight: 700;
}

.license-mobile-meta strong {
  display: block;
  min-width: 0;
  color: #0f172a;
  font-size: 0.86rem;
  font-weight: 760;
  line-height: 1.2;
  word-break: break-word;
}

.license-mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.license-mobile-actions .btn,
.license-mobile-more summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  border-radius: 7px;
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: normal;
}

.license-mobile-more summary {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.license-mobile-more summary::-webkit-details-marker {
  display: none;
}

.license-mobile-more summary::after {
  content: "v";
  margin-left: 0.3rem;
  color: #64748b;
  font-size: 0.8rem;
}

.license-mobile-more[open] summary::after {
  content: "^";
}

.license-mobile-more[open] {
  grid-column: 1 / -1;
}

.license-mobile-more-menu {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.mobile-record-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.mobile-select-line {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.mobile-record-title {
  min-width: 0;
  color: #0f172a;
  font-weight: 760;
  line-height: 1.35;
  word-break: break-word;
}

.mobile-record-subtitle {
  min-width: 0;
  color: #64748b;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
}

.mobile-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.8rem;
}

.mobile-record-grid div {
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}

.mobile-record-grid span {
  color: #7f8ea3;
  font-size: 0.72rem;
  font-weight: 700;
}

.mobile-record-grid strong {
  min-width: 0;
  color: #182230;
  font-size: 0.88rem;
  font-weight: 650;
  word-break: break-word;
}

.mobile-record-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.mobile-record-actions .action-buttons {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.mobile-record-actions .btn {
  min-height: 40px;
  white-space: normal;
}

.mobile-drama-detail {
  padding-top: 0.2rem;
  border-top: 1px solid #e2e8f0;
}

.mobile-empty-state {
  padding: 1.2rem;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}

@media (max-width: 768px) {
  .desktop-table.mobile-switchable {
    display: none;
  }

  .mobile-card-list {
    display: grid;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .list-page-toolbar .d-flex > .btn {
    flex-basis: 100%;
  }

  .mobile-record-actions,
  .mobile-record-actions .action-buttons,
  .mobile-record-grid {
    grid-template-columns: 1fr;
  }

  .license-mobile-meta,
  .license-mobile-more-menu {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .license-mobile-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.monitor-page {
  max-width: 1400px;
}

.monitor-title {
  font-size: 1.8rem;
  font-weight: 700;
}

.monitor-last-updated {
  font-size: 0.95rem;
}

.monitor-metric-card {
  border: 0;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

.monitor-metric-label {
  color: #64748b;
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

.monitor-metric-value {
  color: #0f172a;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.monitor-metric-sub {
  color: #94a3b8;
  font-size: 0.88rem;
}

.monitor-chart {
  height: 420px;
}

.monitor-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 240px;
  color: #64748b;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  font-size: 0.95rem;
  text-align: center;
  padding: 1rem;
}

.monitor-table th {
  white-space: nowrap;
}

.monitor-toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  min-width: 240px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.monitor-toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1199px) {
  .license-sidebar {
    position: static;
  }
}

/* UI refresh layer: keeps Bootstrap, but gives the admin shell a cohesive skin. */
:root {
  --app-bg: #eef3f8;
  --app-bg-top: #f7fafc;
  --app-surface: #ffffff;
  --app-surface-soft: #f7f9fc;
  --app-border: #d9e2ec;
  --app-border-strong: #c4d0dd;
  --app-text: #132238;
  --app-muted: #64748b;
  --app-subtle: #8a9aad;
  --app-primary: #2563eb;
  --app-primary-strong: #1d4ed8;
  --app-primary-soft: #e9f1ff;
  --app-page-title: #0f1f35;
  --app-top-bg: rgba(255, 255, 255, 0.86);
  --app-table-head-bg: #f4f7fb;
  --app-table-hover: #f7fbff;
  --app-brand-bg: #2563eb;
  --app-brand-shadow: 0 12px 24px rgba(37, 99, 235, 0.35);
  --app-sidebar-active: #20355c;
  --app-sidebar-active-border: rgba(147, 197, 253, 0.22);
  --app-sidebar-indicator: #60a5fa;
  --app-success: #0f9f6e;
  --app-warning: #b7791f;
  --app-danger: #dc2626;
  --app-sidebar-bg: #111a2b;
  --app-sidebar-panel: #172235;
  --app-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --app-shadow-md: 0 14px 34px rgba(21, 31, 48, 0.08);
  --app-shadow-lg: 0 22px 52px rgba(21, 31, 48, 0.12);
  --app-radius: 8px;
}

html[data-app-theme="sunset"] {
  --app-bg: #f5edf8;
  --app-bg-top: #fff7f0;
  --app-surface: #ffffff;
  --app-surface-soft: #fff7f4;
  --app-border: #ead6e5;
  --app-border-strong: #d8b9d1;
  --app-text: #25172e;
  --app-muted: #765e78;
  --app-subtle: #9a7f9b;
  --app-primary: #f04467;
  --app-primary-strong: #c7358c;
  --app-primary-soft: #fff0f3;
  --app-page-title: #28162f;
  --app-top-bg: rgba(255, 250, 248, 0.88);
  --app-table-head-bg: #fff3f4;
  --app-table-hover: #fff8f2;
  --app-brand-bg: linear-gradient(135deg, #ff7a18 0%, #ff3f70 48%, #8b35d8 100%);
  --app-brand-shadow: 0 12px 26px rgba(240, 68, 103, 0.28);
  --app-sidebar-bg: #201329;
  --app-sidebar-panel: #2d1a3a;
  --app-sidebar-active: rgba(255, 105, 120, 0.18);
  --app-sidebar-active-border: rgba(255, 183, 119, 0.22);
  --app-sidebar-indicator: #ff7a18;
  --app-success: #0f9f6e;
  --app-warning: #b7791f;
  --app-danger: #dc2626;
  --app-shadow-sm: 0 1px 2px rgba(45, 24, 54, 0.05);
  --app-shadow-md: 0 14px 34px rgba(61, 34, 73, 0.09);
  --app-shadow-lg: 0 22px 52px rgba(61, 34, 73, 0.13);
}

body,
.app-body {
  background:
    linear-gradient(180deg, var(--app-bg-top) 0, var(--app-bg) 230px),
    var(--app-bg);
  color: var(--app-text);
  font-size: 14px;
}

.app-shell {
  background: transparent;
}

.app-sidebar {
  width: 232px;
  flex-basis: 232px;
  gap: 0.85rem;
  padding: 1rem 0.7rem;
  background: var(--app-sidebar-bg);
  box-shadow: 10px 0 30px rgba(15, 23, 42, 0.18);
}

.app-brand {
  min-height: 60px;
  margin: 0 0.2rem 0.25rem;
  padding: 0.3rem 0.45rem 0.95rem;
  border-bottom-color: rgba(226, 232, 240, 0.1);
}

.app-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--app-radius);
  background: var(--app-brand-bg);
  box-shadow: var(--app-brand-shadow);
  font-size: 1.1rem;
}

.app-theme-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: #ffffff;
  box-shadow: var(--app-shadow-sm);
}

.app-theme-option {
  width: 26px;
  height: 22px;
  border: 1px solid var(--app-border-strong);
  border-radius: 7px;
  padding: 0;
  cursor: pointer;
  opacity: 0.82;
  transition: border-color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.app-theme-option:hover,
.app-theme-option:focus {
  opacity: 1;
  transform: translateY(-1px);
}

.app-theme-option.is-active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--app-primary);
  opacity: 1;
}

.app-theme-option-default {
  background: linear-gradient(135deg, #111a2b 0%, #2563eb 100%);
}

.app-theme-option-sunset {
  background: linear-gradient(135deg, #ff7a18 0%, #ff3f70 48%, #8b35d8 100%);
}

.app-brand-text strong {
  font-size: 0.98rem;
  letter-spacing: 0;
}

.app-brand-text small {
  color: #91a3bb;
}

.app-nav,
.app-sidebar-section {
  gap: 0.25rem;
}

.app-sidebar-title {
  padding: 0.55rem 0.7rem 0.2rem;
  color: #8494aa;
  font-size: 0.72rem;
  letter-spacing: 0;
}

.app-nav-link {
  overflow: hidden;
  min-height: 40px;
  padding: 0.56rem 0.7rem;
  border-radius: var(--app-radius);
  color: #c8d4e3;
  font-size: 0.9rem;
}

.app-nav-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: transparent;
}

.app-nav-link:hover,
.app-nav-link:focus {
  background: var(--app-sidebar-panel);
  color: #ffffff;
}

.app-nav-link.active {
  background: var(--app-sidebar-active);
  border-color: var(--app-sidebar-active-border);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.app-nav-link.active::before {
  background: var(--app-sidebar-indicator);
}

.app-nav-icon {
  display: none;
}

.app-nav-link.active .app-nav-icon {
  display: none;
}

.app-main {
  background: transparent;
}

.app-topbar {
  min-height: 72px;
  padding: 1rem 1.45rem;
  background: var(--app-top-bg);
  border-bottom: 1px solid var(--app-border);
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
}

.app-page-title {
  color: var(--app-page-title);
  font-size: 1.28rem;
  font-weight: 750;
  letter-spacing: 0;
}

.app-page-subtitle {
  color: var(--app-muted);
  font-size: 0.88rem;
}

.app-userbar {
  color: var(--app-muted);
  font-size: 0.9rem;
}

.app-userbar > span:first-child:not(.badge):not(.app-user-chip) {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.58rem;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: #fff;
  color: #344256;
}

.app-user-chip {
  border-color: var(--app-border);
  color: #344256;
  box-shadow: var(--app-shadow-sm);
}

.app-content {
  max-width: 1440px;
  padding: 1.2rem 1.45rem 2.25rem;
}

.app-content > .card,
.app-content .card,
#adminActions,
#adminRemoteActions,
.inline-editor,
.list-filter-bar,
.remote-message,
.mobile-record-card {
  border-color: var(--app-border);
  border-radius: var(--app-radius);
  box-shadow: var(--app-shadow-md);
}

.app-content > .card:first-of-type {
  border-color: #d4deeb;
}

.card {
  color: var(--app-text);
}

.card-body {
  padding: 1rem;
}

.app-content .form-label {
  margin-bottom: 0.42rem;
  color: var(--app-page-title);
  font-size: 0.8rem;
  font-weight: 720;
}

.form-control,
.form-select {
  min-height: 36px;
  border-color: var(--app-border);
  border-radius: 7px;
  color: var(--app-text);
  font-size: 0.9rem;
  box-shadow: none;
}

.form-control::placeholder {
  color: #94a3b8;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary) 18%, transparent);
}

.btn {
  min-height: 36px;
  border-radius: 7px;
  font-weight: 650;
}

.btn-sm {
  min-height: 30px;
}

.btn-primary {
  background-color: var(--app-primary);
  border-color: var(--app-primary);
  box-shadow: 0 8px 18px color-mix(in srgb, var(--app-primary) 22%, transparent);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--app-primary-strong);
  border-color: var(--app-primary-strong);
}

.btn-outline-primary {
  border-color: var(--app-primary);
  color: var(--app-primary);
  background: #ffffff;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--app-primary);
  border-color: var(--app-primary);
  color: #ffffff;
}

.btn-outline-secondary {
  border-color: var(--app-border-strong);
  color: #475569;
  background: #ffffff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: #f1f5f9;
  border-color: #aab8c8;
  color: #1f2a3a;
}

.btn-outline-success {
  border-color: #36b37e;
  color: #08784f;
  background: #ffffff;
}

.btn-outline-success:hover,
.btn-outline-success:focus {
  background: #e8f7f0;
  border-color: #0f9f6e;
  color: #065f46;
}

.badge {
  border-radius: 999px;
  padding: 0.36em 0.62em;
  font-weight: 700;
}

.text-bg-primary {
  background-color: var(--app-primary) !important;
}

.text-bg-success,
.badge.bg-success {
  background-color: #dff7eb !important;
  color: #086045 !important;
  border: 1px solid #b8ebd1;
}

.text-bg-danger {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #fecaca;
}

.text-bg-warning {
  background-color: #fff4cf !important;
  color: #854d0e !important;
  border: 1px solid #f7dda4;
}

.text-bg-secondary,
.badge.bg-secondary {
  background-color: #edf2f7 !important;
  color: #475569 !important;
  border: 1px solid #d8e1eb;
}

.app-content .table-responsive {
  overflow: auto;
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  background: var(--app-surface);
  box-shadow: var(--app-shadow-md);
}

.table {
  margin-bottom: 0;
  color: var(--app-text);
  font-size: 0.88rem;
}

.table > :not(caption) > * > * {
  padding: 0.72rem 0.75rem;
  border-bottom-color: #e7edf4;
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--app-table-head-bg) !important;
  color: var(--app-page-title);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 #d9e2ec;
}

.table tbody tr {
  transition: background-color 0.14s ease;
}

.table tbody tr:hover {
  background-color: var(--app-table-hover);
}

.table td {
  vertical-align: middle;
}

.table td.text-center.text-muted {
  height: 80px;
  color: #7d8da1 !important;
  background:
    linear-gradient(180deg, rgba(247, 250, 252, 0.7), rgba(255, 255, 255, 0.92)),
    #ffffff;
  font-weight: 650;
}

.sortable-col {
  color: var(--app-page-title);
}

.sortable-col:hover,
.sortable-col.sort-active {
  color: var(--app-primary);
}

.sort-icon {
  color: #8a9aad;
}

.mobile-empty,
.mobile-empty-state {
  padding: 1.2rem;
  border: 1px dashed var(--app-border-strong);
  border-radius: var(--app-radius);
  background: #ffffff;
  color: var(--app-muted) !important;
  text-align: center;
  box-shadow: var(--app-shadow-sm);
}

.list-page-toolbar {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #e7edf4;
}

.inline-editor,
.list-filter-bar,
.remote-messages-box {
  background: var(--app-surface-soft);
}

.monitor-metric-card {
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow-md);
}

.monitor-metric-value {
  color: var(--app-page-title);
}

.monitor-chart-empty {
  border-radius: var(--app-radius);
  background: #f7fafc;
}

@media (max-width: 768px) {
  body,
  .app-body {
    background: var(--app-bg);
  }

  .app-sidebar {
    width: 100%;
    padding: 0.7rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.12);
  }

  .app-brand {
    min-height: 0;
    margin: 0;
  }

  .app-nav-link {
    min-height: 38px;
  }

  .app-topbar {
    padding: 0.9rem;
    background: #ffffff;
  }

  .app-theme-switch {
    order: -1;
  }

  .app-content {
    padding: 0.85rem;
  }

  .card-body {
    padding: 0.9rem;
  }

  .app-content .table-responsive {
    box-shadow: none;
  }
}
