@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  color-scheme: light;
  --bg-dark: #f5f7fb;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fbff;
  --bg-sidebar: #061526;
  --bg-sidebar-soft: #0b2138;
  --border-color: #e4e9f2;
  --border-color-hover: #c8d4e5;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  /* Status Colors */
  --color-approved: #10b981;
  --color-pending: #f59e0b;
  --color-rejected: #ef4444;
  --color-progress: #3b82f6;
  --color-correction: #f97316;
  --color-resubmitted: #a855f7;
  
  --color-brand: #005bea;
  --color-brand-hover: #0047b8;
  --color-brand-glow: rgba(0, 91, 234, 0.15);
  
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.14);
}

body {
  background:
    radial-gradient(circle at top left, rgba(0, 91, 234, 0.06), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  letter-spacing: -0.011em;
}

h1, h2, h3, h4, h5, h6, .sidebar-brand {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #eef3f9;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: var(--shadow-md);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

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

.sidebar {
  width: 260px;
  background:
    radial-gradient(circle at top left, rgba(0, 91, 234, 0.28), transparent 18rem),
    linear-gradient(180deg, var(--bg-sidebar) 0%, #03101e 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1.5rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  color: #ffffff;
  margin-bottom: 0.8rem;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  column-gap: 0.7rem;
  line-height: 1;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, #005bea, #2f80ed);
  box-shadow: 0 10px 24px rgba(0, 91, 234, 0.35);
  font-weight: 900;
}

.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.sidebar-brand-name {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
}

.sidebar-brand small {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  color: #9fb4cc;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.siteos-context-platform .sidebar {
  background:
    radial-gradient(circle at top left, rgba(124, 58, 237, 0.26), transparent 18rem),
    linear-gradient(180deg, #130b2d 0%, #070515 100%);
}

.siteos-context-platform .sidebar-brand-mark,
.siteos-context-platform .sidebar-link.active {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

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

.sidebar-navigation {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.sidebar-mobile-toggle {
  display: none;
}

/* A permanent item outside the collapsible groups (Data Books for the responsible company). */
.sidebar-pinned {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar-pinned-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(47, 128, 237, 0.55);
  background: rgba(47, 128, 237, 0.18);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar-pinned-link:hover,
.sidebar-pinned-link.active {
  background: linear-gradient(135deg, #005bea, #2f80ed);
}

.sidebar-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.sidebar-group + .sidebar-group {
  margin-top: 0.35rem;
}

.sidebar-group-toggle {
  list-style: none;
  cursor: pointer;
  color: #d9e6f5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.sidebar-group-toggle::-webkit-details-marker {
  display: none;
}

.sidebar-group-chevron {
  color: #9fb4cc;
  transition: transform 0.18s ease;
}

.sidebar-group[open] .sidebar-group-chevron {
  transform: rotate(180deg);
}

.sidebar-group-links {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0 0.45rem 0.5rem;
}

.sidebar-group-label {
  color: #d9e6f5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 0.85rem 0.2rem;
}

.sidebar-link {
  color: #cbd7e5;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.72rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid transparent;
}

.sidebar-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, #005bea, #0d6efd);
  border-color: rgba(255, 255, 255, 0.16);
  font-weight: 600;
  box-shadow: 0 10px 22px rgba(0, 91, 234, 0.28);
}

.sidebar-logout {
  color: #f87171;
}

.top-context {
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-muted);
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  margin-bottom: 1.25rem;
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.top-context-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.top-context-main {
  font-size: 0.83rem;
  color: var(--text-main);
  font-weight: 700;
}

.top-context-link {
  margin-left: auto;
  color: var(--color-brand);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 700;
}

.text-link {
  color: var(--color-brand);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.text-link:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

.section-block {
  margin-bottom: 1.5rem;
}

.section-heading {
  margin: 0 0 0.85rem;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-main);
}

.section-heading p {
  margin: 0.25rem 0 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.context-chip {
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.main-content {
  flex-grow: 1;
  padding: 1.65rem 2.25rem;
  overflow-y: auto;
  min-width: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
}

/* Card & Panels */
.card-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.35rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card-panel:hover {
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-md);
}

.panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

/* Responsive Table Wrapper */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 0.78rem 1rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

th {
  font-weight: 600;
  color: var(--text-muted);
  background-color: #f8fafc;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

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

tr:hover td {
  background-color: #f8fbff;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-approved { background-color: #e9f9f1; color: #169a5a; border-color: #bfeacc; }
.badge-pending { background-color: #fff6df; color: #b77905; border-color: #ffe3a3; }
.badge-correction { background-color: #fff0e7; color: #c75c12; border-color: #ffd3ba; }
.badge-rejected { background-color: #fff0f0; color: #d92d20; border-color: #ffc9c9; }
.badge-resubmitted { background-color: #f3ecff; color: #7048e8; border-color: #d9c7ff; }
.badge-progress { background-color: #eaf3ff; color: #005bea; border-color: #bfdbfe; }
.badge-draft { background-color: #f1f5f9; color: #475569; border-color: #dbe3ed; }
.badge-overdue { background-color: #fff0f0; color: #d92d20; border-color: #ffc9c9; }
.badge-complete, .badge-closed, .badge-signed { background-color: #e9f9f1; color: #169a5a; border-color: #bfeacc; }
.badge-unsigned { background-color: #f1f5f9; color: #475569; border-color: #dbe3ed; }
.badge-blocker { background-color: #fff0f0; color: #d92d20; border-color: #ffc9c9; }
.badge-review { background-color: #fff6df; color: #b77905; border-color: #ffe3a3; }

.badge-status-ready { background-color: rgba(16, 185, 129, 0.1); color: #34d399; border-color: rgba(16, 185, 129, 0.2); }
.badge-status-progress { background-color: rgba(59, 130, 246, 0.1); color: #60a5fa; border-color: rgba(59, 130, 246, 0.2); }
.badge-status-risk { background-color: rgba(239, 68, 68, 0.1); color: #f87171; border-color: rgba(239, 68, 68, 0.2); }
.badge-status-notstarted { background-color: rgba(148, 163, 184, 0.1); color: #94a3b8; border-color: rgba(148, 163, 184, 0.2); }

.badge-level-high { background-color: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.25); }
.badge-level-medium { background-color: rgba(249, 115, 22, 0.15); color: #ff9d43; border-color: rgba(249, 115, 22, 0.25); }
.badge-level-low { background-color: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.25); }

/* KPI Cards Layout */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-sm);
}

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

.kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.kpi-val {
  font-size: 1.85rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
}

.border-total { border-top: 3px solid #64748b; }
.border-approved { border-top: 3px solid var(--color-approved); }
.border-pending { border-top: 3px solid var(--color-pending); }
.border-correction { border-top: 3px solid var(--color-correction); }
.border-rejected { border-top: 3px solid var(--color-rejected); }
.border-resubmitted { border-top: 3px solid var(--color-resubmitted); }
.border-progress { border-top: 3px solid var(--color-progress); }
.border-overdue { border-top: 3px solid #ef4444; background-color: #ffffff; }

/* Buttons */
.btn-submit {
  background-color: var(--color-brand);
  color: white;
  border: none;
  padding: 0.625rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.875rem;
  box-shadow: 0 8px 18px rgba(0, 91, 234, 0.2);
}

.btn-submit:hover {
  background-color: var(--color-brand-hover);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.btn-submit:active {
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  height: 40px;
  border-radius: 8px;
  padding: 0 1.25rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--border-color-hover);
  background-color: #f8fbff;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 3px;
}

.sidebar-link,
.sidebar-brand,
.text-link,
.top-context-link,
.btn-submit,
.btn-secondary,
button,
summary {
  min-height: 44px;
}

.text-link,
.top-context-link,
.table-wrapper a,
.table-wrapper button {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
}

.page-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-eyebrow {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

.page-title {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  max-width: 760px;
  line-height: 1.55;
}

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

.data-book-mobile-actions {
  display: none;
}

.table-actions .btn-secondary,
.table-actions .btn-submit {
  height: 30px;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}

/* Detail Grids */
.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
}

@media (max-width: 1300px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
}

.photo-item {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background-color: #f8fafc;
  transition: border-color 0.2s;
}

.photo-item:hover {
  border-color: var(--border-color-hover);
}

.photo-item img {
  width: 100%;
  height: 155px;
  object-fit: cover;
  display: block;
}

.photo-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.625rem;
  text-align: center;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
}

.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--color-brand);
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

.progress-bar-wrapper {
  background-color: #e2e8f0;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
  max-width: 120px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.progress-bar-fill {
  background-color: var(--color-brand);
  height: 100%;
  border-radius: 999px;
}

.progress-bar-fill.ready { background-color: var(--color-approved); }
.progress-bar-fill.risk { background-color: var(--color-rejected); }

/* Login */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(0, 91, 234, 0.1), transparent 28rem),
    linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}

/* Empty State Styling */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-state-text {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Alert Banner styling */
.alert-banner {
  background-color: #fff8e6;
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #9a6700;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.legacy-notice {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(15, 23, 42, 0.02));
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.legacy-notice__label {
  color: var(--color-brand);
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 0.25rem;
}

.legacy-notice__body {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 760px;
}

.legacy-notice__actions {
  flex-shrink: 0;
}

/* Generic Input & Filter Control Styling */
input,
select,
textarea,
.filter-control {
  background-color: #ffffff !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
  font-family: inherit !important;
  font-size: 0.9rem !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  box-sizing: border-box !important;
}

input:focus,
select:focus,
textarea:focus,
.filter-control:focus {
  border-color: var(--color-brand) !important;
  box-shadow: 0 0 0 2px var(--color-brand-glow) !important;
}

input::placeholder,
textarea::placeholder,
.filter-control::placeholder {
  color: var(--text-muted) !important;
}

/* Style date picker indicator to be visible on dark bg */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: none;
  cursor: pointer;
}

/* Align filter-bar nicely */
.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.filter-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

@media (max-width: 980px) {
  .layout-wrapper {
    flex-direction: column;
  }
  .sidebar {
    width: auto;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0.8rem 1rem;
    gap: 0.75rem;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar-brand {
    margin-bottom: 0;
  }
  .sidebar-pinned {
    flex-direction: row;
    margin-left: auto;
  }
  .sidebar-pinned-link {
    padding: 0.65rem 0.8rem;
    font-size: 0.78rem;
  }
  .sidebar-navigation {
    display: block;
    flex: 0 0 auto;
    position: relative;
  }
  .sidebar-mobile-toggle {
    min-width: 132px;
    padding: 0.65rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
  }
  .sidebar-mobile-toggle::-webkit-details-marker {
    display: none;
  }
  .sidebar-menu {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    width: min(720px, calc(100vw - 2rem));
    max-height: calc(100vh - 84px);
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: #061526;
    box-shadow: 0 18px 44px rgba(2, 8, 23, 0.42);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
  .sidebar-group {
    min-width: 0;
  }
  .sidebar-link {
    padding: 0.55rem 0.7rem;
  }
  .main-content {
    padding: 1.25rem;
  }
  .top-context-link {
    margin-left: 0;
  }
  .page-header {
    align-items: stretch;
  }
  .page-actions {
    width: 100%;
  }
}

/* On a narrow screen the brand keeps its mark and gives its words up to the Data Books item. */
@media (max-width: 600px) {
  .sidebar:has(.sidebar-pinned) .sidebar-brand-copy {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 0;
  }
  .layout-wrapper {
    display: block;
  }
  .sidebar {
    min-height: 64px;
    padding: 0.85rem 1rem;
  }
  .sidebar-brand {
    margin-bottom: 0;
  }
  .sidebar-menu {
    position: absolute;
    left: auto;
    right: 0;
    bottom: auto;
    grid-template-columns: 1fr;
    width: min(320px, calc(100vw - 1.5rem));
    max-height: calc(100vh - 78px);
    padding: 0.6rem;
    overflow-y: auto;
  }
  .sidebar-group {
    min-width: 0;
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.035);
  }
  .sidebar-group-toggle,
  .sidebar-group-label {
    color: #d9e6f5;
    font-size: 0.75rem;
    padding: 0.5rem 0.55rem;
  }
  .sidebar-group-links {
    padding: 0 0.3rem 0.35rem;
  }
  .sidebar-link {
    color: #cbd7e5;
    justify-content: flex-start;
    text-align: left;
    font-size: 0.875rem;
    padding: 0.65rem 0.6rem;
    border-radius: 12px;
    line-height: 1.15;
  }
  .sidebar-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
  }
  .sidebar-link.active {
    color: #ffffff;
    box-shadow: none;
  }
  .top-context {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-top: 0.25rem;
  }
  .top-context > * {
    min-width: 0;
  }
  .top-context-main {
    overflow-wrap: anywhere;
  }
  .top-context-link {
    grid-column: 1 / -1;
  }
  .page-actions {
    display: flex;
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.65rem;
    padding-bottom: 0.35rem;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  .page-actions > * {
    flex: 0 0 auto;
  }
  .page-actions .btn-submit,
  .page-actions .btn-secondary,
  .page-actions button {
    width: auto;
  }
  .data-book-mobile-actions {
    display: none;
  }
  .data-book-mobile-actions .btn-submit,
  .data-book-mobile-actions .btn-secondary {
    width: auto;
  }
  .kpis-grid {
    grid-template-columns: 1fr;
  }
  .card-panel {
    padding: 1rem;
  }
  th, td {
    padding: 0.7rem 0.85rem;
  }
  .btn-submit,
  .btn-secondary {
    width: 100%;
    justify-content: center;
  }
  .table-actions .btn-submit,
  .table-actions .btn-secondary {
    width: auto;
  }
  .filter-bar {
    grid-template-columns: 1fr !important;
  }
  .page-title {
    font-size: 1.65rem;
  }
}


/* Print optimization */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }
  .sidebar, .nav-header, .flash-messages, .btn, .btn-submit, .btn-secondary, form, #date-picker-form, header div:last-child {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .card-panel {
    background-color: white !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  table, th, td {
    border: 1px solid #ddd !important;
    color: black !important;
  }
  th {
    background-color: #f2f2f2 !important;
  }
}

