@import url("components.css");
@import url("forms.css");
@import url("responsive.css");

:root {
  --ksl-maroon: #7a1118;
  --ksl-maroon-dark: #3e0b10;
  --ksl-navy: #003366;
  --ksl-navy-700: #0b477f;
  --ksl-navy-soft: #eaf1f8;
  --ksl-red: #b4232a;
  --ksl-red-soft: #fdebed;
  --ksl-gold: #c7a044;
  --ksl-gold-soft: #f8f3e5;
  --ksl-ink: #102033;
  --ksl-muted: #607089;
  --ksl-line: #d8e1ec;
  --ksl-bg: #f6f8fb;
  --ksl-card: #ffffff;
  --ksl-success: #168a4a;
  --ksl-warning: #b7791f;
  --ksl-danger: #c24141;
  --ksl-info: #1b6b9b;
  --shadow-sm: 0 8px 24px rgba(16, 32, 51, 0.07);
  --shadow-md: 0 18px 45px rgba(16, 32, 51, 0.12);
  --radius: 8px;
  --chart-grid: #d7e0ec;
  --row-hover: #f1f6fc;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ksl-maroon: #d26770;
  --ksl-maroon-dark: #22060a;
  --ksl-navy: #8ebaff;
  --ksl-navy-700: #5f98df;
  --ksl-navy-soft: #162a45;
  --ksl-red: #ff8e96;
  --ksl-red-soft: #3b1419;
  --ksl-gold: #e7c66b;
  --ksl-gold-soft: #352b16;
  --ksl-ink: #eef4ff;
  --ksl-muted: #b7c5d8;
  --ksl-line: #29415f;
  --ksl-bg: #071426;
  --ksl-card: #0d2038;
  --chart-grid: #2d4667;
  --row-hover: #102b4c;
  --text-main: #eef4ff;
  --text-muted: #b7c5d8;
  --border-soft: #29415f;
  --surface: #0d2038;
  --surface-soft: #102b4c;
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--ksl-ink);
  background:
    linear-gradient(180deg, rgba(11, 45, 87, 0.055), rgba(255, 255, 255, 0.76) 42%, transparent 72%),
    var(--ksl-bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
  transition: background 0.22s ease, color 0.22s ease;
}

html[data-theme="dark"] body {
  color: var(--ksl-ink);
  background: var(--ksl-bg);
}

a {
  color: var(--ksl-maroon);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0%, rgba(199, 160, 68, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(11, 45, 87, 0.99), rgba(62, 11, 16, 0.95)),
    var(--ksl-maroon-dark);
  padding: 22px 18px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-lockup img,
.login-logo img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 6px;
}

.brand-lockup strong,
.login-logo strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 1.15;
}

.brand-lockup span,
.login-logo span {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  margin-top: 4px;
}

.sidebar-profile {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--ksl-navy);
  font-weight: 800;
}

.sidebar-profile b {
  display: block;
  font-size: 0.92rem;
}

.sidebar-profile small {
  color: rgba(255, 255, 255, 0.72);
  text-transform: capitalize;
}

.nav-group {
  margin-top: 20px;
}

.nav-label {
  margin: 0 0 8px 12px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-sub {
  margin: 12px 0 6px 12px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  font-weight: 800;
}

.nav-link {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 4px;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transform: translateX(2px);
}

.nav-link i {
  width: 18px;
  text-align: center;
  color: #f0cf76;
}

.badge-dot {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #fff;
  color: var(--ksl-navy);
  font-size: 0.72rem;
  font-weight: 800;
}

.register-wizard {
  display: grid;
  gap: 18px;
}

.register-stepper {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  margin: 0 0 6px;
  list-style: none;
}

.stepper-item {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
  color: var(--ksl-muted);
  font-weight: 800;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.stepper-item span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--ksl-navy-soft);
  color: var(--ksl-navy);
}

.stepper-item.active,
.stepper-item.complete {
  color: var(--ksl-navy);
  border-color: rgba(0, 51, 102, 0.38);
  box-shadow: var(--shadow-sm);
}

.stepper-item.active {
  transform: translateY(-1px);
}

.stepper-item.active span,
.stepper-item.complete span {
  background: var(--ksl-navy);
  color: #fff;
}

.register-step {
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
  overflow: hidden;
}

.register-step-title {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: linear-gradient(90deg, var(--ksl-navy-soft), transparent);
  color: var(--ksl-ink);
  padding: 15px 18px;
  cursor: pointer;
  text-align: left;
}

.register-step-title i:first-child {
  color: var(--ksl-maroon);
  margin-right: 8px;
}

.register-step-body {
  padding: 18px;
}

.direction-tabs {
  width: fit-content;
  margin-bottom: 18px;
}

.legacy-routing-fields {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--ksl-line);
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.rich-text-lite {
  min-height: 168px;
}

.validation-summary {
  margin: 14px 18px 0;
  padding: 12px 14px;
  border: 1px solid rgba(194, 65, 65, 0.24);
  border-left: 4px solid var(--ksl-danger);
  border-radius: var(--radius);
  color: var(--ksl-danger);
  background: rgba(194, 65, 65, 0.08);
}

.validation-summary ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

[aria-invalid="true"] {
  border-color: var(--ksl-danger) !important;
  box-shadow: 0 0 0 3px rgba(194, 65, 65, 0.12) !important;
}

.upload-progress {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ksl-navy-soft);
}

.upload-progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ksl-navy), var(--ksl-maroon));
  transition: width 0.28s ease;
}

.attachment-meta-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0 0 12px;
  list-style: none;
}

.attachment-meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-bg);
}

.attachment-meta-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.review-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.review-summary div,
.audit-preview {
  padding: 12px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-bg);
}

.review-summary dt {
  color: var(--ksl-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.review-summary dd {
  margin: 3px 0 0;
  color: var(--ksl-ink);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.register-nav {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 0;
  background: linear-gradient(180deg, transparent, var(--ksl-card) 30%);
}

.drop-zone.is-dragging {
  border-color: var(--ksl-maroon);
  background: var(--ksl-red-soft);
}

.register-classic-form {
  position: relative;
  border-top: 4px solid var(--ksl-navy);
  background:
    linear-gradient(180deg, rgba(234, 241, 248, 0.72), transparent 150px),
    var(--ksl-card);
}

.form-section-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--ksl-navy-soft), rgba(255, 255, 255, 0.68));
}

.form-section-title span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  color: #fff;
  background: var(--ksl-navy);
  box-shadow: 0 8px 18px rgba(0, 51, 102, 0.18);
}

.form-section-title h2 {
  margin: 0;
  color: var(--ksl-navy);
  font-size: 1.05rem;
}

.form-section-title p {
  margin: 3px 0 0;
  color: var(--ksl-muted);
}

.register-identity-grid {
  padding: 14px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.register-workspace {
  align-items: start;
}

.register-routing-workspace {
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.register-routing-workspace .register-panel {
  width: 100%;
  min-width: 0;
}

.register-routing-workspace #incomingFields,
.register-routing-workspace #outgoingFields {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.recipient-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(234, 241, 248, 0.66), transparent),
    var(--ksl-card);
}

.recipient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
}

.recipient-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.recipient-card:hover,
.recipient-card:focus-within {
  transform: translateY(-1px);
  border-color: var(--ksl-maroon);
  box-shadow: 0 10px 24px rgba(16, 32, 51, 0.08);
}

.recipient-card input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 3px;
}

.recipient-card b,
.recipient-card small {
  display: block;
  overflow-wrap: anywhere;
}

.recipient-card small {
  color: var(--ksl-muted);
}

.recipient-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.recipient-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ksl-maroon);
  font-weight: 850;
}

html[data-theme="dark"] .recipient-card {
  background: #0d2038;
}

.register-panel {
  border: 1px solid var(--ksl-line);
  background:
    linear-gradient(180deg, rgba(234, 241, 248, 0.7), transparent 120px),
    var(--ksl-card);
}

.register-panel .section-head {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ksl-line);
}

.register-panel .section-head h2 {
  display: flex;
  gap: 9px;
  align-items: center;
  color: var(--ksl-navy);
}

.register-panel .section-head h2::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 24px;
  border-radius: 999px;
  background: var(--ksl-maroon);
}

.register-upload-panel .drop-zone {
  min-height: 170px;
  border-color: rgba(0, 51, 102, 0.26);
  background:
    linear-gradient(180deg, rgba(234, 241, 248, 0.88), rgba(255, 255, 255, 0.92));
}

.register-upload-panel .drop-zone:hover {
  border-color: var(--ksl-navy);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.register-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding: 14px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.repo-table-wrap {
  border-color: rgba(0, 51, 102, 0.2);
  box-shadow: var(--shadow-sm);
}

.classic-repository-table {
  min-width: 1320px;
  table-layout: fixed;
}

.classic-repository-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  vertical-align: middle;
}

.classic-repository-table th:nth-child(1),
.classic-repository-table td:nth-child(1) {
  width: 168px;
}

.classic-repository-table th:nth-child(2),
.classic-repository-table td:nth-child(2),
.classic-repository-table th:nth-child(4),
.classic-repository-table td:nth-child(4),
.classic-repository-table th:nth-child(6),
.classic-repository-table td:nth-child(6),
.classic-repository-table th:nth-child(7),
.classic-repository-table td:nth-child(7),
.classic-repository-table th:nth-child(9),
.classic-repository-table td:nth-child(9),
.classic-repository-table th:nth-child(10),
.classic-repository-table td:nth-child(10) {
  width: 118px;
}

.classic-repository-table th:nth-child(3),
.classic-repository-table td:nth-child(3) {
  width: 280px;
}

.classic-repository-table th:nth-child(5),
.classic-repository-table td:nth-child(5),
.classic-repository-table th:nth-child(8),
.classic-repository-table td:nth-child(8),
.classic-repository-table th:nth-child(11),
.classic-repository-table td:nth-child(11),
.classic-repository-table th:nth-child(12),
.classic-repository-table td:nth-child(12) {
  width: 150px;
}

.classic-repository-table th:nth-child(13),
.classic-repository-table td:nth-child(13) {
  width: 190px;
}

.classic-repository-table td {
  vertical-align: top;
}

.classic-repository-table tbody tr:nth-child(even) {
  background: rgba(234, 241, 248, 0.45);
}

.classic-repository-table tbody tr:hover {
  background: var(--row-hover);
}

.repo-number-cell {
  background: rgba(234, 241, 248, 0.48);
}

.repo-subject-cell .cell-truncate {
  color: var(--ksl-navy);
  font-weight: 800;
}

.repo-actions-cell .actions {
  align-items: stretch;
}

.repo-actions-cell .btn {
  justify-content: center;
}

.report-option-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.report-option-grid a {
  display: grid;
  gap: 7px;
  justify-items: center;
  min-height: 86px;
  padding: 14px 10px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  color: var(--ksl-navy);
  background: var(--ksl-card);
  text-align: center;
  text-decoration: none;
  font-weight: 850;
}

.report-option-grid a i {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--ksl-navy);
  border-radius: 50%;
}

.report-option-grid a.active,
.report-option-grid a:hover {
  border-color: rgba(122, 17, 24, 0.34);
  background: var(--ksl-red-soft);
}

.report-bars {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--ksl-line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--ksl-navy-soft);
}

.editor-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

html[data-theme="dark"] .form-section-title,
html[data-theme="dark"] .register-identity-grid,
html[data-theme="dark"] .register-panel,
html[data-theme="dark"] .register-actionbar,
html[data-theme="dark"] .repo-number-cell {
  background: var(--ksl-card);
}

html[data-theme="dark"] .classic-repository-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 920px) {
  .report-option-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .register-actionbar {
    position: static;
  }

  .classic-repository-table {
    min-width: 0;
  }

  .classic-repository-table thead {
    display: none;
  }

  .classic-repository-table,
  .classic-repository-table tbody,
  .classic-repository-table tr,
  .classic-repository-table td {
    display: block;
    width: 100% !important;
  }

  .classic-repository-table tr {
    margin: 0 0 14px;
    border: 1px solid var(--ksl-line);
    border-radius: var(--radius);
    background: var(--ksl-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .classic-repository-table td {
    display: grid;
    grid-template-columns: 138px minmax(0, 1fr);
    gap: 12px;
    border-bottom: 1px solid var(--ksl-line);
  }

  .classic-repository-table td::before {
    content: attr(data-label);
    color: var(--ksl-muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .classic-repository-table td:last-child {
    border-bottom: 0;
  }

  .repo-actions-cell .actions {
    flex-direction: row;
  }
}

@media (max-width: 980px) {
  .register-stepper {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recipient-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipient-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .review-summary dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .register-stepper {
    grid-template-columns: 1fr;
  }

  .stepper-item {
    min-height: 44px;
  }

  .input-action-row,
  .recipient-tools,
  .register-routing-workspace #incomingFields,
  .register-routing-workspace #outgoingFields,
  .review-summary dl {
    grid-template-columns: 1fr;
  }

  .register-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .register-nav .btn {
    width: 100%;
  }

  .dashboard-equal-card {
    min-height: auto;
  }

  .calendar-month-grid {
    gap: 4px;
  }

  .calendar-day {
    min-height: 28px;
    padding: 3px 1px;
    font-size: 0.76rem;
  }

  .calendar-day-note {
    display: none;
  }
}

.main-shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 16px 26px;
  background: rgba(245, 247, 251, 0.88);
  border-bottom: 1px solid var(--ksl-line);
  backdrop-filter: blur(14px);
}

.topbar > div:first-of-type {
  min-width: 0;
}

html[data-theme="dark"] .topbar {
  background: rgba(7, 20, 38, 0.9);
}

html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .page-title h1,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] label {
  color: #eef4ff;
}

html[data-theme="dark"] .eyebrow {
  color: #f3d47a;
}

html[data-theme="dark"] a {
  color: #9fc8ff;
}

.topbar h1,
.page-title h1 {
  margin: 0;
  color: var(--ksl-ink);
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--ksl-maroon);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none !important;
}

.topbar-actions > .profile-block {
  flex: 0 1 380px;
}

.topbar-actions form {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 320px;
}

.profile-block {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: min(100%, 260px);
  padding: 8px 10px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  color: var(--ksl-ink);
  background: var(--ksl-card);
}

.profile-block img,
.profile-photo {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 2px solid var(--ksl-navy-soft);
  border-radius: 50%;
}

.profile-block b,
.profile-block small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.profile-block small {
  color: var(--ksl-muted);
  line-height: 1.35;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.content {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px;
}

.portal-frame {
  width: 100%;
  min-height: calc(100vh - 77px);
  border: 0;
  background: transparent;
}

.portal-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 24px;
  align-items: center;
  margin-bottom: 22px;
  padding: clamp(20px, 3vw, 32px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(11, 45, 87, 0.96), rgba(111, 21, 27, 0.9)),
    var(--ksl-navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.portal-hero::before {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 280px;
  height: 280px;
  border: 44px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.portal-hero h2 {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3vw, 2.55rem);
  line-height: 1.08;
}

.portal-hero p:not(.eyebrow) {
  position: relative;
  z-index: 1;
  max-width: 660px;
  color: rgba(255, 255, 255, 0.84);
  margin: 10px 0 0;
}

.portal-hero img {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  animation: float-soft 5.2s ease-in-out infinite;
}

.portal-hero .eyebrow {
  color: #f3d47a;
}

@keyframes float-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: var(--ksl-card);
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  animation: card-in 0.28s ease both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-pad {
  padding: 20px;
}

.stat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-top: 4px solid var(--ksl-maroon);
}

.stat-card p {
  margin: 0;
  color: var(--ksl-muted);
  font-size: 0.9rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  color: var(--ksl-navy);
  background: var(--ksl-navy-soft);
}

.view-controls {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
}

.view-controls .btn {
  color: var(--ksl-ink);
}

.view-controls .btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.appearance-control {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  max-width: 520px;
}

.appearance-control input[type="range"] {
  min-height: 38px;
  padding: 0;
  accent-color: var(--ksl-maroon);
}

.appearance-control strong {
  min-width: 52px;
  color: var(--ksl-ink);
  text-align: right;
  white-space: nowrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.section-head h2,
.card h2 {
  margin: 0;
  font-size: 1.1rem;
}

.section-head p,
.card-subtitle {
  margin: 4px 0 0;
  color: var(--ksl-muted);
  font-size: 0.9rem;
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 9px 14px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.btn-primary {
  color: #fff;
  background: var(--ksl-maroon);
}

.btn-primary:hover {
  background: var(--ksl-navy-700);
}

.btn-secondary {
  color: #fff;
  background: var(--ksl-red);
}

.btn-outline {
  color: var(--ksl-ink);
  background: var(--ksl-card);
  border-color: var(--ksl-line);
}

html[data-theme="dark"] .btn-outline {
  color: var(--ksl-ink);
}

.btn-danger {
  color: #fff;
  background: var(--ksl-danger);
}

.btn-success {
  color: #fff;
  background: var(--ksl-success);
}

.btn-sm {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.icon-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  white-space: nowrap;
}

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

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

.form-field {
  display: grid;
  gap: 7px;
}

.form-field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--ksl-ink);
  font-size: 0.88rem;
  font-weight: 750;
}

code {
  color: var(--ksl-maroon);
  background: var(--ksl-red-soft);
  border-radius: 6px;
  padding: 3px 6px;
}

.code-panel {
  overflow: auto;
  max-height: 420px;
  padding: 14px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  color: var(--ksl-ink);
  background: var(--ksl-card);
  white-space: pre-wrap;
}

input,
select,
textarea {
  width: 100%;
  min-height: 41px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--ksl-ink);
  background: var(--ksl-card);
  font: inherit;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .activity-item,
html[data-theme="dark"] .calendar-item,
html[data-theme="dark"] .modal-panel,
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .drop-zone,
html[data-theme="dark"] .profile-block {
  color: var(--ksl-ink);
  background: #0d2038;
  border-color: var(--ksl-line);
}

html[data-theme="dark"] th {
  color: #ffffff;
  background: linear-gradient(180deg, #174a80, #0b2d57);
}

html[data-theme="dark"] td {
  color: #eef4ff;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(196, 154, 44, 0.28);
  border-color: var(--ksl-navy-700);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
  box-shadow: 0 12px 26px rgba(16, 32, 51, 0.06);
}

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

.smart-table-wrap {
  position: relative;
}

.smart-table {
  table-layout: fixed;
  min-width: 1180px;
}

.smart-table th,
.smart-table td {
  max-width: 320px;
}

.smart-table th {
  white-space: nowrap;
}

.smart-table .col-expand {
  width: 46px;
}

.smart-table .col-select {
  width: 46px;
}

.smart-table .col-number {
  width: 160px;
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.smart-table .col-id {
  width: 82px;
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.smart-table .col-date {
  width: 124px;
}

.smart-table .col-actions {
  width: 150px;
}

.smart-table .col-status,
.smart-table .col-version,
.smart-table .col-type {
  width: 116px;
}

.smart-table .col-person,
.smart-table .col-department,
.smart-table .col-contact {
  width: 220px;
  max-width: 280px;
}

.smart-table .col-title {
  width: auto;
}

.smart-table .col-tags {
  width: 180px;
}

.cell-truncate {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-clamp {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
}

.cell-mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 0.86rem;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 190px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  max-width: 120px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #0b2d57;
  background: var(--ksl-navy-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.tag-chip-more {
  color: #6f151b;
  background: var(--ksl-gold-soft);
}

.column-chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0 0;
}

.column-chooser label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
  font-size: 0.82rem;
}

.column-chooser input {
  width: auto;
  min-height: auto;
}

.row-expand-btn {
  width: 34px;
  height: 34px;
  padding: 0;
}

.row-expand-btn i {
  transition: transform 0.18s ease;
}

tr.is-expanded .row-expand-btn i {
  transform: rotate(90deg);
}

.smart-table [data-hidden-column="true"] {
  display: none !important;
}

th,
td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--ksl-line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th {
  color: #fff;
  background: linear-gradient(180deg, var(--ksl-navy), #092545);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--row-hover);
}

tbody tr:nth-child(even) {
  background: rgba(11, 45, 87, 0.025);
}

html[data-theme="dark"] tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.025);
}

canvas {
  width: 100% !important;
  max-height: 340px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.pill-approved,
.pill-success {
  color: #0f6b39;
  background: #e8f6ee;
}

.pill-pending,
.pill-warning {
  color: #905f12;
  background: #fff4d6;
}

.pill-declined,
.pill-danger {
  color: #9d2f2f;
  background: #fdeaea;
}

.pill-info {
  color: #0b4f78;
  background: #e8f3fa;
}

html[data-theme="dark"] .pill-info {
  color: #c8e9ff;
  background: #143852;
}

html[data-theme="dark"] .pill-warning {
  color: #ffe6a3;
  background: #3a2b10;
}

html[data-theme="dark"] .pill-success,
html[data-theme="dark"] .pill-approved {
  color: #bdf2cf;
  background: #123923;
}

html[data-theme="dark"] .pill-danger,
html[data-theme="dark"] .pill-declined {
  color: #ffd1d1;
  background: #3c1719;
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pagination a {
  min-width: 36px;
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  color: var(--ksl-ink);
  background: #fff;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  text-decoration: none;
}

.pagination a.active {
  color: #fff;
  background: var(--ksl-maroon);
  border-color: var(--ksl-maroon);
}

.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--ksl-line);
  background: #fff;
}

.alert-success {
  color: #0f6b39;
  background: #e8f6ee;
  border-color: #bce5ca;
}

.alert-danger {
  color: #9d2f2f;
  background: #fdeaea;
  border-color: #f5c1c1;
}

.alert-info {
  color: #135d86;
  background: #e8f3fa;
  border-color: #b9dced;
}

.tabs {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: #fff;
}

.tab {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 9px 13px;
  color: var(--ksl-muted);
  cursor: pointer;
  font-weight: 750;
}

.tab.active {
  color: #fff;
  background: var(--ksl-maroon);
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 144px;
  border: 2px dashed #c9d1df;
  border-radius: var(--radius);
  background: #fbfcff;
  color: var(--ksl-muted);
  text-align: center;
  padding: 18px;
  cursor: pointer;
}

.drop-zone.is-dragover {
  border-color: var(--ksl-navy-700);
  background: var(--ksl-navy-soft);
}

.drop-zone i {
  display: block;
  color: var(--ksl-maroon);
  font-size: 1.65rem;
  margin-bottom: 6px;
}

.activity-list,
.calendar-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-item,
.calendar-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--ksl-line);
  border-radius: var(--radius);
  background: var(--ksl-card);
}

.activity-item i,
.calendar-date {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--ksl-navy-soft);
  color: var(--ksl-navy);
  font-weight: 800;
}

.activity-item b,
.calendar-item b {
  display: block;
}

.activity-item small,
.calendar-item small {
  color: var(--ksl-muted);
}

.dashboard-balance-grid {
  align-items: stretch;
}

.dashboard-equal-card {
  display: flex;
  min-height: 560px;
  flex-direction: column;
}

.dashboard-equal-card .activity-list {
  flex: 1 1 auto;
  align-content: start;
}

.dashboard-calendar-card .quick-actions {
  margin-top: auto !important;
  padding-top: 18px;
}

.dashboard-calendar-widget {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 380px;
  min-height: 0;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid #dfe5ec;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 35, 55, 0.05);
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
}

.calendar-toolbar h3 {
  margin: 0;
  color: #5b6573;
  font-size: 0.92rem;
  font-weight: 850;
  text-align: center;
}

.calendar-nav-btn {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border: 1px solid #cfd6df;
  border-radius: 50%;
  color: #a7b0bc;
  background: #fff;
  font-size: 0.68rem;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.calendar-nav-btn:hover,
.calendar-nav-btn:focus-visible {
  border-color: var(--ksl-navy);
  color: var(--ksl-navy);
  background: #f4f7fb;
}

.calendar-subtoolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ksl-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.calendar-system-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  min-height: 24px;
  border: 1px solid #d8dee7;
  border-radius: 999px;
  background: #f8fafc;
}

.calendar-system-toggle button {
  min-width: 34px;
  border: 0;
  color: var(--ksl-muted);
  background: transparent;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}

.calendar-system-toggle button.active {
  color: #fff;
  background: #4f83f1;
}

.calendar-today-link {
  border: 0;
  color: var(--ksl-navy);
  background: transparent;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px 6px;
  min-width: 0;
}

.calendar-month-grid.slide-next {
  animation: calendar-slide-next 0.22s ease-out;
}

.calendar-month-grid.slide-prev {
  animation: calendar-slide-prev 0.22s ease-out;
}

.calendar-month-grid.slide-refresh {
  animation: calendar-refresh 0.18s ease-out;
}

.calendar-weekday {
  min-height: 26px;
  color: #626d7c;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.calendar-day {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 28px;
  padding: 3px 2px;
  border: 0;
  border-radius: 4px;
  color: #2d3748;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
}

.calendar-day:not(.muted-day) {
  cursor: default;
}

.calendar-day.is-today {
  color: #fff;
  background: #5b8df7;
  box-shadow: 0 5px 12px rgba(91, 141, 247, 0.3);
}

.calendar-day-note {
  display: none;
}

.muted-day {
  color: #c1c8d2;
}

@keyframes calendar-slide-next {
  from { opacity: 0.3; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes calendar-slide-prev {
  from { opacity: 0.3; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes calendar-refresh {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .calendar-month-grid.slide-next,
  .calendar-month-grid.slide-prev,
  .calendar-month-grid.slide-refresh {
    animation: none;
  }
}

html[data-theme="dark"] .dashboard-calendar-widget,
html[data-theme="dark"] .calendar-system-toggle {
  background: #0d2038;
  border-color: #29415e;
}

html[data-theme="dark"] .calendar-toolbar h3 {
  color: var(--ksl-ink);
}

html[data-theme="dark"] .calendar-day {
  color: var(--ksl-ink);
  background: transparent;
}

html[data-theme="dark"] .calendar-nav-btn {
  color: #b7c3d4;
  background: #102946;
  border-color: #3b536e;
}

html[data-theme="dark"] .calendar-weekday,
html[data-theme="dark"] .calendar-subtoolbar {
  color: #b7c3d4;
}

html[data-theme="dark"] .muted-day {
  color: #64758b;
}

html[data-theme="dark"] .calendar-day.is-today {
  color: #fff;
  background: #5b8df7;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.54);
}

.modal-backdrop.open {
  display: flex;
}

.modal-panel {
  width: min(760px, 96vw);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--ksl-line);
}

.modal-body {
  padding: 20px;
}

.password-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.password-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ksl-danger);
  transition: width 0.2s ease, background 0.2s ease;
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--ksl-ink);
  background: #fff;
  border-left: 4px solid var(--ksl-navy);
  box-shadow: var(--shadow-md);
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  color: var(--ksl-ink);
  background:
    radial-gradient(circle at 12% 16%, rgba(199, 160, 68, 0.2), transparent 30%),
    linear-gradient(125deg, #003366 0%, #082344 58%, #6f151b 100%);
  overflow: hidden;
}

html[data-theme="dark"] .login-page {
  background:
    radial-gradient(circle at 12% 16%, rgba(210, 103, 112, 0.16), transparent 30%),
    linear-gradient(125deg, #050d18, #10233d 55%, #27080c);
}

.login-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(20px, 4vw, 48px);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.login-hero-inner {
  position: relative;
  z-index: 1;
}

.login-hero::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -140px;
  width: 360px;
  height: 360px;
  border: 54px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.login-hero h1 {
  margin: 0;
  max-width: 720px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.login-hero .eyebrow {
  color: #f6d983;
}

.login-hero p {
  max-width: 620px;
  color: #f4f8ff;
  font-size: 0.98rem;
}

.login-panel-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 12px;
  background: #ffffff;
}

.login-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  padding: clamp(18px, 2.4vw, 26px);
  background: #fff;
  border: 1px solid #c7a044;
  border-radius: var(--radius);
  box-shadow: 0 18px 45px rgba(0, 51, 102, 0.18);
}

html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .login-panel-wrap {
  color: var(--ksl-ink);
}

html[data-theme="dark"] .login-panel-wrap {
  background:
    linear-gradient(180deg, rgba(8, 22, 40, 0.96), rgba(11, 30, 52, 0.92)),
    #081628;
}

html[data-theme="dark"] .login-panel {
  background: #0d2038;
  border-color: #e7c66b;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.login-illustration {
  display: none;
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  margin-bottom: 18px;
}

.login-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
  max-width: 680px;
}

.login-feature {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(246, 217, 131, 0.48);
  border-radius: var(--radius);
  color: #ffffff;
  background: rgba(0, 51, 102, 0.42);
  backdrop-filter: blur(10px);
}

.login-feature i {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #3e0b10;
  background: #f3d47a;
  border-radius: var(--radius);
}

.login-feature b,
.login-feature small {
  display: block;
}

.login-feature b {
  color: #ffffff;
}

.login-feature small {
  color: #f5fbff;
}

.login-logo {
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.login-logo img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  padding: 9px;
  border: 3px solid #c7a044;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(0, 51, 102, 0.18);
}

.login-panel h2 {
  margin: 0 0 6px;
  color: var(--ksl-navy);
  font-size: 1.32rem;
}

.login-panel .subtitle {
  margin: 0 0 12px;
  color: var(--ksl-navy);
}

.login-credentials-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.login-session-note {
  margin-top: 12px;
  color: #003366;
  background: #fff9e8;
  border-color: #c7a044;
}

.login-social .btn {
  color: #003366;
  background: #ffffff;
  border-color: #003366;
}

.login-social .btn:hover {
  color: #ffffff;
  background: #003366;
}

.login-panel label {
  color: var(--ksl-maroon-dark);
}

.login-panel input {
  color: var(--ksl-navy);
  background: #ffffff;
  border-color: #003366;
}

.login-panel input::placeholder {
  color: #7a1118;
}

html[data-theme="dark"] .login-panel h2,
html[data-theme="dark"] .login-panel .subtitle,
html[data-theme="dark"] .login-panel label {
  color: #ffffff;
}

html[data-theme="dark"] .login-panel input {
  color: #ffffff;
  background: #003366;
  border-color: #e7c66b;
}

html[data-theme="dark"] .login-panel input::placeholder {
  color: #ffe6a3;
}

html[data-theme="dark"] .login-session-note {
  color: #ffffff;
  background: #003366;
  border-color: #e7c66b;
}

html[data-theme="dark"] .login-social .btn {
  color: #ffffff;
  background: #003366;
  border-color: #e7c66b;
}

.login-work-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 680px;
  margin-top: 18px;
}

.login-work-areas span {
  padding: 7px 10px;
  border: 1px solid rgba(246, 217, 131, 0.72);
  border-radius: 999px;
  color: #fff9e8;
  background: rgba(0, 51, 102, 0.38);
  font-size: 0.82rem;
  font-weight: 800;
}

.login-help-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 18px 0 0;
  padding: 12px;
  color: #5b2730;
  background: #fff6df;
  border: 1px solid #ecd18b;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.login-help-note a {
  color: #003366;
  font-weight: 800;
}

html[data-theme="dark"] .login-help-note {
  color: #ffe6a3;
  background: #352b16;
  border-color: #6d5a25;
}

html[data-theme="dark"] .login-help-note a {
  color: #ffffff;
}

.quick-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-table-wrap {
  box-shadow: var(--shadow-md);
}

.user-table th,
.user-table td {
  vertical-align: top;
}

.user-table:not(.smart-table) td:last-child {
  min-width: 360px;
}

.user-cell {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.user-cell b,
.user-cell small {
  display: block;
}

.user-cell small {
  color: var(--ksl-muted);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  font-size: 0.82rem;
}

.muted {
  color: var(--ksl-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .grid-4,
  .grid-3,
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .mobile-menu-toggle {
    display: inline-flex !important;
  }

  body.sidebar-open .mobile-menu-toggle,
  .sidebar.is-open ~ .main-shell .mobile-menu-toggle {
    display: none !important;
  }

  .app-shell,
  .login-page {
    grid-template-columns: 1fr;
  }

  .login-page {
    overflow: auto;
  }

  .login-panel {
    max-height: none;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .topbar-actions form,
  .topbar-actions > .profile-block {
    flex: 1 1 100%;
    max-width: none;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .main-shell {
    min-height: 100vh;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .content {
    padding: 18px;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid,
  .form-grid-3,
  .filter-bar {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 46vh;
  }

  .smart-table {
    min-width: 0;
    table-layout: auto;
  }

  .smart-table thead {
    display: none;
  }

  .smart-table,
  .smart-table tbody,
  .smart-table tr,
  .smart-table td {
    display: block;
    width: 100%;
  }

  .smart-table tr {
    margin: 0 0 12px;
    border: 1px solid var(--ksl-line);
    border-radius: var(--radius);
    background: var(--ksl-card);
    box-shadow: var(--shadow-sm);
  }

  .smart-table td {
    display: none;
    border-bottom: 1px solid var(--ksl-line);
    padding: 10px 12px;
  }

  .smart-table td.mobile-primary,
  .smart-table td.mobile-actions,
  .smart-table td.col-expand,
  .smart-table tr.is-expanded td {
    display: block;
  }

  .smart-table td.col-expand {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .smart-table td:not(.col-expand)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--ksl-muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .smart-table td.mobile-actions {
    border-bottom: 0;
  }

  .smart-table .actions {
    justify-content: flex-start;
  }

  .cell-truncate {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
  }
}

@media (max-width: 560px) {
  .login-feature-grid,
  .login-credentials-grid {
    grid-template-columns: 1fr;
  }

  .appearance-control {
    grid-template-columns: auto 1fr auto;
  }

  .appearance-control strong {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* Final visibility guard: .btn is also display:inline-flex, so this must come last. */
.mobile-menu-toggle {
  display: none !important;
}

@media (max-width: 860px) {
  .mobile-menu-toggle {
    display: inline-flex !important;
  }

  body.sidebar-open .mobile-menu-toggle,
  .sidebar.is-open ~ .main-shell .mobile-menu-toggle {
    display: none !important;
  }
}
