/* ============================================================
   GO.NOVUM4KIDS.INFO – Modern UX Styles (2025/2026)
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Brand */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --secondary: #8b5cf6;
  --accent: #f59e0b;

  /* Semantic */
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --info: #06b6d4;
  --info-bg: #ecfeff;
  --info-text: #155e75;

  /* Neutrals */
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --surface: #ffffff;
  --bg: #f8fafc;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 0 3px var(--primary-glow);

  /* Layout */
  --sidebar-width: 264px;
  --sidebar-width-collapsed: 72px;
  --header-height: 64px;
  --footer-height: 48px;
  --content-max: 1280px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.2s;
  --duration-slow: 0.3s;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  color-scheme: light;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

::selection {
  background: var(--primary-light);
  color: var(--primary-hover);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* --- Auth Layout --- */
.body-auth {
  display: block;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99, 102, 241, 0.12), transparent),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(139, 92, 246, 0.08), transparent),
    var(--bg);
}

.auth-main {
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* --- Page Frame --- */
.page-frame {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--footer-height);
  overflow: hidden;
}

/* --- Skip Link --- */
.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  transform: translateY(-200%);
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  z-index: 2000;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: transform var(--duration) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

[hidden] {
  display: none !important;
}

/* --- Card --- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
  transition: box-shadow var(--duration) var(--ease);
}

.card.soft {
  background: #fafbff;
  border-color: var(--border-light);
}

/* --- App Shell --- */
.app-shell {
  min-height: 0;
  height: 100%;
  width: 100%;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    'sidebar topbar'
    'sidebar content';
  overflow: hidden;
}

.app-shell.is-collapsed {
  grid-template-columns: var(--sidebar-width-collapsed) 1fr;
}

/* --- Sidebar --- */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  color: #cbd5e1;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  gap: 8px;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 16px;
}

.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all var(--duration) var(--ease);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* --- Focus Styles --- */
.icon-btn:focus-visible,
.btn:focus-visible,
.input:focus-visible,
.menu-item:focus-visible,
.menu-subitem:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.brand {
  color: #f1f5f9;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Menu --- */
.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.menu-item:hover,
.menu-item:focus-visible {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  border-color: transparent;
  text-decoration: none;
}

.menu-item.is-active {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #c7d2fe;
  font-weight: 600;
}

.menu-item.is-active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.menu-item.settings {
  width: 100%;
}

/* --- Sidebar Bottom --- */
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  position: relative;
}

/* --- Settings Popover --- */
.settings-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 6px;
}

.menu-subitem {
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--duration) var(--ease);
}

.menu-subitem:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  text-decoration: none;
}

/* --- Topbar Settings --- */
.topbar-settings {
  position: relative;
}

.topbar-settings .settings-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  bottom: auto;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 6px;
  z-index: 1045;
  animation: popoverIn 0.15s var(--ease);
}

@keyframes popoverIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar-settings .menu-subitem {
  color: var(--text);
}

.topbar-settings .menu-subitem:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

/* --- Topbar --- */
.topbar {
  grid-area: topbar;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-left > div {
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
}

.view-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
}

.app-breadcrumb {
  font-size: 0.8125rem;
  margin-top: 2px;
}

.app-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.app-breadcrumb a:hover {
  color: var(--primary);
  text-decoration: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* --- User Chip --- */
.user-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--duration) var(--ease);
}

.user-chip:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.sep {
  opacity: 0.5;
}

/* --- Page Content --- */
.page-content,
.content,
.list-box,
.container {
  grid-area: content;
  padding: 1.5rem 2rem 2rem;
  overflow: auto;
  background: var(--bg);
}

/* Custom scrollbar for content */
.page-content::-webkit-scrollbar {
  width: 6px;
}
.page-content::-webkit-scrollbar-track {
  background: transparent;
}
.page-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}
.page-content::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}

.page-content > * {
  max-width: var(--content-max);
}

#main-content:focus {
  outline: none;
}

.page-content.page-content-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}

.page-content.page-content-list > * {
  max-width: 100%;
}

/* --- List Fill Card --- */
.list-fill-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  background: var(--surface);
}

.list-fill-card > .table-responsive {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
}

/* --- Content Widths --- */
.content-narrow-sm {
  max-width: 560px;
}

.content-narrow-md {
  max-width: 840px;
}

.content-narrow-lg {
  max-width: 920px;
}

.offscreen-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.input-search {
  min-width: 240px;
}

.table-scroll-lg {
  max-height: 72vh;
}

.list-fill-card .table-scroll-lg {
  max-height: none;
  height: 100%;
}

.cell-wrap-220 {
  max-width: 220px;
}

.cell-wrap-260 {
  max-width: 260px;
}

/* --- Page Header --- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 20px;
  margin-bottom: 0;
  padding: 4px 0;
}

.page-header-title {
  margin: 0;
  font-size: clamp(1.35rem, 1.15rem + 0.6vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  background: linear-gradient(135deg, var(--text) 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header-subtitle,
.sub,
.help {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.01em;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3), 0 1px 2px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35), 0 2px 4px rgba(99, 102, 241, 0.2);
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* --- Field / Form --- */
.field {
  margin-bottom: 16px;
}

.input,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='url'],
select,
textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text);
  transition: all var(--duration) var(--ease);
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover,
.input:hover {
  border-color: #cbd5e1;
}

input:focus,
select:focus,
textarea:focus,
.input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: var(--shadow-glow);
  outline: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.code-badge {
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-xs);
  padding: 4px 10px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--primary-hover);
}

/* --- Tables --- */
.table-wrap,
.table-responsive {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
.th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}

td,
.td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background var(--duration) var(--ease);
}

tbody tr {
  transition: background var(--duration) var(--ease);
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr:hover td {
  background: #f8fafc;
}

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

th a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

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

.td-muted {
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}

/* --- List Page Card Overrides --- */
.page-content.page-content-list > .card:not(.list-fill-card),
.page-content.page-content-list > .card.p-3,
.page-content.page-content-list > .card.p-4 {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.page-content.page-content-list > .card form.row.g-2 {
  margin: 0;
  row-gap: 0.5rem !important;
}

.page-content.page-content-list > .card .form-label {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-content.page-content-list .form-check {
  margin-bottom: 0;
}

.page-content.page-content-list .form-check-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.page-content.page-content-list .alert {
  margin-bottom: 0;
  border-radius: var(--radius-md);
}

.page-content.page-content-list .text-end .d-inline-flex .btn {
  min-width: 100px;
}

/* --- Badges --- */
.badge,
.badge-ok,
.badge-info,
.badge-warn,
.badge-danger {
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  padding: 0.25em 0.75em;
}

.badge-ok {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-warn {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- KPI Grid --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-val {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Modal --- */
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

/* --- Login --- */
.login-wrap {
  width: min(440px, 100%);
}

.login-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow:
    var(--shadow-xl),
    0 0 0 1px rgba(0, 0, 0, 0.03);
  padding: 36px 32px;
}

.login-card h1,
.login-card .h4 {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.5rem;
  color: var(--text);
}

.login-card .help {
  color: var(--text-secondary);
}

.login-card .btn-primary {
  padding: 0.75rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
}

/* --- Footer --- */
.site-footer {
  height: var(--footer-height);
  width: 100%;
  padding: 0 20px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.site-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--duration) var(--ease);
}

.site-footer a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.site-footer p {
  margin: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      'topbar'
      'content';
  }

  .sidebar {
    position: fixed;
    inset: 0 auto var(--footer-height) 0;
    width: var(--sidebar-width);
    z-index: 1040;
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease);
  }

  .app-shell.is-mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-slow) var(--ease);
  }

  .app-shell.is-mobile-menu-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    padding: 0 16px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .page-content,
  .content,
  .list-box,
  .container {
    padding: 1rem;
  }

  .page-content.page-content-list {
    min-height: auto;
  }

  .kpi-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    gap: 8px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions > * {
    flex: 1 1 auto;
  }

  th,
  .th,
  td,
  .td {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .topbar-left .app-breadcrumb {
    display: none;
  }

  .user-chip {
    display: none;
  }

  .login-card {
    padding: 28px 24px;
  }
}

@media (min-width: 992px) {
  .sidebar-backdrop {
    display: none;
  }

  .app-shell.is-collapsed .brand,
  .app-shell.is-collapsed .menu-item .label {
    display: none;
  }

  .app-shell.is-collapsed .menu-item {
    justify-content: center;
    padding: 10px;
  }

  .app-shell.is-collapsed .menu-item::before {
    left: -12px;
  }
}

@media (max-width: 1199.98px) {
  .page-content.page-content-list .row.g-2 > .col-xl-5,
  .page-content.page-content-list .row.g-2 > .col-xl-2,
  .page-content.page-content-list .row.g-2 > .col-xl-1 {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Bootstrap overrides for unified look
   ============================================================ */
.form-control {
  border-radius: var(--radius-md);
  border-color: var(--border);
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.625rem 0.875rem;
  transition: all var(--duration) var(--ease);
}

.form-control:hover {
  border-color: #cbd5e1;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.form-control-sm {
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  padding: 0.375rem 0.625rem;
}

.form-select {
  border-radius: var(--radius-md);
  border-color: var(--border);
  font-family: inherit;
  transition: all var(--duration) var(--ease);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.form-check-input {
  border-radius: 4px;
  transition: all var(--duration) var(--ease);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-check-input:focus {
  box-shadow: var(--shadow-glow);
  border-color: var(--primary);
}

/* Alerts */
.alert {
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-left: 4px solid var(--success);
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-left: 4px solid var(--warning);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-left: 4px solid var(--info);
}

/* Bootstrap buttons override */
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-secondary);
  font-weight: 600;
}

.btn-outline-secondary:hover {
  background: var(--bg);
  border-color: #cbd5e1;
  color: var(--text);
}

.btn-outline-danger {
  font-weight: 600;
}

.btn-outline-success {
  font-weight: 600;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.8125rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-muted);
}

.breadcrumb-item.active {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Bootstrap table override */
.table {
  --bs-table-hover-bg: rgba(99, 102, 241, 0.04);
  --bs-table-striped-bg: rgba(248, 250, 252, 0.8);
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--border-light);
}

/* Badge override */
.text-bg-info {
  background-color: var(--info-bg) !important;
  color: var(--info-text) !important;
}

/* ============================================================
   URL Display & Edit Modal
   ============================================================ */
.url-display {
  display: inline-block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Bootstrap modal overrides */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 1rem 1.5rem;
  gap: 0.5rem;
}

.modal-backdrop.show {
  backdrop-filter: blur(4px);
}
