:root {
  color-scheme: light;
  --ink: #18243a;
  --muted: #718096;
  --brand: #3559d8;
  --brand-dark: #2646bd;
  --line: #e5eaf2;
  --surface: #ffffff;
  --canvas: #f5f7fb;
  --shadow-soft: 0 12px 32px rgba(25, 42, 77, 0.07);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 53, 89, 216;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--line);
  --bs-border-radius: 0.75rem;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 5% 0%, rgba(53, 89, 216, 0.07), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.94rem;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1560px;
  padding: 30px clamp(16px, 3.5vw, 56px) 56px;
}

.app-footer {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3.5vw, 56px) 24px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.app-header {
  padding: 0 0 25px;
  border-bottom: 1px solid rgba(218, 225, 236, 0.8);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(145deg, #5275f0, #2b4bc4);
  box-shadow: 0 8px 16px rgba(53, 89, 216, 0.2);
  color: white;
}

.brand-mark[hidden],
.brand-logo[hidden],
.brand-logo-preview[hidden] {
  display: none;
}

.brand-logo {
  width: 112px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-logo-preview {
  width: 140px;
  height: 72px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

.brand-name {
  margin: 0;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.brand-caption {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.header-actions {
  justify-content: flex-end;
}

#currentUser {
  max-width: min(100%, 320px);
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #42516a !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  min-height: 38px;
  border-radius: 10px;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: #a9b8ee;
  --bs-btn-disabled-border-color: #a9b8ee;
  box-shadow: 0 5px 12px rgba(53, 89, 216, 0.15);
}

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: #cbd5fa;
  --bs-btn-hover-bg: #eef1ff;
  --bs-btn-hover-border-color: #bac7f5;
  --bs-btn-hover-color: var(--brand-dark);
  --bs-btn-active-bg: #e7ecff;
  --bs-btn-active-border-color: #bac7f5;
  --bs-btn-active-color: var(--brand-dark);
}

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 18px;
}

.workspace-eyebrow {
  margin-bottom: 5px;
  color: var(--brand);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.workspace-title {
  margin: 0;
  font-size: clamp(1.1rem, 1.5vw, 1.1rem);
  font-weight: 750;
  letter-spacing: -0.045em;
}

.workspace-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.workspace-heading {
  align-items: center;
  margin-bottom: 22px;
}

.dashboard-scope-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid #dfe6f0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #53627a;
  font-size: 0.8rem;
  font-weight: 650;
}

.scope-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48a679;
  box-shadow: 0 0 0 3px #e7f5ed;
}

.dashboard-loading {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed #d8e0ed;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted);
  font-size: 0.88rem;
}

.dashboard-kpis > div {
  min-width: 0;
}

.kpi-card {
  min-height: 143px;
  padding: 18px 18px 17px;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 17px 36px rgba(25, 42, 77, 0.1) !important;
}

.kpi-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #637087;
  font-size: 0.78rem;
  font-weight: 650;
}

.kpi-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 750;
}

.kpi-value {
  margin-top: 9px;
  color: #202c42;
  font-size: clamp(1.65rem, 2.2vw, 2rem);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 1;
}

.kpi-caption {
  margin-top: 7px;
  color: #8a95a6;
  font-size: 0.73rem;
}

.kpi-blue {
  border-top: 3px solid #5574e3 !important;
}

.kpi-blue .kpi-icon {
  background: #edf1ff;
  color: #4565d4;
}

.kpi-amber {
  border-top: 3px solid #e0ad43 !important;
}

.kpi-amber .kpi-icon {
  background: #fff5e1;
  color: #a77916;
}

.kpi-violet {
  border-top: 3px solid #9271d5 !important;
}

.kpi-violet .kpi-icon {
  background: #f2edfc;
  color: #7b5abc;
}

.kpi-red {
  border-top: 3px solid #d87575 !important;
}

.kpi-red .kpi-icon {
  background: #fff0ef;
  color: #b65353;
}

.kpi-green {
  border-top: 3px solid #56a77b !important;
}

.kpi-green .kpi-icon {
  background: #eaf7ef;
  color: #38865d;
}

.dashboard-analytics {
  margin-bottom: 2px;
}

.analytics-card {
  min-height: 280px;
  padding: 22px;
}

.analytics-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.analytics-title {
  margin: 0;
  color: #26334b;
  font-size: 1rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.analytics-subtitle {
  margin: 5px 0 0;
  color: #8a95a6;
  font-size: 0.77rem;
}

.analytics-label {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 8px;
  background: #f4f6fa;
  color: #768298;
  font-size: 0.68rem;
  font-weight: 650;
}

.breakdown-list {
  display: grid;
  gap: 15px;
}

.breakdown-row {
  display: grid;
  width: 100%;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.breakdown-filter {
  border-radius: 8px;
  cursor: pointer;
}

.breakdown-filter:focus-visible {
  outline: 3px solid rgba(53, 89, 216, 0.25);
  outline-offset: 4px;
}

.breakdown-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.breakdown-name {
  color: #536178;
  font-size: 0.82rem;
  font-weight: 600;
}

.breakdown-value {
  color: #2f3b51;
  font-size: 0.83rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.breakdown-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f0f2f6;
}

.breakdown-fill {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  transition: width 300ms ease;
}

.bar-open {
  background: linear-gradient(90deg, #5575e5, #7891ed);
}

.bar-progress {
  background: linear-gradient(90deg, #e0ae46, #f0ca74);
}

.bar-resolved {
  background: linear-gradient(90deg, #51a779, #83c59f);
}

.bar-critical {
  background: linear-gradient(90deg, #c84f55, #e17a7e);
}

.bar-high {
  background: linear-gradient(90deg, #e58b53, #f0b17e);
}

.bar-medium {
  background: linear-gradient(90deg, #518bb4, #7db3d2);
}

.bar-low {
  background: linear-gradient(90deg, #9aa6b8, #c1c9d4);
}

.tool-ribbon {
  gap: 8px !important;
  padding: 6px !important;
  border-color: var(--line) !important;
  border-radius: 13px !important;
  background: rgba(255, 255, 255, 0.72) !important;
  box-shadow: 0 4px 14px rgba(25, 42, 77, 0.035) !important;
}

.tool-ribbon .btn {
  padding-inline: 14px;
  border-color: transparent;
}

.tool-ribbon .btn[aria-expanded="true"] {
  border-color: #d7def4;
  background: #edf1ff;
  color: var(--brand-dark);
}

.card {
  border: 1px solid var(--line) !important;
  border-radius: 15px !important;
  background: var(--surface);
  box-shadow: var(--shadow-soft) !important;
}

.card-header {
  min-height: 62px;
  padding: 15px 20px;
  border-bottom-color: var(--line);
  border-radius: 15px 15px 0 0 !important;
  font-weight: 700;
}

.card-body {
  padding: 22px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.form-label {
  margin-bottom: 7px;
  color: #40506a;
  font-size: 0.84rem;
  font-weight: 650;
}

.form-control,
.form-select {
  min-height: 43px;
  border-color: #dce3ed;
  border-radius: 10px;
  background-color: #fff;
  color: var(--ink);
  font-size: 0.91rem;
  box-shadow: none;
}

textarea.form-control {
  min-height: auto;
}

.form-control::placeholder {
  color: #a3adbc;
}

.form-control:focus,
.form-select:focus {
  border-color: #8298ed;
  box-shadow: 0 0 0 3px rgba(53, 89, 216, 0.11);
}

.form-check-input {
  border-color: #c7d0df;
}

.form-check-input:checked {
  border-color: var(--brand);
  background-color: var(--brand);
}

.alert {
  border: 0;
  border-radius: 12px;
}

#pageMessage:not(.d-none),
#adminMessage:not(.d-none) {
  box-shadow: 0 5px 14px rgba(25, 42, 77, 0.04);
}

.table-responsive {
  border-radius: 0 0 15px 15px;
}

.table {
  --bs-table-color: #344158;
  --bs-table-hover-bg: #f7f9fd;
  margin: 0;
  font-size: 0.88rem;
}

.table thead th {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8f9fc;
  color: #718096;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  white-space: nowrap;
}

.issues-card {
  overflow: hidden;
}

.issue-register-header,
.issue-register-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.issue-register-header {
  padding-block: 17px;
}

.issue-register-title {
  min-width: 220px;
}

.issue-register-title h2 {
  color: #25334a;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.issue-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.issue-pagination .form-select {
  width: 72px;
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.issue-pagination .btn {
  min-height: 34px;
  padding: 5px 10px;
}

.issue-filter-bar {
  padding: 16px 20px;
  border-top: 1px solid #eef1f6;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}

.issue-filter-bar .form-label {
  margin-bottom: 5px;
  font-size: 0.76rem;
}

.issue-filter-bar .form-control,
.issue-filter-bar .form-select {
  min-height: 39px;
}

.issue-register-footer {
  min-height: 58px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.issues-card .table-responsive {
  max-height: min(68vh, 820px);
  border-radius: 0;
}

.issues-card .table thead th {
  position: sticky;
  z-index: 1;
  top: 0;
}

.issues-card .table tbody tr {
  transition: background-color 120ms ease;
}

.table tbody td {
  padding: 15px 16px;
  border-color: #eef1f6;
  vertical-align: top;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.issue-title {
  color: #24324a;
  font-size: 0.94rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.issue-description {
  max-width: 500px;
  color: #7b8798 !important;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.badge {
  padding: 0.48em 0.72em;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 650;
}

.text-bg-primary {
  border-color: #d6e2ff;
  background-color: #edf3ff !important;
  color: #3158bf !important;
}

.text-bg-warning {
  border-color: #f4e4bb;
  background-color: #fff6df !important;
  color: #936b12 !important;
}

.text-bg-success {
  border-color: #c7ead8;
  background-color: #e8f8ef !important;
  color: #238352 !important;
}

.text-bg-danger {
  border-color: #f2cccc;
  background-color: #fff0f0 !important;
  color: #bd4545 !important;
}

.text-bg-info {
  border-color: #caeaf2;
  background-color: #e9f8fc !important;
  color: #267c91 !important;
}

.text-bg-secondary {
  border-color: #e2e6ec;
  background-color: #f0f2f5 !important;
  color: #657185 !important;
}

.issue-actions .btn,
#managedUsers .btn {
  min-height: 31px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.modal-content {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(20, 33, 62, 0.2);
}

.modal-header,
.modal-footer {
  padding: 18px 22px;
  border-color: var(--line);
}

.modal-body {
  padding: 22px;
}

.modal-title {
  font-weight: 750;
}

.text-muted {
  color: var(--muted) !important;
}

@media (max-width: 767.98px) {
  .app-shell {
    padding-top: 19px;
  }

  .app-header {
    align-items: flex-start !important;
  }

  .header-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .brand-logo {
    width: 88px;
    height: 48px;
  }

  #currentUser {
    flex-basis: 100%;
    max-width: 100%;
  }

  .header-actions > .btn {
    flex: 1 1 calc(50% - 0.5rem);
  }

  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 24px;
  }

  .dashboard-scope-pill {
    font-size: 0.75rem;
  }

  .kpi-card {
    min-height: 132px;
    padding: 15px;
  }

  .analytics-card {
    min-height: auto;
    padding: 18px;
  }

  .card-body {
    padding: 17px;
  }

  .table thead th,
  .table tbody td {
    padding-inline: 12px;
  }

  .issue-description {
    min-width: 230px;
  }

  .issue-register-header {
    align-items: flex-start;
  }

  .issue-pagination {
    justify-content: flex-start;
  }

  .issue-pagination .btn,
  .issue-actions .btn {
    min-height: 40px;
  }

  .report-preview-actions > .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-height: 44px;
  }

  .issue-filter-bar {
    padding: 15px;
  }

  .issue-register-footer {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.report-preview-table {
  font-size: 0.82rem;
}

.report-preview-table td {
  white-space: pre-wrap;
}

.report-print-heading {
  display: none;
}

@media print {
  @page {
    size: landscape;
    margin: 12mm;
  }

  body * {
    visibility: hidden !important;
  }

  #reportPreviewModal,
  #reportPreviewModal * {
    visibility: visible !important;
  }

  #reportPreviewModal {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    overflow: visible !important;
    background: #fff !important;
  }

  #reportPreviewModal .modal-dialog {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
  }

  #reportPreviewModal .modal-content {
    border: 0 !important;
  }

  #reportPreviewModal .modal-header,
  #reportPreviewModal .report-preview-actions,
  #reportPreviewMessage {
    display: none !important;
  }

  #reportPreviewModal .modal-body,
  #reportPreviewModal .table-responsive {
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
  }

  .report-print-heading {
    display: block;
  }

  .report-preview-table {
    font-size: 8pt;
  }

  .report-preview-table thead {
    display: table-header-group;
  }

  .report-preview-table tr {
    break-inside: avoid;
  }
}
