/* Design system extracted from the business's original "clearpath" mockup
   - see docs/design-system.md in the repo root for the full spec and
   exact source citations. Palette/spacing/type values below are copied
   from that doc, not guessed. */

:root {
  --navy: #082035;
  --blue: #15587A;
  --ltblue: #59B5E3;
  --surface: #FAFAFA;
  --border: #C9E6F5;
  --tint: #EBF6FC;
  --gold: #d5a34f;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--navy);
  margin: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  color: var(--navy);
}

h1, h2, h3 {
  color: var(--navy);
  font-weight: 600;
  margin: 0;
}

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

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.app-sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.app-header {
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.app-content {
  padding: 24px;
  max-width: 1200px;
}

.nav-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--navy);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.sidebar-backdrop {
  display: none;
}

@media (max-width: 900px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 101;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 24px rgba(0, 0, 0, .18);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .nav-toggle-btn {
    display: inline-flex;
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 32, 53, .4);
    z-index: 100;
  }
}

/* ---------- Sidebar internals ---------- */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.sidebar-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.sidebar-logo-mark .dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff;
}

.sidebar-logo-text b {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.sidebar-logo-text span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--blue);
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 24px 0 8px;
  padding: 0 8px;
}

.sidebar-workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--tint);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 8px;
}

.sidebar-workspace-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.sidebar-workspace-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
}

.sidebar-workspace-role {
  font-size: 11px;
  color: var(--blue);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--tint);
  color: var(--navy);
}

.nav-item.active {
  background: var(--navy);
  color: #fff;
}

.nav-item.active .bi {
  color: var(--ltblue);
}

.nav-item .count-pill {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--blue);
}

.nav-item.active .count-pill {
  background: var(--blue);
  color: #fff;
}

.sidebar-help {
  border: 1px solid var(--border);
  background: var(--tint);
  border-radius: 12px;
  padding: 14px;
  margin-top: 24px;
}

.sidebar-help h6 {
  font-size: 13px;
  font-weight: 700;
  margin: 6px 0 4px;
  color: var(--navy);
}

.sidebar-help p {
  font-size: 12px;
  color: var(--blue);
  margin: 0 0 8px;
}

.sidebar-spacer {
  flex: 1;
}

/* ---------- Header internals ---------- */

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--blue);
}

.header-breadcrumb .current {
  color: var(--navy);
  font-weight: 700;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.header-user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.header-logout-form button {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.header-logout-form button:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* ---------- Cards ---------- */

.card-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.card-panel.tint {
  background: var(--tint);
  border: none;
}

.card-panel.navy {
  background: var(--navy);
  color: #fff;
  border: none;
}

.card-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 900px) {
  .card-grid.stats-3 {
    grid-template-columns: 1.3fr .7fr .7fr;
  }
  .card-grid.split-2 {
    grid-template-columns: 1.45fr .75fr;
  }
}

.card-label {
  font-size: 13px;
  color: var(--blue);
  margin: 0 0 6px;
}

.card-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.card-big-number {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--navy);
  line-height: 1;
}

.divide-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.divide-list > li {
  border-top: 1px solid var(--tint);
  padding: 14px 0;
}

.divide-list > li:first-child {
  border-top: none;
  padding-top: 8px;
}

/* ---------- Buttons ---------- */

.btn-app-primary {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 5px 16px rgba(8, 32, 53, .22);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.btn-app-primary:hover {
  background: var(--blue);
  color: #fff;
}

.btn-app-secondary {
  background: var(--surface);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.btn-app-secondary:hover {
  background: var(--tint);
  color: var(--navy);
}

.btn-app-outline-light {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--blue);
  border-radius: 12px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.btn-app-outline-light:hover {
  background: var(--tint);
}

.btn-app-ghost {
  background: none;
  border: none;
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.btn-app-ghost:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* Filter pills (e.g. Scan Details severity filter) */
.filter-pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
}
.filter-pill:hover {
  border-color: var(--ltblue);
  color: var(--navy);
}
.filter-pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* ---------- Pills / badges ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pill-critical { background: #fff0ee; color: #bb4c3e; border-color: #f3c6bf; }
.pill-serious  { background: #fff7e5; color: #9a6811; border-color: #edd49b; }
.pill-moderate { background: #edf3ff; color: #4569a6; border-color: #c9d8f4; }
.pill-minor    { background: #edf7f2; color: #3f7a68; border-color: #c6e4d6; }
.pill-positive { background: #edf7f2; color: #3f7a68; border-color: #c6e4d6; }
.pill-neutral  { background: var(--tint); color: var(--blue); border-color: var(--border); }
.pill-info     { background: #edf3ff; color: #4569a6; border-color: #c9d8f4; }

/* ---------- Score ring ---------- */

.score-ring {
  position: relative;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.score-ring.small {
  width: 80px;
  height: 80px;
}

.score-ring-inner {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-ring.small .score-ring-inner {
  width: 62px;
  height: 62px;
}

.score-ring-value {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.score-ring.small .score-ring-value {
  font-size: 18px;
}

.score-ring-caption {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ltblue);
  margin-top: 2px;
}

/* ---------- Tables inside cards ---------- */

.table-clean {
  border-spacing: 0;
}

.table-clean thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue);
  padding: 0 16px 10px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-clean tbody td {
  padding: 14px 16px 14px 0;
  border-bottom: 1px solid var(--tint);
  font-size: 14px;
  color: var(--navy);
}

.table-clean thead th:last-child,
.table-clean tbody td:last-child {
  padding-right: 0;
}

.table-clean tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Forms ---------- */

.form-group-app {
  margin-bottom: 16px;
}

.form-group-app label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 6px;
}

.form-group-app input[type="text"],
.form-group-app input[type="email"],
.form-group-app input[type="password"],
.form-group-app input[type="number"],
.form-group-app input[type="date"],
.form-group-app input[type="url"],
.form-group-app select,
.form-group-app textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--navy);
  background: #fff;
}

.form-group-app input:focus,
.form-group-app select:focus,
.form-group-app textarea:focus {
  outline: none;
  border-color: var(--ltblue);
  box-shadow: 0 0 0 3px rgba(89, 181, 227, .3);
}

.field-error {
  color: #bb4c3e;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

.alert-app {
  border-radius: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  background: var(--tint);
  margin-bottom: 16px;
}

.alert-app.warn {
  background: #fff7e5;
  border-color: #edd49b;
}

.alert-app.danger {
  background: #fff0ee;
  border-color: #f3c6bf;
  color: #8a1c1c;
}

.alert-app.success {
  background: #edf7f2;
  border-color: #c6e4d6;
}
