:root {
  color-scheme: light;
  --bg: #f5f8fc;
  --surface: #ffffff;
  --surface-soft: #eef5ff;
  --primary: #1167d8;
  --primary-dark: #0b4da8;
  --primary-soft: #dbeaff;
  --accent: #10a37f;
  --warning: #f59e0b;
  --danger: #d92d20;
  --ink: #142033;
  --muted: #64748b;
  --line: #d8e1ee;
  --shadow: 0 14px 34px rgba(17, 103, 216, 0.14);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.auth-topbar {
  display: none;
  position: static;
  background: #fff;
  border-bottom-color: #eef1f6;
  box-shadow: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow);
}

.brand-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px clamp(14px, 4vw, 28px) 34px;
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: stretch;
}

.login-layout {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: 1.1fr 420px;
  gap: 18px;
  align-items: center;
}

.prelogin-layout {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 18px;
  align-items: center;
}

.auth-switch-link {
  justify-self: end;
  min-height: 44px;
  padding: 0;
  color: #a0a4ad;
  background: transparent;
  border: 0;
  font-size: clamp(16px, 3.6vw, 24px);
  font-weight: 600;
}

.prelogin-hero {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(26px, 6vw, 58px);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(13, 95, 197, 0.96), rgba(18, 124, 168, 0.9) 54%, rgba(16, 163, 127, 0.92)),
    radial-gradient(circle at 76% 22%, rgba(255,255,255,0.28), transparent 28%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  margin: 18px 0 0;
  max-width: 760px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 680px;
  margin: 18px 0 0;
  font-size: 17px;
  line-height: 1.85;
  opacity: 0.94;
}

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

.feature-strip span {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  font-weight: 800;
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 850;
}

.unified-login-card {
  gap: 16px;
  padding: 22px;
  border-color: #c8d9f4;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  background: #eef5ff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tabs button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 850;
}

.auth-tabs button.active {
  color: var(--primary-dark);
  background: #fff;
  box-shadow: 0 4px 14px rgba(17, 103, 216, 0.12);
}

.login-hero {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 6vw, 56px);
  color: #fff;
  background: linear-gradient(135deg, #0d5fc5 0%, #1177bb 58%, #10a37f 100%);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-hero h1 {
  margin: 18px 0 0;
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.05;
  letter-spacing: 0;
}

.login-hero p {
  max-width: 680px;
  margin: 18px 0 0;
  line-height: 1.8;
  opacity: 0.94;
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0;
  font-size: 22px;
}

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

.dashboard-head h1 {
  margin: 8px 0 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  letter-spacing: 0;
}

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

.entry-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.entry-card strong {
  display: block;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.1;
}

.entry-card span {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.7;
}

.entry-card em {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  color: #0f3b75;
  background: var(--primary-soft);
  font-style: normal;
  font-weight: 800;
}

.primary-entry {
  border-color: #9ec5ff;
}

.upload-entry {
  border-color: #9be7d2;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.segmented button {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.segmented button.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

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

.split-grid h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.compact-table table {
  min-width: 640px;
}

.intro {
  padding: clamp(22px, 5vw, 40px);
  min-height: 310px;
  color: #fff;
  background: linear-gradient(135deg, #0d5fc5, #168ac9 62%, #14a88f);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.intro h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.intro p {
  max-width: 680px;
  margin: 16px 0 0;
  font-size: 16px;
  line-height: 1.75;
  opacity: 0.94;
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.login-panel h2,
.section-title {
  margin: 0 0 12px;
  font-size: 20px;
}

.role-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.role-card {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.role-card.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 3px 0 0 var(--primary);
}

.role-card strong {
  display: block;
  font-size: 15px;
}

.role-card span {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

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

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

.field {
  display: grid;
  gap: 6px;
}

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

.field label {
  font-size: 13px;
  font-weight: 650;
  color: #334155;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17, 103, 216, 0.12);
}

.field input[type="checkbox"] {
  width: 24px;
  min-height: 24px;
  accent-color: var(--primary);
  box-shadow: none;
}

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

.actions {
  margin-top: 16px;
}

.btn {
  min-height: 44px;
  max-width: 100%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: normal;
  text-align: center;
}

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

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.soft {
  color: var(--primary-dark);
  border-color: #bed6ff;
  background: var(--primary-soft);
}

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

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

.btn.icon-only {
  width: 44px;
  padding-inline: 0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

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

.quick-btn {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 800;
}

.quick-btn.weekly {
  background: #0f766e;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.panel + .panel {
  margin-top: 14px;
}

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

.stat {
  min-height: 92px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 7px;
  font-size: 25px;
}

.workspace {
  display: grid;
  grid-template-columns: 214px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.side-nav {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 8px;
}

.side-nav .btn {
  justify-content: flex-start;
}

.content-stack {
  display: grid;
  gap: 14px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(120px, 0.65fr));
  gap: 10px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: #334155;
  background: #f8fbff;
  font-weight: 800;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #0f3b75;
  background: var(--primary-soft);
  font-size: 12px;
  font-weight: 750;
}

.tag.ok {
  color: #075b47;
  background: #d9f8ec;
}

.tag.warn {
  color: #814d00;
  background: #fff0c2;
}

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

.helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

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

.person-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.person-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.person-main {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-width: 0;
}

.person-avatar {
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 20px;
  font-weight: 800;
}

.person-card h3 {
  margin: 0;
  font-size: 18px;
}

.person-card p {
  margin: 5px 0 0;
  line-height: 1.45;
}

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

.contact-box {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-box strong {
  display: block;
  font-size: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  color: #fff;
  background: rgba(20, 32, 51, 0.94);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.hidden-file {
  display: none;
}

@media (max-width: 860px) {
  .hero,
  .login-layout,
  .prelogin-layout,
  .entry-grid,
  .split-grid,
  .workspace,
  .form-grid,
  .filter-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    min-height: 260px;
  }

  .prelogin-hero {
    min-height: 460px;
  }

  .feature-strip {
    grid-template-columns: 1fr;
  }

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

  .side-nav .btn {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .brand-subtitle {
    display: none;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .quick-actions,
  .side-nav,
  .person-grid {
    grid-template-columns: 1fr;
  }

  .quick-btn {
    min-height: 92px;
    font-size: 18px;
  }

  .btn {
    flex: 1 1 auto;
  }
}

/* Refined login, agent portal, and secondary admin console */
.signin-auth-page {
  position: relative;
  isolation: isolate;
  width: min(920px, 100%);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding: 18px 18px 34px;
  overflow: hidden;
  background:
    linear-gradient(180deg, #f8fbff 0, #f8fbff 248px, #eef3f8 248px, #eef3f8 100%);
}

.signin-auth-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(17, 103, 216, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 103, 216, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000 0, transparent 70%);
}

.signin-device-bar {
  width: min(720px, 100%);
  min-height: 48px;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 56px;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  padding: 6px 8px;
  color: #1d2b3f;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #e4ebf5;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(20, 32, 51, 0.08);
}

.signin-device-bar > span {
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.signin-url {
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  color: #0f3b75;
  background: #f2f7ff;
  border: 1px solid #d8e8ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.signin-url span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signin-center {
  width: min(610px, 100%);
  display: grid;
  gap: 24px;
  margin: 46px auto 0;
}

.signin-brand-block {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.signin-mark {
  position: relative;
  width: 124px;
  height: 124px;
  display: grid;
  place-items: center;
}

.signin-mark-core {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #1167d8, #0f766e);
  border: 5px solid #fff;
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(17, 103, 216, 0.22);
}

.signin-mark-chip {
  position: absolute;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #0f3b75;
  background: #fff;
  border: 1px solid #dfe8f5;
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 32, 51, 0.1);
}

.signin-mark-chip.chip-a {
  left: 2px;
  bottom: 16px;
}

.signin-mark-chip.chip-b {
  right: 0;
  top: 14px;
  color: #075b47;
}

.signin-eyebrow {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  color: #0f3b75;
  background: #e8f2ff;
  border: 1px solid #cfe2ff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 850;
}

.signin-brand-block h1 {
  margin: 14px 0 0;
  color: #0d1728;
  font-size: 42px;
  line-height: 1.08;
  letter-spacing: 0;
}

.signin-brand-block p {
  max-width: 520px;
  margin: 10px auto 0;
  color: #5d6b80;
  font-size: 14px;
  line-height: 1.75;
}

.signin-card {
  width: 100%;
  display: grid;
  gap: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dce6f2;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.1);
}

.signin-entry-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 5px;
  background: #f1f6fb;
  border: 1px solid #e1ebf6;
  border-radius: 8px;
}

.signin-entry-tabs button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #516074;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 900;
}

.signin-entry-tabs button.active {
  color: #fff;
  background: #1167d8;
  border-color: #1167d8;
  box-shadow: 0 8px 18px rgba(17, 103, 216, 0.16);
}

.signin-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.signin-card-head span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.signin-card-head strong {
  display: block;
  margin-top: 4px;
  color: #142033;
  font-size: 22px;
}

.signin-card-head em {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: #075b47;
  background: #e4fbf1;
  border: 1px solid #c5f0de;
  border-radius: 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.signin-fields {
  display: grid;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dfe8f5;
  border-radius: 8px;
}

.signin-field {
  min-height: 66px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid #eef3f8;
}

.signin-field:last-child {
  border-bottom: 0;
}

.signin-field > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #26364d;
  font-size: 15px;
  font-weight: 800;
}

.signin-field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0;
  color: #142033;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 16px;
}

.signin-field input::placeholder {
  color: #b6c0ce;
}

.signin-submit {
  min-height: 54px;
  width: 100%;
  color: #fff;
  background: #1167d8;
  border: 1px solid #1167d8;
  border-radius: 8px;
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(17, 103, 216, 0.2);
}

.signin-submit:active {
  transform: translateY(1px);
}

.signin-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  color: #526277;
  background: #f7fafc;
  border: 1px solid #e5edf6;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.signin-card .auth-switch-link {
  justify-self: end;
  min-height: 36px;
  color: #1167d8;
  font-size: 14px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header .section-title {
  margin-top: 8px;
  margin-bottom: 0;
}

.panel-header .toolbar {
  justify-content: flex-end;
}

.agent-portal-page,
.agent-access-page {
  display: grid;
  gap: 16px;
}

.agent-hero,
.agent-access-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: center;
  gap: 18px;
  padding: 24px;
  color: #fff;
  background: linear-gradient(135deg, #10233d, #1167d8 64%, #0f766e);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
}

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

.agent-hero h1,
.agent-access-hero h1,
.admin-hero h1 {
  margin: 10px 0 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

.agent-hero p,
.agent-access-hero p,
.admin-hero p {
  max-width: 650px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.7;
}

.agent-identity {
  display: grid;
  gap: 7px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.agent-identity span,
.agent-identity small {
  color: rgba(255, 255, 255, 0.76);
}

.agent-identity strong {
  font-size: 30px;
  letter-spacing: 0;
}

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

.agent-stat-card {
  min-height: 96px;
  display: grid;
  gap: 6px;
  padding: 15px;
  background: #fff;
  border: 1px solid #dce6f2;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.agent-stat-card .lucide {
  color: #1167d8;
}

.agent-stat-card span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.agent-stat-card strong {
  color: #142033;
  font-size: 28px;
}

.agent-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
  align-items: start;
}

.agent-upload-panel .form-grid {
  margin-top: 14px;
}

.agent-submit-row .btn {
  min-width: 220px;
}

.invite-code-preview {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px;
  background: #f7fbff;
  border: 1px solid #e1ebf6;
  border-radius: 8px;
}

.invite-code-preview span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.invite-code-preview strong {
  color: #0f3b75;
  font-size: 28px;
  letter-spacing: 0;
}

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

.agent-side-stack {
  display: grid;
  gap: 14px;
}

.agent-support-panel {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.support-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: #075b47;
  background: #e4fbf1;
  border: 1px solid #c5f0de;
  border-radius: 8px;
}

.agent-support-panel strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
}

.agent-record-list {
  display: grid;
  gap: 10px;
}

.agent-record-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbff;
  border: 1px solid #e2ebf6;
  border-radius: 8px;
}

.agent-record-card strong {
  display: block;
  font-size: 15px;
}

.agent-record-card span,
.agent-record-card small {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
}

.record-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.record-meta .tag {
  margin-top: 0;
}

.admin-console-page {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-console-page::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 320px;
  background: linear-gradient(180deg, rgba(17, 103, 216, 0.08), rgba(255, 255, 255, 0));
  border-radius: 8px;
}

.admin-rail {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 10px;
  padding: 14px;
  color: #142033;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid #e4ebf5;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(14px);
}

.admin-rail-title {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  font-weight: 900;
}

.admin-rail-title .lucide {
  color: #1167d8;
}

.admin-rail .btn {
  justify-content: flex-start;
  color: #334155;
  background: #fff;
  border-color: #e4ebf5;
  box-shadow: none;
}

.admin-rail .btn.primary {
  color: #0f3b75;
  background: #edf5ff;
  border-color: #cfe2ff;
}

.admin-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  align-items: center;
  padding: 24px;
  color: #142033;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.94)),
    linear-gradient(135deg, rgba(17, 103, 216, 0.12), rgba(15, 118, 110, 0.1));
  border: 1px solid #e1eaf5;
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.admin-hero .tag {
  color: #0f3b75;
  background: #e8f2ff;
}

.admin-hero h1 {
  color: #0d1728;
}

.admin-hero p {
  color: #627086;
}

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

.admin-kpi {
  min-height: 82px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid #e2ebf6;
  border-radius: 8px;
}

.admin-kpi span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.admin-kpi strong {
  display: block;
  margin-top: 8px;
  color: #0f3b75;
  font-size: 28px;
}

.admin-board {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.admin-agent-panel .table-wrap,
.data-ledger-panel .table-wrap {
  box-shadow: none;
}

.admin-console-page .panel {
  border-color: #e4ebf5;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.admin-console-page .panel-header {
  padding-bottom: 12px;
  border-bottom: 1px solid #eef3f8;
}

.admin-console-page .table-wrap {
  border-color: #e5edf6;
}

.admin-console-page th {
  color: #526277;
  background: #f8fafc;
}

.admin-console-page td {
  color: #26364d;
}

.admin-agent-panel table {
  min-width: 620px;
}

.admin-invite-panel .actions .btn {
  width: 100%;
}

.admin-data-grid {
  gap: 16px;
}

.ledger-section h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  color: #142033;
  font-size: 16px;
}

.ledger-section h3 span {
  min-width: 28px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f3b75;
  background: #e8f2ff;
  border-radius: 8px;
  font-size: 12px;
}

@media (max-width: 900px) {
  .signin-center {
    margin-top: 36px;
  }

  .page {
    padding-inline: 12px;
  }

  .agent-hero,
  .agent-access-hero,
  .agent-work-grid,
  .admin-console-page,
  .admin-hero,
  .admin-board {
    grid-template-columns: 1fr;
  }

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

  .agent-portal-page,
  .agent-access-page,
  .admin-console-page,
  .admin-main,
  .admin-board,
  .agent-work-grid,
  .panel {
    min-width: 0;
  }

  .admin-rail {
    position: static;
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(0, 1fr));
    align-items: center;
    padding: 10px;
  }

  .admin-rail .btn {
    justify-content: center;
  }

  .admin-rail-title {
    min-height: 42px;
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 10px;
    padding: 12px;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions .btn {
    flex: 1 1 0;
  }

  .signin-auth-page {
    padding: 14px 12px 24px;
  }

  .signin-device-bar {
    grid-template-columns: 72px minmax(0, 1fr) 42px;
    gap: 6px;
  }

  .signin-device-bar > span {
    font-size: 11px;
  }

  .signin-url {
    padding: 0 8px;
    font-size: 12px;
  }

  .signin-center {
    gap: 18px;
    margin-top: 28px;
  }

  .signin-brand-block h1 {
    font-size: 34px;
  }

  .signin-brand-block p {
    font-size: 13px;
  }

  .signin-field {
    grid-template-columns: 86px minmax(0, 1fr);
    min-height: 62px;
    padding: 0 12px;
  }

  .signin-field > span {
    font-size: 14px;
  }

  .signin-field input {
    font-size: 15px;
  }

  .panel-header,
  .record-meta {
    display: grid;
    justify-items: start;
  }

  .agent-hero,
  .agent-access-hero,
  .admin-hero {
    gap: 14px;
    padding: 16px;
  }

  .agent-hero h1,
  .agent-access-hero h1,
  .admin-hero h1 {
    font-size: 26px;
  }

  .agent-stat-grid,
  .admin-kpi-grid {
    grid-template-columns: 1fr;
  }

  .agent-identity strong,
  .invite-code-preview strong {
    font-size: 24px;
    overflow-wrap: anywhere;
  }

  .agent-submit-row .btn,
  .actions .btn,
  .toolbar .btn {
    width: 100%;
  }

  .invite-input-row {
    grid-template-columns: 1fr;
  }

  .agent-support-panel {
    grid-template-columns: 1fr;
  }

  .admin-agent-panel table {
    min-width: 560px;
  }

  .compact-table table {
    min-width: 560px;
  }

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