:root {
  --kutrrh-brand: #283593;
  --kutrrh-brand-dark: #1a237e;
  --kutrrh-brand-light: #3949ab;
  --kutrrh-sidebar-accent: #f98c1f;
  --kutrrh-sidebar-width: 250px;
  --kutrrh-navbar-height: 48px;
  --kutrrh-footer-height: 36px;
}

@media (min-width: 992px) {
  :root {
    --kutrrh-sidebar-width: 280px;
  }
}

@media (min-width: 1400px) {
  :root {
    --kutrrh-sidebar-width: 300px;
  }
}

/* Compact top navbar */
.kutrrh-topbar {
  min-height: var(--kutrrh-navbar-height);
  background: linear-gradient(90deg, #1a237e 0%, #283593 55%, #1a237e 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 12px rgba(26, 35, 126, 0.25);
}

.kutrrh-topbar .kutrrh-topbar-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  max-width: 140px;
}

.kutrrh-breadcrumb {
  --bs-breadcrumb-divider: "›";
  font-size: 0.72rem;
}

.kutrrh-breadcrumb .breadcrumb-item a {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
}

.kutrrh-breadcrumb .breadcrumb-item a:hover {
  color: #fff;
}

.kutrrh-breadcrumb .breadcrumb-item.active {
  color: #fff;
  font-weight: 600;
}

.kutrrh-topbar-btn {
  color: rgba(255, 255, 255, 0.9);
  padding: 0.2rem 0.45rem;
  line-height: 1;
}

.kutrrh-topbar-btn:hover,
.kutrrh-topbar-btn:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.kutrrh-topbar-search {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  gap: 0.35rem;
}

.kutrrh-search-input {
  width: 140px;
  font-size: 0.75rem;
  color: #fff !important;
}

.kutrrh-search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.kutrrh-search-input:focus {
  box-shadow: none;
  outline: none;
}

.kutrrh-topbar-user {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.5rem 0.15rem 0.15rem;
  max-width: 200px;
}

.kutrrh-topbar-user:hover,
.kutrrh-topbar-user.show {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.kutrrh-topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  color: var(--kutrrh-brand);
  font-size: 0.7rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kutrrh-user-name {
  font-size: 0.72rem;
  font-weight: 600;
  max-width: 110px;
}

.kutrrh-user-role {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

.kutrrh-notify-badge {
  font-size: 0.55rem;
  padding: 0.2em 0.45em;
}

.kutrrh-dropdown-menu {
  font-size: 0.85rem;
  min-width: 200px;
}

.chart-card .card-body {
  padding: 0.75rem 1rem 1rem;
}

.chart-card .card-header {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.chart-wrap {
  position: relative;
  height: 200px;
}

@media (min-width: 768px) {
  .chart-wrap { height: 220px; }
}

@media (min-width: 992px) {
  .chart-wrap { height: 240px; }
}

@media (min-width: 1200px) {
  .chart-wrap { height: min(260px, 28vh); }
}

@media (min-width: 1400px) {
  .chart-wrap { height: min(280px, 30vh); }
}

@media (max-width: 575.98px) {
  .chart-wrap { height: 180px; }
}

/* Dashboard content uses booklet scroll on smaller viewports */
.booklet-page-right .booklet-page-inner {
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .kutrrh-topbar .kutrrh-topbar-title {
    max-width: none;
  }

  .kutrrh-search-input {
    width: 160px;
  }
}

@media (min-width: 1200px) {
  .kutrrh-search-input {
    width: 200px;
  }
}

.bg-kutrrh { background-color: var(--kutrrh-brand) !important; }
.bg-kutrrh-dark { background-color: var(--kutrrh-brand-dark) !important; }
.text-kutrrh { color: var(--kutrrh-brand) !important; }
.border-kutrrh { border-color: var(--kutrrh-brand) !important; }

.kutrrh-dashboard-bg {
  background: #283593;
  background-attachment: fixed;
  min-height: 100dvh;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .kutrrh-dashboard-bg {
    height: 100dvh;
    overflow: hidden;
  }
}

.kutrrh-sidebar {
  width: var(--kutrrh-sidebar-width);
  height: 100dvh;
  max-height: 100dvh;
  background: var(--kutrrh-sidebar-accent);
  overflow: hidden;
}

.kutrrh-sidebar-inner {
  padding: 0;
  min-height: 0;
}

.kutrrh-sidebar-brand {
  flex-shrink: 0;
  padding: 0.75rem 0.5rem 0.65rem;
  background: #283593;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.kutrrh-sidebar-logo-wrap {
  display: inline-block;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.45rem;
  background: transparent;
}

.kutrrh-sidebar-decoration-wrap {
  padding: 0 0.35rem;
  margin-bottom: 0.35rem;
}

.kutrrh-sidebar-decoration {
  max-height: 3.5rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.kutrrh-sidebar-logo {
  height: 44px;
  width: auto;
  max-width: 100%;
}

@media (min-width: 992px) {
  .kutrrh-sidebar-logo {
    height: 52px;
  }
}

.kutrrh-sidebar-gold {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: var(--kutrrh-sidebar-accent);
}

.kutrrh-sidebar-gold-meta {
  flex-shrink: 0;
  padding: 0.65rem 0.5rem 0.75rem;
}

.kutrrh-sidebar-system-title {
  font-size: 0.58rem;
  line-height: 1.25;
  color: #1a237e;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.35rem !important;
}

@media (min-width: 992px) {
  .kutrrh-sidebar-system-title {
    font-size: 0.62rem;
  }
}

.kutrrh-sidebar-user {
  font-size: 0.72rem;
  line-height: 1.2;
  color: #1a237e;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kutrrh-sidebar-role,
.kutrrh-role-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff !important;
  background: var(--kutrrh-brand) !important;
  border: 1px solid rgba(26, 35, 126, 0.25);
  padding: 0.35em 0.65em;
  letter-spacing: 0.02em;
}

.kutrrh-sidebar-gold-nav {
  padding: 0.5rem 0.35rem;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(26, 35, 126, 0.35) transparent;
}

.kutrrh-sidebar-gold-nav::-webkit-scrollbar {
  width: 5px;
}

.kutrrh-sidebar-gold-nav::-webkit-scrollbar-thumb {
  background: rgba(26, 35, 126, 0.35);
  border-radius: 4px;
}

.kutrrh-sidebar-gold-heading {
  color: rgba(26, 35, 126, 0.8);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.kutrrh-sidebar-gold .nav-link {
  color: #1a237e;
  font-weight: 500;
}

.kutrrh-sidebar-gold .nav-link:hover,
.kutrrh-sidebar-gold .nav-link:focus {
  color: #fff;
  background: var(--kutrrh-brand);
}

.kutrrh-sidebar-gold .nav-link.active {
  color: #fff;
  background: var(--kutrrh-brand);
  border: 1px solid var(--kutrrh-brand-dark);
  box-shadow: 0 4px 12px rgba(26, 35, 126, 0.25);
}

.kutrrh-sidebar-footer {
  flex-shrink: 0;
  padding: 0.65rem 0.5rem 0.75rem;
  border-top: 1px solid rgba(26, 35, 126, 0.15);
  background: var(--kutrrh-sidebar-accent);
}

.kutrrh-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  border-radius: 0.5rem;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.1rem;
  font-size: 0.82rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.2s ease;
}

@media (min-width: 992px) {
  .kutrrh-sidebar .nav-link {
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
  }
}

.kutrrh-sidebar-nav .text-uppercase {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem !important;
}

.kutrrh-sidebar .nav-link:hover,
.kutrrh-sidebar .nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.kutrrh-sidebar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kutrrh-footer {
  background: linear-gradient(90deg, #1a237e 0%, #283593 50%, #1a237e 100%);
  color: rgba(255, 255, 255, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 36px;
}

.kutrrh-footer-copy {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.9);
}

.kutrrh-footer-links a {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.75);
}

.kutrrh-footer-links a:hover {
  color: #fff;
}

/* Main area beside sidebar */
@media (min-width: 768px) {
  .kutrrh-main-wrap {
    margin-left: var(--kutrrh-sidebar-width);
    width: calc(100% - var(--kutrrh-sidebar-width));
    max-width: calc(100% - var(--kutrrh-sidebar-width));
    height: 100dvh;
    max-height: 100dvh;
  }
}

.kutrrh-main-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.kutrrh-content-area {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
  background: #283593;
}

@media (min-width: 992px) {
  .kutrrh-content-area {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}

/* Dashboard content panel */
.booklet-scene {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  padding: 0.65rem 0.85rem 0.85rem;
  overflow: visible;
  background: #283593;
}

@media (min-width: 992px) {
  .booklet-scene {
    padding: 0.75rem 1rem 1rem;
  }
}

.booklet {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: auto;
  min-height: 0;
  max-width: 100%;
  margin: 0 auto;
  filter: drop-shadow(0 10px 32px rgba(40, 53, 147, 0.18));
}

.booklet-spine {
  flex: 0 0 16px;
  background: linear-gradient(180deg, #1a237e 0%, #283593 50%, #1a237e 100%);
  border-radius: 0.85rem 0 0 0.85rem;
  box-shadow: inset -4px 0 10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(26, 35, 126, 0.35);
  border-right: none;
}

.booklet-page {
  flex: 1 1 auto;
  min-width: 0;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 50%, #eef0fa 100%);
  border: 1px solid rgba(40, 53, 147, 0.14);
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.booklet-page-right {
  border-radius: 0.85rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

.booklet-page-inner {
  padding: 1.25rem 1.5rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

@media (min-width: 992px) {
  .booklet-page-inner {
    padding: 1.5rem 2rem;
  }
}

.btn-kutrrh {
  background-color: var(--kutrrh-brand);
  border-color: var(--kutrrh-brand);
  color: #fff;
}

.btn-kutrrh:hover {
  background-color: var(--kutrrh-brand-dark);
  border-color: var(--kutrrh-brand-dark);
  color: #fff;
}

.btn-outline-kutrrh {
  color: var(--kutrrh-brand);
  border-color: var(--kutrrh-brand);
}

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

/* Portal login card (welcome hero + forgot password) */
.kutrrh-auth-portal-page {
  background: linear-gradient(135deg, #1a237e, #283593, #3949ab);
}

.kutrrh-hero-auth-wrap {
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.15rem 1.35rem;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (min-width: 768px) {
  .kutrrh-hero-auth-wrap {
    padding: 0.75rem 1rem 1rem;
    justify-content: flex-end;
    align-items: center;
  }
}

.kutrrh-portal-auth,
.kutrrh-hero-auth {
  width: 100%;
  max-width: min(340px, calc(100vw - 2.75rem));
  background: rgba(255, 255, 255, 0.98);
  border-radius: 1rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-sizing: border-box;
}

.kutrrh-hero-auth.is-register,
.kutrrh-portal-auth.kutrrh-portal-auth--register {
  max-width: min(400px, calc(100vw - 2.75rem));
}

.kutrrh-portal-auth .card-body,
.kutrrh-hero-auth .card-body,
.kutrrh-hero-auth-body {
  padding: 1.25rem 1.4rem !important;
}

.kutrrh-hero-auth.is-register .card-body,
.kutrrh-hero-auth.is-register .kutrrh-hero-auth-body,
.kutrrh-portal-auth.kutrrh-portal-auth--register .card-body {
  padding: 1.3rem 1.45rem !important;
}

.kutrrh-hero-auth-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.kutrrh-hero-auth-forms.is-scrollable {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(calc(100dvh - 15.5rem), 26rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 0.35rem;
  margin-right: -0.2rem;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.kutrrh-hero-auth-forms.is-scrollable::-webkit-scrollbar {
  width: 6px;
}

.kutrrh-hero-auth-forms.is-scrollable::-webkit-scrollbar-thumb {
  background: rgba(40, 53, 147, 0.25);
  border-radius: 999px;
}

.kutrrh-portal-auth .form-label,
.kutrrh-hero-auth .form-label {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.kutrrh-portal-auth .form-control,
.kutrrh-hero-auth .form-control,
.kutrrh-register-form .form-control {
  font-size: 0.9rem;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  border-color: rgba(40, 53, 147, 0.18);
}

.kutrrh-portal-auth .btn,
.kutrrh-hero-auth .btn,
.kutrrh-hero-auth .kutrrh-auth-tab {
  font-size: 0.88rem;
  border-radius: 0.5rem;
}

.kutrrh-hero-auth .alert {
  border-radius: 0.5rem;
}

.kutrrh-portal-auth .auth-logo,
.kutrrh-hero-auth .auth-logo {
  height: 48px;
  width: auto;
}

.kutrrh-portal-auth .portal-title,
.kutrrh-hero-auth .portal-title {
  font-size: 0.8rem;
}

@media (min-width: 768px) {
  .kutrrh-portal-auth,
  .kutrrh-hero-auth {
    max-width: 380px;
  }

  .kutrrh-hero-auth.is-register,
  .kutrrh-portal-auth.kutrrh-portal-auth--register {
    max-width: 420px;
  }
}

.kutrrh-register-form .form-control {
  max-width: 100%;
}

/* Welcome hero: keep auth card inside viewport with visible rounded corners */
@media (max-width: 767.98px) {
  .kutrrh-hero-inner {
    align-items: center;
  }

  .kutrrh-hero-auth-wrap {
    width: 100%;
    max-width: min(400px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .kutrrh-hero-auth-forms.is-scrollable {
    max-height: min(calc(100dvh - 17rem), 24rem);
  }
}

/* In-app PDF viewer */
.kutrrh-pdf-viewer {
  border: 1px solid rgba(40, 53, 147, 0.12);
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
}

.kutrrh-pdf-viewer-toolbar {
  background: #f8f9ff;
  border-bottom: 1px solid rgba(40, 53, 147, 0.1);
}

.kutrrh-pdf-viewer-body {
  border: none !important;
  border-radius: 0 !important;
}

.kutrrh-pdf-frame {
  display: block;
  min-height: 70vh;
  height: 70vh;
}

.kutrrh-pdf-frame--expanded {
  min-height: calc(100vh - 3.5rem);
  height: calc(100vh - 3.5rem);
}

.kutrrh-pdf-modal .modal-body {
  overflow: hidden;
}

/* Finalize / PDF modals render outside the booklet scroll panel */
.kutrrh-finalize-modal {
  z-index: 1060;
}

.office-document-pdf-viewer .kutrrh-pdf-viewer {
  border: none;
}

.office-document-pdf-viewer .kutrrh-pdf-viewer-toolbar {
  border-radius: 0.375rem 0.375rem 0 0;
  margin-bottom: 0;
}
