@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F3F7F9;
  --panel: #FFFFFF;
  --ink: #142A36;
  --muted: #586C78;
  --line: #D9E4EB;
  --primary: #0E808C;
  --primary-dark: #0B3954;
  --primary-tint: #E4F4F5;
  --accent: #B35B30;
  --accent-tint: #FBEDE6;
  --danger: #A6402F;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,42,54,.06), 0 6px 20px rgba(20,42,54,.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .4em 0;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: 'IBM Plex Mono', monospace; }

/* ---------- Layout shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: linear-gradient(90deg, #ffffff 0, #ffffff 150px, var(--primary-dark) 480px, var(--primary-dark) 100%);
  color: #F4F8F6;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 62px;
  flex-wrap: wrap;
}

.brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}
.brand-logo {
  height: 124px;
  width: auto;
  display: block;
}
.tag {
  background: var(--accent);
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 3px 8px;
  border-radius: 4px;
  transform: rotate(-2deg);
  white-space: nowrap;
  display: inline-block;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
}

.nav-links a {
  color: #CFE3DB;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 500;
  position: relative;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
}
.badge-count {
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 6px;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #CFE3DB;
  font-size: .88rem;
}
.user-box form { margin: 0; }
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .82rem;
}
.btn-logout:hover { background: rgba(255,255,255,.12); }

.content {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Cards / sections ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.section-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.section-box h3 {
  font-size: .95rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary-tint);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

/* ---------- Specimen tag (signature element for KER numbers) ---------- */
.specimen-tag {
  display: inline-flex;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: .82rem;
  color: var(--accent);
  border: 1.5px dashed var(--accent);
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--accent-tint);
  transform: rotate(-1deg);
  white-space: nowrap;
}
.specimen-tag.lg { font-size: 1.05rem; padding: 4px 12px; }

/* ---------- Dashboard ---------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.page-header p { color: var(--muted); margin: 4px 0 0; }

.stat-strip {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 18px;
  min-width: 140px;
}
.stat .num { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.stat .lbl { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filters input, .filters select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--panel);
}
.filters input { flex: 1; min-width: 200px; }

.ker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.ker-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.ker-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(22,35,31,.08), 0 10px 24px rgba(22,35,31,.08);
}
.ker-card h4 { font-size: 1rem; margin: 6px 0 2px; }
.ker-card .desc {
  color: var(--muted);
  font-size: .86rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ker-card .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: .78rem;
  color: var(--muted);
}
.trl-pill {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: .76rem;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--primary-tint); text-decoration: none; }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: #FBEAE6; }
.btn-sm { padding: 6px 12px; font-size: .8rem; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
.form-row label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 5px;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: .92rem;
  background: #fff;
  color: var(--ink);
}
.form-row textarea { resize: vertical; min-height: 80px; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field-error { color: var(--danger); font-size: .78rem; margin-top: 4px; }

.involvement-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
  background: #FAFBF9;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.involvement-card:hover,
.involvement-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(31,111,92,.08);
}
.involvement-index {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: .78rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.involvement-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 12px;
  min-width: 0;
}
.mini-field label {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 5px;
}
.mini-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: .85rem;
  background: #fff;
  color: var(--ink);
}
.mini-field-wide { grid-column: 1 / -1; }
.mini-field label .hint { text-transform: none; letter-spacing: 0; font-weight: 400; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.mini-field .check-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.mini-field .check-pill input { margin: 0; accent-color: var(--primary); }
.mini-field .check-pill:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary-dark);
}
.mini-field select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.remove-row-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--danger);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  transition: background-color .12s ease, border-color .12s ease;
}
.remove-row-btn:hover {
  background: #FBEAE6;
  border-color: #F3CFC6;
}

.beneficiary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.beneficiary-row select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: .85rem;
  background: #fff;
  color: var(--ink);
}
.beneficiary-row select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ---------- Toggle switch (Yes/No beyond-SoA) ---------- */
.toggle-row { display: flex; align-items: center; gap: 12px; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--line);
  transition: background-color .15s ease;
  border-radius: 999px;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: transform .15s ease;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.toggle-switch input:checked ~ .toggle-slider {
  background-color: var(--primary);
}
.toggle-switch input:checked ~ .toggle-slider::before {
  transform: translateX(18px);
}
.toggle-switch input:focus-visible ~ .toggle-slider {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.toggle-text {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* ---------- Detail page ---------- */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.trl-track {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: .85rem;
  margin-top: 10px;
}
.trl-step {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 4px 9px;
}
.trl-arrow { color: var(--muted); }
.dl-list { display: grid; grid-template-columns: 1fr; gap: 6px; }
.dl-list dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 8px; }
.dl-list dd { margin: 0; }

table.involvement-table, table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.involvement-table th, table.involvement-table td,
table.data-table th, table.data-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 10px;
}
table.involvement-table th, table.data-table th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-role-admin { background: var(--accent-tint); color: var(--accent); }
.chip-role-partner { background: var(--primary-tint); color: var(--primary-dark); }
.chip {
  display: inline-block;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 9px;
}
.chip-lead { background: var(--accent-tint); color: var(--accent); }
.chip-partner { background: var(--primary-tint); color: var(--primary-dark); }
.chip-yes { background: var(--accent-tint); color: var(--accent); }
.chip-no { background: #EEF1EC; color: var(--muted); }

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--primary-dark), #0C332A);
  padding: 20px;
}
.login-card {
  background: var(--panel);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.login-logo {
  height: 116px;
  width: auto;
  display: block;
}
.login-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); font-size: .86rem; margin-bottom: 22px; }
.alert-error {
  background: #FBEAE6;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 16px;
}
.alert-info {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .85rem;
  margin-bottom: 16px;
}

/* ---------- Messages page ---------- */
.messages-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  min-height: 460px;
}
.conv-list { border-right: 1px solid var(--line); padding-right: 14px; }
.conv-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  color: var(--ink);
}
.conv-item:hover, .conv-item.active { background: var(--primary-tint); text-decoration: none; }
.conv-item .name { font-weight: 600; font-size: .9rem; }
.conv-item .preview { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread { display: flex; flex-direction: column; height: 100%; }
.thread-messages { flex: 1; overflow-y: auto; padding: 4px 4px 12px; max-height: 420px; }
.msg-bubble {
  max-width: 70%;
  padding: 9px 13px;
  border-radius: 12px;
  margin-bottom: 8px;
  font-size: .88rem;
}
.msg-bubble.mine { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 3px; }
.msg-bubble.theirs { background: var(--primary-tint); color: var(--ink); border-bottom-left-radius: 3px; }
.msg-bubble .time { display: block; font-size: .68rem; opacity: .7; margin-top: 3px; }
.thread-compose { display: flex; gap: 8px; margin-top: 12px; }
.thread-compose input { flex: 1; }

/* ---------- Events / calendar board ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-dow { text-align: center; font-size: .72rem; text-transform: uppercase; color: var(--muted); padding-bottom: 4px; }
.cal-cell {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
  font-size: .78rem;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell .day-num { font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.cal-cell.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.cal-event {
  background: var(--accent-tint);
  color: var(--accent);
  border-radius: 5px;
  padding: 2px 5px;
  margin-bottom: 3px;
  font-size: .7rem;
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upcoming-list { list-style: none; margin: 0; padding: 0; }
.upcoming-list li { padding: 10px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; }
.upcoming-list .ev-date { font-family: 'IBM Plex Mono', monospace; color: var(--accent); font-weight: 600; font-size: .82rem; white-space: nowrap; }









/* ==========================================
   OTP VERIFICATION PAGE
   ========================================== */

.otp-card {
    max-width: 400px;
}

.otp-title {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

.otp-description {
    text-align: center;
    line-height: 1.7;
}

.otp-email {
    display: block;
    color: var(--primary-dark);
    font-weight: 600;
    overflow-wrap: anywhere;
    margin-top: 4px;
}

/* Six-digit input layout */

.otp-input-row {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 18px;
}

/* Individual OTP boxes */

.otp-input-row .otp-digit {
    width: 100%;
    min-width: 0;
    height: 52px;

    padding: 0;

    border: 1.5px solid var(--line);
    border-radius: 9px;

    background: #fff;
    color: var(--ink);

    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;

    caret-color: var(--primary);

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

/* Focused digit */

.otp-input-row .otp-digit:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 92, .12);
}

/* Disabled after expiration */

.otp-input-row .otp-digit:disabled {
    background: var(--bg);
    opacity: .65;
    cursor: not-allowed;
}

/* Countdown */

.otp-timer-text {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    margin: 8px 0 18px;
}

.otp-timer-text strong {
    color: var(--primary-dark);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
}

/* Action buttons */

.otp-action-button {
    width: 100%;
    justify-content: center;
}

.otp-action-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.otp-resend-form {
    margin-top: 14px;
}

.otp-back {
    text-align: center;
    font-size: .8rem;
    margin-top: 18px;
}

















/* ==========================================
   KER BACKGROUND & FOREGROUND
   PARTNER-SPECIFIC VIEW
   ========================================== */

.ker-knowledge-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

/* Individual partner block */

.ker-knowledge-partner {
    padding: 16px;
    border: 1px solid var(--line, #dce5df);
    border-radius: 10px;
    background: #f8faf8;
}

/* Partner badge header */

.ker-knowledge-partner-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.ker-knowledge-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: fit-content;
    padding: 5px 11px;

    border-radius: 6px;
    background: #e1eee7;
    color: #245742;

    font-size: 12px;
    font-weight: 700;
    letter-spacing: .025em;
}

/* Background and Foreground columns */

.ker-knowledge-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

/* Each knowledge field */

.ker-knowledge-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 7px;
}

/* Column labels */

.ker-knowledge-label {
    font-size: 12px;
    font-weight: 600;
    color: #245742;
}

/* Read-only text box */

.ker-knowledge-text {
    flex: 1;
    min-height: 75px;

    padding: 13px 14px;

    background: #fff;
    border: 1px solid #dce5df;
    border-radius: 7px;

    color: var(--ink, #26352d);
    font-size: 13px;
    line-height: 1.65;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Empty state */

.ker-knowledge-empty {
    padding: 24px 16px;
    margin-top: 14px;

    border: 1px dashed var(--line, #dce5df);
    border-radius: 8px;

    color: var(--muted, #6b776f);
    font-size: 13px;
    text-align: center;
}






/* ==========================================
   KER BACKGROUND & FOREGROUND
   PARTNER-SPECIFIC EDIT MODE
   ========================================== */

/* Information message */

.ker-knowledge-edit-hint {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 11px 14px;
    margin-top: 14px;

    border: 1px solid #d4e5da;
    border-radius: 8px;

    background: #eff7f1;
    color: #315943;

    font-size: 12px;
    line-height: 1.5;
}

/* Small information icon */

.ker-knowledge-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 19px;
    height: 19px;

    border: 1px solid #87ad97;
    border-radius: 50%;

    color: #315943;
    font-size: 12px;
    font-weight: 700;
    font-style: normal;
}

/* Partner-specific editable textareas */

.ker-knowledge-input {
    display: block;

    width: 100%;
    min-height: 155px;
    box-sizing: border-box;

    padding: 13px 14px;

    border: 1px solid #d2ded5;
    border-radius: 7px;

    background: #fff;
    color: var(--ink, #26352d);

    font: inherit;
    font-size: 13px;
    line-height: 1.65;

    resize: vertical;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.ker-knowledge-input:focus {
    outline: none;
    border-color: #36785b;
    box-shadow: 0 0 0 3px rgba(54, 120, 91, .12);
}

.ker-knowledge-input::placeholder {
    color: #97a59b;
    opacity: 1;
}








/* Logged-in user profile link */

.user-profile-link {
    color: #FFFFFF;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background-color .15s ease;
}

.user-profile-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, .12);
    text-decoration: underline;
}

.user-profile-link:focus-visible {
    outline: 2px solid #FFFFFF;
    outline-offset: 2px;
}




/* ==========================================
   TEAM MEMBER ACCESS ROLES
   ========================================== */

.team-role-badge {
    display: inline-flex;
    align-items: center;

    padding: 4px 9px;
    border-radius: 6px;

    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

/* Partner administrator */

.team-role-admin {
    background: #DCEFF1;
    color: #0B3954;
    border: 1px solid #B5DDE1;
}

/* Normal partner member */

.team-role-member {
    background: #F0F3F5;
    color: #596D7C;
    border: 1px solid #DFE5E8;
}

/* Role information below the form */

.team-role-note {
    padding: 12px 14px;
    margin-bottom: 18px;

    background: #EFF7F8;
    border: 1px solid #D0E5E8;
    border-radius: 8px;

    color: #0B3954;
    font-size: 12px;
    line-height: 1.6;
}

.team-role-note strong {
    font-weight: 600;
}

.team-role-note p {
    margin: 4px 0 0;
    color: #526C7A;
}

/* Member form actions */

.team-member-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}


/* ==========================================
   GLOBAL ADMIN - MEMBER ROLE MANAGEMENT
   ========================================== */

.member-admin-modal {
    max-width: 920px;
}

.member-admin-table-scroll {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
}

.member-admin-table-scroll .data-table {
    min-width: 760px;
}

.member-admin-status {
    padding: 12px 14px;
    margin-bottom: 18px;
    border: 1px solid #C9E2E6;
    border-radius: 8px;
    background: #F0F8F9;
    color: #0B3954;
    font-size: 12px;
}

.member-admin-status strong {
    font-weight: 600;
}

.member-admin-status p {
    margin: 4px 0 0;
    color: #526C7A;
}

.member-admin-form-heading {
    margin-top: 20px;
}

.member-admin-checkbox {
    margin: 14px 0 18px;
    padding: 14px;
    border: 1px solid #BADDE1;
    border-radius: 8px;
    background: #F0F8F9;
}

.member-admin-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.member-admin-checkbox input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    accent-color: #0E808C;
}

.member-admin-checkbox strong {
    display: block;
    color: #0B3954;
    font-size: 13px;
}

.member-admin-checkbox small {
    display: block;
    margin-top: 4px;
    color: #526C7A;
    font-size: 12px;
    line-height: 1.5;
}

.member-admin-help {
    margin: 12px 0 18px;
    color: var(--muted);
    font-size: 12px;
}


@media (max-width: 650px) {
    .member-admin-modal {
        padding: 18px;
    }
}


/* Responsive edit layout */

@media (max-width: 650px) {

    .ker-knowledge-edit-hint {
        align-items: flex-start;
    }

    .ker-knowledge-input {
        min-height: 125px;
    }
}


/* Responsive layout */

@media (max-width: 650px) {

    .ker-knowledge-partner {
        padding: 12px;
    }

    .ker-knowledge-columns {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ker-knowledge-text {
        min-height: 60px;
    }
}


/* Small mobile screens */

@media (max-width: 400px) {

    .otp-card {
        padding: 28px 20px;
    }

    .otp-input-row {
        gap: 6px;
    }

    .otp-input-row .otp-digit {
        height: 46px;
        font-size: 1.2rem;
    }
}


/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .form-grid-3, .form-grid-2 { grid-template-columns: 1fr; }
  .involvement-fields { grid-template-columns: 1fr 1fr; }
  .messages-shell { grid-template-columns: 1fr; }
  .conv-list { border-right: none; border-bottom: 1px solid var(--line); padding-right: 0; padding-bottom: 10px; margin-bottom: 10px; }
}
@media (max-width: 600px) {
  .topbar { height: auto; padding: 10px 14px; }
  .nav-links { order: 3; width: 100%; justify-content: flex-start; }
  .content { padding: 18px 12px 40px; }
  .detail-header { flex-direction: column; }
  .involvement-card { flex-wrap: wrap; }
  .involvement-fields { grid-template-columns: 1fr; order: 3; width: 100%; }
  .calendar-grid { gap: 3px; }
  .cal-cell { min-height: 54px; font-size: .68rem; }
  .topbar { background: linear-gradient(90deg, #ffffff 0, #ffffff 100px, var(--primary-dark) 320px, var(--primary-dark) 100%); }
  .brand-logo { height: 80px; }
  .brand .tag { font-size: .56rem; white-space: normal; line-height: 1.3; }
}

@media (prefers-reduced-motion: reduce) {
  .ker-card { transition: none; }
}
/* ---------- Members popup (Partners admin page) ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 35, 31, .45);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px 24px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.modal-header h3 { margin: 0; font-size: 1.05rem; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }

/* ---------- Email notice composer (Messages page) ---------- */
.notice-partner-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 14px;
}
.notice-partner { padding: 8px 0; border-bottom: 1px solid var(--line); }
.notice-partner:last-child { border-bottom: none; }
.notice-partner-toggle,
.notice-member {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.notice-partner-toggle input,
.notice-member input { width: auto; }
.notice-member { font-size: .85rem; margin: 4px 0; }
.notice-member-list { margin: 4px 0 2px 26px; display: flex; flex-direction: column; }


/* ==========================================
   MY PROFILE - TWO-COLUMN DESIGN
   Scoped to the My Profile page only.
   ========================================== */

.profile-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 35px;
}

/* Page introduction */
.profile-page-header {
    margin-bottom: 24px;
}

.profile-page-header h1 {
    margin: 0;
    color: #0B3954;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.profile-page-header p {
    margin: 8px 0 0;
    color: #74838B;
    font-size: 13px;
    line-height: 1.6;
}

/* Account and personal details side by side */
.profile-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.5fr);
    gap: 22px;
    align-items: start;
}

/* Shared card */
.profile-card {
    min-width: 0;
    background: #FFFFFF;
    border: 1px solid #DAE4E4;
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(11, 57, 84, 0.035);
}

.profile-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 24px;
    border-bottom: 1px solid #E8EEEE;
}

.profile-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 39px;
    flex-shrink: 0;
    color: #0E808C;
    background: #EAF5F5;
    border-radius: 10px;
}

.profile-card-header h2 {
    margin: 0;
    color: #0B3954;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0;
}

.profile-card-header p {
    margin: 4px 0 0;
    color: #829097;
    font-size: 12px;
}

/* ==========================================
   ACCOUNT INFORMATION
   ========================================== */

.profile-card-body {
    padding: 0 24px 22px;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 24px 0;
    border-bottom: 1px solid #E8EEEE;
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 13px;
    background: #0E808C;
    color: #FFFFFF;
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
}

.profile-identity-details {
    min-width: 0;
}

.profile-identity-name {
    color: #0B3954;
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.profile-identity-partner {
    margin-top: 4px;
    color: #7A8991;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.profile-account-details {
    margin: 0;
    padding: 5px 0;
}

.profile-detail {
    padding: 14px 0;
    border-bottom: 1px solid #EDF1F1;
}

.profile-detail:last-child {
    border-bottom: none;
}

.profile-detail dt {
    margin: 0 0 7px;
    color: #849198;
    font-size: 11px;
    font-weight: 600;
}

.profile-detail dd {
    margin: 0;
    color: #0B3954;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.profile-email {
    font-weight: 500 !important;
    overflow-wrap: anywhere;
}

/* Role is a label, not an editable input */
.profile-access-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}

.profile-access-admin {
    color: #0B6170;
    background: #DFF1F0;
    border: 1px solid #BCE0DF;
}

.profile-access-member {
    color: #5D6C76;
    background: #F0F3F5;
    border: 1px solid #E1E7E9;
}

.profile-account-footer {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    color: #657982;
    background: #F5F8F8;
    font-size: 11px;
    line-height: 1.6;
}

.profile-account-footer svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #0E808C;
}

/* ==========================================
   PERSONAL DETAILS FORM
   ========================================== */

.profile-edit-form {
    margin: 0;
}

.profile-form-body {
    padding: 26px 24px;
}

.profile-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.profile-field {
    min-width: 0;
    margin-bottom: 22px;
}

.profile-field:last-child {
    margin-bottom: 0;
}

.profile-field label {
    display: block;
    margin-bottom: 9px;
    color: #244A5B;
    font-size: 12px;
    font-weight: 600;
}

.profile-field input {
    display: block;
    width: 100%;
    height: 43px;
    padding: 0 13px;
    box-sizing: border-box;
    border: 1px solid #D5E0E1;
    border-radius: 8px;
    outline: none;
    background: #FFFFFF;
    color: #0B3954;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.profile-field input:hover {
    border-color: #AFCBCD;
}

.profile-field input:focus {
    border-color: #0E808C;
    box-shadow: 0 0 0 3px rgba(14, 128, 140, 0.10);
}

.profile-field input::placeholder {
    color: #A6B2B8;
}

.profile-field-hint {
    display: block;
    margin-top: 8px;
    color: #89969C;
    font-size: 11px;
    line-height: 1.6;
}

.profile-field-error {
    display: block;
    margin-top: 6px;
    color: #B42336;
    font-size: 11px;
}

.profile-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 18px 24px;
    background: #FAFCFC;
    border-top: 1px solid #E8EEEE;
}

.profile-save-hint {
    color: #849198;
    font-size: 11px;
    line-height: 1.5;
}

.profile-form-footer .btn {
    white-space: nowrap;
}

/* ==========================================
   MY PROFILE - RESPONSIVE LAYOUT
   ========================================== */

@media (max-width: 850px) {
    .profile-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 550px) {
    .profile-page-header h1 {
        font-size: 23px;
    }

    .profile-card-header {
        padding: 18px;
    }

    .profile-card-body {
        padding: 0 18px 18px;
    }

    .profile-form-body {
        padding: 22px 18px;
    }

    .profile-form-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .profile-form-footer {
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
    }

    .profile-form-footer .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===============================================================
   KER DETAIL — COMPACT CONTRIBUTION LISTS
   Scoped to .ker-detail-page; does not modify other application pages.
   =============================================================== */

.ker-detail-page .section-box {
    padding: 14px 17px;
    margin-bottom: 13px;
}

.ker-detail-page .section-box h3 {
    font-size: .84rem;
    line-height: 1.5;
    margin-bottom: 9px;
    padding-bottom: 7px;
}

.ker-detail-page .section-box > div:first-child:has(> h3) {
    align-items: center !important;
}

.ker-detail-page .section-box > div:first-child > .btn {
    flex-shrink: 0;
}

/* One compact line per partner instead of nested full-size cards. */
.ker-detail-page .ker-compact-list {
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    overflow: hidden;
    background: var(--panel);
}

.ker-detail-page .ker-compact-row {
    display: grid;
    grid-template-columns: minmax(128px, 164px) minmax(0, 1fr);
    gap: 15px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.ker-detail-page .ker-compact-row:last-child {
    border-bottom: 0;
}

.ker-detail-page .ker-compact-row:nth-child(even) {
    background: #FAFBFA;
}

.ker-detail-page .ker-compact-identity {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 7px;
    min-width: 0;
}

.ker-detail-page .ker-knowledge-badge {
    font-size: .72rem;
    padding: 4px 8px;
    border-radius: 6px;
}

.ker-detail-page .ker-role-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: .69rem;
    line-height: 1.35;
    font-weight: 700;
    white-space: normal;
    background: #EEF1F3;
    color: #52616D;
}

/* Distinct, restrained role colors. */
.ker-detail-page .ker-role-chip--leader {
    background: #DDF2E9;
    color: #126044;
    border: 1px solid #B9DDCE;
}

.ker-detail-page .ker-role-chip--participant {
    background: #E8F0F9;
    color: #335C82;
    border: 1px solid #CFDFEF;
}

.ker-detail-page .ker-compact-own {
    display: block;
    width: 100%;
    font-size: .68rem;
    color: var(--muted);
}

.ker-detail-page .ker-compact-fields {
    display: grid;
    gap: 12px 16px;
    min-width: 0;
}

.ker-detail-page .ker-compact-fields--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ker-detail-page .ker-compact-fields--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ker-detail-page .ker-compact-field {
    min-width: 0;
}

.ker-detail-page .ker-compact-field--wide {
    grid-column: 1 / -1;
}

.ker-detail-page .ker-compact-label {
    display: block;
    margin-bottom: 4px;
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}

.ker-detail-page .ker-compact-value {
    display: block;
    font-size: .84rem;
    line-height: 1.48;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--ink);
}

/* Historical shared fields stay available but are collapsed by default. */
.ker-detail-page .ker-legacy-details {
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 10px 0;
    padding: 0 12px;
    background: #F7F9F7;
}

.ker-detail-page .ker-legacy-details > summary {
    padding: 9px 0;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
}

.ker-detail-page .ker-legacy-details > summary span {
    font-weight: 400;
}

.ker-detail-page .ker-legacy-details[open] > .ker-compact-fields {
    padding: 4px 0 13px;
}

/* The editor retains all existing controls but is visually separated. */
.ker-detail-page .ker-section-edit-form:not([hidden]) {
    margin-top: 12px;
}

@media (max-width: 830px) {
    .ker-detail-page .ker-compact-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .ker-detail-page .ker-compact-own {
        width: auto;
        align-self: center;
    }
}

@media (max-width: 570px) {
    .ker-detail-page .ker-compact-fields--2,
    .ker-detail-page .ker-compact-fields--3 {
        grid-template-columns: 1fr;
    }
    .ker-detail-page .section-box {
        padding: 12px;
    }
    .ker-detail-page .ker-compact-row {
        padding: 10px 12px;
    }
}

/* ================================================================
   KER DETAIL — ROLE / IPR / EXPLOITATION ONLY
   Scoped to #involvements: other KER sections remain unchanged.
   Each partner has a softly separated row. Badge stacks below ID.
   Text is allowed to wrap/grow without clipping.
   ================================================================ */

.ker-detail-page #involvements .ker-compact-list {
    display: flex;
    flex-direction: column;
    gap: 11px;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.ker-detail-page #involvements .ker-compact-row,
.ker-detail-page #involvements .ker-compact-row:last-child {
    grid-template-columns: minmax(150px, 176px) minmax(0, 1fr);
    column-gap: 24px;
    row-gap: 14px;
    padding: 17px 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.ker-detail-page #involvements .ker-compact-row:nth-child(even) {
    background: #FBFCFB;
}

/* Acronym on first line, muted KER role badge immediately below. */
.ker-detail-page #involvements .ker-compact-identity {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 8px;
}

.ker-detail-page #involvements .ker-role-chip {
    max-width: 100%;
    padding: 4px 9px;
    font-weight: 600;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ker-detail-page #involvements .ker-role-chip--leader {
    color: #345D4A;
    background: #E7F0EA;
    border-color: #D1E2D7;
}

.ker-detail-page #involvements .ker-role-chip--participant {
    color: #48647B;
    background: #EDF2F6;
    border-color: #DBE5ED;
}

/* More width for the exploitation description, natural text wrapping. */
.ker-detail-page #involvements .ker-compact-fields--2 {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.35fr);
    column-gap: 24px;
    row-gap: 14px;
}

.ker-detail-page #involvements .ker-compact-label {
    margin-bottom: 6px;
}

.ker-detail-page #involvements .ker-compact-value {
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Avoid squeezing long descriptions on narrow screens. */
@media (max-width: 900px) {
    .ker-detail-page #involvements .ker-compact-row,
    .ker-detail-page #involvements .ker-compact-row:last-child {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .ker-detail-page #involvements .ker-compact-fields--2 {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }
}



/* ================================================================
   KER DETAIL — BACKGROUND / FOREGROUND READ-ONLY BOXES
   Scoped to #knowledge. Does not change other sections or editors.
   ================================================================ */

.ker-detail-page #knowledge .ker-knowledge-readonly-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 13px;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-row,
.ker-detail-page #knowledge .ker-knowledge-readonly-row:last-child {
    grid-template-columns: minmax(100px, 135px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #FFFFFF;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-row:nth-child(even) {
    background: #FBFCFB;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-row .ker-compact-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-field {
    min-width: 0;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-field .ker-compact-label {
    margin-bottom: 8px;
    color: #52675D;
}

/* Read-only display. Full text is visible without JavaScript.
   Script adds the collapsed class only when content really overflows. */
.ker-detail-page #knowledge .ker-knowledge-readonly-box {
    min-width: 0;
    padding: 12px 14px;
    min-height: 72px;
    background: #FFFFFF;
    border: 1px solid #DDE5DE;
    border-radius: 7px;
}

.ker-detail-page #knowledge .ker-knowledge-readonly-value {
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    font-size: .85rem;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
    color: var(--ink);
}

/* Max 5 lines by default when text is long. Expands vertically. */
.ker-detail-page #knowledge .ker-knowledge-readonly-value.is-collapsed {
    max-height: 8.25em;
    overflow: hidden;
}

.ker-detail-page #knowledge .ker-knowledge-more {
    display: inline-block;
    margin-top: 9px;
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ker-detail-page #knowledge .ker-knowledge-more[hidden] {
    display: none;
}

.ker-detail-page #knowledge .ker-knowledge-more:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Give long knowledge descriptions the full width on smaller screens. */
@media (max-width: 800px) {
    .ker-detail-page #knowledge .ker-knowledge-readonly-row,
    .ker-detail-page #knowledge .ker-knowledge-readonly-row:last-child {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }
    .ker-detail-page #knowledge .ker-knowledge-readonly-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
}


/* ================================================================
   KER DETAIL — BENEFICIARIES & INNOVATION READ-ONLY CARDS
   Scoped to #beneficiaries only. Editable form remains unchanged.
   Long text is boxed and expands vertically on demand.
   ================================================================ */
.ker-detail-page #beneficiaries .ker-beneficiary-records {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 13px;
}

.ker-detail-page #beneficiaries .ker-beneficiary-entry {
    display: grid;
    grid-template-columns: minmax(100px, 135px) minmax(0, 1fr);
    gap: 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    min-width: 0;
}

.ker-detail-page #beneficiaries .ker-beneficiary-entry--legacy {
    background: #F8FAF8;
}

.ker-detail-page #beneficiaries .ker-beneficiary-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.ker-detail-page #beneficiaries .ker-beneficiary-legacy-badge {
    display: inline-flex;
    background: #EAEEEA;
    border: 1px solid #DEE5DE;
    color: #51645A;
    border-radius: 6px;
    font-weight: 600;
    font-size: .72rem;
    line-height: 1.4;
    padding: 4px 9px;
}

.ker-detail-page #beneficiaries .ker-beneficiary-legacy-caption {
    color: var(--muted);
    font-size: .73rem;
    line-height: 1.55;
}

.ker-detail-page #beneficiaries .ker-beneficiary-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
    min-width: 0;
}

.ker-detail-page #beneficiaries .ker-beneficiary-field {
    min-width: 0;
}

.ker-detail-page #beneficiaries .ker-beneficiary-field--full {
    grid-column: 1 / -1;
}

.ker-detail-page #beneficiaries .ker-compact-label {
    display: block;
    margin-bottom: 8px;
    color: #52675D;
}

.ker-detail-page #beneficiaries .ker-knowledge-readonly-box {
    min-width: 0;
    min-height: 72px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #DDE5DE;
    border-radius: 7px;
}

.ker-detail-page #beneficiaries .ker-beneficiary-field--full .ker-knowledge-readonly-box {
    min-height: 50px;
}

.ker-detail-page #beneficiaries .ker-knowledge-readonly-value {
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    font-size: .85rem;
    line-height: 1.65;
    color: var(--ink);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
}

.ker-detail-page #beneficiaries .ker-knowledge-readonly-value.is-collapsed {
    max-height: 8.25em;
    overflow: hidden;
}

.ker-detail-page #beneficiaries .ker-knowledge-more {
    display: inline-block;
    padding: 2px 0;
    margin-top: 9px;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ker-detail-page #beneficiaries .ker-knowledge-more[hidden] {
    display: none;
}

.ker-detail-page #beneficiaries .ker-knowledge-more:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

@media (max-width: 800px) {
    .ker-detail-page #beneficiaries .ker-beneficiary-entry {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }
    .ker-detail-page #beneficiaries .ker-beneficiary-fields {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
    .ker-detail-page #beneficiaries .ker-beneficiary-field--full {
        grid-column: auto;
    }
}

/* Internal beneficiary acronyms are inline values, not prose: avoid
   preserving whitespace introduced by Thymeleaf/HTML formatting. */
.ker-detail-page #beneficiaries .ker-beneficiary-field--full .ker-knowledge-readonly-value {
    white-space: normal;
    overflow-wrap: anywhere;
}


/* ================================================================
   KER DETAIL — QUANTITATIVE RESULT & STATE OF THE ART
   Scoped to #quantitative only. Partner content and legacy content
   are visible without dropdowns and long text can expand vertically.
   ================================================================ */
.ker-detail-page #quantitative .ker-quantitative-records {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 13px;
}

.ker-detail-page #quantitative .ker-quantitative-entry {
    display: grid;
    grid-template-columns: minmax(100px, 135px) minmax(0, 1fr);
    gap: 20px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #FFFFFF;
}

.ker-detail-page #quantitative .ker-quantitative-entry--legacy {
    background: #F8FAF8;
}

.ker-detail-page #quantitative .ker-quantitative-identity {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.ker-detail-page #quantitative .ker-quantitative-legacy-badge {
    display: inline-flex;
    background: #EAEEEA;
    border: 1px solid #DEE5DE;
    color: #51645A;
    border-radius: 6px;
    font-weight: 600;
    font-size: .72rem;
    line-height: 1.4;
    padding: 4px 9px;
}

.ker-detail-page #quantitative .ker-quantitative-legacy-caption {
    color: var(--muted);
    font-size: .73rem;
    line-height: 1.55;
}

.ker-detail-page #quantitative .ker-quantitative-fields {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.ker-detail-page #quantitative .ker-quantitative-field { min-width: 0; }

.ker-detail-page #quantitative .ker-compact-label {
    display: block;
    margin-bottom: 8px;
    color: #52675D;
}

.ker-detail-page #quantitative .ker-knowledge-readonly-box {
    min-width: 0;
    padding: 12px 14px;
    background: #FFFFFF;
    border: 1px solid #DDE5DE;
    border-radius: 7px;
}

.ker-detail-page #quantitative .ker-quantitative-status-box {
    min-height: 48px;
    display: flex;
    align-items: center;
}

.ker-detail-page #quantitative .ker-knowledge-readonly-value {
    color: var(--ink);
    font-family: 'IBM Plex Sans', -apple-system, sans-serif;
    font-size: .85rem;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: normal;
}

.ker-detail-page #quantitative .ker-knowledge-readonly-value.is-collapsed {
    max-height: 8.25em;
    overflow: hidden;
}

.ker-detail-page #quantitative .ker-knowledge-more {
    display: inline-block;
    padding: 2px 0;
    margin-top: 9px;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font: inherit;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ker-detail-page #quantitative .ker-knowledge-more[hidden] {
    display: none;
}

.ker-detail-page #quantitative .ker-knowledge-more:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

@media (max-width: 800px) {
    .ker-detail-page #quantitative .ker-quantitative-entry {
        grid-template-columns: minmax(0, 1fr);
        gap: 13px;
    }
}

/* ================================================================
   KER SECTION COMMENTS - deliberately scoped to the KER detail page
   ================================================================ */
.ker-detail-page .ker-comment-target {
    position: relative;
    padding-right: 85px !important;
}

.ker-detail-page .ker-comment-trigger {
    position: absolute;
    right: 13px;
    top: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 31px;
    padding: 5px 9px;
    background: #FFFFFF;
    color: #45675D;
    border: 1px solid #D9E2DB;
    border-radius: 7px;
    font: 600 .76rem 'IBM Plex Sans', sans-serif;
    cursor: pointer;
    white-space: nowrap;
}
.ker-detail-page .ker-comment-trigger:hover {
    background: #F1F6F3;
    border-color: #B9CEC1;
    color: #184B3B;
}
.ker-detail-page .ker-comment-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.ker-detail-page .ker-comment-count { font-variant-numeric: tabular-nums; }

.ker-comment-modal[hidden], .ker-comment-form[hidden] { display: none !important; }
body.ker-comment-modal-open { overflow: hidden; }
.ker-comment-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.ker-comment-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 37, 30, .52);
}
.ker-comment-panel {
    position: relative;
    width: min(100%, 610px);
    max-height: min(86vh, 760px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 55px rgba(18, 42, 33, .2);
    outline: none;
}
.ker-comment-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    padding: 18px 20px 13px;
    border-bottom: 1px solid var(--line);
}
.ker-comment-panel-header h2 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--primary-dark);
}
.ker-comment-context { color: var(--muted); font-size: .81rem; margin: 5px 0 0; }
.ker-comment-close {
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--muted);
    background: #FFFFFF;
    cursor: pointer;
    width: 31px;
    height: 31px;
    font-size: 1.4rem;
    line-height: 1;
}
.ker-comment-close:hover { background: var(--bg); }
.ker-comment-list {
    padding: 15px 20px;
    overflow-y: auto;
    min-height: 65px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.ker-comment-item {
    background: #FAFBF9;
    border: 1px solid #E1E6DF;
    border-radius: 9px;
    padding: 12px 14px;
    min-width: 0;
}
.ker-comment-item-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 9px;
}
.ker-comment-author {
    display: inline-flex;
    background: #E3EFE8;
    color: #245742;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 700;
}
.ker-comment-date { font-size: .72rem; color: var(--muted); }
.ker-comment-text {
    font-size: .87rem;
    color: var(--ink);
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ker-comment-item-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    border-top: 1px solid #E9EEEA;
    padding-top: 8px;
}
.ker-comment-text-action {
    background: transparent;
    color: var(--primary-dark);
    border: 0;
    font: 600 .77rem 'IBM Plex Sans', sans-serif;
    cursor: pointer;
    padding: 2px 0;
}
.ker-comment-text-action:hover { text-decoration: underline; }
.ker-comment-danger-action { color: var(--danger); }
.ker-comment-empty, .ker-comment-loading {
    margin: 0;
    font-size: .84rem;
    color: var(--muted);
}
.ker-comment-feedback {
    margin: 12px 20px 0;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: .83rem;
    color: #883726;
    background: #FBEAE6;
}
.ker-comment-form {
    padding: 15px 20px 18px;
    background: #F8FAF8;
    border-top: 1px solid var(--line);
}
.ker-comment-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--primary-dark);
    font-size: .83rem;
    font-weight: 600;
}
.ker-comment-form textarea {
    display: block;
    width: 100%;
    min-height: 90px;
    max-height: 240px;
    resize: vertical;
    border: 1px solid #D2DED5;
    border-radius: 8px;
    padding: 11px 12px;
    font: inherit;
    font-size: .88rem;
    line-height: 1.55;
    background: #FFFFFF;
}
.ker-comment-form textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}
.ker-comment-form-actions {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 9px;
}
.ker-comment-limit { margin-right: auto; font-size: .72rem; color: var(--muted); }
@media (max-width: 570px) {
    .ker-comment-modal { padding: 9px; }
    .ker-comment-panel { max-height: 94vh; }
    .ker-comment-panel-header, .ker-comment-list, .ker-comment-form {
        padding-left: 14px;
        padding-right: 14px;
    }
    .ker-detail-page .ker-comment-target { padding-right: 70px !important; }
    .ker-detail-page .ker-comment-trigger { right: 8px; top: 9px; }
}


/* ==========================================================
   MY PROFILE — PASSWORD RESET MODAL (scoped to the profile)
   ========================================================== */
.profile-footer-secondary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}
.profile-password-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-color: #A8C8C5;
    color: #17675E;
    background: #FFFFFF;
    white-space: nowrap;
}
.profile-password-trigger:hover { background: #EAF5F3; border-color: #79AAA3; }
.profile-password-overlay[hidden] { display: none !important; }
body.profile-password-open { overflow: hidden; }
.profile-password-overlay {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.profile-password-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 36, 42, .48);
}
.profile-password-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(100%, 580px);
    max-height: min(90vh, 740px);
    overflow-y: auto;
    background: #FFFFFF;
    border: 1px solid #DAE4E4;
    border-radius: 13px;
    box-shadow: 0 18px 60px rgba(18, 36, 42, .24);
    outline: none;
}
.profile-password-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px;
    border-bottom: 1px solid #E8EEEE;
}
.profile-password-heading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #EAF5F5;
    color: #0E808C;
}
.profile-password-heading-text { flex: 1; min-width: 0; }
.profile-password-heading-text h2 {
    margin: 0;
    font-size: 18px;
    color: #0B3954;
    font-weight: 700;
}
.profile-password-heading-text p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #74838B;
}
.profile-password-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6C7F88;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.profile-password-close:hover { background: #F0F4F4; color: #0B3954; }
.profile-password-error {
    margin: 16px 24px 0;
    padding: 10px 12px;
    border-radius: 8px;
    color: #A6402F;
    background: #FBEAE6;
    font-size: 13px;
}
.profile-password-form { margin: 0; }
.profile-password-body { padding: 24px 24px 15px; }
.profile-password-body .profile-field { margin-bottom: 18px; }
.profile-password-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.profile-password-input-wrap { position: relative; }
.profile-password-input-wrap input[type="password"],
.profile-password-input-wrap input[type="text"] { padding-right: 46px; }
.profile-password-reveal {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    width: 32px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: #657982;
    cursor: pointer;
}
.profile-password-reveal:hover { background: #EEF4F4; color: #0B3954; }
.profile-password-reveal:focus-visible,
.profile-password-close:focus-visible,
.profile-password-trigger:focus-visible {
    outline: 2px solid #0E808C;
    outline-offset: 2px;
}
.profile-password-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 18px 24px;
    border-top: 1px solid #E8EEEE;
}
@media (max-width: 650px) {
    .profile-password-heading,
    .profile-password-body,
    .profile-password-footer { padding-left: 18px; padding-right: 18px; }
    .profile-password-fields { grid-template-columns: 1fr; gap: 0; }
    .profile-password-overlay { padding: 10px; }
    .profile-footer-secondary { flex-direction: column; align-items: flex-start; }
    .profile-password-error { margin-left: 18px; margin-right: 18px; }
}




/* ==========================================
   LOGIN PASSWORD VISIBILITY TOGGLE
   ========================================== */

.login-password-wrap {
    position: relative;
    width: 100%;
}

.login-password-wrap input {
    width: 100%;
    padding-right: 50px;
}

.login-password-toggle {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;
    border: none;
    border-radius: 6px;

    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.login-password-toggle:hover {
    background: var(--primary-tint);
    color: var(--primary-dark);
}

.login-password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.login-password-toggle svg[hidden] {
    display: none;
}




/* ==========================================
   MY MEMBERS - PASSWORD VISIBILITY TOGGLE
   ========================================== */

.member-password-wrap {
    position: relative;
    width: 100%;
}

.form-row .member-password-wrap input {
    width: 100%;
    padding-right: 50px;
}

.member-password-toggle {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;
    border: none;
    border-radius: 6px;

    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.member-password-toggle:hover {
    background: var(--primary-tint);
    color: var(--primary-dark);
}

.member-password-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.member-password-toggle svg[hidden] {
    display: none;
}


/* MY PROFILE - PASSWORD EYE ICONS */

.profile-password-reveal svg[hidden] {
    display: none;
}


.member-password-toggle svg[hidden] {
    display: none;
}



/* ==========================================
   KER - MOVE TO TRASH BUTTON
   ========================================== */

.btn.btn-trash {
    background: var(--danger);
    color: #FFFFFF;
    border: 1px solid var(--danger);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.btn.btn-trash:hover {
    background: #FBEAE6;
    color: var(--danger);
}