:root {
  --navy: #243b55;
  --navy-2: #1b2c3e;
  --warm-gray: #8a817c;
  --warm-gray-2: #d9d4cf;
  --sage: #8aa399;
  --sage-2: #c7d4cf;
  --secondary: #46C6CE;
  --bg: #eaf6fb;
  --panel: #ffffff;
  --text: #1d2733;
  --muted: #6f6a66;
  --line: #e4dfda;
  --success: #dff4e8;
  --error: #f8d7da;
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  padding: 0
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, var(--bg), #eef2ef);
  color: var(--text)
}

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

.sidebar {
  width: 290px;
  background: linear-gradient(135deg, #194376, #0d2f57);
  color: #fff;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  min-height: 100vh;
  transition: width 0.3s ease, padding 0.3s ease;
  overflow-x: hidden;
  z-index: 1000
}

.sidebar.collapsed {
  width: 80px;
  padding: 22px 12px;
}

.content {
  flex: 1;
  padding: 28px;
  transition: margin-left 0.3s ease;
}

.brand-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  transition: opacity 0.2s ease;
  white-space: nowrap;
}

.sidebar.collapsed .brand-header>div {
  display: none;
}

.sidebar.collapsed .brand-logo {
  width: 44px;
  height: 44px;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  object-fit: cover;
  background: #fff;
  padding: 4px
}

.sidebar h2 {
  margin: 0
}

.sidebar-caption {
  margin: 4px 0 16px;
  color: #d8e2e8;
  font-size: .92rem
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  padding: 12px 14px;
  margin: 7px 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08)
}

.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-group summary,
.sidebar.collapsed .sidebar-group-links {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  justify-content: center;
  padding: 12px 0;
}

.sidebar.collapsed nav a {
  padding: 12px;
  justify-content: center;
}

.sidebar.collapsed .sidebar-group {
  margin-bottom: 10px;
}

.sidebar.collapsed .sidebar-group summary::after {
  display: none;
}

.sidebar-group summary {
  cursor: pointer;
  padding: 10px 14px;
  list-style: none;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-group summary::after {
  content: '›';
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  color: rgba(255, 255, 255, 0.5);
  transform: rotate(0deg);
  transition: transform 0.22s ease, color 0.2s ease;
  display: inline-block;
}

.sidebar-group[open]>summary::after {
  transform: rotate(90deg);
  color: rgba(255, 255, 255, 0.9);
}

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

.card,
.login-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 12px 30px rgba(36, 59, 85, .08);
  margin-bottom: 20px;
  border: 1px solid var(--line)
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #194376, #0d2f57);
  color: #fff
}

.login-shell {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 20px
}

.branded-login {
  max-width: 520px;
  width: 100%
}

.login-brand {
  text-align: center;
  margin-bottom: 14px
}

.login-logo {
  width: 110px;
  height: 110px;
  border-radius: 22px;
  object-fit: cover;
  border: 4px solid var(--sage-2);
  background: #fff
}

label {
  display: block;
  font-weight: 600;
  margin: 10px 0 6px
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cfc7c2;
  border-radius: 12px;
  background: white
}

button,
.button,
.button-link {
  background: linear-gradient(135deg, var(--navy), var(--sage));
  color: white;
  border: none;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 12px;
  width: auto
}

.button.secondary {
  background: var(--warm-gray-2);
  color: var(--text)
}

.button.danger {
  background: #b94747;
  color: white
}

.button.small {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .9rem
}

textarea {
  min-height: 110px
}

.muted {
  color: var(--muted)
}

.small-note {
  font-size: .9rem
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 18px
}

.alert.success {
  background: var(--success);
  color: #1f5132
}

.alert.error {
  background: var(--error);
  color: #7a2630
}

.stats-grid,
.grid-2 {
  display: grid;
  gap: 18px
}

.stats-grid {
  grid-template-columns: repeat(4, 1fr)
}

.admin-cards {
  grid-template-columns: repeat(3, 1fr)
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr)
}

.stat p {
  font-size: 2rem;
  font-weight: 700;
  margin: 0
}

.toolbar,
.quick-links,
.toolbar-inline,
.inline-form,
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px
}

.inline-form,
.search-bar {
  min-width: 0;
}

.inline-form > *,
.inline-form input,
.inline-form select,
.inline-form textarea,
.inline-form button,
.search-bar input,
.search-bar button {
  min-width: 0;
  max-width: 100%;
}

.inline-form input,
.inline-form select,
.inline-form textarea,
.inline-form button {
  flex: 1 1 100%;
}

.search-bar input {
  flex: 1
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 16px;
  overflow: hidden
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e5e1dd;
  text-align: left;
  vertical-align: top
}

th {
  background: #eef1f2;
  font-size: .92rem
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px
}

.form-grid button {
  grid-column: span 2
}

.actions {
  white-space: nowrap
}

.badge {
  display: inline-block;
  padding: 6px 10px;
  background: #eef5f2;
  color: var(--navy);
  border-radius: 999px;
  font-size: .85rem
}

.placeholder-preview {
  border: 2px dashed #c9d4d0;
  padding: 24px;
  border-radius: 14px;
  color: var(--muted);
  background: #f7faf8
}

/* Plain-text preview: dark background, light text */
.text-preview {
  max-height: 480px;
  overflow: auto;
  background: #233142;
  color: #000000;
  padding: 16px;
  border-radius: 14px;
  white-space: pre-wrap
}

/* Office previews (DOCX/XLSX/PPTX): white background, dark text */
.office-preview {
  max-height: 480px;
  overflow: auto;
  background: #fff;
  color: #1d2733;
  padding: 16px;
  border-radius: 14px
}

.notice {
  padding: 10px;
  background: #eef5f2;
  border-left: 4px solid var(--sage)
}

.clean-list {
  margin: 0;
  padding-left: 18px
}

@media (max-width:1100px) {

  .stats-grid,
  .admin-cards {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media (max-width:900px) {
  .sidebar {
    width: 100%;
    position: relative;
    min-height: auto
  }

  .wrapper {
    flex-direction: column
  }

  .stats-grid,
  .grid-2,
  .admin-cards,
  .form-grid {
    grid-template-columns: 1fr
  }

  .form-grid button {
    grid-column: span 1
  }
}


.permission-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 10px
}

.permission-group {
  border: 1px solid #bfc5ba;
  background: #f4f1eb;
  border-radius: 12px;
  padding: 14px
}

.permission-group h3 {
  margin: 0 0 10px 0;
  color: #1f3a5f
}

.perm-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid #d8d3cb
}

.perm-item:last-child {
  border-bottom: none
}

.perm-item small {
  color: #6f746d
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap
}

.notice {
  padding: 12px;
  border-radius: 10px;
  background: #eef3ef;
  border: 1px solid #b8c7b3;
  color: #2e3d34
}

.preview-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px
}

.preview-toolbar button {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #9aa59f;
  background: #f2f0eb;
  cursor: pointer
}

.office-preview {
  background: #fff;
  color: #1d2733;
  border: 1px solid #d7d3cb;
  border-radius: 12px;
  padding: 16px;
  min-height: 280px;
  overflow: auto
}

.office-docx p {
  margin: 0 0 12px 0;
  line-height: 1.5
}

.table-scroll {
  overflow: auto
}

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

.sheet-table th,
.sheet-table td {
  border: 1px solid #d7d3cb;
  padding: 8px;
  vertical-align: top
}

.slide-card {
  border: 1px solid #d7d3cb;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: #faf9f6
}

/* Fullscreen modal overlay animations */
@keyframes rnFsBackdrop {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes rnFsSlide {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wrap-off {
  white-space: pre;
  overflow: auto
}


.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 18px
}

.topbar-spacer {
  flex: 1
}

.user-menu {
  position: relative;
  min-width: 280px
}

.user-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 8px 18px rgba(36, 59, 85, .06)
}

.user-menu summary::-webkit-details-marker {
  display: none
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--sage));
  color: #fff;
  font-weight: 700
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0
}

.user-meta strong,
.user-meta small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis
}

.user-meta small {
  color: var(--muted)
}

.user-caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 1rem
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 32px rgba(27, 44, 62, .14);
  padding: 10px;
  z-index: 50
}

.user-menu-profile {
  padding: 10px 10px 12px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px
}

.user-menu-panel a {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text)
}

.user-menu-panel a:hover {
  background: #f2f5f4
}

.user-menu-panel .danger-link {
  color: #8f2d3c
}

.user-menu-panel .danger-link:hover {
  background: #fbe7ea
}

@media (max-width:900px) {
  .topbar {
    justify-content: stretch
  }

  .user-menu {
    width: 100%;
    min-width: 0
  }
}

.grid-doc-view {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(540px, 1.7fr);
  gap: 18px
}

.user-photo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--navy)
}

.alerts-menu {
  position: relative;
  margin-right: 12px
}

.alerts-menu summary {
  list-style: none;
  cursor: pointer;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px
}

.alerts-menu summary::-webkit-details-marker {
  display: none
}

.alert-count {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .8rem
}

.alerts-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 32px rgba(27, 44, 62, .14);
  padding: 12px;
  z-index: 60
}

.alert-item {
  display: block;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text)
}

.alert-item:hover {
  background: #f2f5f4
}

.grid-communications {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px
}

.message-tile {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px
}

.message-tile.unread {
  border-left: 5px solid var(--sage)
}

.comment-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f6;
  margin-bottom: 10px
}

.profile-preview img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover
}

.mini-chart-row {
  display: grid;
  grid-template-columns: 180px 1fr 56px;
  gap: 10px;
  align-items: center;
  margin: 8px 0
}

.mini-chart-bar-wrap {
  background: #edf1f0;
  border-radius: 999px;
  height: 14px;
  overflow: hidden
}

.mini-chart-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--navy), var(--sage))
}

@media (max-width:900px) {

  .grid-doc-view,
  .grid-communications {
    grid-template-columns: 1fr
  }

  .alerts-panel {
    width: min(320px, 90vw)
  }
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  color: var(--muted)
}

.tree-code {
  font-family: monospace
}

.chat-popup {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: min(360px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(27, 44, 62, .18);
  z-index: 9998;
  overflow: hidden
}

.chat-popup.minimized .chat-popup-body {
  display: none
}

.chat-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--navy), var(--sage));
  color: #fff
}

.chat-popup-header button {
  width: auto;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .15);
  border: 0;
  color: #fff
}

.chat-popup-body {
  padding: 12px
}

.chat-popup-thread {
  max-height: 140px;
  overflow: auto;
  margin: 8px 0 12px
}

.chat-reply-form textarea {
  min-height: 70px
}

.chat-popup-footer {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px
}

.break-long {
  overflow-wrap: anywhere;
  word-break: break-word
}

.doc-meta-card,
.doc-preview-card {
  min-width: 0
}

.preview-frame,
.comment-box,
.small-note,
td,
th,
p,
div {
  min-width: 0
}

.grid-doc-view .card {
  overflow: hidden
}

.grid-doc-view table {
  table-layout: fixed
}

.grid-doc-view td,
.grid-doc-view th {
  overflow-wrap: anywhere
}


/* v16 fixes */
.table-scroll {
  overflow: auto;
  max-width: 100%
}

.break-long {
  word-break: break-word;
  overflow-wrap: anywhere
}

.preview-frame {
  min-height: 560px;
  overflow: auto;
  color: #000000 !important;
  background: var(--panel)
}

.preview-frame * {
  color: #000000 !important
}

.doc-meta-card,
.doc-preview-card,
.comment-box,
.small-note,
table td {
  overflow-wrap: anywhere;
  word-break: break-word
}

.responsive-table td,
.responsive-table th {
  vertical-align: top;
  max-width: 240px
}

.suggestions {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1)
}

.suggestions div {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0
}

.suggestions div:hover,
.suggestions div.selected {
  background: #f9f9f9
}

.suggestions div:last-child {
  border-bottom: none
}

/* Website visual sync - RecordNest styles (imported from site stylesheet)
   Adds hero, brand and accent styles so the app matches the website look */
.page-header {
  background: linear-gradient(rgba(25, 67, 118, .82), rgba(25, 67, 118, .82)), url('../img/carousel-1.jpg') center center/cover no-repeat;
  padding: 120px 0 70px;
  color: #fff;
}

.brand-text {
  font-weight: 800;
  letter-spacing: 0.5px
}

.top-contact a {
  color: #fff
}

.service-card p {
  font-size: 0.95rem;
  margin-top: 12px
}

.contact-card {
  min-height: 120px
}

.feature-box {
  border-left: 4px solid var(--sage)
}

.mission-strip {
  background: linear-gradient(135deg, #194376, #0d2f57);
  color: #fff;
  padding: 16px;
  border-radius: 10px
}

.cta-strip {
  background: linear-gradient(135deg, rgba(25, 67, 118, 1), rgba(70, 198, 206, 0.95));
  color: #fff;
  padding: 14px;
  border-radius: 10px
}

.footer-link {
  color: rgba(255, 255, 255, .8)
}

.footer-link:hover {
  color: #fff;
  text-decoration: none
}

.carousel-caption {
  background: rgba(10, 22, 40, .18);
  padding: 12px;
  border-radius: 8px
}

@media (max-width: 991.98px) {
  .brand-logo {
    height: 46px;
  }
}

/* Button theming - match website primary/secondary/utility colors */
/* Applied with higher specificity under .wrapper to override defaults */
.wrapper button,
.wrapper .button,
.wrapper .button-link,
.wrapper .btn,
.wrapper input[type="submit"],
.wrapper .button-link {
  background: linear-gradient(135deg, #194376 0%, #46C6CE 100%);
  color: #ffffff;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(25, 67, 118, 0.12);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  display: inline-block;
}

.wrapper button:hover,
.wrapper .button:hover,
.wrapper .btn:hover,
.wrapper .button-link:hover,
.wrapper input[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(25, 67, 118, 0.16);
  opacity: 0.96;
}

/* Secondary / neutral variant */
.wrapper .button.secondary,
.wrapper .btn-secondary {
  background: linear-gradient(135deg, var(--warm-gray-2) 0%, #f4f1eb 100%);
  color: var(--text);
  border: 1px solid rgba(27, 44, 62, 0.06);
}

/* Danger variant */
.wrapper .button.danger,
.wrapper .btn-danger {
  background: linear-gradient(135deg, #b94747 0%, #8f2d3c 100%);
  color: #fff;
}

/* Small sizing */
.wrapper .button.small,
.wrapper .btn-sm {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: .9rem;
}

/* Preserve link-style buttons while providing hover affordance */
.wrapper .button-link {
  background: transparent;
  border: 1px solid transparent;
  padding: 8px 10px;
}

/* Ensure inputs with button role also match */
.wrapper input[type="submit"],
.wrapper input[type="button"] {
  cursor: pointer;
}

/* Overrides to ensure app logo and login visuals use site navy */
.login-logo {
  border-color: var(--navy) !important;
}

.login-page {
  background: linear-gradient(135deg, #194376, #0d2f57);
  color: #fff;
}

/* Panel / Card visual sync - match website panels */
.card,
.login-card,
.doc-meta-card,
.doc-preview-card,
.message-tile,
.slide-card {
  background: linear-gradient(180deg, #ffffff 0%, #f4fbfd 100%);
  border: 1px solid rgba(27, 44, 62, 0.06);
  box-shadow: 0 14px 36px rgba(25, 67, 118, 0.06);
  border-radius: 18px;
  transition: transform .12s ease, box-shadow .15s ease, border-color .12s ease;
}

.card:hover,
.login-card:hover,
.message-tile:hover,
.slide-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 48px rgba(25, 67, 118, 0.10);
}

/* Optional header styling inside cards */
.card .card-header,
.panel-header {
  background: linear-gradient(90deg, var(--navy), var(--navy-2));
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px 12px 0 0;
  margin: -22px -22px 12px;
}

.card h3,
.card .title {
  color: var(--navy);
  margin: 0;
  font-weight: 700;
}

/* Muted/light panels for secondary information */
.panel-muted {
  background: linear-gradient(180deg, #fbfeff, #f7fbfb);
  border-color: rgba(36, 59, 85, 0.04);
}

/* Ensure small panels keep consistent padding and radius */
.doc-preview-card,
.doc-meta-card {
  padding: 16px;
  border-radius: 14px;
}

/* Login form CTA gradient (applies the requested cta-strip gradient to the login form) */
.branded-login,
.login-card,
.branded-login .card {
  background: linear-gradient(135deg, rgba(25, 67, 118, 1), rgba(70, 198, 206, 0.95));
  color: #ffffff;
  border: none;
  box-shadow: 0 20px 44px rgba(25, 67, 118, 0.12);
}

.branded-login label,
.branded-login .login-brand,
.branded-login .small-note,
.branded-login .muted {
  color: rgba(255, 255, 255, 0.95);
}

.branded-login input,
.branded-login textarea,
.branded-login select {
  background: #fff;
  color: var(--text);
  border-radius: 10px;
}

.branded-login .login-logo {
  border-color: rgba(255, 255, 255, 0.18) !important;
}

/* Ensure action area contrasts on the gradient */
.branded-login .form-actions {
  gap: 8px;
}

.branded-login .button,
.branded-login button {
  box-shadow: 0 10px 26px rgba(25, 67, 118, 0.12);
}

/* Additional site-specific small rules from recordnest-custom.css */
.brand-logo {
  height: 58px;
  width: auto;
}

.brand-text {
  font-weight: 800;
  letter-spacing: 0.5px;
}

.top-contact a {
  color: #fff;
}

.service-card p {
  font-size: 0.95rem;
  margin-top: 12px;
}

.contact-card {
  min-height: 120px;
}

.feature-box {
  border-left: 4px solid var(--secondary);
}

.mission-strip {
  background: linear-gradient(135deg, #194376, #0d2f57);
}

.cta-strip {
  background: linear-gradient(135deg, rgba(25, 67, 118, 1), rgba(70, 198, 206, 0.95));
}

.footer-link {
  color: rgba(255, 255, 255, .8);
}

.footer-link:hover {
  color: #fff;
  text-decoration: none;
}

.carousel-caption {
  background: rgba(10, 22, 40, .18);
}

@media (max-width: 991.98px) {
  .brand-logo {
    height: 46px;
  }
}

/* Suggestion Search Styles */
[data-suggestion-search] {
  position: relative;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(36, 59, 85, 0.12);
}

.suggestion-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.15s ease;
  font-size: 0.95rem;
  line-height: 1.4;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background-color: #f5f5f5;
}

.suggestion-item strong {
  color: var(--navy);
  display: block;
  font-weight: 600;
}

.suggestion-item small {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  margin-top: 4px;
}

.suggestion-item.no-match {
  cursor: default;
  color: var(--muted);
  text-align: center;
  padding: 20px 14px;
}

.suggestion-item.no-match:hover {
  background-color: transparent;
}

/* Audit trail detail comparison and JSON display styles */
.audit-comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  border: 1px solid #ddd;
}

.audit-comparison-table th {
  background-color: #f5f5f5;
  padding: 10px;
  border: 1px solid #ddd;
  text-align: left;
  font-weight: bold;
  width: 33%;
}

.audit-comparison-table td {
  padding: 10px;
  border: 1px solid #ddd;
  word-wrap: break-word;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-field-name {
  background-color: #fafafa;
  font-weight: 600;
}

.audit-before-val {
  background-color: #ffebee;
}

.audit-after-val {
  background-color: #e8f5e9;
}

.audit-unchanged-val {
  background-color: #f5f5f5;
}

.audit-removed {
  background-color: #ffcdd2;
}

.audit-added {
  background-color: #c8e6c9;
}

.audit-json-block {
  background-color: #f8f8f8;
  padding: 12px;
  border-left: 3px solid #2196F3;
  margin: 8px 0;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  overflow-x: auto;
}

/* ========================================
   MOBILE-FIRST RESPONSIVE ENHANCEMENTS
   ======================================== */

/* Reusable component classes */
.brand-title {
  font-size: 1.4rem;
  margin: 0;
}

.sidebar-logout-btn {
  margin-top: 20px !important;
  background: rgba(185, 71, 71, 0.2) !important;
  color: #ff9999 !important;
}

.alerts-header {
  margin: 0 0 10px 0;
  font-size: 1rem;
}

/* Page Hero Section */
.page-hero {
  background: linear-gradient(135deg, #194376, var(--secondary)) !important;
  color: #fff !important;
  border: none !important;
  padding: 30px !important;
  position: relative;
  overflow: hidden;
}

.page-hero-content {
  position: relative;
  z-index: 2;
}

.page-hero-title {
  margin: 0;
  font-size: 2.2rem;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.page-hero-title svg {
  flex-shrink: 0;
}

.page-hero-subtitle {
  margin: 8px 0 0;
  opacity: 0.85;
  font-size: 1.1rem;
}

.page-hero-decoration {
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

/* Table Card - accent border */
.table-card {
  border-top: 4px solid var(--secondary) !important;
  padding: 24px !important;
}

/* Form utilities */
.form-full-width {
  grid-column: span 2;
}

.history-card {
  margin-top: 16px;
}

@media (max-width: 768px) {
  .form-full-width {
    grid-column: span 1 !important;
  }
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Mobile navigation toggle */
.mobile-nav-toggle {
  display: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
  flex-shrink: 0;
  background: transparent;
  border: none;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  font-size: inherit;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-toggle:active {
  background: var(--hover);
  border-radius: 8px;
}

.mobile-nav-toggle:hover {
  background: var(--hover);
  border-radius: 8px;
}

.mobile-nav-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* ========================================
   MOBILE BREAKPOINT (max-width: 480px)
   ======================================== */
@media (max-width: 480px) {

  /* Base responsive adjustments */
  body {
    font-size: 14px;
  }

  table {
    margin-bottom: 0;
  }

  .wrapper {
    flex-direction: column;
  }

  /* Show mobile menu toggle */
  .mobile-nav-toggle {
    display: flex !important;
    order: -1;
  }

  .sidebar {
    width: 100vw !important;
    max-width: 100vw;
    position: fixed !important;
    top: 0;
    left: 0;
    right: auto;
    height: 100vh;
    max-height: 100vh;
    min-height: auto;
    padding: 16px 14px !important;
    z-index: 1100;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    sticky: none;
  }

  /* Sidebar visible when not collapsed on mobile */
  .sidebar:not(.collapsed) {
    transform: translateX(0) !important;
  }

  /* Sidebar hidden when collapsed on mobile */
  .sidebar.collapsed {
    transform: translateX(-100%) !important;
  }

  /* Overlay styling for mobile */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
  }

  /* Show overlay when active */
  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible !important;
  }

  .content {
    padding: 12px;
    flex: 1;
  }

  /* Hero sections */
  .page-hero,
  .page-header {
    padding: 40px 12px !important;
  }

  .page-hero h1,
  .page-header h1,
  .card>h1 {
    font-size: 1.6rem !important;
    margin: 0 !important;
  }

  .page-hero p,
  .page-header p {
    font-size: 0.95rem !important;
    margin: 8px 0 0 !important;
  }

  /* Hero circles/decorations - hide on mobile */
  .page-hero>div:last-child,
  .card>div:last-child {
    display: none !important;
  }

  /* Forms and inputs */
  input,
  select,
  textarea,
  button {
    width: 100%;
    font-size: 16px;
    /* Prevent zoom on iOS */
    min-height: 44px;
    /* Touch-friendly */
  }

  /* Form grids */
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px 12px !important;
  }

  .form-grid button {
    grid-column: span 1 !important;
    width: 100%;
  }

  /* Tables - scrollable on mobile */
  table {
    width: 100%;
    display: block;
    border-collapse: collapse;
  }

  table thead {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
  }

  table th {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
  }

  table tbody {
    display: block;
    width: 100%;
  }

  table tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: visible;
    background: var(--panel);
    page-break-inside: avoid;
  }

  table td {
    display: block;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    word-wrap: break-word;
    overflow-wrap: break-word;
    width: 100%;
    box-sizing: border-box;
  }

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

  /* Improved table container for mobile - no overflow issues */
  .card {
    overflow-x: hidden;
  }

  .card table {
    width: 100%;
    table-layout: fixed;
  }

  /* Ensure text doesn't overflow */
  table td {
    max-width: 100%;
  }

  /* Grids */
  .stats-grid,
  .grid-2,
  .admin-cards,
  .grid-doc-view,
  .grid-communications {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Buttons - more touch-friendly */
  button,
  .button,
  .button-link {
    padding: 12px 16px;
    min-height: 44px;
    font-size: 16px;
  }

  .button.small,
  .button.small {
    padding: 10px 14px;
    min-height: 40px;
  }

  /* Toolbar - stack on mobile */
  .toolbar,
  .toolbar-inline,
  .quick-links,
  .inline-form,
  .form-actions,
  .search-bar {
    flex-direction: column;
    width: 100%;
  }

  .toolbar button,
  .toolbar-inline button,
  .form-actions button,
  .search-bar button {
    width: 100%;
  }

  /* Cards */
  .card {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 14px;
  }

  /* Sidebar logout button */
  .sidebar-logout-btn {
    margin-top: 12px !important;
    width: 100%;
    display: flex;
    gap: 12px;
    padding: 12px !important;
  }

  /* User menu - full width */
  .user-menu,
  .alerts-menu {
    position: relative;
    width: auto;
    min-width: auto;
  }

  .user-menu summary,
  .alerts-menu summary {
    width: auto;
    flex-shrink: 0;
  }

  .user-menu-panel,
  .alerts-panel {
    position: fixed !important;
    width: min(300px, 85vw) !important;
    right: 12px !important;
    left: auto !important;
    top: 60px !important;
    bottom: auto !important;
    transform: none !important;
    z-index: 1200 !important;
  }

  /* Topbar - sticky on mobile */
  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 99;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  /* Ensure content doesn't hide dropdowns */
  .content {
    overflow: visible;
  }

  /* Mini charts */
  .mini-chart-row {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* Alerts */
  .alerts-panel {
    width: min(280px, 85vw) !important;
  }

  /* Message tiles */
  .message-tile {
    padding: 10px;
    margin-bottom: 8px;
  }

  /* Small text */
  .small-note {
    font-size: 13px;
  }

  /* Badge */
  .badge {
    font-size: 0.8rem;
    padding: 4px 8px;
  }

  /* Sidebar nav items - better touch targets */
  .sidebar nav a {
    padding: 10px 12px;
    margin: 6px 0;
    font-size: 14px;
  }

  .sidebar-group summary {
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-top: 12px;
  }

  /* Login page */
  .login-shell {
    padding: 16px;
  }

  .branded-login {
    max-width: 100%;
  }

  .login-logo {
    width: 80px;
    height: 80px;
  }

  /* Footer */
  .app-footer {
    flex-direction: column;
    padding: 10px 16px;
    font-size: 12px;
  }
}

/* ========================================
   TABLET BREAKPOINT (481px - 768px)
   ======================================== */
@media (min-width: 481px) and (max-width: 768px) {
  .sidebar {
    width: 100% !important;
    position: relative;
    min-height: auto;
    padding: 18px 14px;
  }

  .sidebar.collapsed {
    width: 100% !important;
    padding: 18px 12px;
  }

  .content {
    padding: 20px;
  }

  .page-hero h1,
  .page-header h1 {
    font-size: 1.8rem;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
    min-height: 44px;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .stats-grid,
  .admin-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .grid-2,
  .grid-doc-view,
  .grid-communications {
    grid-template-columns: 1fr !important;
  }

  .toolbar,
  .form-actions {
    flex-wrap: wrap;
  }

  .card {
    padding: 18px;
  }

  .user-menu summary {
    flex-wrap: wrap;
  }

  /* Collapsible sidebar on tablet */
  .sidebar.collapsed .nav-label {
    display: none;
  }

  /* Tablet table styles - still in card view */
  table {
    font-size: 14px;
    display: block;
    overflow-x: auto;
  }

  .responsive-table {
    width: 100%;
    overflow-x: auto;
  }

  .responsive-table td[data-label]:before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody {
    display: block;
  }

  .responsive-table tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: var(--panel);
  }

  table td {
    display: block;
    padding: 8px 0;
    border: none;
    word-wrap: break-word;
  }

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

  th,
  td {
    padding: 10px;
  }
}

/* ========================================
   LANDSCAPE MOBILE (769px - 1023px)
   ======================================== */
@media (min-width: 769px) and (max-width: 1023px) {
  .sidebar {
    width: 250px;
    padding: 18px 14px;
  }

  .sidebar.collapsed {
    width: 80px;
  }

  .content {
    padding: 20px;
  }

  .page-hero h1 {
    font-size: 1.9rem;
  }

  .form-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .admin-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .grid-doc-view,
  .grid-communications {
    grid-template-columns: 1fr !important;
  }
}

/* ========================================
   DESKTOP BREAKPOINT (1024px+)
   ======================================== */
@media (min-width: 1024px) {
  .sidebar {
    width: 290px;
    padding: 22px 18px;
  }

  .sidebar.collapsed {
    width: 80px;
    padding: 22px 12px;
  }

  .content {
    padding: 28px;
  }

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

  .sidebar-overlay {
    display: none !important;
  }

  .page-hero h1 {
    font-size: 2.2rem;
  }

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

  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .admin-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-doc-view {
    grid-template-columns: minmax(280px, 0.9fr) minmax(540px, 1.7fr);
  }

  .grid-communications {
    grid-template-columns: 1.15fr 1fr;
  }

  /* Tables - standard layout on desktop */
  table {
    display: table;
    margin: 0;
    width: 100%;
  }

  .card table {
    margin: 0;
    width: 100%;
  }

  table thead {
    display: table-header-group;
  }

  table tbody {
    display: table-row-group;
  }

  table tr {
    display: table-row;
    margin-bottom: 0;
    border: none;
    padding: 0;
    background: none;
    border-radius: 0;
  }

  table td {
    display: table-cell;
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e1dd;
    word-wrap: normal;
    overflow-wrap: normal;
  }

  table td:last-child {
    border-bottom: 1px solid #e5e1dd;
  }

  .user-menu-panel,
  .alerts-panel {
    right: 0 !important;
    transform: none !important;
  }
}
