/* Shared koitin.com brand tokens. Keep functional layouts in portal.css. */
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/SourceSans3VF-Upright.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  background: #f7f9fa;
  --site-font:
    "Source Sans 3", "Public Sans", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --site-navy: #071e34;
  --site-blue: #005ea8;
  --site-hover: #1a4480;
  --site-line: #dfe1e2;
  --site-background: #f7f9fa;
  --radius-sm: 3px;
  --radius-md: 3px;
  --radius-lg: 3px;
}

body,
body.admin-body,
body.portal-body,
body.verify-body {
  font-family: var(--site-font);
}

body:is(.admin-body, .portal-body, .verify-body) {
  --canvas: var(--site-background);
  --surface: #fff;
  --surface-soft: #eef7fd;
  --ink: #1b1b1b;
  --muted: #565c65;
  --line: var(--site-line);
  --primary: var(--site-blue);
  --primary-dark: var(--site-hover);
  --primary-soft: #eef7fd;
  --red: #d83933;
  --shadow: 0 2px 8px rgb(7 30 52 / 6%);
  color: var(--ink);
  background: var(--canvas);
}

body:is(.admin-body, .portal-body, .verify-body)
  :is(button, input, select, textarea, h1, h2, h3, .eyebrow) {
  font-family: inherit;
}

body:is(.admin-body, .portal-body, .verify-body)
  :is(
    .panel,
    .auth-copy,
    .auth-panel,
    .work-panel,
    .summary-block,
    .info-cell,
    .generated-item,
    .identity-card,
    .review-card,
    .workflow-card,
    .form-section,
    .application-card,
    .admin-sidebar,
    .admin-overview-card
  ) {
  border-radius: 0;
  box-shadow: none;
}

body:is(.admin-body, .portal-body, .verify-body)
  :is(input, select, textarea, button, .button-link, .ghost-btn) {
  border-radius: 3px;
}

body:is(.admin-body, .portal-body, .verify-body)
  :is(input, select, textarea):focus-visible {
  outline: 2px solid var(--site-blue);
  outline-offset: 2px;
}

body:is(.admin-body, .portal-body, .verify-body) :is(button, a):focus-visible {
  outline: 3px solid #fdb81e;
  outline-offset: 3px;
}

body:is(.admin-body, .portal-body, .verify-body) :is(.topbar, .verify-header) {
  background: #fff;
  border-bottom: 3px solid #d83933;
  box-shadow: none;
}

body:is(.admin-body, .portal-body) .topbar::after {
  display: none;
}

body:is(.admin-body, .portal-body) .auth-copy {
  color: #fff;
  background: #071e34;
  border: 0;
  border-top: 4px solid #005ea8;
}

body:is(.admin-body, .portal-body) .auth-copy :is(h2, p, strong, .eyebrow) {
  color: inherit;
}

body:is(.admin-body, .portal-body) .auth-copy .auth-route > div {
  border-color: #153f65;
  background: transparent;
}

body.admin-body .admin-sidebar {
  background: #071e34;
}

body.admin-body .admin-primary-navigation > button {
  border-radius: 0;
}

body.admin-body .admin-primary-navigation > button.active {
  background: #005ea8;
  color: #fff;
}

body.admin-body .topbar .notification-indicator {
  color: #005ea8;
  background: #eef7fd;
  border: 1px solid #d9eaf7;
}

body.admin-body .topbar .notification-indicator svg {
  stroke: currentColor;
  fill: none;
}

.site-home-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: #071e34;
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.site-home-link > span:last-child > span {
  color: #005ea8;
}

body .site-logo,
body.admin-body .sidebar-brand-mark,
body .portal-brand-mark,
body .admin-trust-logo {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 3px solid #d9eaf7;
  border-radius: 50%;
  color: #fff;
  background: #005ea8;
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.02em;
  transform: none;
}

body .portal-heading > div {
  padding-left: 18px;
  border-left: 1px solid #dfe1e2;
}

body .portal-heading h1 {
  font-size: 20px;
}

body .verify-header {
  flex-wrap: wrap;
  gap: 16px;
}

body .verify-header > div {
  flex: 1 1 260px;
  min-width: 0;
}

/* Match the existing website without changing its unclassified body. */
body:is(.admin-body, .portal-body) .topbar {
  border-bottom-width: 4px;
}

body:is(.admin-body, .portal-body) .auth-layout {
  border-top: 4px solid #005ea8;
}

/* Match the website service-card accent's small curved end caps. */
body.admin-body #admin-login-view,
body.portal-body #auth-view {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

body:is(.admin-body, .portal-body) .auth-copy {
  border-top: 0;
  background: #0b2e4f;
}

body:is(.admin-body, .portal-body) .auth-copy h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.035em;
}

body:is(.admin-body, .portal-body) .auth-copy > p:not(.eyebrow) {
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.63;
}

body:is(.admin-body, .portal-body) .site-home-link {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -0.035em;
}

body:is(.admin-body, .portal-body) .site-logo,
body.admin-body .sidebar-brand-mark {
  border-radius: 50% 50% 48% 48%;
  box-shadow: inset 0 0 0 2px #005ea8;
}

body:is(.admin-body, .portal-body) .auth-form button[type="submit"] {
  min-height: 48px;
  padding: 11px 20px;
  border: 2px solid transparent;
  border-radius: 3px;
  background: #005ea8;
  color: #fff;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.2;
  box-shadow: 0 5px 0 #1a4480;
}

body:is(.admin-body, .portal-body)
  .auth-form
  button[type="submit"]:hover:not(:disabled) {
  background: #1a4480;
  box-shadow: 0 3px 0 #0b2e4f;
}

@media (max-width: 980px) {
  body.portal-body .topbar {
    margin-inline: 0;
    padding-inline: 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
}

@media (max-width: 700px) {
  body .portal-heading {
    flex-wrap: wrap;
    gap: 12px;
  }
  body .portal-heading > div {
    border-left: 0;
    padding-left: 0;
  }
  body .topbar .site-home-link {
    font-size: 18px;
  }
  body .admin-toolbar-main {
    min-width: 0;
  }
}

/* Account and operations workspace */
body:is(.portal-body, .admin-body) {
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --site-line: #e1e7ed;
  --shadow: 0 8px 28px rgb(18 42 66 / 5%);
  background: #f3f6f9;
}

body:is(.portal-body, .admin-body) .topbar {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--site-line);
}

body:is(.portal-body, .admin-body) .panel {
  box-shadow: var(--shadow);
  border-radius: 16px;
}

body:is(.portal-body, .admin-body) :is(input, select, textarea) {
  border-radius: 8px;
  background-color: #fcfdfe;
}

body:is(.portal-body, .admin-body) :is(button, .button-link, .ghost-btn) {
  border-radius: 8px;
}

body:is(.portal-body, .admin-body)
  :is(button, a, input, select, summary):focus-visible {
  outline: 3px solid #66a9dc;
  outline-offset: 3px;
}

.admin-body .list-row:not(.active):hover {
  background: #f5f9fc;
}

.admin-body .info-cell {
  border-radius: 10px;
  padding: 18px;
}

.membership-panel {
  overflow: hidden;
  padding: 0;
  scroll-margin-top: 24px;
}

.membership-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: 30px;
  color: #f3f7fc;
  background: linear-gradient(115deg, #0c273d, #194966);
}

.membership-card.is-member {
  background: linear-gradient(115deg, #102c3e, #264f56);
}

.membership-card .eyebrow {
  color: #c7dfed;
  font-size: 11px;
  letter-spacing: 0.16em;
  margin: 0 0 12px;
}

.membership-card h2 {
  color: #fff;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.4;
  margin: 0 0 12px;
}

.membership-card p:not(.eyebrow) {
  color: #d0e0ec;
  line-height: 1.8;
  max-width: 540px;
  margin: 0;
}

.membership-perks {
  display: flex;
  gap: 10px 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #e8cf9d;
  margin-top: 22px;
}

.membership-perks span::before {
  content: "✓ ";
}

.membership-card-action {
  display: grid;
  justify-items: center;
  gap: 12px;
  min-width: 160px;
}

.membership-card-action > strong {
  font-size: 30px;
  font-weight: 600;
}

.membership-card-action small {
  display: block;
  text-align: center;
  color: #d0e0ec;
  font-size: 12px;
  font-weight: 400;
}

.membership-card-action a {
  color: #f0d7aa;
  font-size: 14px;
}

.membership-card-action .button-link {
  background: #ebd2a4;
  color: #173044;
  border-color: #ebd2a4;
  padding: 12px 20px;
  font-weight: 700;
}

.membership-seal {
  border: 1px solid #afbdac;
  color: #f0d7aa;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 15px;
}

.membership-badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  background: #edf1f5;
  color: #526274;
  line-height: 1.4;
}

.membership-badge.is-member {
  color: #6b4c15;
  background: #f5ecd7;
}

.member-library {
  padding: 20px 28px;
}

.member-library summary {
  cursor: pointer;
  color: #173a52;
  font-weight: 600;
}

.member-library summary span {
  margin-left: 8px;
  color: #617487;
  font-size: 12px;
  font-weight: 400;
}

.member-article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

button.member-article-link {
  display: grid;
  gap: 12px;
  padding: 18px;
  text-align: left;
  color: #193b52;
  background: #f6f9fb;
  border: 1px solid #e0e8ef;
  white-space: normal;
}

button.member-article-link:hover {
  background: #eaf2f8;
  color: #193b52;
}

.member-article-link small {
  color: #66798a;
  font-size: 12px;
}

.member-article-link span {
  font-size: 12px;
  color: #31648a;
}

.member-reader {
  min-width: 0;
  scroll-margin-top: 24px;
}

.member-reader .cherry {
  box-shadow: none;
  border: 0;
}

.member-reader .cherry-previewer {
  position: relative;
  max-height: none;
  padding: 16px 0;
  line-height: 1.9;
}

.member-reader img {
  max-width: 100%;
}

.membership-settings {
  min-width: 0;
  padding: 24px;
  border: 1px solid #ccdae6;
  border-radius: 12px;
  background: #f6f9fc;
}

.membership-settings legend {
  padding: 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #163b56;
}

.membership-settings p,
.membership-settings > small {
  color: #566b7d;
  line-height: 1.8;
}

@media (max-width: 700px) {
  .membership-card {
    grid-template-columns: 1fr;
    padding: 24px 20px;
    gap: 24px;
  }
  .membership-card-action {
    justify-items: start;
    grid-template-columns: auto auto;
    justify-content: space-between;
    align-items: center;
    min-width: 0;
  }
  .membership-card-action small {
    text-align: left;
  }
  .member-library {
    padding: 18px 20px;
  }
  .member-article-grid {
    grid-template-columns: 1fr;
  }
  .membership-settings {
    padding: 16px;
  }
}

body:is(.portal-body, .admin-body) .account-actions .ghost-btn {
  color: #285772;
  background: #eef4f8;
  border-color: #d3e0e9;
}

body:is(.portal-body, .admin-body) .account-actions .ghost-btn:hover {
  color: #153e5a;
  background: #dceaf4;
}

body.portal-body .summary-block {
  border-radius: 14px;
}

.portal-body .status-steps:empty {
  display: none;
}

.member-reader {
  padding: 28px;
  scroll-margin-top: 110px;
  overflow-wrap: anywhere;
}

.member-reader .cherry-toolbar,
.member-reader .cherry-floatmenu,
.member-reader .cherry-bubble,
.member-reader .cherry-sidebar {
  display: none;
}

@media (max-width: 700px) {
  .member-reader {
    padding: 20px;
  }
}

@media (max-width: 700px) {
  .portal-body .account-only .workspace {
    order: -1;
  }
}

.member-reader .cherry,
.member-reader .cherry-previewer {
  height: auto;
  min-height: 0;
}

/* Settings use independent tab panels and forms. */
body:is(.admin-body, .portal-body) {
  min-width: 0;
}

body.portal-body .topbar {
  margin-inline: 0;
  padding-inline: 24px;
}

.admin-body #admin-settings-view,
.admin-body #admin-settings-view > *,
.admin-body #integration-panel {
  min-width: 0;
  max-width: 100%;
}

.admin-body #admin-settings-view [hidden],
.portal-body .captcha-field [hidden] {
  display: none !important;
}

.admin-body .settings-tabs {
  display: flex;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid #dce5ed;
  border-radius: 12px;
  background: #eaf0f5;
  scrollbar-width: thin;
}

.admin-body .settings-tabs [role="tab"] {
  flex: 1 0 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #536a7e;
  padding: 11px 16px;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: none;
}

.admin-body .settings-tabs [aria-selected="true"] {
  background: #fff;
  border-color: #d9e3ec;
  color: #163e5c;
  box-shadow: 0 2px 5px rgb(18 42 66 / 6%);
}

.admin-body .settings-tabs [role="tab"]:hover {
  background: #f8fbfd;
  color: #163e5c;
}

.admin-body #admin-integration-settings-panel {
  padding: 0;
  overflow: clip;
}

.settings-config-form {
  gap: 0;
}

.settings-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 28px 32px 22px;
  border-bottom: 1px solid #e4ebf1;
}

.settings-section-heading h2 {
  margin: 4px 0 8px;
  color: #183b55;
  font-size: 23px;
}

.settings-section-heading p:not(.eyebrow) {
  margin: 0;
  color: #657a8c;
  font-size: 14px;
  line-height: 1.7;
}

.settings-save-state {
  padding: 6px 10px;
  border-radius: 20px;
  background: #eef4f7;
  color: #526b7d;
  font-size: 12px;
  white-space: nowrap;
}

[data-dirty="true"] .settings-save-state {
  background: #fff3dc;
  color: #85621d;
}

.settings-fields {
  display: grid;
  gap: 24px;
  min-width: 0;
  border: 0;
  padding: 28px 32px;
  margin: 0;
}

.settings-fields .info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 24px;
  margin: 0;
}

.settings-fields :is(label, input, select, textarea, .key-diagnostic) {
  min-width: 0;
  max-width: 100%;
}

.settings-fields label {
  gap: 8px;
}

.settings-fields :is(p, small) {
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.settings-fields textarea {
  min-height: 112px;
  resize: vertical;
}

.settings-group {
  display: grid;
  gap: 18px;
  min-width: 0;
  border: 1px solid #e2e9ef;
  border-radius: 12px;
  padding: 24px;
}

.settings-group h3,
.settings-group summary {
  margin: 0;
  color: #254960;
  font-size: 16px;
  font-weight: 650;
}

.settings-group summary {
  cursor: pointer;
}

.settings-group[open] > :not(summary) {
  margin-top: 18px;
}

.settings-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 32px;
  border-top: 1px solid #e1e9ef;
  background: #f7fafc;
}

.settings-save-bar .message {
  margin: 0;
  overflow-wrap: anywhere;
}

.settings-save-bar button {
  flex-shrink: 0;
  min-width: 140px;
}

.admin-body #admin-settings-view .service-config-row,
.admin-body #admin-settings-view .service-order-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 22px;
  border: 1px solid #e0e8ef;
  border-radius: 12px;
  background: #fafcfe;
}

#admin-settings-view .service-config-row > strong,
#admin-settings-view .service-config-row > small,
#admin-settings-view .settings-row-message {
  grid-column: 1 / -1;
  margin: 0;
}

#admin-settings-view :is(.service-config-row, .service-order-row) label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #526b7d;
  font-size: 13px;
}

#admin-settings-view :is(.service-config-row, .service-order-row) button {
  align-self: end;
}

#admin-settings-view .settings-subheading {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

#admin-settings-view .service-config-list {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.portal-body
  :is(
    .auth-panel,
    .auth-form,
    .captcha-field,
    .register-code-row,
    .auth-form label
  ) {
  min-width: 0;
  max-width: 100%;
}

.captcha-field {
  display: grid;
  gap: 8px;
}

.turnstile-slot[data-size="compact"] {
  min-height: 140px;
}

.captcha-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.captcha-status-row p {
  margin: 0;
  font-size: 12px;
  color: #617587;
  line-height: 1.6;
}

.captcha-status-row p:empty {
  display: none;
}

.portal-body .captcha-status-row button {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 12px;
}

@media (max-width: 720px) {
  .settings-section-heading {
    flex-direction: column;
    padding: 22px 20px;
    gap: 12px;
  }
  .settings-fields {
    padding: 22px 20px;
    gap: 20px;
  }
  .settings-fields .info-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }
  .settings-group {
    padding: 18px 14px;
  }
  .settings-save-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 20px;
    gap: 8px;
  }
  .admin-body #admin-settings-view .service-config-row,
  .admin-body #admin-settings-view .service-order-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px;
  }
  .admin-body .settings-tabs [role="tab"] {
    padding: 10px 12px;
  }
}

@media (max-width: 380px) {
  .portal-body .register-code-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .portal-body .register-code-row button {
    justify-self: stretch;
  }
}
