:root {
  --ew-sidebar: #243447;
  --ew-sidebar-deep: #1b2838;
  --ew-sidebar-hover: #2f4258;
  --ew-sidebar-active: #3a536d;
  --ew-primary: #4a69bd;
  --ew-primary-hover: #3b5998;
  --ew-danger: #c0392b;
  --ew-bg: #f0f3f6;
  --ew-surface: #ffffff;
  --ew-border: #e2e8ee;
  --ew-text: #2c3e50;
  --ew-muted: #7f8c9a;
  --ew-topbar-h: 64px;
  --ew-sidebar-w: 260px;
  --brand-primary: var(--ew-primary);
  --brand-accent: var(--ew-primary-hover);
  --brand-surface: var(--ew-bg);
  --brand-border: var(--ew-border);
  --brand-text: var(--ew-text);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  height: 100%;
}

body.app-body {
  margin: 0;
  min-height: 100%;
  color: var(--ew-text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: var(--ew-bg);
}

/* ——— Shell ——— */
.app-authenticated {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--ew-sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ew-sidebar) 0%, var(--ew-sidebar-deep) 100%);
  color: #e8eef5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1040;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}

.sidebar-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--ew-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.sidebar-brand-text strong {
  font-size: 1.05rem;
}

.sidebar-brand-text small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.75rem;
}

.sidebar-close {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 1.1rem;
}

.sidebar-search {
  position: relative;
  margin: 0.85rem 0.85rem 0.5rem;
}

.sidebar-search i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
}

.sidebar-search .form-control {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 6px;
  padding-left: 2rem;
  height: 38px;
  font-size: 0.9rem;
}

.sidebar-search .form-control::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-search .form-control:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(74, 105, 189, 0.6);
  box-shadow: none;
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.6rem 1rem;
}

.sidebar-link,
.sidebar-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.2rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
}

.sidebar-link > i,
.sidebar-group-toggle span > i {
  width: 1.25rem;
  margin-right: 0.55rem;
  opacity: 0.9;
}

.sidebar-group-toggle span {
  display: inline-flex;
  align-items: center;
}

.sidebar-link:hover,
.sidebar-group-toggle:hover {
  background: var(--ew-sidebar-hover);
  color: #fff;
}

.sidebar-link.active {
  background: var(--ew-sidebar-active);
  color: #fff;
}

.sidebar-group-toggle .chevron {
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.sidebar-group.open > .sidebar-group-toggle .chevron {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: none;
  padding: 0.15rem 0 0.4rem 0.5rem;
}

.sidebar-group.open > .sidebar-submenu {
  display: block;
}

.sidebar-sublink {
  display: block;
  padding: 0.45rem 0.85rem 0.45rem 2.1rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.sidebar-sublink:hover {
  background: var(--ew-sidebar-hover);
  color: #fff;
}

.sidebar-sublink.active {
  background: rgba(74, 105, 189, 0.35);
  color: #fff;
}

.sidebar-footer {
  padding: 0.85rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-meta {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.45;
}

.app-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-topbar {
  height: var(--ew-topbar-h);
  background: var(--ew-surface);
  border-bottom: 1px solid var(--ew-border);
  box-shadow: 0 1px 8px rgba(36, 52, 71, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.topbar-quick {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  text-decoration: none;
  color: var(--ew-muted);
  min-width: 52px;
  padding: 0.15rem 0.25rem;
}

.quick-item:hover {
  color: var(--ew-text);
}

.quick-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1rem;
}

.qi-blue { background: #4a69bd; }
.qi-orange { background: #e67e22; }
.qi-green { background: #27ae60; }
.qi-pink { background: #c44569; }
.qi-yellow { background: #f1c40f; color: #2c3e50; }

.quick-item small {
  font-size: 0.68rem;
  font-weight: 600;
}

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--ew-border);
  background: #fff;
  color: var(--ew-text);
  display: inline-grid;
  place-items: center;
  position: relative;
}

.topbar-icon-btn:hover {
  background: #f7f9fb;
  color: var(--ew-primary);
}

.topbar-icon-btn.dropdown-toggle::after {
  display: none;
}

.topbar-lang,
.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ew-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.notify-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ew-danger);
  color: #fff;
  font-size: 0.65rem;
  line-height: 16px;
  font-weight: 700;
}

.notify-menu {
  min-width: 320px;
  max-width: 360px;
}

.app-content {
  padding: 1.25rem 1.35rem 2rem;
  flex: 1;
}

.guest-content {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top right, rgba(74, 105, 189, 0.18), transparent 40%),
    linear-gradient(160deg, #1b2838 0%, #243447 45%, #f0f3f6 45%);
}

/* ——— Page chrome ——— */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.page-header h1 {
  font-size: 1.55rem;
  margin: 0;
  color: var(--ew-text);
  font-weight: 700;
}

.content-panel {
  background: var(--ew-surface);
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 2px 10px rgba(36, 52, 71, 0.04);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 1rem;
  align-items: center;
}

.btn-brand,
.btn-primary {
  background: var(--ew-primary);
  border-color: var(--ew-primary);
  color: #fff;
  border-radius: 6px;
  font-weight: 600;
}

.btn-brand:hover,
.btn-primary:hover {
  background: var(--ew-primary-hover);
  border-color: var(--ew-primary-hover);
  color: #fff;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success,
.btn-outline-danger {
  border-radius: 6px;
  font-weight: 600;
}

.btn-outline-primary {
  color: var(--ew-primary);
  border-color: var(--ew-primary);
}

.btn-outline-primary:hover {
  background: var(--ew-primary);
  border-color: var(--ew-primary);
  color: #fff;
}

.form-control,
.form-select {
  border-radius: 6px;
  border-color: var(--ew-border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--ew-primary);
  box-shadow: 0 0 0 0.2rem rgba(74, 105, 189, 0.18);
}

.table thead th {
  background: #f5f7fa;
  color: var(--ew-text);
  font-weight: 600;
  border-bottom: 1px solid var(--ew-border);
  font-size: 0.88rem;
}

.table > :not(caption) > * > * {
  vertical-align: middle;
}

.nav-tabs {
  border-bottom: 1px solid var(--ew-border);
}

.nav-tabs .nav-link {
  border: 0;
  color: var(--ew-muted);
  font-weight: 600;
  border-radius: 6px 6px 0 0;
}

.nav-tabs .nav-link.active {
  color: var(--ew-primary);
  background: transparent;
  border-bottom: 2px solid var(--ew-primary);
}

#globalModal .modal-header {
  background: var(--ew-sidebar);
  color: #fff;
  border-bottom: 0;
}

#globalModal .modal-header .btn-close {
  filter: invert(1);
}

#globalModal .modal-content {
  border: 0;
  border-radius: 10px;
  overflow: hidden;
}

.stat-widget {
  background: var(--ew-surface);
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  box-shadow: 0 2px 8px rgba(36, 52, 71, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.stat-widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(36, 52, 71, 0.08);
  color: inherit;
}

.stat-widget .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--ew-primary);
  line-height: 1.1;
}

.stat-widget .stat-label {
  color: var(--ew-muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.risk-pie {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px var(--ew-border);
}

.pie-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
}

.bar-chart {
  display: grid;
  gap: 0.75rem;
}

.bar-chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 40px;
  gap: 0.75rem;
  align-items: center;
}

.bar-track {
  height: 12px;
  background: #e6edf3;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ew-primary), var(--ew-primary-hover));
  border-radius: 999px;
}

.process-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.process-tile {
  background: #fff;
  border: 1px solid var(--ew-border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: 0 2px 8px rgba(36, 52, 71, 0.04);
  min-height: 140px;
}

.process-tile-wide {
  grid-column: 1 / -1;
}

.process-tile h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ew-text);
  margin-bottom: 0.75rem;
}

.framework-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 0.35rem;
  margin-right: 0.35rem;
  color: #fff;
  vertical-align: middle;
}

.framework-bgys { background: #4a69bd; }
.framework-kys { background: #d4a017; color: #1c2b36; }
.framework-kvkk { background: #c44569; }

.badge-score-low { background: #6c757d; }
.badge-score-medium { background: #f0ad4e; }
.badge-score-high { background: #fd7e14; }
.badge-score-critical { background: #dc3545; }

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 18px 40px rgba(27, 40, 56, 0.22);
}

.login-card h1 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ew-text);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  z-index: 1035;
}

.sidebar-backdrop.show {
  display: block;
}

.sidebar-item-hidden {
  display: none !important;
}

.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 1080;
  background: rgba(15, 23, 32, 0.48);
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.help-overlay[hidden] {
  display: none !important;
}

.help-panel {
  width: min(920px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 22px 50px rgba(27, 40, 56, 0.28);
}

.help-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.4rem 1rem;
  border-bottom: 1px solid var(--ew-border);
}

.help-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ew-primary);
}

.help-panel-body {
  padding: 1.25rem 1.4rem 1.5rem;
}

.help-intro {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.help-card {
  border: 1px solid var(--ew-border);
  border-radius: 12px;
  padding: 1rem 1.05rem;
  background: #f8fafc;
}

.help-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ew-primary);
  color: #fff;
  display: grid;
  place-items: center;
  margin-bottom: 0.7rem;
}

.help-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}

.help-card p {
  margin: 0;
  color: var(--ew-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.help-flow-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.help-flow {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  align-items: stretch;
  gap: 0.55rem;
}

.help-step {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #fff;
  border: 1px solid var(--ew-border);
  border-radius: 12px;
  padding: 0.9rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.help-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.42rem;
  width: 0.3rem;
  height: 0.3rem;
  border-top: 2px solid #b7c4d4;
  border-right: 2px solid #b7c4d4;
  transform: translateY(-50%) rotate(45deg);
}

.help-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ew-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-bottom: 0.25rem;
}

.help-step strong {
  font-size: 0.88rem;
}

.help-step small {
  color: var(--ew-muted);
  line-height: 1.4;
}

.help-hint {
  color: var(--ew-muted);
  font-size: 0.82rem;
}

@media (max-width: 767.98px) {
  .help-intro,
  .help-flow {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .help-step:not(:last-child)::after {
    top: auto;
    right: auto;
    left: 50%;
    bottom: -0.42rem;
    transform: translateX(-50%) rotate(135deg);
  }
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .topbar-quick .quick-item:nth-child(n+4) {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .topbar-quick {
    display: none;
  }

  .app-content {
    padding: 1rem;
  }
}
