:root {
  --ink: #1b2736;
  --ink-strong: #0f1724;
  --muted: #697789;
  --line: #d9e2ec;
  --brand: #ff6a18;
  --brand-strong: #ed5510;
  --brand-blue: #1268a8;
  --brand-blue-strong: #0b406d;
  --surface: #fff;
  --panel: #f7f9fc;
  --danger: #c84630;
  --danger-bg: #fff1ed;
  --focus: rgba(255, 106, 24, .18);
  --ease-out: cubic-bezier(.22, .8, .18, 1);
  --ease-spring: cubic-bezier(.2, .9, .22, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Outfit", "Satoshi", "Plus Jakarta Sans", "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(255, 106, 24, .55);
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-strong);
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.tabler-icon {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-avatar .tabler-icon {
  width: 20px;
  height: 20px;
}

.app-avatar.small .tabler-icon {
  width: 16px;
  height: 16px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 16px;
  z-index: 5;
  transform: translateY(-180%);
  padding: 10px 14px;
  color: #fff;
  border-radius: 12px;
  background: var(--ink-strong);
  box-shadow: 0 20px 44px rgba(15, 23, 36, .18);
  transition: transform .5s var(--ease-spring);
}

.skip-link:focus {
  transform: translateY(0);
}

.login-page {
  min-height: 100dvh;
  overflow-x: hidden;
  background: #e9f4f9;
}

.login-page::before,
.admin-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .8) 0 1px, transparent 1.4px),
    radial-gradient(circle at 80% 70%, rgba(18, 104, 168, .22) 0 1px, transparent 1.3px);
  background-size: 34px 34px, 46px 46px;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 70px;
  isolation: isolate;
}

.visual-plane {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .34)),
    url("/assets/login-bg.png") center / cover no-repeat,
    #e9f4f9;
}

.visual-plane::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(225, 242, 249, .2)),
    rgba(255, 255, 255, .06);
}

.login-composition {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: center;
  gap: clamp(42px, 8vw, 120px);
}

.login-composition.single-card {
  display: flex;
  justify-content: center;
}

.login-card {
  position: relative;
  width: min(400px, 100%);
  min-height: 520px;
  padding: 28px 30px 26px;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(255, 255, 255, .9)),
    rgba(255, 255, 255, .92);
  box-shadow:
    0 34px 90px rgba(17, 72, 112, .24),
    0 1px 0 rgba(255, 255, 255, .92) inset,
    0 0 0 8px rgba(255, 255, 255, .18);
  animation: taste-rise .8s var(--ease-spring) both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 16px;
  pointer-events: none;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .9);
}

.mfa-card {
  min-height: 420px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: #6d7b8c;
  font-size: 13px;
}

.security-pill {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  color: var(--brand-blue);
  font-size: 12px;
  border-radius: 999px;
  background: rgba(18, 104, 168, .08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 42px 0 24px;
  color: var(--ink-strong);
}

.brand-lockup.compact {
  justify-content: flex-start;
  margin: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .22), transparent 40%),
    linear-gradient(135deg, var(--brand), #ff9b46 48%, var(--brand-blue) 100%);
  box-shadow: 0 12px 28px rgba(255, 106, 24, .24);
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  line-height: 1.25;
}

.brand-lockup strong {
  font-size: 15px;
}

.brand-lockup small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

h1 {
  margin: 0 0 18px;
  color: var(--ink-strong);
  text-align: left;
  font-size: 22px;
  font-weight: 700;
}

.context-line,
.alert {
  margin-bottom: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  border-radius: 10px;
}

.context-line {
  color: #3c5871;
  border: 1px solid rgba(18, 104, 168, .12);
  background: rgba(18, 104, 168, .07);
}

.alert {
  color: var(--danger);
  border: 1px solid rgba(200, 70, 48, .16);
  background: var(--danger-bg);
}

.login-form {
  display: grid;
  gap: 14px;
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .9);
  transition: border-color .32s var(--ease-out), box-shadow .32s var(--ease-out), background-color .32s var(--ease-out), transform .32s var(--ease-out);
}

.field:hover {
  border-color: #bfd0df;
  background: #fff;
}

.field:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus), 0 10px 26px rgba(255, 106, 24, .08);
  transform: translateY(-1px);
}

.field-icon {
  flex: 0 0 auto;
  width: 44px;
  display: grid;
  place-items: center;
  color: #91a0af;
  font-size: 18px;
}

.field:focus-within .field-icon {
  color: var(--brand);
}

.field input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.field input::placeholder {
  color: #9aa7b6;
}

.ghost-eye {
  flex: 0 0 auto;
  width: 42px;
  height: 100%;
  display: grid;
  place-items: center;
  border: 0;
  color: #8b99a8;
  background: transparent;
  cursor: pointer;
  transition: color .32s var(--ease-out), transform .32s var(--ease-out);
}

.ghost-eye:hover,
.ghost-eye.is-active {
  color: var(--brand-blue);
  transform: scale(1.04);
}

.primary-btn,
.secondary-btn {
  border: 0;
  cursor: pointer;
}

.primary-btn {
  position: relative;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .16), transparent 42%),
    linear-gradient(135deg, var(--brand) 0%, #ff8b32 54%, #e85f18 100%);
  box-shadow: 0 18px 36px rgba(255, 106, 24, .22);
  transition: transform .36s var(--ease-spring), box-shadow .36s var(--ease-spring), filter .36s var(--ease-spring);
}

.primary-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(255, 106, 24, .28);
}

.primary-btn:active {
  transform: translateY(0) scale(.985);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: .86;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  display: none;
  border: 2px solid rgba(255, 255, 255, .48);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.primary-btn.is-loading .btn-spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.secondary-btn {
  height: 30px;
  padding: 0 12px;
  color: var(--ink);
  border-radius: 999px;
  background: #eef2f7;
}

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
  font-size: 13px;
}

.check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #59687a;
  cursor: pointer;
  user-select: none;
}

.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.check-box {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd7e2;
  border-radius: 6px;
  background: #fff;
  transition: background-color .28s var(--ease-out), border-color .28s var(--ease-out), box-shadow .28s var(--ease-out), transform .28s var(--ease-out);
}

.check-box::after {
  content: "";
  width: 8px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0);
  transition: transform .18s ease;
}

.check input:checked + .check-box {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 6px 14px rgba(255, 106, 24, .2);
  transform: translateY(-1px);
}

.check input:checked + .check-box::after {
  transform: rotate(-45deg) scale(1);
}

.check input:focus-visible + .check-box {
  outline: 2px solid rgba(255, 106, 24, .55);
  outline-offset: 3px;
}

.forgot {
  color: #667789;
  white-space: nowrap;
  transition: color .18s ease;
}

.forgot:hover {
  color: var(--brand);
}

.external-login { margin-top: 20px; }
.external-login-title { display: flex; align-items: center; gap: 12px; color: #91a0af; font-size: 12px; line-height: 1; text-align: center; }
.external-login-title::before, .external-login-title::after { content: ""; flex: 1; height: 1px; background: #e4ebf2; }
.external-login-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.external-login-option { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #45576a; border: 1px solid #dce5ed; border-radius: 10px; background: #fff; font-size: 13px; font-weight: 650; text-decoration: none; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.external-login-option:hover { color: var(--ink-strong); border-color: #adc5d8; box-shadow: 0 4px 12px rgba(32, 58, 84, .08); transform: translateY(-1px); }
.external-login-option img { width: 22px; height: 22px; }

.page-footer {
  position: fixed;
  z-index: 1;
  left: 20px;
  right: 20px;
  bottom: 22px;
  color: rgba(255, 255, 255, .86);
  text-align: center;
  font-size: 12px;
  text-shadow: 0 8px 24px rgba(8, 31, 52, .28);
}

.forgot-card {
  min-height: 430px;
}

.forgot-actions {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.primary-link-btn,
.secondary-link-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 700;
}

.primary-link-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #ff8b32 48%, var(--brand-blue));
  box-shadow: 0 14px 30px rgba(255, 106, 24, .22);
}

.primary-link-btn:hover {
  color: #fff;
  filter: brightness(1.04);
}

.secondary-link-btn {
  color: var(--brand-blue);
  border: 1px solid rgba(18, 104, 168, .18);
  background: rgba(18, 104, 168, .07);
}

.mfa-secret {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: #647284;
  font-size: 13px;
  line-height: 1.55;
}

code {
  padding: 4px 6px;
  color: #a84612;
  border-radius: 6px;
  background: #fff2eb;
  white-space: pre-wrap;
}

.mfa-secret textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #667789;
  padding: 10px;
  background: rgba(255, 255, 255, .8);
}

.admin-page {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #f7fafc 0%, #eef5f9 100%);
}

.admin-header {
  position: sticky;
  top: 14px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 0 28px;
  width: min(1320px, calc(100% - 32px));
  margin: 14px auto 0;
  border: 1px solid rgba(226, 232, 240, .72);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 20px 52px rgba(20, 63, 96, .08);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-nav a {
  padding: 8px 10px;
  color: #667789;
  border-radius: 8px;
  font-size: 13px;
  transition: color .18s ease, background-color .18s ease;
}

.admin-nav a:hover {
  color: var(--brand-blue);
  background: rgba(18, 104, 168, .08);
}

.admin-user,
.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px;
}

.admin-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, .7fr);
  gap: 18px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 24px 32px;
}

.admin-hero {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-height: 156px;
  padding: 28px;
  color: #fff;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(15, 38, 62, .95), rgba(18, 104, 168, .78)),
    url("/assets/login-bg.png") center 58% / cover no-repeat;
  box-shadow: 0 28px 70px rgba(11, 64, 109, .18);
  overflow: hidden;
  animation: taste-rise .72s var(--ease-spring) both;
}

.admin-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(13, 32, 52, .76), rgba(13, 32, 52, .22)),
    radial-gradient(circle at 82% 20%, rgba(255, 122, 38, .28), transparent 30%);
}

.admin-hero h1 {
  margin: 6px 0 8px;
  color: #fff;
  font-size: 28px;
}

.admin-hero p {
  max-width: 680px;
  color: rgba(255, 255, 255, .78);
}

.admin-hero > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, .72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-action {
  min-width: 118px;
  background: linear-gradient(135deg, var(--brand), #ff964a);
  box-shadow: 0 14px 30px rgba(255, 106, 24, .28);
}

.metric-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid #e3eaf3;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(15, 23, 36, .04);
  animation: taste-rise .72s var(--ease-spring) both;
}

.metric-card span {
  display: block;
  color: #667789;
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  color: var(--ink-strong);
  font-size: 30px;
  line-height: 1;
}

.panel,
.notice {
  background: #fff;
  border: 1px solid #e2e8f0;
}

.panel {
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(15, 23, 36, .04);
  animation: taste-rise .72s var(--ease-spring) both;
}

.panel.wide,
.notice {
  grid-column: 1 / -1;
}

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}

.notice.success {
  color: #127a47;
  border-color: rgba(18, 122, 71, .16);
  background: #effaf4;
}

.notice.danger {
  color: var(--danger);
  border-color: rgba(200, 70, 48, .16);
  background: var(--danger-bg);
}

.notice.warning {
  border-color: #ffd4bf;
  background: #fff5ef;
}

.panel h1,
.panel h2 {
  margin: 0 0 14px;
  text-align: left;
  font-size: 16px;
}

.panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.admin-form input,
.admin-form select,
.admin-form textarea {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 9px 10px;
  background: #fff;
}

.admin-form textarea {
  min-height: 70px;
}

.filter-form,
.compact-form {
  display: grid;
  gap: 10px;
}

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

.compact-form {
  grid-template-columns: 1fr;
  margin-bottom: 16px;
}

.filter-form input,
.filter-form select,
.compact-form input,
.compact-form select,
.compact-form textarea,
.employee-form input,
.employee-form select,
.employee-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  transition: border-color .3s var(--ease-out), box-shadow .3s var(--ease-out), transform .3s var(--ease-out);
}

.filter-form input,
.filter-form select,
.compact-form input,
.compact-form select,
.employee-form input,
.employee-form select {
  height: 42px;
  padding: 0 12px;
}

.compact-form textarea,
.employee-form textarea {
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
}

.filter-form input:focus,
.filter-form select:focus,
.compact-form input:focus,
.compact-form select:focus,
.compact-form textarea:focus,
.employee-form input:focus,
.employee-form select:focus,
.employee-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
  transform: translateY(-1px);
}

.subtle {
  color: #8190a2;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #edf1f6;
  text-align: left;
  vertical-align: top;
}

th {
  color: #6d7988;
  font-weight: 600;
  background: #f8fafc;
}

tbody tr {
  transition: background-color .28s var(--ease-out), transform .28s var(--ease-out);
}

tbody tr:hover {
  background: #fbfdff;
}

td small {
  display: block;
  color: #8994a3;
  margin-top: 2px;
}

.link-btn {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  cursor: pointer;
}

.link-btn:disabled {
  color: #b6c1ce;
  cursor: not-allowed;
}

.danger-link {
  color: var(--danger);
}

.employee-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.employee-cell strong {
  display: block;
  color: var(--ink-strong);
}

.avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 10px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-blue));
}

.role-badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.role-badge {
  color: #315a7b;
  background: #edf5fb;
}

.status-badge.is-active {
  color: #127a47;
  background: #eaf8f0;
}

.status-badge.is-disabled {
  color: #a0493a;
  background: #fff0eb;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 150px;
}

.row-actions form {
  margin: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  color: #7a8797;
  text-align: center;
  border: 1px dashed #d5deea;
  border-radius: 12px;
  background: #fbfdff;
}

.client-empty {
  margin-top: 14px;
}

.client-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.client-card {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid #e5edf5;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: 0 12px 32px rgba(20, 63, 96, .04);
}

.client-card.is-disabled {
  opacity: .74;
}

.client-card h3 {
  margin: 10px 0 8px;
  color: var(--ink-strong);
  font-size: 16px;
}

.client-card p {
  margin: 6px 0;
  font-size: 13px;
}

.client-card code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.client-callbacks {
  display: grid;
  gap: 6px;
}

.client-callbacks small {
  color: #7b8796;
  font-weight: 700;
}

.client-callbacks code {
  display: block;
  min-height: 30px;
  max-height: 92px;
  overflow: auto;
}

.empty-state strong {
  color: var(--ink);
}

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

.pagination a {
  min-width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #617083;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  background: #fff;
}

.pagination a.is-current {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.settings-note {
  color: #718095;
  font-size: 13px;
  line-height: 1.6;
}

.admin-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 28px 88px rgba(15, 23, 36, .28);
}

.admin-dialog::backdrop {
  background: rgba(12, 26, 44, .46);
  backdrop-filter: blur(3px);
}

.employee-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.employee-form header,
.employee-form footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.employee-form header h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
}

.dialog-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #687789;
  background: #f1f5f9;
  cursor: pointer;
}

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

.form-grid label,
.employee-form > label {
  display: grid;
  gap: 7px;
  color: #4a596b;
  font-size: 13px;
  font-weight: 700;
}

.span-2 {
  grid-column: span 2;
}

.check.inline {
  justify-content: flex-start;
  color: #59687a;
  font-weight: 400;
}

.account-resend-dialog {
  width: min(820px, calc(100vw - 32px));
  overflow: hidden;
  background: #fcfefd;
}

.account-resend-form {
  gap: 0;
  padding: 0;
}

.account-resend-form > header {
  align-items: flex-start;
  padding: 28px 30px 22px;
  background:
    radial-gradient(circle at 0 0, rgba(34, 125, 116, .16), transparent 43%),
    linear-gradient(130deg, #f2f9f8, #fbfdfd 62%, #edf6f8);
}

.dialog-heading {
  display: grid;
  gap: 5px;
}

.dialog-kicker,
.delivery-options-heading > div > span,
.resend-account-context > span {
  color: #0e685f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.account-resend-form header h2 {
  font-size: 24px;
  letter-spacing: -.035em;
}

.resend-account-context {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 12px;
  row-gap: 5px;
  margin: 22px 30px 0;
  padding: 16px 18px;
  border: 1px solid #dbe9e7;
  border-radius: 14px;
  background: #f6fbfa;
}

.resend-account-context strong {
  color: #173a38;
  font-size: 16px;
}

.resend-account-context p {
  grid-column: 1 / -1;
  margin: 0;
  color: #617571;
  font-size: 13px;
  line-height: 1.55;
}

.delivery-options {
  display: grid;
  gap: 16px;
  margin: 24px 30px 0;
}

.delivery-options-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.delivery-options-heading > div {
  display: grid;
  gap: 5px;
}

.delivery-options-heading h3 {
  margin: 0;
  color: #203331;
  font-size: 18px;
  letter-spacing: -.025em;
}

.delivery-options-heading p {
  margin: 0;
  color: #71817f;
  font-size: 12px;
  white-space: nowrap;
}

.delivery-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.delivery-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 186px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #d9e4e2;
  border-radius: 16px;
  color: #263c3a;
  background: #fff;
  box-shadow: 0 2px 0 rgba(19, 63, 59, .02);
  cursor: pointer;
  text-align: left;
  transition: border-color .24s ease, box-shadow .24s ease, transform .24s ease, background-color .24s ease;
}

.delivery-card::before {
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: #bfcecd;
  content: '';
  transition: background-color .24s ease;
}

.delivery-card:hover:not(:disabled) {
  border-color: #91beb8;
  box-shadow: 0 12px 25px rgba(29, 75, 70, .10);
  transform: translateY(-3px);
}

.delivery-card:focus-visible {
  outline: 3px solid rgba(20, 121, 112, .28);
  outline-offset: 3px;
}

.delivery-card.is-selected {
  border-color: #147970;
  background: linear-gradient(145deg, #f5fcfa, #ebf7f4);
  box-shadow: 0 12px 28px rgba(17, 106, 97, .15);
}

.delivery-card.is-selected::before {
  background: #0d7168;
}

.delivery-card:disabled {
  border-color: #e4e9e8;
  color: #87928f;
  background: #f8faf9;
  cursor: not-allowed;
}

.delivery-card:disabled::before {
  background: #d8dfdd;
}

.delivery-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.delivery-card-name {
  color: inherit;
  font-size: 14px;
  font-weight: 800;
}

.delivery-card-state {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: #526967;
  background: #edf2f1;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.delivery-card.is-selected .delivery-card-state {
  color: #087166;
  background: #d7eeea;
}

.delivery-card strong {
  color: #213936;
  font-size: 16px;
  letter-spacing: -.02em;
}

.delivery-card small {
  color: #71817f;
  font-size: 12px;
  line-height: 1.58;
}

.delivery-card:disabled strong,
.delivery-card:disabled small {
  color: #98a3a1;
}

.account-resend-form .resend-confirm {
  margin: 18px 30px 0;
  padding: 12px 14px;
  border: 1px solid #e7e1d5;
  border-radius: 12px;
  color: #675b47;
  background: #fffbf3;
}

.account-resend-form footer {
  margin-top: 22px;
  padding: 18px 30px 24px;
  border-top: 1px solid #e6edeb;
}

.delivery-selection-summary {
  display: block;
  margin: 14px 30px 0;
  color: #59706d;
  font-size: 12px;
  font-weight: 700;
}

.account-resend-form footer {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.account-resend-form footer > button {
  min-width: 108px;
}

@media (max-width: 680px) {
  .account-resend-form > header { padding: 22px 20px 18px; }
  .account-resend-form header h2 { font-size: 21px; }
  .resend-account-context,
  .delivery-options,
  .account-resend-form .resend-confirm,
  .delivery-selection-summary { margin-right: 20px; margin-left: 20px; }
  .delivery-options-heading { align-items: start; flex-direction: column; gap: 6px; }
  .delivery-card-grid { grid-template-columns: 1fr; }
  .delivery-card { min-height: 0; }
  .account-resend-form footer { align-items: center; flex-direction: row; padding: 16px 20px 20px; }
  .account-resend-form footer > button { flex: 1; min-width: 0; }
}

@keyframes taste-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 1040px) {
  .login-shell {
    padding-inline: 28px;
  }

  .login-composition {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .login-composition.single-card {
    justify-content: center;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

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

}

@media (max-width: 840px) {
  .login-shell {
    min-height: 100svh;
    padding: 74px 20px 76px;
  }

  .login-card {
    width: min(420px, 100%);
    min-height: auto;
    padding: 26px 22px 24px;
  }

  .brand-lockup {
    margin-top: 34px;
  }

  .visual-plane::after {
    background: rgba(255, 255, 255, .18);
  }

  .admin-header {
    top: 8px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
  }

  .admin-grid,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    padding: 16px;
  }

  .admin-hero {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 14px;
  }

  .admin-hero h1 {
    font-size: 24px;
  }

  .metric-grid,
  .filter-form,
  .form-grid,
  .client-card {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 460px) {
  .login-shell {
    align-items: center;
    padding-top: 44px;
  }

  .login-card {
    padding: 24px 18px 22px;
    border-radius: 14px;
  }

  .card-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  h1 {
    font-size: 21px;
  }

  .form-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-footer {
    position: static;
    margin-top: 22px;
    color: rgba(255, 255, 255, .82);
  }

  .admin-nav {
    width: 100%;
    overflow-x: auto;
  }

  .admin-user {
    width: 100%;
    justify-content: space-between;
  }

  .employee-table table,
  .employee-table thead,
  .employee-table tbody,
  .employee-table tr,
  .employee-table td {
    display: block;
  }

  .employee-table thead {
    display: none;
  }

  .employee-table tr {
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #e3eaf3;
    border-radius: 12px;
    background: #fff;
  }

  .employee-table td {
    padding: 8px 0;
    border: 0;
  }

  .row-actions {
    min-width: 0;
  }
}

/* CloudDye Identity Center shell */
.identity-admin {
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 106, 24, .08), transparent 28%),
    radial-gradient(circle at 84% 6%, rgba(18, 104, 168, .1), transparent 30%),
    linear-gradient(180deg, #f7fafc 0%, #edf3f8 100%);
}

.identity-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
}

.identity-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  color: #dbe7f2;
  background:
    linear-gradient(180deg, rgba(14, 35, 56, .98), rgba(11, 44, 71, .96)),
    #102538;
  box-shadow: 18px 0 58px rgba(15, 23, 36, .12);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand strong {
  color: #fff;
  font-size: 15px;
}

.sidebar-brand span {
  margin-top: 3px;
  color: rgba(219, 231, 242, .68);
  font-size: 12px;
}

.identity-nav {
  display: grid;
  gap: 6px;
  margin-top: 28px;
}

.identity-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: rgba(229, 238, 247, .78);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background-color .24s var(--ease-out), border-color .24s var(--ease-out), color .24s var(--ease-out), transform .24s var(--ease-out);
}

.identity-nav a:hover,
.identity-nav a.is-active {
  color: #fff;
  border-color: rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .1);
  transform: translateX(2px);
}

.identity-nav a.is-active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
}

.sidebar-foot {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
}

.sidebar-foot span {
  color: rgba(229, 238, 247, .66);
  font-size: 12px;
}

.sidebar-foot strong {
  color: #fff;
  font-size: 12px;
}

.identity-main {
  min-width: 0;
}

.identity-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 26px;
  background: rgba(247, 250, 252, .88);
  border-bottom: 1px solid rgba(217, 226, 236, .72);
  backdrop-filter: blur(18px);
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid #dfe7f0;
  border-radius: 12px;
  color: var(--ink-strong);
  background: #fff;
}

.topbar-search {
  flex: 1;
  min-height: 42px;
  display: flex;
  align-items: center;
  max-width: 460px;
  padding: 0 14px;
  color: #8a97a8;
  border: 1px solid #dfe7f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 36, .035);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: var(--brand-blue);
  border: 1px solid rgba(18, 104, 168, .14);
  border-radius: 999px;
  background: rgba(18, 104, 168, .06);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 4px 10px 4px 5px;
  border: 1px solid #e1e8f1;
  border-radius: 999px;
  background: #fff;
}

.user-chip strong,
.user-chip small {
  display: block;
  line-height: 1.2;
}

.user-chip strong {
  color: var(--ink-strong);
  font-size: 13px;
}

.user-chip small {
  margin-top: 2px;
  color: #7c8999;
  font-size: 11px;
}

.avatar.small {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  font-size: 12px;
}

.identity-content {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px clamp(20px, 3vw, 36px) 46px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.page-heading h1 {
  margin: 5px 0 7px;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: 0;
}

.page-heading p {
  margin: 0;
  color: #687789;
}

.eyebrow.dark {
  color: var(--brand-blue);
  text-shadow: none;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.compact-stats {
  grid-template-columns: repeat(2, minmax(0, 240px));
}

.stat-tile {
  position: relative;
  min-height: 124px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid #e1e8f1;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(250, 253, 255, .95)),
    #fff;
  box-shadow: 0 18px 44px rgba(18, 63, 99, .055);
}

.stat-tile::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: rgba(18, 104, 168, .08);
}

.stat-tile.accent-orange::after {
  background: rgba(255, 106, 24, .14);
}

.stat-tile.accent-blue::after {
  background: rgba(18, 104, 168, .14);
}

.stat-tile.warning-tone::after,
.stat-tile.danger-tone::after {
  background: rgba(200, 70, 48, .11);
}

.stat-tile span,
.stat-tile small {
  display: block;
  color: #687789;
  font-size: 13px;
}

.stat-tile strong {
  display: block;
  margin: 16px 0 10px;
  color: var(--ink-strong);
  font-size: 32px;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 18px;
}

.board-card {
  min-height: 320px;
}

.activity-list,
.reminder-stack,
.mini-list,
.settings-list {
  display: grid;
  gap: 10px;
}

.activity-item,
.mini-list > div,
.settings-list > div,
.permission-matrix > div,
.reminder-stack > div {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fbfdff;
}

.activity-item {
  justify-content: space-between;
}

.activity-item > div,
.mini-list > div > div {
  min-width: 0;
  flex: 1;
}

.activity-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(18, 104, 168, .08);
}

.activity-dot.ok {
  background: #22a06b;
  box-shadow: 0 0 0 4px rgba(34, 160, 107, .1);
}

.activity-dot.bad {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(200, 70, 48, .1);
}

.activity-item strong,
.mini-list strong,
.reminder-stack strong,
.permission-matrix strong {
  color: var(--ink-strong);
}

.activity-item small,
.mini-list small,
.reminder-stack span,
.permission-matrix span {
  display: block;
  margin-top: 3px;
  color: #7a8797;
  font-size: 12px;
}

.empty-state.compact {
  min-height: 86px;
  padding: 14px;
}

.app-admin-grid,
.org-layout,
.security-grid,
.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}

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

.application-form label,
.inline-reset-form {
  display: grid;
  gap: 7px;
  color: #4a596b;
  font-size: 13px;
  font-weight: 700;
}

.application-form input,
.application-form select,
.application-form textarea,
.inline-reset-form input,
.portal-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.application-form input,
.application-form select,
.inline-reset-form input,
.portal-search input {
  height: 42px;
  padding: 0 12px;
}

.application-form textarea {
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
}

.app-guide-panel {
  align-self: start;
}

.endpoint-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.endpoint-list > div {
  display: grid;
  gap: 6px;
}

.endpoint-list span {
  color: #687789;
  font-size: 12px;
  font-weight: 700;
}

.application-list,
.portal-app-grid,
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.application-card,
.portal-app-card,
.role-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #e1e9f2;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: 0 16px 40px rgba(18, 63, 99, .045);
}

.application-card.is-disabled {
  opacity: .72;
}

.app-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-card-main h2,
.app-card-main h3,
.role-card h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 16px;
}

.app-card-main p,
.app-desc {
  margin: 3px 0 0;
  color: #758396;
  font-size: 13px;
}

.app-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .22), transparent 48%),
    linear-gradient(135deg, var(--brand), var(--brand-blue));
  box-shadow: 0 12px 28px rgba(18, 104, 168, .14);
}

.app-avatar .ti {
  font-size: 19px;
}

.app-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.application-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.application-card dl > div {
  display: grid;
  gap: 5px;
}

.application-card dt {
  color: #718095;
  font-size: 12px;
  font-weight: 700;
}

.application-card dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.dept-tree {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.dept-node {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #edf2f7;
  border-radius: 13px;
  background: #fbfdff;
}

.dept-node span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--brand);
}

.dept-node small {
  color: #768497;
}

.role-card p {
  min-height: 42px;
  margin: 0;
  color: #718095;
  line-height: 1.55;
}

.role-card strong {
  color: var(--brand-blue);
}

.permission-matrix {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.audit-timeline {
  display: grid;
  gap: 12px;
}

.audit-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fbfdff;
}

.audit-row p {
  margin: 4px 0 8px;
  color: #718095;
  font-size: 13px;
}

.settings-list > div {
  justify-content: space-between;
}

.settings-list span {
  color: #718095;
}

.settings-list strong {
  color: var(--ink-strong);
  text-align: right;
}

.inline-reset-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-top: 14px;
}

.compact-link {
  padding: 0 16px;
}

.portal-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 106, 24, .11), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(18, 104, 168, .13), transparent 30%),
    linear-gradient(180deg, #f7fafc 0%, #edf4f9 100%);
}

.portal-header {
  width: min(1180px, calc(100% - 32px));
  min-height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border: 1px solid #e0e8f1;
  border-radius: 20px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 18px 46px rgba(18, 63, 99, .06);
  backdrop-filter: blur(16px);
}

.portal-header .sidebar-brand strong {
  color: var(--ink-strong);
}

.portal-header .sidebar-brand span {
  color: #718095;
}

.portal-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 68px;
}

.portal-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 20px;
}

.portal-hero h1 {
  margin: 6px 0 8px;
  font-size: clamp(30px, 5vw, 46px);
}

.portal-hero p {
  margin: 0;
  color: #687789;
}

.portal-search {
  width: min(320px, 100%);
  display: grid;
  gap: 7px;
  color: #566579;
  font-size: 13px;
  font-weight: 700;
}

.portal-app-card {
  min-height: 240px;
}

/* Employee portal: prioritize application access over account summaries. */
.portal-section {
  padding: 16px;
}

.portal-section .panel-title h2 {
  font-size: 16px;
}

.portal-app-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
  gap: 12px;
}

.portal-app-card {
  min-height: 186px;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
}

.portal-app-card .app-card-main {
  gap: 10px;
}

.portal-app-card .app-card-main h2 {
  font-size: 15px;
}

.portal-app-card .app-card-main p,
.portal-app-card .app-desc {
  font-size: 12px;
}

.portal-app-card .primary-link-btn,
.portal-app-card .secondary-btn {
  min-height: 36px;
  font-size: 13px;
}

.portal-app-card .primary-link-btn {
  margin-top: auto;
}

.portal-empty {
  min-height: 260px;
}

.portal-footer {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 18px;
  color: #7c8999;
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

@media (max-width: 1280px) {
  .identity-stats,
  .application-list,
  .portal-app-grid,
  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .identity-shell {
    grid-template-columns: 1fr;
  }

  .identity-sidebar {
    position: fixed;
    z-index: 10;
    inset: 0 auto 0 0;
    width: min(292px, 86vw);
    transform: translateX(-105%);
    transition: transform .28s var(--ease-out);
  }

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

  .sidebar-toggle {
    display: grid;
    place-items: center;
  }

  .topbar-search {
    display: none;
  }

  .identity-content {
    padding-top: 22px;
  }

  .identity-stats,
  .stat-grid,
  .dashboard-grid,
  .app-admin-grid,
  .org-layout,
  .security-grid,
  .settings-grid,
  .permission-matrix {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .portal-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 680px) {
  .identity-topbar,
  .portal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .user-chip {
    flex: 1;
  }

  .application-form,
  .application-list,
  .portal-app-grid,
  .role-grid,
  .compact-stats,
  .inline-reset-form {
    grid-template-columns: 1fr;
  }

  .application-form .span-2 {
    grid-column: auto;
  }

  .portal-footer {
    position: static;
    padding-bottom: 18px;
  }
}

/* Enterprise console refinement layer */
.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;
}

.identity-content {
  width: min(1560px, 100%);
}

.global-search {
  position: relative;
  flex: 1;
  max-width: 540px;
}

.topbar-search input {
  width: 100%;
  height: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.topbar-search input::placeholder {
  color: #91a0af;
}

.search-popover {
  position: absolute;
  z-index: 9;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  max-height: 360px;
  padding: 8px;
  overflow: auto;
  border: 1px solid #e1e8f1;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 62px rgba(15, 23, 36, .16);
}

.search-result-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 2px 10px;
  padding: 10px 12px;
  color: var(--ink);
  border-radius: 12px;
  transition: background-color .2s var(--ease-out), transform .2s var(--ease-out);
}

.search-result-item:hover {
  color: var(--ink);
  background: #f6f9fc;
  transform: translateY(-1px);
}

.search-result-item span {
  grid-row: span 2;
  align-self: center;
  color: var(--brand-blue);
  font-size: 12px;
  font-weight: 800;
}

.search-result-item strong {
  color: var(--ink-strong);
  overflow-wrap: anywhere;
}

.search-result-item small,
.search-empty {
  color: #748296;
  font-size: 12px;
}

.search-empty {
  padding: 18px;
  text-align: center;
}

.heading-actions,
.panel-actions,
.bulk-toolbar,
.filter-actions,
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: #315a7b;
  border: 1px solid #d9e7f2;
  border-radius: 999px;
  background: rgba(18, 104, 168, .06);
  font-size: 13px;
  font-weight: 700;
}

.health-pill.ok {
  color: #127a47;
  border-color: #c9ecd9;
  background: #eefaf4;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
  gap: 10px;
}

.quick-card {
  min-height: 84px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid #e1e8f1;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fbfdff);
  box-shadow: 0 14px 34px rgba(18, 63, 99, .045);
  transition: transform .24s var(--ease-out), box-shadow .24s var(--ease-out), border-color .24s var(--ease-out);
}

.quick-card:hover {
  color: var(--ink);
  border-color: rgba(255, 106, 24, .28);
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(18, 63, 99, .08);
}

.quick-card strong {
  color: var(--ink-strong);
  font-size: 13px;
}

.quick-card small {
  color: #748296;
  font-size: 11px;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
  gap: 18px;
}

.wide-board {
  grid-column: 1 / -1;
}

.compact-dashboard {
  margin-bottom: 18px;
}

.dense-filter {
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #fbfdff;
}

.bulk-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fbfdff;
}

.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu > summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--brand-blue);
  border: 1px solid rgba(18, 104, 168, .16);
  border-radius: 999px;
  background: rgba(18, 104, 168, .06);
  cursor: pointer;
  list-style: none;
}

.action-menu > summary::-webkit-details-marker {
  display: none;
}

.action-menu[open] > summary {
  color: #fff;
  border-color: var(--brand-blue);
  background: var(--brand-blue);
}

.action-menu-content {
  position: absolute;
  z-index: 8;
  right: 0;
  top: calc(100% + 8px);
  min-width: 156px;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid #e1e8f1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 36, .16);
}

.action-menu-content form {
  margin: 0;
}

.action-menu-content .link-btn,
.action-menu-content a {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--ink);
  border-radius: 9px;
  text-align: left;
}

.action-menu-content .link-btn:hover,
.action-menu-content a:hover {
  color: var(--brand-blue);
  background: #f5f8fb;
}

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

.config-details {
  border: 1px solid #edf2f7;
  border-radius: 14px;
  background: #fbfdff;
}

.config-details > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink-strong);
  font-weight: 800;
  cursor: pointer;
}

.rules-form {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.rules-form label {
  display: grid;
  gap: 7px;
  color: #4a596b;
  font-size: 13px;
  font-weight: 700;
}

.rules-form input,
.settings-form-grid input,
.settings-form-grid select,
.settings-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.rules-form input,
.settings-form-grid input,
.settings-form-grid select {
  height: 42px;
  padding: 0 12px;
}

.settings-form-grid textarea {
  min-height: 86px;
  padding: 10px 12px;
  resize: vertical;
}

.endpoint-list.compact {
  gap: 8px;
}

.endpoint-list.compact code {
  display: block;
  overflow-wrap: anywhere;
}

.settings-tabs {
  display: grid;
  gap: 18px;
}

.settings-section {
  padding: 16px;
  border: 1px solid #edf2f7;
  border-radius: 16px;
  background: #fbfdff;
}

.settings-section h3 {
  margin: 0 0 12px;
  color: var(--ink-strong);
  font-size: 16px;
}

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

.settings-form-grid label {
  display: grid;
  gap: 7px;
  color: #4a596b;
  font-size: 13px;
  font-weight: 700;
}

.json-preview {
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  color: #425064;
  border: 1px solid #e1e8f1;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 12px;
  line-height: 1.55;
}

.portal-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.portal-section {
  margin-bottom: 18px;
}

.app-avatar.small {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 12px;
}

@media (max-width: 1180px) {
  .identity-stats,
  .quick-actions,
  .dense-filter,
  .settings-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cockpit-grid,
  .pro-app-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .global-search {
    display: none;
  }
}

@media (max-width: 680px) {
  .heading-actions,
  .bulk-toolbar,
  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions > *,
  .bulk-toolbar > *,
  .filter-actions > * {
    width: 100%;
  }

  .quick-actions,
  .portal-overview,
  .dense-filter,
  .settings-form-grid {
    grid-template-columns: 1fr;
  }

  .action-menu-content {
    left: 0;
    right: auto;
  }
}

/* Unified Permission Center */
.permission-page .identity-content,
.permission-portal {
  max-width: 1460px;
}

.permission-heading {
  align-items: flex-start;
  border: 1px solid rgba(224, 232, 243, .9);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 251, 255, .9)),
    radial-gradient(circle at 14% 10%, rgba(255, 112, 45, .12), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(48, 112, 196, .11), transparent 30%);
}

.permission-nav a:nth-child(n + 4) .nav-icon {
  color: #9b4d18;
  background: rgba(255, 112, 45, .14);
}

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

.permission-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, .9fr);
  gap: 18px;
  margin-bottom: 20px;
}

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

.permission-workbench {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.permission-app-rail {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 8px;
}

.permission-app-rail h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.permission-app-rail a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 750;
}

.permission-app-rail a:hover,
.permission-app-rail a.is-active {
  color: #12335c;
  border-color: #dce8f7;
  background: #f4f8fd;
}

.permission-tree-panel {
  min-height: 620px;
}

.permission-tree-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.permission-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid #e4ebf4;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 38, 63, .05);
}

.permission-node:hover {
  border-color: rgba(255, 112, 45, .35);
  box-shadow: 0 14px 36px rgba(18, 38, 63, .08);
  transform: translateY(-1px);
}

.permission-node.is-disabled {
  opacity: .58;
  background: #f8fafc;
}

.permission-node strong,
.permission-package-card strong {
  color: var(--ink-strong);
  font-size: 15px;
}

.permission-node code,
.direct-permission-card code {
  display: inline-flex;
  max-width: 100%;
  margin-top: 7px;
  padding: 4px 8px;
  overflow-wrap: anywhere;
  color: #1f4e79;
  border-radius: 8px;
  background: #edf6ff;
  font-size: 12px;
}

.permission-node small,
.permission-package-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.permission-detail-panel,
.permission-cart-panel {
  position: sticky;
  top: 96px;
}

.permission-cart-panel strong {
  display: inline-flex;
  margin: 10px 0;
  padding: 8px 11px;
  color: #9b4d18;
  border-radius: 999px;
  background: rgba(255, 112, 45, .12);
}

.direct-permission-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  margin-bottom: 18px;
  border-color: rgba(255, 112, 45, .26);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(255, 248, 244, .88)),
    radial-gradient(circle at 92% 18%, rgba(255, 112, 45, .12), transparent 30%);
}

.direct-permission-card h2 {
  margin: 4px 0 8px;
  color: var(--ink-strong);
  font-size: 22px;
}

.direct-apply-box {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid #f0d6c6;
  border-radius: 16px;
  background: #fff;
}

.direct-apply-box label {
  display: grid;
  gap: 8px;
  color: #4a596b;
  font-size: 13px;
  font-weight: 800;
}

.direct-apply-box textarea {
  min-height: 118px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}

.permission-package-strip {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #edf2f7;
}

.permission-package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.permission-package-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #e4ebf4;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff, #fbfdff);
}

.permission-package-card p {
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.permission-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.single-column {
  grid-template-columns: 1fr;
}

.status-badge.risk-low {
  color: #16724f;
  background: #e7f7ef;
}

.status-badge.risk-medium {
  color: #8a5a00;
  background: #fff4d6;
}

.status-badge.risk-high {
  color: #a64b11;
  background: #fff0e5;
}

.status-badge.risk-critical {
  color: #a11e2f;
  background: #ffe8ec;
}

@media (max-width: 1280px) {
  .permission-stat-grid,
  .permission-actions,
  .permission-package-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permission-workbench {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .permission-detail-panel,
  .permission-cart-panel {
    position: static;
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .permission-overview-grid,
  .permission-workbench,
  .direct-permission-card,
  .permission-rule-grid {
    grid-template-columns: 1fr;
  }

  .permission-app-rail {
    position: static;
  }
}

@media (max-width: 680px) {
  .permission-stat-grid,
  .permission-actions,
  .permission-package-grid {
    grid-template-columns: 1fr;
  }

  .permission-node {
    grid-template-columns: 1fr;
  }
}

/* Product redesign retained for history but intentionally disabled: use the original light UI. */
@media not all {
:root {
  --ink: #172235;
  --ink-strong: #0d1829;
  --muted: #66758a;
  --line: #dbe3ed;
  --brand: #0f766e;
  --brand-strong: #0b5d57;
  --brand-blue: #2563eb;
  --brand-blue-strong: #1d4ed8;
  --surface: #ffffff;
  --panel: #f6f8fb;
  --danger: #b4233c;
  --danger-bg: #fff1f3;
  --focus: rgba(15, 118, 110, .2);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-md: 0 12px 26px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .04);
}

body {
  min-height: 100dvh;
  color: var(--ink);
  background: #f4f7fa;
  font-family: "Outfit", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ti {
  display: inline-block;
  font-size: 1.1em;
  line-height: 1;
  vertical-align: -.12em;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a { color: var(--brand); }
a:hover { color: var(--brand-strong); }

.login-page,
.portal-page,
.identity-admin { background: #f4f7fa; }

.login-page::before,
.admin-page::before {
  opacity: 1;
  background-image: linear-gradient(rgba(202, 213, 224, .42) 1px, transparent 1px), linear-gradient(90deg, rgba(202, 213, 224, .42) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, black, transparent 58%);
}

.visual-plane {
  background: radial-gradient(circle at 78% 15%, rgba(13, 148, 136, .13), transparent 30%), radial-gradient(circle at 8% 92%, rgba(37, 99, 235, .09), transparent 31%), #f4f7fa;
}

.visual-plane::after { background: linear-gradient(120deg, rgba(244, 247, 250, .1), rgba(244, 247, 250, .7)); }

.login-shell { padding: 48px 24px 68px; }

.login-card {
  min-height: 0;
  padding: 32px;
  border: 1px solid rgba(218, 227, 237, .96);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-md);
  animation-duration: .48s;
}

.login-card::before { display: none; }
.mfa-card { min-height: 0; }
.card-top { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .02em; }
.security-pill { color: #0f5e58; background: #e7f5f2; font-weight: 700; }
.brand-lockup { margin: 34px 0 28px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #0f766e;
  box-shadow: none;
}

.brand-mark .ti { font-size: 21px; vertical-align: 0; }
.brand-lockup strong { font-size: 15px; }
.brand-lockup small { color: var(--muted); }
h1 { margin-bottom: 16px; font-size: 24px; letter-spacing: -.025em; }

.field {
  height: 48px;
  border-color: #d7e0e9;
  border-radius: 10px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.field:hover { border-color: #aab8c8; }
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); transform: none; }
.field-icon { color: #7a899b; }
.field:focus-within .field-icon { color: var(--brand); }
.ghost-eye:hover, .ghost-eye.is-active { color: var(--brand); transform: none; }

.primary-btn,
.primary-link-btn {
  border-radius: 10px;
  background: var(--brand);
  box-shadow: 0 1px 2px rgba(15, 118, 110, .22);
  transition: background .16s ease, transform .16s ease, box-shadow .16s ease;
}

.primary-btn:hover,
.primary-link-btn:hover { background: var(--brand-strong); box-shadow: 0 5px 12px rgba(15, 118, 110, .18); transform: translateY(-1px); }
.secondary-btn, .secondary-link-btn, .ghost-btn { border-color: #d7e0e9; border-radius: 10px; background: #fff; }
.secondary-btn:hover, .secondary-link-btn:hover, .ghost-btn:hover { color: var(--ink-strong); border-color: #afbdca; background: #f8fafc; }
.page-footer { color: #748296; font-size: 12px; }

.identity-shell { min-height: 100dvh; }
.identity-sidebar {
  width: 250px;
  padding: 18px 12px;
  border-right: 1px solid #dce4ed;
  background: #ffffff;
}

.sidebar-brand { padding: 7px 9px 22px; gap: 11px; }
.sidebar-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-brand .brand-mark .ti { font-size: 18px; }
.sidebar-brand strong { color: var(--ink-strong); letter-spacing: -.015em; }
.sidebar-brand span { color: var(--muted); }
.identity-nav { gap: 3px; }
.identity-nav a {
  min-height: 42px;
  padding: 9px 10px;
  color: #526174;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 650;
}

.nav-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: #758499;
  border-radius: 7px;
  background: transparent;
  font-size: 17px;
}

.identity-nav a:hover { color: var(--ink-strong); background: #f3f6f8; }
.identity-nav a.is-active { color: #0d5f59; border-color: #c9e7e2; background: #e9f6f3; box-shadow: none; }
.identity-nav a.is-active .nav-icon { color: var(--brand); background: #d8f0eb; }
.sidebar-foot { margin: auto 4px 4px; padding: 14px; border: 1px solid #e1e8ef; border-radius: 10px; background: #f8fafc; }

.identity-topbar,
.portal-header {
  min-height: 68px;
  padding: 0 30px;
  border-bottom: 1px solid #dce4ed;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .025);
  backdrop-filter: blur(12px);
}

.identity-topbar { position: sticky; top: 0; z-index: 10; }
.sidebar-toggle { color: var(--ink); border: 1px solid #dbe3ed; border-radius: 8px; background: #fff; }
.topbar-search input, .global-search input { border-color: #dce4ed; border-radius: 9px; background: #f8fafc; }
.topbar-search input:focus, .global-search input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px var(--focus); }
.user-chip { padding: 4px 8px 4px 4px; border: 1px solid #e0e7ef; border-radius: 999px; background: #fff; }
.avatar { background: #d8f0eb; color: #0d5f59; }

.identity-content,
.portal-main { max-width: 1540px; padding: 30px; }
.page-heading,
.portal-hero,
.permission-heading {
  padding: 28px;
  border: 1px solid #dfe7ef;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.page-heading h1, .portal-hero h1 { font-size: clamp(24px, 2vw, 32px); letter-spacing: -.035em; }
.page-heading p, .portal-hero p { max-width: 62ch; color: var(--muted); }
.eyebrow.dark { color: var(--brand); font-weight: 750; letter-spacing: .07em; }
.health-pill { color: #0d5f59; border-color: #c9e7e2; background: #e9f6f3; }

.panel,
.stat-tile,
.quick-card,
.portal-app-card,
.permission-node,
.permission-package-card,
.settings-section {
  border-color: #dfe7ef;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.panel { padding: 22px; }
.stat-tile { min-height: 142px; padding: 20px; overflow: hidden; }
.stat-tile::after { width: 4px; border-radius: 4px; background: var(--brand); }
.stat-tile.accent-orange::after, .stat-tile.accent-blue::after { background: var(--brand); }
.stat-tile.warning-tone::after { background: #d97706; }
.stat-tile.danger-tone::after { background: #d92d20; }
.stat-tile strong { color: var(--ink-strong); }
.quick-card:hover, .portal-app-card:hover, .permission-node:hover { border-color: #b8d9d4; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.app-avatar { color: #0d5f59; background: #e2f3f0; }
.app-avatar .ti { font-size: 18px; vertical-align: 0; }

.table-wrap { border: 1px solid #e0e7ef; border-radius: 11px; }
table thead th { color: #516174; background: #f8fafc; font-size: 12px; letter-spacing: .02em; }
table tbody tr:hover { background: #f8fbfb; }
.status-badge { border-radius: 999px; font-weight: 700; }
.notice { border-radius: 10px; box-shadow: var(--shadow-sm); }
.dialog-close { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; }
.dialog-close:hover { color: var(--danger); background: #fff1f3; }

.portal-header { position: sticky; top: 0; z-index: 10; }
.portal-hero { align-items: end; background: linear-gradient(115deg, #ffffff, #f3faf8); }
.portal-search span { color: var(--muted); font-weight: 650; }
.portal-search input { border-color: #d7e0e9; border-radius: 10px; background: #fff; }

@media (max-width: 980px) {
  .identity-topbar, .portal-header { padding: 0 18px; }
  .identity-content, .portal-main { padding: 20px; }
}

@media (max-width: 680px) {
  .login-shell { padding: 24px 16px 50px; }
  .login-card { padding: 24px 20px; }
  .identity-content, .portal-main { padding: 16px; }
  .page-heading, .portal-hero, .permission-heading { padding: 20px; }
  .portal-header .topbar-actions { gap: 6px; }
  .portal-header .user-chip, .portal-header form { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
}

/* Login page: use content height, centered brand hierarchy, and a separate legal line. */
body.login-page-primary .login-shell {
  padding: 36px 24px 28px;
}

body.login-page-primary .login-composition.single-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

body.login-page-primary .login-card {
  min-height: 0;
  padding: 30px 32px 28px;
}

body.login-page-primary .brand-lockup.login-brand {
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  margin: 2px 0 26px;
  text-align: center;
}

body.login-page-primary .brand-lockup.login-brand strong {
  font-size: 18px;
  letter-spacing: .01em;
}

body.login-page-primary .login-legal {
  display: grid;
  gap: 2px;
  width: min(420px, 100%);
  color: rgba(255, 255, 255, .94);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
  text-shadow: 0 1px 10px rgba(31, 67, 92, .42);
}

@media (max-width: 460px) {
  body.login-page-primary .login-shell { padding: 24px 16px 20px; }
  body.login-page-primary .login-card { padding: 26px 20px 24px; }
  body.login-page-primary .brand-lockup.login-brand { margin-bottom: 22px; }
  body.login-page-primary .brand-lockup.login-brand strong { font-size: 17px; }
  body.login-page-primary .login-legal { padding-inline: 8px; font-size: 10px; }
}

/* Employee portal: a quiet identity landscape behind the application workspace. */
body.portal-page {
  min-height: 100dvh;
  isolation: isolate;
  overflow-x: hidden;
  background:
    radial-gradient(74rem 46rem at -10% -18%, rgba(35, 137, 121, .22), transparent 62%),
    radial-gradient(56rem 38rem at 108% 16%, rgba(37, 104, 132, .17), transparent 64%),
    radial-gradient(42rem 28rem at 72% 108%, rgba(128, 175, 151, .12), transparent 68%),
    linear-gradient(135deg, #edf7f5 0%, #f6faf9 48%, #edf3f6 100%);
}

body.portal-page::before,
body.portal-page::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: '';
}

body.portal-page::before {
  opacity: .52;
  background-image:
    linear-gradient(rgba(49, 106, 98, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 106, 98, .045) 1px, transparent 1px);
  background-position: center;
  background-size: 42px 42px;
  mask-image: linear-gradient(130deg, rgba(0, 0, 0, .76), transparent 72%);
}

body.portal-page::after {
  inset: auto -16rem -13rem auto;
  width: 44rem;
  height: 44rem;
  border: 1px solid rgba(22, 105, 94, .14);
  border-radius: 50%;
  box-shadow:
    0 0 0 4.5rem rgba(22, 105, 94, .025),
    0 0 0 9rem rgba(22, 105, 94, .018);
}

body.portal-page .portal-header,
body.portal-page .portal-main,
body.portal-page .portal-footer {
  position: relative;
  z-index: 1;
}

body.portal-page .portal-header {
  border-color: rgba(216, 232, 229, .92);
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 18px 46px rgba(20, 74, 69, .09);
}

body.portal-page .portal-hero {
  position: relative;
  overflow: hidden;
  border-color: rgba(204, 226, 221, .9);
  background:
    linear-gradient(112deg, rgba(255, 255, 255, .93), rgba(246, 252, 250, .78)),
    radial-gradient(circle at 88% 28%, rgba(30, 134, 119, .16), transparent 34%);
  box-shadow: 0 18px 42px rgba(22, 79, 72, .08);
}

body.portal-page .portal-hero::after {
  position: absolute;
  top: -7rem;
  right: 16%;
  width: 16rem;
  height: 16rem;
  border: 1px solid rgba(24, 114, 103, .11);
  border-radius: 50%;
  box-shadow: 0 0 0 2.75rem rgba(24, 114, 103, .025);
  content: '';
}

body.portal-page .portal-hero > * {
  position: relative;
  z-index: 1;
}

/* System color coherence: one calm brand accent across actions and icon surfaces. */
:root {
  --brand: #0f766e;
  --brand-strong: #0a5f58;
  --brand-blue: #176f68;
  --brand-blue-strong: #0a5f58;
  --line: #d6e4e1;
  --panel: #f4f8f7;
  --focus: rgba(15, 118, 110, .22);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-color: rgba(15, 118, 110, .58);
}

.primary-btn,
.primary-link-btn,
.admin-action {
  color: #fff;
  background: #0f766e;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .18);
}

.primary-btn:hover,
.primary-link-btn:hover,
.admin-action:hover {
  color: #fff;
  background: #0a5f58;
  box-shadow: 0 10px 22px rgba(15, 118, 110, .24);
  filter: none;
}

.primary-btn:active,
.primary-link-btn:active,
.admin-action:active {
  transform: translateY(1px) scale(.985);
}

.brand-mark,
.avatar {
  background: #0f766e;
  box-shadow: 0 8px 18px rgba(15, 118, 110, .16);
}

.app-avatar {
  color: #0b625b;
  border: 1px solid #cbe5e0;
  background: #e4f3f0;
  box-shadow: none;
}

.role-badge {
  color: #0b625b;
  background: #e8f5f2;
}

.secondary-btn,
.secondary-link-btn,
.ghost-btn {
  color: #315d59;
  border-color: #d3e2df;
  background: rgba(255, 255, 255, .78);
}

.secondary-btn:hover,
.secondary-link-btn:hover,
.ghost-btn:hover {
  color: #0a5f58;
  border-color: #a9cec7;
  background: #eff8f6;
}

body.admin-page,
body.identity-admin {
  background: #f3f8f7;
}

body input::placeholder,
body textarea::placeholder {
  color: #a4b1af !important;
  font-size: .92em;
  font-weight: 400 !important;
  opacity: 1;
}

/* Employee portal: render the greeting row directly on the page, not inside a panel. */
body.portal-page .portal-main {
  padding-bottom: 76px;
}

body.portal-page .portal-hero {
  align-items: center;
  margin-bottom: 12px;
  padding: 8px 0 24px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.portal-page .portal-hero::after {
  display: none;
}

body.portal-page .portal-hero h1 {
  margin: 4px 0 0;
}

body.portal-page .portal-footer {
  position: fixed;
  right: 20px;
  bottom: 18px;
  left: 20px;
  z-index: 2;
  margin: 0;
  padding: 0;
}

@media (max-width: 680px) {
  body.portal-page .portal-hero {
    align-items: flex-start;
    padding: 6px 0 20px;
  }

  body.portal-page .portal-search {
    width: 100%;
  }

  body.portal-page .portal-footer {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
}

/* Permission-center navigation stays within the complete admin menu. */
.identity-nav .nav-group {
  display: grid;
  gap: 3px;
}

.identity-nav .nav-group-trigger {
  position: relative;
}

.identity-nav .nav-group-caret {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.identity-nav .nav-submenu {
  display: grid;
  gap: 2px;
  margin: 0 0 4px 22px;
  padding-left: 14px;
  border-left: 1px solid #cfe2de;
}

.identity-nav .nav-submenu a {
  min-height: 34px;
  padding: 7px 9px;
  color: #667c78;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
}

.identity-nav .nav-submenu a:hover,
.identity-nav .nav-submenu a.is-active {
  color: #0a5f58;
  border-color: transparent;
  background: #e9f6f3;
  box-shadow: none;
  transform: none;
}

body.identity-admin .identity-sidebar {
  overflow-y: auto;
  padding-bottom: 22px;
  background: linear-gradient(180deg, #113f3c, #0b3432);
  scrollbar-color: rgba(202, 230, 224, .34) transparent;
  scrollbar-width: thin;
}

body.identity-admin .sidebar-foot {
  position: static;
  margin: 24px 0 0;
}

.permission-nav .nav-submenu {
  border-left-color: rgba(198, 229, 223, .24);
}

.permission-nav .nav-submenu a {
  color: rgba(224, 240, 237, .72);
}

.permission-nav .nav-submenu a:hover,
.permission-nav .nav-submenu a.is-active {
  color: #fff;
  background: rgba(171, 223, 211, .14);
}

body.portal-page .portal-header .user-chip {
  padding: 4px 0 4px 4px;
  border: 0;
  background: transparent;
}

.portal-app-card .app-card-intro {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 20px;
  color: #6e807d;
  font-size: 12px;
  line-height: 1.55;
}

.portal-app-card .app-card-intro > span {
  flex: 0 0 auto;
  color: #52716c;
  font-weight: 700;
}

.portal-app-card .app-card-intro p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}
