/* =============================================================
   Netman — Application Styles
   ============================================================= */

:root {
  --se-primary:      #2563eb;
  --se-primary-dark: #1d4ed8;
  --se-bg:           #f1f5f9;
  --se-surface:      #ffffff;
  --se-nav-bg:       #0f172a;
  --se-border:       #e2e8f0;
  --se-text:         #0f172a;
  --se-text-muted:   #64748b;
  --se-danger:       #dc2626;
  --se-success:      #16a34a;
  --se-form-width:   760px;
}

/* ----- Base ----- */

body {
  background-color: var(--se-bg);
  color: var(--se-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.9375rem;
}

/* ----- App wrapper (flex column so footer sticks to bottom) ----- */

#app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app-content {
  flex: 1;
  padding: 1.5rem 0 2rem;
}

/* ----- Navbar ----- */

.se-navbar {
  background-color: var(--se-nav-bg) !important;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.se-navbar .navbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.se-navbar .navbar-brand:hover { color: #cbd5e1; }

.se-navbar .nav-link          { color: #94a3b8; font-size: 0.9rem; }
.se-navbar .nav-link:hover    { color: #fff; }
.se-navbar .nav-link.active   { color: #fff; }

.se-navbar .navbar-toggler {
  border-color: rgba(255,255,255,0.2);
}
.se-navbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.6%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.se-module-home-link > .nav-link {
  font-weight: 600;
  color: #e2e8f0;
  padding-right: 1rem;
  margin-right: 0.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}
.se-module-home-link > .nav-link:hover { color: #fff; }

.se-dev-badge {
  background: #f59e0b;
  color: #000;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.18em 0.55em;
  border-radius: 9999px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 0.25rem;
}

.se-navbar .dropdown-menu {
  background-color: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.se-navbar .dropdown-item        { color: #94a3b8; font-size: 0.875rem; }
.se-navbar .dropdown-item:hover  { background-color: #334155; color: #fff; }

.se-navbar .nav-user {
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 0.375rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.se-navbar .btn-logout {
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.15s;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.se-navbar .btn-logout:hover {
  color: #fff;
  border-color: #64748b;
  background-color: #1e293b;
}

/* ----- Breadcrumbs ----- */

.se-breadcrumb {
  margin-top: 0.75rem;
  margin-bottom: -0.25rem;
}

.se-breadcrumb .breadcrumb {
  font-size: 0.8rem;
  margin-bottom: 0;
  padding: 0;
  background: none;
}

.se-breadcrumb .breadcrumb-item a {
  color: var(--se-text-muted);
  text-decoration: none;
}
.se-breadcrumb .breadcrumb-item a:hover { color: var(--se-primary); text-decoration: underline; }
.se-breadcrumb .breadcrumb-item.active  { color: var(--se-text-muted); }
.se-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: #cbd5e1; }

/* ----- Page header (title + action buttons row) ----- */

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

.se-page-header h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--se-text);
}

/* ----- Cards ----- */

.se-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: 0.5rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ----- Sortable table headers ----- */

.se-table th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.se-table th[data-sort]::after {
  content: '\2195';
  margin-left: 0.35rem;
  opacity: 0.3;
  font-size: 0.75em;
}

.se-table th[data-sort].sort-asc::after  { content: '\2191'; opacity: 0.75; }
.se-table th[data-sort].sort-desc::after { content: '\2193'; opacity: 0.75; }

/* ----- Tables ----- */

.se-table-wrapper {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.se-table {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.se-table thead th {
  background-color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--se-text-muted);
  border-bottom: 1px solid var(--se-border);
  padding: 0.625rem 0.875rem;
  white-space: nowrap;
}

.se-table tbody td {
  padding: 0.625rem 0.875rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--se-border);
}

.se-table tbody tr:last-child td { border-bottom: none; }
.se-table tbody tr:hover         { background-color: #f8fafc; }

/* ----- Edit/action buttons in tables ----- */

.btn-icon {
  padding: 0.25rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1.2;
  border-radius: 0.375rem;
}

/* ----- Form layout ----- */

.se-form-card {
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 1.25rem;
  max-width: var(--se-form-width);
}

/* Escape hatch for forms that genuinely need full width (e.g. complex multi-column data entry) */
.se-form-card--wide { max-width: none; }

/* Standardised button footer inside se-form-card */
.se-form-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--se-border);
}

/* Destructive-action section rendered below the main form card */
.se-danger-zone {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--se-surface);
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  max-width: var(--se-form-width);
  margin-top: 1.5rem;
}

.se-danger-zone-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #dc2626;
  margin-bottom: 0.2rem;
}

/* Option row: checkbox/toggle + label + helper text, used for boolean settings */
.se-option-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.se-option-row .form-check {
  margin: 0;
  padding-top: 0.15rem;
  flex-shrink: 0;
}

.se-option-row-label {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.se-option-row-hint {
  font-size: 0.875em;
  color: #6c757d;
  line-height: 1.4;
}

/* Section divider inside forms (replaces .large) */
.se-section-header,
.heading_label_container label.large,
label.large {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--se-text-muted);
  background-color: #f8fafc;
  border: 1px solid var(--se-border);
  border-radius: 0.3rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
  height: auto !important;          /* override old inline height */
  vertical-align: unset !important;
}

.heading_label_container {
  padding: 0.25rem 0 !important;    /* tighten old padding */
}

/* Smaller label text on narrow columns */
label.small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.775rem;
  color: var(--se-text-muted);
}

.icon-complete { color: var(--se-success); }

/* ----- Badges ----- */

.se-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2em 0.55em;
  border-radius: 9999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.se-badge-success   { background: #dcfce7; color: #15803d; }
.se-badge-warning   { background: #fef9c3; color: #a16207; }
.se-badge-danger    { background: #fee2e2; color: #b91c1c; }
.se-badge-info      { background: #dbeafe; color: #1d4ed8; }
.se-badge-neutral,
.se-badge-secondary { background: #f1f5f9; color: #475569; }

/* ----- Alerts ----- */

.alert { border-radius: 0.5rem; font-size: 0.9rem; }

/* ----- Footer ----- */

.se-footer {
  background: var(--se-surface);
  border-top: 1px solid var(--se-border);
  padding: 0.875rem 0;
  font-size: 0.8rem;
  color: var(--se-text-muted);
}

.se-perm-panel {
  background: transparent;
  border: 1px dashed var(--se-border);
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--se-text-muted);
}

.se-perm-panel[open] {
  background: #f8fafc;
  border-style: solid;
  padding: 0.75rem 1rem;
  color: inherit;
}

.se-perm-panel > summary {
  list-style: none; /* hide native disclosure triangle in Firefox */
}

.se-perm-panel > summary::-webkit-details-marker {
  display: none; /* hide native disclosure triangle in WebKit/Chrome */
}

.se-perm-panel > summary::before {
  content: "\25B8"; /* right-pointing small triangle */
  display: inline-block;
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
}

.se-perm-panel[open] > summary::before {
  transform: rotate(90deg);
}

.se-perm-panel .list-group-item {
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
}

/* ----- Login page ----- */

.se-login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Permit-stamp photo layered under a near-opaque brand gradient so the
     image registers faintly without competing with the login form. */
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.88) 0%, rgba(30, 58, 95, 0.88) 100%),
    url('/assets/images/paw-permit-stamp.jpg') center / cover no-repeat,
    #0f172a;
  padding: 1.5rem;
}

.se-login-card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 370px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}

.se-login-card .se-logo-mark {
  text-align: center;
  margin-bottom: 0.5rem;
}

.se-login-card .se-logo-mark img {
  display: inline-block;
  width: 64px;
  height: 64px;
}

.se-login-card .se-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--se-primary);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
  text-align: center;
}

.se-login-card .se-tagline {
  font-size: 0.85rem;
  color: var(--se-text-muted);
  margin-bottom: 1.75rem;
  text-align: center;
}

/* ----- Home / module selector ----- */

.se-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.se-module-card {
  position: relative;
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.se-module-card:hover {
  border-color: var(--se-primary);
  box-shadow: 0 6px 20px rgba(37,99,235,0.1);
  transform: translateY(-2px);
}

.se-module-type {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.22em 0.65em;
  border-radius: 999px;
}

.se-module-type--built-in {
  background: #f1f5f9;
  color: #64748b;
}

.se-module-type--add-on {
  background: #eff6ff;
  color: var(--se-primary);
}

.se-module-card .se-module-icon {
  width: 3rem;
  height: 3rem;
  background: #eff6ff;
  color: var(--se-primary);
  border-radius: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  flex-shrink: 0;
}

.se-module-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--se-text);
}

.se-module-desc {
  font-size: 0.845rem;
  color: var(--se-text-muted);
  line-height: 1.55;
  flex: 1;
}

.se-module-footer {
  margin-top: 1rem;
}

/* ----- Error page ----- */

.se-error-page {
  text-align: center;
  padding: 3rem 1rem;
}

.se-error-page .se-error-icon {
  font-size: 3.5rem;
  color: var(--se-danger);
  margin-bottom: 1rem;
}

.se-error-page h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* ----- Dashboard stat cards ----- */

.se-stat-card {
  display: block;
  background: var(--se-surface);
  border: 1px solid var(--se-border);
  border-radius: 0.5rem;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  color: var(--se-text);
}
.se-stat-card:hover {
  border-color: var(--se-primary);
  box-shadow: 0 4px 14px rgba(37,99,235,0.1);
  transform: translateY(-1px);
  color: var(--se-text);
}

.se-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 0.875rem;
}
.se-stat-icon--blue  { background: #dbeafe; color: #2563eb; }
.se-stat-icon--green { background: #dcfce7; color: #16a34a; }
.se-stat-icon--cyan  { background: #cffafe; color: #0891b2; }
.se-stat-icon--teal  { background: #ccfbf1; color: #0f766e; }
.se-stat-icon--amber { background: #fef9c3; color: #a16207; }
.se-stat-icon--red   { background: #fee2e2; color: #b91c1c; }

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

.se-stat-primary {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--se-text);
  margin-bottom: 0.5rem;
}
.se-stat-primary span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--se-text-muted);
}

.se-stat-secondary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  min-height: 1.4rem;
}

/* ----- Dashboard card title ----- */

.se-card-title {
  font-size: 0.875rem;
  font-weight: 700;
  margin: 0;
  color: var(--se-text);
}

/* ----- Activity list ----- */

.se-activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.se-activity-list li {
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--se-border);
}
.se-activity-list li:last-child { border-bottom: none; }

.se-activity-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.se-activity-address {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--se-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.se-activity-address:hover { text-decoration: underline; }

.se-activity-time {
  font-size: 0.75rem;
  color: var(--se-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.se-activity-user {
  font-size: 0.78rem;
  color: var(--se-text-muted);
  margin-bottom: 0.1rem;
}

.se-activity-changes {
  font-size: 0.78rem;
  color: var(--se-text);
}

/* ----- Error page ----- */

.se-error-page p {
  color: var(--se-text-muted);
  margin-bottom: 1.5rem;
}

/* ----- Attachment panel ----- */

.se-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 130px);
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.se-attachment-thumb {
  position: relative;
  border-radius: 0.375rem;
  overflow: hidden;
  border: 1px solid var(--se-border);
  background: #f8fafc;
  cursor: pointer;
  display: block;
  text-decoration: none;
}

.se-attachment-thumb > a {
  display: block;
  text-decoration: none;
  color: inherit;
}

.se-thumb-delete-form {
  position: absolute;
  top: 0;
  right: 0;
  margin: 0;
  pointer-events: none;
}

.se-thumb-delete-form .se-thumb-delete {
  pointer-events: auto;
}

.se-attachment-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.se-attachment-thumb:hover .se-thumb-overlay {
  opacity: 1;
}

.se-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.se-thumb-overlay i {
  color: #fff;
  font-size: 1.4rem;
}

.se-thumb-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.2rem 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.se-attachment-thumb .se-thumb-delete {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  padding: 0;
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}

.se-attachment-thumb:hover .se-thumb-delete {
  opacity: 1;
}

.se-upload-area {
  border: 2px dashed var(--se-border);
  border-radius: 0.5rem;
  padding: 1.5rem 1rem;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
  cursor: pointer;
  background: #fafbfc;
}

.se-upload-area:hover,
.se-upload-area.se-drag-over {
  border-color: var(--se-primary);
  background: #eff6ff;
}

.se-upload-area input[type=file] {
  display: none;
}

.se-upload-progress {
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--se-text-muted);
  margin-top: 0.5rem;
}

.se-upload-progress.active { display: flex; }

/* ----- Docs reader ----- */

.se-docs-card {
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 2rem 2.5rem;
  max-width: 860px;
  margin-bottom: 1.5rem;
}

.se-docs-body {
  font-size: 1rem;
  line-height: 1.5;
  color: #1f2328;
  word-wrap: break-word;
}

.se-docs-body h1,
.se-docs-body h2,
.se-docs-body h3,
.se-docs-body h4,
.se-docs-body h5,
.se-docs-body h6 {
  font-weight: 600;
  line-height: 1.25;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: #1f2328;
}

.se-docs-body h1 { font-size: 2em; padding-bottom: 0.3em; border-bottom: 1px solid #d0d7de; }
.se-docs-body h2 { font-size: 1.5em; padding-bottom: 0.3em; border-bottom: 1px solid #d0d7de; }
.se-docs-body h3 { font-size: 1.25em; }
.se-docs-body h4 { font-size: 1em; }
.se-docs-body h5 { font-size: 0.875em; }
.se-docs-body h6 { font-size: 0.85em; color: #57606a; }

.se-docs-body p { margin-top: 0; margin-bottom: 1rem; }

.se-docs-body a { color: #0969da; text-decoration: none; }
.se-docs-body a:hover { text-decoration: underline; }

.se-docs-body ul,
.se-docs-body ol {
  padding-left: 2em;
  margin-top: 0;
  margin-bottom: 1rem;
}

.se-docs-body ul { list-style-type: disc; }
.se-docs-body ol { list-style-type: decimal; }
.se-docs-body li { margin-bottom: 0.25em; }
.se-docs-body li > ul,
.se-docs-body li > ol { margin-top: 0.25em; margin-bottom: 0; }

.se-docs-body code {
  background: rgba(175, 184, 193, 0.2);
  border-radius: 6px;
  padding: 0.2em 0.4em;
  font-size: 85%;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
  color: #1f2328;
}

.se-docs-body pre {
  background: #f6f8fa;
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-top: 0;
  margin-bottom: 1rem;
  line-height: 1.45;
}

.se-docs-body pre code {
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: 85%;
  color: #1f2328;
  white-space: pre;
}

.se-docs-body blockquote {
  border-left: 4px solid #d0d7de;
  padding: 0 1em;
  color: #57606a;
  margin: 0 0 1rem;
}

.se-docs-body blockquote > :first-child { margin-top: 0; }
.se-docs-body blockquote > :last-child  { margin-bottom: 0; }

.se-docs-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  display: block;
  overflow-x: auto;
}

.se-docs-body table th,
.se-docs-body table td {
  padding: 6px 13px;
  border: 1px solid #d0d7de;
  text-align: left;
  vertical-align: top;
}

.se-docs-body table th {
  font-weight: 600;
  background: #f6f8fa;
}

.se-docs-body table tbody tr:nth-child(even) { background: #f6f8fa; }

.se-docs-body hr {
  height: 0.25em;
  padding: 0;
  margin: 1.5rem 0;
  background-color: #d0d7de;
  border: 0;
}

.se-docs-body img { max-width: 100%; }

.se-docs-meta {
  font-size: 0.75rem;
  color: #57606a;
  padding-top: 0.75rem;
  border-top: 1px solid #d0d7de;
  margin-top: 0.5rem;
}

/* ── Sidebar layout ───────────────────────────────────────────────────────
   Opt-in per-module. A module's menu.php sets $menu_layout = 'sidebar' and
   declares $sidebar_groups; bs_header.php then adds .se-layout-sidebar to
   <body> and renders the <aside id="se-sidebar"> markup. The toggle button
   in the topbar flips .se-sidebar-collapsed on <html> (persisted via
   localStorage). Below 768px the sidebar becomes an offcanvas overlay
   triggered by .se-sidebar-mobile-open. */

:root {
    --se-sidebar-width: 240px;
    --se-sidebar-collapsed-width: 64px;
    /* Matches the rendered height of .se-navbar — used to push the
       sidebar below the topbar so the two never overlap. If the navbar
       padding / brand size ever changes, update this one place. */
    --se-navbar-height: 3.5rem;
}

body.se-layout-sidebar #app-content {
    margin-left: var(--se-sidebar-width);
    transition: margin-left 0.18s ease;
}

html.se-sidebar-collapsed body.se-layout-sidebar #app-content {
    margin-left: var(--se-sidebar-collapsed-width);
}

.se-sidebar {
    position: fixed;
    top: var(--se-navbar-height);
    bottom: 0;
    left: 0;
    width: var(--se-sidebar-width);
    background: #1e293b;
    color: #cbd5e1;
    z-index: 1020;          /* above content, below modals */
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.18s ease, transform 0.18s ease;
    box-shadow: 1px 0 2px rgba(0, 0, 0, 0.05);

    /* Subtle scrollbar — overlay-style, low-contrast on the dark
       background, brightens slightly on hover. Matches the pattern
       used by major admin UIs (GitHub, Linear, Vercel). */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
    transition: width 0.18s ease, transform 0.18s ease, scrollbar-color 0.15s ease;
}

.se-sidebar:hover {
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* WebKit / Blink (Chrome, Safari, Edge) — Firefox uses the standard
   scrollbar-color properties above. */
.se-sidebar::-webkit-scrollbar {
    width: 6px;
}

.se-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.se-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.se-sidebar:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

.se-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

html.se-sidebar-collapsed .se-sidebar {
    width: var(--se-sidebar-collapsed-width);
}

.se-sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--se-navbar-height));
}

.se-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid #334155;
    white-space: nowrap;
}

.se-sidebar-brand:hover {
    color: #fff;
    background: #273449;
}

.se-sidebar-brand i {
    font-size: 1.15rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.se-sidebar-nav {
    flex-grow: 1;
    padding: 0.5rem 0;
}

.se-sidebar-group + .se-sidebar-group {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #273449;
}

.se-sidebar-group-label {
    padding: 0.375rem 1rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    white-space: nowrap;
}

.se-sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.se-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    white-space: nowrap;
}

.se-sidebar-link:hover {
    color: #fff;
    background: #273449;
}

.se-sidebar-link.is-active {
    color: #fff;
    background: #273449;
    border-left-color: #3b82f6;
}

.se-sidebar-link i {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

.se-sidebar-collapse-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: #64748b;
    background: transparent;
    border: none;
    border-top: 1px solid #273449;
    font-size: 0.8rem;
    text-align: left;
    width: 100%;
    cursor: pointer;
}

.se-sidebar-collapse-btn:hover { color: #cbd5e1; background: #273449; }

.se-sidebar-collapse-btn i {
    font-size: 1rem;
    flex-shrink: 0;
    width: 1.25rem;
    text-align: center;
}

/* Collapsed state — hide labels, center icons. The label remains in
   the DOM for screen readers; the title attribute on links handles the
   tooltip on hover for sighted users. */
html.se-sidebar-collapsed .se-sidebar-label {
    display: none;
}

html.se-sidebar-collapsed .se-sidebar-group-label {
    visibility: hidden;
    height: 0;
    padding: 0;
    margin: 0;
}

html.se-sidebar-collapsed .se-sidebar-brand,
html.se-sidebar-collapsed .se-sidebar-link,
html.se-sidebar-collapsed .se-sidebar-collapse-btn {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

html.se-sidebar-collapsed .se-sidebar-link {
    border-left-width: 0;
    border-right: 3px solid transparent;
}

html.se-sidebar-collapsed .se-sidebar-link.is-active {
    border-right-color: #3b82f6;
}

/* Topbar toggle button styling — matches the dark navbar. */
.se-navbar .se-sidebar-toggle {
    color: #cbd5e1;
    font-size: 1.25rem;
    line-height: 1;
}

.se-navbar .se-sidebar-toggle:hover { color: #fff; }

/* Mobile: sidebar becomes an off-canvas overlay. The collapse-button
   hint at the bottom is hidden — mobile users don't need it. */
@media (max-width: 767.98px) {
    body.se-layout-sidebar #app-content { margin-left: 0; }

    .se-sidebar {
        width: var(--se-sidebar-width);
        transform: translateX(-100%);
    }

    html.se-sidebar-mobile-open .se-sidebar { transform: translateX(0); }

    html.se-sidebar-mobile-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1015;          /* below sidebar, above content */
    }

    .se-sidebar-collapse-btn { display: none; }

    /* On mobile, ignore the collapsed state so the overlay always shows
       full labels. */
    html.se-sidebar-collapsed .se-sidebar-label { display: inline; }
    html.se-sidebar-collapsed .se-sidebar-group-label {
        visibility: visible;
        height: auto;
        padding: 0.375rem 1rem 0.25rem;
    }
    html.se-sidebar-collapsed .se-sidebar-brand,
    html.se-sidebar-collapsed .se-sidebar-link,
    html.se-sidebar-collapsed .se-sidebar-collapse-btn {
        justify-content: flex-start;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ── Questions waiting badge ─────────────────────────────────────────
   Topbar affordance for the staging-only user-questions feature.
   Renders only when there's an unanswered question targeted at the
   signed-in user, so its presence itself is the cue. */

.se-questions-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.6rem;
    color: #cbd5e1;
    background: transparent;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.875rem;
    line-height: 1;
    transition: color 0.12s ease, background 0.12s ease;
}

.se-questions-badge:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.se-questions-badge i {
    font-size: 1rem;
}

.se-questions-badge .badge {
    font-size: 0.72rem;
}
