/* =====================================================================
   KRYPTON — application shell styling
   Palette matches the KRYPTON analysis tool (deep forest green on white).
   ===================================================================== */

:root {
  --ci-green-900: #0B2E20;
  --ci-green-800: #0E3A28;
  --ci-green-700: #12432E;
  --ci-green-600: #14512F;
  --ci-green-500: #176B3A;
  --ci-green-400: #1F8A4C;
  --ci-green-300: #2E9E5B;
  --ci-green-200: #4CAF50;
  --ci-mint:      #EAFBF0;
  --ci-mint-2:    #BFE3CC;

  --ci-ink:       #12261B;
  --ci-dim:       #4A6153;
  --ci-faint:     #7C978A;
  --ci-line:      #DCE7DF;
  --ci-line-2:    #C3D6C9;
  --ci-panel:     #FFFFFF;
  --ci-panel-2:   #F3F8F4;
  --ci-bg:        #F5F8F6;

  --ci-amber:     #B7791F;
  --ci-red:       #C62828;
  --ci-blue:      #1B6CA8;

  --ci-topbar-h:  58px;
  --ci-sidebar-w: 246px;
  --ci-mono: 'Courier New', Courier, monospace;
  --ci-sans: 'Times New Roman', Times, Georgia, serif;

  --bs-primary: #14512F;
}

/* ---------- base ---------- */
html, body { height: 100%; }

body.ci-app {
  margin: 0;
  background: var(--ci-bg);
  color: var(--ci-ink);
  font-family: var(--ci-sans);
  font-size: 15px;
  padding-top: var(--ci-topbar-h);
  padding-left: var(--ci-sidebar-w);
  min-height: 100vh;
}

body.ci-auth {
  padding: 0;
  background:
    radial-gradient(1100px 620px at 12% -10%, rgba(46,158,91,.22), transparent 60%),
    linear-gradient(160deg, #0B2E20 0%, #12432E 45%, #14512F 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

a { color: var(--ci-green-500); }
a:hover { color: var(--ci-green-400); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ci-panel-2); }
::-webkit-scrollbar-thumb { background: var(--ci-line-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ci-green-400); }

/* ---------- topbar ---------- */
.ci-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--ci-topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: linear-gradient(90deg, var(--ci-green-800), var(--ci-green-600));
  border-bottom: 3px solid var(--ci-green-900);
  z-index: 1040;
}

.ci-burger {
  display: none; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  color: #fff; border-radius: 7px; width: 36px; height: 34px; font-size: 18px; line-height: 1;
}

.ci-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.ci-logo {
  width: 34px; height: 34px; border-radius: 7px; flex: 0 0 34px;
  background: linear-gradient(135deg, var(--ci-green-200), var(--ci-green-900));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: 1px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.25), 0 2px 10px rgba(51,196,107,.35);
}
.ci-brandtext b { color: #fff; font-size: 18px; letter-spacing: 3px; display: block; line-height: 1.1; }
.ci-brandtext small { color: var(--ci-mint-2); font-size: 9.5px; letter-spacing: .4px; text-transform: uppercase; }
@media (max-width: 991px) { .ci-brandtext small { display: none; } }

.ci-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ci-role-pill {
  color: var(--ci-mint); border: 1px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.10); border-radius: 20px;
  padding: 4px 12px; font-size: 11.5px; font-family: var(--ci-mono); white-space: nowrap;
}
@media (max-width: 767px) { .ci-role-pill { display: none; } }

.ci-icon-btn {
  color: #fff; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28);
  border-radius: 7px; padding: 6px 11px; font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center;
}
.ci-icon-btn:hover { background: rgba(255,255,255,.24); color: #fff; }

.ci-dot {
  position: absolute; top: -6px; right: -6px; background: var(--ci-red); color: #fff;
  border-radius: 10px; font-size: 10px; padding: 1px 5px; font-family: var(--ci-mono);
  border: 2px solid var(--ci-green-700); min-width: 18px; text-align: center;
}

.ci-user-btn {
  display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.28); color: #fff; border-radius: 22px;
  padding: 4px 12px 4px 4px; font-size: 13px;
}
.ci-user-btn:hover { background: rgba(255,255,255,.24); }
.ci-user-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ci-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .5px;
  border: 2px solid rgba(255,255,255,.45);
}
.ci-avatar.lg { width: 56px; height: 56px; flex-basis: 56px; font-size: 20px; }
.ci-avatar.sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10px; border-width: 1px; }

/* ---------- sidebar ---------- */
.ci-sidebar {
  position: fixed; top: var(--ci-topbar-h); bottom: 0; left: 0; width: var(--ci-sidebar-w);
  background: var(--ci-green-700); border-right: 1px solid var(--ci-green-900);
  display: flex; flex-direction: column; overflow-y: auto; z-index: 1030;
  transition: transform .22s ease;
}

.ci-nav { padding: 10px 0; flex: 1; }

.ci-nav-group {
  padding: 14px 18px 5px; font-size: 9.5px; letter-spacing: 1.6px;
  text-transform: uppercase; color: #7FBF9A;
}

.ci-nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 18px;
  color: rgba(255,255,255,.84); font-size: 13.5px; text-decoration: none;
  border-left: 3px solid transparent;
}
.ci-nav-item i { width: 18px; text-align: center; font-size: 15px; }
.ci-nav-item:hover { background: rgba(255,255,255,.10); color: #fff; }
.ci-nav-item.active {
  background: #fff; color: var(--ci-green-600); border-left-color: var(--ci-green-200); font-weight: 600;
}
.ci-nav-label { flex: 1; }
.ci-nav-count {
  background: rgba(255,255,255,.16); color: var(--ci-mint); font-family: var(--ci-mono);
  font-size: 10.5px; padding: 1px 7px; border-radius: 10px; min-width: 22px; text-align: center;
}
.ci-nav-item.active .ci-nav-count { background: var(--ci-green-600); color: #fff; }
.ci-nav-count.alert { background: var(--ci-red); color: #fff; }

.ci-sidebar-foot {
  padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.12);
  color: #9CC7AE; font-size: 11px; line-height: 1.5;
}

.ci-scrim {
  display: none; position: fixed; inset: var(--ci-topbar-h) 0 0 0;
  background: rgba(11,46,32,.55); z-index: 1025;
}

/* ---------- main ---------- */
.ci-main { min-height: calc(100vh - var(--ci-topbar-h)); display: flex; flex-direction: column; }

.ci-pagehead {
  background: var(--ci-panel); border-bottom: 1px solid var(--ci-line);
  padding: 16px 26px; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.ci-pagesub { color: var(--ci-dim); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.ci-pagehead h1 { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: .3px; color: var(--ci-green-600); }
.ci-pagehead-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.ci-content { padding: 22px 26px 34px; flex: 1; }

.ci-foot {
  border-top: 1px solid var(--ci-line); background: var(--ci-panel);
  padding: 10px 26px; display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ci-faint);
}

/* ---------- cards ---------- */
.ci-card {
  background: var(--ci-panel); border: 1px solid var(--ci-line); border-radius: 10px;
  box-shadow: 0 1px 3px rgba(18,38,27,.06);
}
.ci-card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--ci-line);
  font-size: 11.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--ci-dim);
  display: flex; align-items: center; gap: 8px;
}
.ci-card-head .ci-card-tag { margin-left: auto; font-family: var(--ci-mono); font-size: 11px; color: var(--ci-faint); text-transform: none; letter-spacing: 0; }
.ci-card-body { padding: 16px; }
.ci-card-body.p0 { padding: 0; }

/* stat tiles */
.ci-stat {
  background: var(--ci-panel); border: 1px solid var(--ci-line); border-radius: 10px;
  padding: 15px 16px; height: 100%; position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(18,38,27,.06);
}
.ci-stat::after {
  content: ''; position: absolute; right: -14px; top: -14px; width: 74px; height: 74px;
  border-radius: 50%; background: var(--ci-panel-2);
}
.ci-stat .ci-stat-ic {
  position: absolute; right: 12px; top: 12px; font-size: 22px; color: var(--ci-green-400); opacity: .55; z-index: 1;
}
.ci-stat .k { font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--ci-faint); position: relative; z-index: 1; }
.ci-stat .v { font-size: 30px; font-weight: 700; font-family: var(--ci-mono); margin: 5px 0 2px; color: var(--ci-green-600); position: relative; z-index: 1; }
.ci-stat .d { font-size: 11.5px; color: var(--ci-dim); position: relative; z-index: 1; }
.ci-stat.red   .v { color: var(--ci-red); }    .ci-stat.red   .ci-stat-ic { color: var(--ci-red); }
.ci-stat.amber .v { color: var(--ci-amber); }  .ci-stat.amber .ci-stat-ic { color: var(--ci-amber); }
.ci-stat.blue  .v { color: var(--ci-blue); }   .ci-stat.blue  .ci-stat-ic { color: var(--ci-blue); }

/* ---------- tables ---------- */
.ci-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ci-table thead th {
  text-align: left; padding: 10px 12px; background: var(--ci-panel-2); color: var(--ci-faint);
  font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase;
  border-bottom: 1px solid var(--ci-line); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.ci-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--ci-line); vertical-align: middle; }
.ci-table tbody tr:hover { background: var(--ci-panel-2); }
.ci-table .mono { font-family: var(--ci-mono); font-size: 12px; }
.ci-table .trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-table-wrap { overflow-x: auto; }

/* ---------- DataTables ---------- */
.ci-table-wrap { overflow-x: visible; }          /* Responsive handles overflow */

div.dt-container { padding: 12px 14px 6px; font-size: 13px; }
div.dt-container .dt-layout-row { align-items: center; }

div.dt-container .dt-search { display: flex; align-items: center; gap: 8px; }
div.dt-container .dt-search input {
  border: 1px solid var(--ci-line-2); border-radius: 7px; padding: 6px 11px 6px 30px;
  font-size: 13px; min-width: 210px; background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%237C978A'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E")
    no-repeat 9px center / 13px;
}
div.dt-container .dt-search input:focus {
  outline: none; border-color: var(--ci-green-400); box-shadow: 0 0 0 .2rem rgba(46, 158, 91, .16);
}
div.dt-container .dt-search label { display: none; }

div.dt-container .dt-length { display: flex; align-items: center; gap: 7px; color: var(--ci-faint); font-size: 12px; }
div.dt-container .dt-length select {
  border: 1px solid var(--ci-line-2); border-radius: 6px; padding: 5px 26px 5px 9px; font-size: 12.5px;
}

div.dt-container .dt-info { color: var(--ci-faint); font-size: 12px; padding-top: 4px; }

div.dt-container .dt-paging .pagination { margin: 0; }
div.dt-container .dt-paging .page-link {
  color: var(--ci-green-600); border-color: var(--ci-line); font-size: 12.5px; padding: 5px 11px;
}
div.dt-container .dt-paging .page-item.active .page-link {
  background: var(--ci-green-600); border-color: var(--ci-green-600); color: #fff;
}
div.dt-container .dt-paging .page-item.disabled .page-link { color: var(--ci-line-2); }

table.ci-table.dataTable > thead > tr > th { border-bottom: 1px solid var(--ci-line); }
table.ci-table.dataTable > thead > tr > th.dt-orderable-asc:hover,
table.ci-table.dataTable > thead > tr > th.dt-orderable-desc:hover { background: #E8F1EA; cursor: pointer; }
table.ci-table.dataTable > thead > tr > th span.dt-column-order::before,
table.ci-table.dataTable > thead > tr > th span.dt-column-order::after { color: var(--ci-green-400); }

/* Responsive expander */
table.ci-table.dtr-inline.collapsed > tbody > tr > td.dtr-control::before {
  background-color: var(--ci-green-500); border-radius: 50%; border: none;
  box-shadow: 0 1px 3px rgba(18, 38, 27, .25); content: '+'; color: #fff;
  font-family: var(--ci-mono); font-weight: 700; line-height: 1.05rem;
}
table.ci-table.dtr-inline.collapsed > tbody > tr.dtr-expanded > td.dtr-control::before {
  content: '-'; background-color: var(--ci-red);
}
table.ci-table > tbody > tr > td.dtr-control { cursor: pointer; }

ul.dtr-details { width: 100%; padding: 0; margin: 6px 0 2px; list-style: none; }
ul.dtr-details > li {
  border-bottom: 1px solid var(--ci-panel-2); padding: 5px 0;
  display: flex; gap: 10px; font-size: 12.5px;
}
ul.dtr-details > li:last-child { border-bottom: none; }
ul.dtr-details .dtr-title {
  min-width: 120px; font-weight: 600; color: var(--ci-faint);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; padding-top: 2px;
}
ul.dtr-details .dtr-data { flex: 1; }

@media (max-width: 767px) {
  div.dt-container .dt-search input { min-width: 0; width: 100%; }
  div.dt-container .dt-layout-row { flex-direction: column; align-items: stretch; gap: 8px; }
  div.dt-container .dt-layout-cell { justify-content: flex-start !important; }
  div.dt-container .dt-paging .pagination { flex-wrap: wrap; }
}

@media print {
  div.dt-container .dt-search,
  div.dt-container .dt-length,
  div.dt-container .dt-paging { display: none !important; }
}

/* ---------- misc ---------- */
.ci-empty { text-align: center; color: var(--ci-faint); padding: 46px 20px; }
.ci-empty i { font-size: 40px; opacity: .45; display: block; margin-bottom: 10px; }
.ci-empty b { color: var(--ci-dim); display: block; margin-bottom: 4px; font-size: 15px; }

.ci-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--ci-panel-2);
  border: 1px solid var(--ci-line-2); color: var(--ci-dim); padding: 4px 11px;
  border-radius: 16px; font-size: 12px; text-decoration: none;
}
.ci-chip:hover { border-color: var(--ci-green-400); color: var(--ci-green-500); }
.ci-chip.on { background: var(--ci-green-600); border-color: var(--ci-green-600); color: #fff; }

.ci-mono { font-family: var(--ci-mono); font-size: 12px; }
.ci-dim  { color: var(--ci-dim); }
.ci-faint { color: var(--ci-faint); }

.btn-krypton { background: var(--ci-green-600); border-color: var(--ci-green-600); color: #fff; }
.btn-krypton:hover, .btn-krypton:focus { background: var(--ci-green-500); border-color: var(--ci-green-500); color: #fff; }
.btn-outline-krypton { border-color: var(--ci-line-2); color: var(--ci-green-600); background: #fff; }
.btn-outline-krypton:hover { background: var(--ci-green-600); border-color: var(--ci-green-600); color: #fff; }

.ci-timeline { position: relative; padding-left: 26px; }
.ci-timeline::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--ci-line-2); }
.ci-tl-item { position: relative; padding: 9px 0 9px 8px; border-bottom: 1px solid var(--ci-panel-2); }
.ci-tl-item:last-child { border-bottom: 0; }
.ci-tl-dot {
  position: absolute; left: -22px; top: 14px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--ci-green-400); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--ci-line-2);
}
.ci-tl-dot.red { background: var(--ci-red); }
.ci-tl-dot.amber { background: var(--ci-amber); }
.ci-tl-dot.grey { background: var(--ci-faint); }

.ci-progress { height: 7px; background: var(--ci-panel-2); border-radius: 4px; overflow: hidden; }
.ci-progress > span { display: block; height: 100%; background: var(--ci-green-400); }

.ci-sev-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: var(--ci-panel-2); }
.ci-sev-bar > i { display: block; height: 100%; }
.ci-sev-bar .high { background: var(--ci-red); }
.ci-sev-bar .medium { background: var(--ci-amber); }
.ci-sev-bar .low { background: var(--ci-blue); }
.ci-sev-bar .info { background: var(--ci-green-300); }

/* ---------- auth pages ---------- */
.ci-auth-wrap { width: 100%; max-width: 1000px; margin: 28px auto; padding: 0 16px; }
.ci-auth-card {
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(6,24,15,.42); display: grid; grid-template-columns: 1fr 1fr;
}
@media (max-width: 860px) { .ci-auth-card { grid-template-columns: 1fr; } .ci-auth-side { display: none; } }

.ci-auth-side {
  background: linear-gradient(160deg, var(--ci-green-800), var(--ci-green-600));
  color: #fff; padding: 40px 34px; display: flex; flex-direction: column;
}
.ci-auth-side h2 { font-size: 25px; letter-spacing: 3px; margin: 20px 0 6px; }
.ci-auth-side p { color: var(--ci-mint-2); font-size: 13.5px; line-height: 1.7; }
.ci-auth-feature { display: flex; gap: 11px; align-items: flex-start; margin-top: 15px; font-size: 13px; color: rgba(255,255,255,.9); }
.ci-auth-feature i { color: var(--ci-green-200); font-size: 16px; margin-top: 2px; }

.ci-auth-body { padding: 38px 36px; }
@media (max-width: 575px) { .ci-auth-body { padding: 28px 22px; } }
.ci-auth-body h1 { font-size: 23px; color: var(--ci-green-600); margin-bottom: 4px; }

.form-control, .form-select { border-color: var(--ci-line-2); padding: 10px 12px; font-size: 14px; }
.form-control:focus, .form-select:focus { border-color: var(--ci-green-400); box-shadow: 0 0 0 .2rem rgba(46,158,91,.16); }
.form-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--ci-faint); margin-bottom: 5px; }

.ci-divider { display: flex; align-items: center; gap: 12px; color: var(--ci-faint); font-size: 11.5px; margin: 20px 0; }
.ci-divider::before, .ci-divider::after { content: ''; flex: 1; height: 1px; background: var(--ci-line); }

.ci-pw-meter { height: 5px; border-radius: 3px; background: var(--ci-line); overflow: hidden; margin-top: 7px; }
.ci-pw-meter > span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; }

/* federated sign-in buttons */
.ci-btn-oauth {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; border: 1px solid var(--ci-line-2); color: var(--ci-ink);
  padding: 9px 12px; font-size: 13.5px; font-weight: 600; border-radius: 8px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.ci-btn-oauth:hover:not(:disabled) {
  border-color: var(--ci-green-400); background: var(--ci-panel-2);
  box-shadow: 0 2px 8px rgba(18, 38, 27, .08); color: var(--ci-ink);
}
.ci-btn-oauth:disabled { opacity: .6; cursor: progress; }
.ci-btn-oauth svg, .ci-btn-oauth i { flex: 0 0 auto; }
.ci-btn-oauth span { line-height: 1; }

@media (max-width: 360px) {
  .ci-btn-oauth { font-size: 12.5px; padding: 9px 6px; gap: 5px; }
}

/* ---------- responsive ---------- */
@media (max-width: 991px) {
  body.ci-app { padding-left: 0; }
  .ci-burger { display: inline-flex; align-items: center; justify-content: center; }
  .ci-sidebar { transform: translateX(-100%); }
  .ci-sidebar.open { transform: translateX(0); }
  .ci-scrim.show { display: block; }
  .ci-content { padding: 18px 16px 30px; }
  .ci-pagehead { padding: 14px 16px; }
}

/* ---------- print ---------- */
@media print {
  .ci-topbar, .ci-sidebar, .ci-foot, .ci-pagehead-actions, .ci-scrim { display: none !important; }
  body.ci-app { padding: 0; background: #fff; }
  .ci-card, .ci-stat { box-shadow: none; }
}
