html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Focus ring lives in theme.css — ocean blue, not Bootstrap's #258cfb. */

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0; /* app-shell layout; no fixed footer */
  background: var(--ctw-background);
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ─── App shell: slim sidebar + content ──────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ctw-primary);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar .side-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--ctw-on-primary);
  text-decoration: none;
  padding: 0.5rem 0.75rem 1.25rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.sidebar .side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.15rem;
  border-radius: var(--ctw-r-md);
  color: var(--ctw-on-primary-container);
  text-decoration: none;
  font-size: 0.95rem;
  transition: background-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.sidebar .side-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ctw-on-primary);
}

.sidebar .side-link.active {
  background: var(--ctw-primary-container);
  color: var(--ctw-primary-fixed);
  font-weight: 600;
}

.sidebar .side-link i {
  font-size: 1.05rem;
  width: 1.25rem;
  text-align: center;
}


.app-main {
  flex-grow: 1;
  min-width: 0;
  padding: 1.5rem 2rem 3rem;
}

.app-content {
    flex-grow:1;
    min-width: 0;
    display: flex;
    flex-direction:column;
    background: var(--ctw-background);
}

.topbar{
    position:sticky;
    top:0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--ctw-surface-lowest);
    border-bottom: 1px solid var(--ctw-outline-variant);
    padding: 0.6rem 2rem;

}

.topbar .topbar-user{
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ctw-on-surface-variant);
}

#auditOffcanvasBody {
    min-width: min(720px, 90vw);
}

/* Icon rail on narrow screens: labels hide, icons stay */
@media (max-width: 991.98px) {
  .sidebar {
    width: 64px;
    padding: 1rem 0.5rem;
  }
    .sidebar .side-label {
        display: none;
    }

    .sidebar .side-link {
        justify-content: center;
    }
  .sidebar .side-brand {
    justify-content: center;
    padding: 0.25rem 0 1rem;
  }
  .app-main {
    padding: 1.25rem 1rem 3rem;
  }
}

/* Dashboard action cards: lift on hover so they read as clickable */
.stat-card {
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
a .stat-card:hover {
  box-shadow: 0 0.5rem 1.25rem rgba(0, 42, 62, 0.10);
  border-color: var(--ctw-primary-container);
  transform: translateY(-2px);
}

.side-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.side-link.disabled .side-label small {
    font-size: 0.7em;
    opacity: 0.8;
}

.stat-card-disabled{
    opacity: 0.5;
    cursor:not-allowed;
}

.stat-card-disabled .stat-card{
    pointer-events: none;
}

/* Entity chips: pill links to related records (activity, user) */
.entity-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.65rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 50rem;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.entity-chip:hover {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
}
