:root {
  --ink: #12352d;
  --ink-2: #1c5143;
  --muted: #70827c;
  --muted-2: #94a19d;
  --canvas: #f5f6f1;
  --surface: #fbfaf5;
  --white: #ffffff;
  --soft: #e7eee7;
  --line: rgba(18, 60, 49, 0.11);
  --green: #2e7d61;
  --green-soft: #dfeae0;
  --gold: #986c3b;
  --gold-soft: #f2e8d4;
  --red: #a55f4e;
  --red-soft: #fbf0eb;
  --shadow: 0 18px 52px rgba(23, 47, 39, 0.07);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --control-height: 44px;
  --control-radius: 12px;
  --control-padding-x: 13px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 2%, rgba(126, 162, 139, 0.13), transparent 25rem),
    var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(46, 125, 97, 0.22);
  outline-offset: 2px;
}

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

.sidebar {
  width: 256px;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 28px 20px 22px;
  color: #eef6f0;
  background:
    radial-gradient(circle at 100% 0, rgba(139, 185, 156, 0.25), transparent 38%),
    linear-gradient(175deg, #143c32 0%, #12352d 62%, #0d2d26 100%);
}

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

.brand strong {
  display: block;
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.brand small {
  display: block;
  margin-top: 1px;
  color: rgba(232, 245, 235, 0.65);
  font-size: 11px;
  letter-spacing: 0.13em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  color: white;
  background: rgba(255, 255, 255, 0.09);
}

.brand-mark i {
  width: 3px;
  display: block;
  border-radius: 99px;
  background: currentColor;
}

.brand-mark i:nth-child(1) { height: 11px; opacity: 0.72; }
.brand-mark i:nth-child(2) { height: 21px; }
.brand-mark i:nth-child(3) { height: 15px; opacity: 0.82; }

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 28px 0 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  flex: 0 0 auto;
}

.agent-card strong {
  margin-top: 5px;
  font-size: 15px;
}

.agent-card small {
  color: rgba(234, 245, 237, 0.56);
  font-size: 11px;
}

.agent-level {
  align-self: flex-start;
  padding: 3px 8px;
  border-radius: 99px;
  color: #d9eadf;
  background: rgba(255, 255, 255, 0.1);
  font-size: 10px;
  font-weight: 700;
}

.primary-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-nav-frame {
  min-height: 0;
  position: relative;
  flex: 1 1 auto;
}

.sidebar-nav-frame .primary-nav {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 5px 12px 0;
  scrollbar-color: rgba(226, 239, 230, 0.34) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.sidebar-nav-frame .primary-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav-frame .primary-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(226, 239, 230, 0.32);
}

.nav-scroll-edge {
  height: 18px;
  position: absolute;
  z-index: 2;
  right: 5px;
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
}

.nav-scroll-edge-top {
  top: 0;
  background: linear-gradient(to bottom, #12352d, transparent);
}

.nav-scroll-edge-bottom {
  bottom: 0;
  background: linear-gradient(to top, #0f3029, transparent);
}

.sidebar-nav-frame.can-scroll-up .nav-scroll-edge-top,
.sidebar-nav-frame.can-scroll-down .nav-scroll-edge-bottom {
  opacity: 0.94;
}

.primary-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 12px;
  color: rgba(235, 246, 238, 0.68);
  font-weight: 570;
  transition: color 150ms ease, background-color 150ms ease, transform 150ms ease;
}

.primary-nav a:hover {
  color: white;
  background: rgba(255, 255, 255, 0.07);
}

.primary-nav a:active {
  transform: scale(0.98);
}

.primary-nav a[aria-current="page"] {
  color: #143c32;
  background: #e1ede3;
}

.nav-dot {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: currentColor;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-weight: 800;
}

.primary-nav a[aria-current="page"] .nav-dot {
  background: rgba(18, 60, 49, 0.09);
}

.sidebar-foot {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-nav-frame + .sidebar-foot {
  margin-top: 12px;
}

.sidebar-foot p {
  margin: 0 0 12px;
  color: rgba(234, 245, 237, 0.46);
  font-size: 11px;
}

.text-button {
  padding: 0;
  border: 0;
  color: rgba(237, 247, 240, 0.72);
  background: transparent;
  cursor: pointer;
}

.sidebar-scrim {
  display: none;
}

.main-content {
  min-height: 100vh;
  margin-left: 256px;
  padding: 42px clamp(28px, 4vw, 64px) 72px;
}

.mobile-header {
  display: none;
}

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

.page-heading h1 {
  max-width: 760px;
  margin: 7px 0 8px;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 660;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.page-heading p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.compact-heading {
  align-items: flex-start;
}

.eyebrow {
  margin: 0;
  color: #6f9a80;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
}

.heading-actions,
.form-actions,
.card-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-actions {
  flex-wrap: wrap;
}

.button {
  height: var(--control-height);
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: var(--control-radius);
  font-weight: 670;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  color: white;
  background: var(--ink-2);
  box-shadow: 0 8px 20px rgba(28, 81, 67, 0.15);
}

.button-primary:hover {
  background: #174639;
}

.button-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
}

.button-large {
  height: 50px;
  min-height: 50px;
  border-radius: 14px;
}

.button-full {
  width: 100%;
}

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

.metric-card {
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 245, 0.9);
  box-shadow: var(--shadow);
}

.metric-card > span {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  margin: 13px 0 8px;
  font-size: clamp(26px, 2.4vw, 36px);
  font-weight: 650;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--muted-2);
  font-size: 11px;
}

.metric-card-accent {
  color: white;
  border-color: transparent;
  background:
    radial-gradient(circle at 100% 0, rgba(139, 185, 156, 0.38), transparent 42%),
    linear-gradient(145deg, #143c32, #1c5143);
}

.metric-card-accent > span,
.metric-card-accent small {
  color: rgba(239, 248, 242, 0.67);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(270px, 0.65fr);
  gap: 20px;
}

.panel,
.form-panel,
.empty-panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 245, 0.92);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.panel h2,
.form-panel h2 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.insight-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.insight-panel > p:not(.eyebrow) {
  margin: 2px 0 22px;
  color: var(--muted);
  font-size: 12px;
}

.large-money {
  margin: 20px 0 8px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.soft-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: auto 0 18px;
  padding: 14px;
  border-radius: 13px;
  background: var(--soft);
}

.soft-block span {
  color: var(--muted);
  font-size: 10px;
}

.soft-block strong {
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 15px 13px;
  border-bottom: 1px solid rgba(18, 60, 49, 0.08);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.08em;
}

td {
  font-size: 12px;
}

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

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: -0.02em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 99px;
  color: #4d665e;
  background: #e8ece8;
  font-size: 10px;
  font-weight: 700;
}

.status-active,
.status-completed,
.status-succeeded,
.status-available,
.status-paid,
.status-settled {
  color: #1c6e5b;
  background: #dcece4;
}

.status-pending_payment,
.status-ready_for_generation,
.status-queued,
.status-submitted,
.status-paying,
.status-locked {
  color: #835e27;
  background: var(--gold-soft);
}

.status-inactive,
.status-cancelled,
.status-rejected,
.status-failed,
.status-refunded,
.status-refund_pending {
  color: #9b5f50;
  background: var(--red-soft);
}

.rejection-reason {
  max-width: 260px;
  color: #9b5f50;
  overflow-wrap: anywhere;
}

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

.institution-card {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 245, 0.92);
  box-shadow: var(--shadow);
}

.institution-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.institution-top .mono {
  color: var(--muted-2);
}

.institution-card h2 {
  margin: 22px 0 5px;
  font-size: 19px;
}

.institution-card > p {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.institution-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 20px 0;
  overflow: hidden;
  border-radius: 13px;
  background: rgba(18, 60, 49, 0.08);
}

.institution-stats div {
  padding: 12px;
  background: #f0f3ed;
}

.institution-stats dt {
  color: var(--muted);
  font-size: 9px;
}

.institution-stats dd {
  margin: 5px 0 0;
  font-size: 19px;
  font-weight: 650;
}

.institution-stats dd small {
  color: var(--muted-2);
  font-size: 9px;
}

.card-actions {
  justify-content: space-between;
}

.text-link,
.row-actions a,
.row-actions button {
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  font-size: 11px;
  font-weight: 690;
  cursor: pointer;
}

.row-actions {
  white-space: nowrap;
}

.row-actions form {
  display: inline-flex;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.filter-bar > label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.filter-bar > label > span:not(.sr-only) {
  min-height: 16px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.filter-bar-wide .search-field {
  flex: 1 1 240px;
}

.filter-bar > label:not(.search-field) {
  flex: 0 1 180px;
}

.filter-bar > .button {
  flex: 0 0 auto;
}

.filter-bar input,
.filter-bar select,
.field input,
.field select,
.form-stack input,
.inline-apply-form input {
  width: 100%;
  height: var(--control-height);
  min-height: var(--control-height);
  margin: 0;
  padding: 0 var(--control-padding-x);
  border: 1px solid rgba(18, 60, 49, 0.13);
  border-radius: var(--control-radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.2;
}

.field textarea {
  width: 100%;
  min-height: 108px;
  margin: 0;
  padding: 11px var(--control-padding-x);
  border: 1px solid rgba(18, 60, 49, 0.13);
  border-radius: var(--control-radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  line-height: 1.55;
  resize: vertical;
}

.filter-bar input::placeholder,
.field input::placeholder,
.form-stack input::placeholder {
  color: #9ba7a3;
}

.search-field {
  flex: 1 1 300px;
}

.search-field input {
  width: 100%;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(18, 60, 49, 0.08);
  border-radius: 14px;
  color: #536a62;
  background: #e9efea;
  font-size: 11px;
}

.notice strong {
  color: var(--ink);
  white-space: nowrap;
}

.notice-warm {
  color: #806743;
  border-color: rgba(152, 108, 59, 0.14);
  background: #f5edde;
}

.form-panel {
  max-width: 820px;
}

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

.field,
.form-stack label,
.inline-apply-form label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field > span,
.form-stack label > span,
.inline-apply-form label > span {
  font-size: 11px;
  font-weight: 700;
}

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

.form-actions {
  justify-content: flex-end;
  padding-top: 8px;
}

.field-error,
.form-alert {
  color: var(--red);
  font-size: 10px;
}

.form-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--red-soft);
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.pagination a:last-child {
  text-align: right;
}

.align-right {
  text-align: right;
}

.amount {
  color: var(--green);
  font-weight: 760;
}

.amount-negative {
  color: var(--red);
}

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

.settlement-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 20px;
  margin-bottom: 20px;
}

.settlement-apply h2 {
  margin-bottom: 18px;
}

.bank-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border-radius: 14px;
  background: var(--soft);
}

.bank-summary span,
.bank-summary small {
  color: var(--muted);
  font-size: 10px;
}

.inline-apply-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-top: 18px;
}

.helper-text {
  margin: 15px 0 0;
  color: var(--muted-2);
  font-size: 10px;
}

.rule-panel ol {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.rule-panel li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
}

.rule-panel li > span {
  color: #79a089;
  font-size: 10px;
  font-weight: 800;
}

.rule-panel li strong {
  font-size: 12px;
}

.rule-panel li p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.current-bank-card {
  width: min(100%, 480px);
  min-height: 210px;
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  padding: 27px;
  border-radius: 24px;
  color: white;
  background:
    radial-gradient(circle at 100% 0, rgba(166, 202, 177, 0.35), transparent 42%),
    linear-gradient(140deg, #12352d, #28634f);
  box-shadow: 0 20px 42px rgba(18, 53, 45, 0.18);
}

.current-bank-card > span,
.current-bank-card small {
  color: rgba(241, 249, 243, 0.62);
  font-size: 10px;
}

.current-bank-card > strong {
  margin-top: 20px;
  font-size: 18px;
}

.current-bank-card p {
  margin: 3px 0 24px;
  color: rgba(241, 249, 243, 0.72);
}

.current-bank-card div {
  margin-top: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 17px;
  letter-spacing: 0.14em;
}

.message-stack {
  position: fixed;
  z-index: 50;
  top: 20px;
  right: 24px;
  width: min(390px, calc(100vw - 40px));
}

.message {
  margin-bottom: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  font-size: 12px;
}

.message-success {
  background: #e4f0e7;
}

.message-error {
  color: #8f5042;
  background: #fbf0eb;
}

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

.empty-panel {
  grid-column: 1 / -1;
}

.empty-panel h2 {
  margin: 0 0 5px;
  color: var(--ink);
}

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

.login-body {
  min-height: 100vh;
  background: #eef1eb;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(480px, 1.08fr);
}

.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 78px);
  color: white;
  background:
    radial-gradient(circle at 92% 8%, rgba(139, 185, 156, 0.36), transparent 38%),
    radial-gradient(circle at 8% 96%, rgba(214, 167, 99, 0.12), transparent 34%),
    linear-gradient(145deg, #143c32, #1c5143);
}

.login-story h1 {
  max-width: 590px;
  margin: 14px 0 20px;
  font-size: clamp(36px, 4.7vw, 66px);
  font-weight: 570;
  line-height: 1.12;
  letter-spacing: -0.055em;
}

.login-story div > p:not(.eyebrow) {
  max-width: 510px;
  color: rgba(236, 247, 239, 0.68);
  font-size: 15px;
}

.login-story > small {
  color: rgba(236, 247, 239, 0.46);
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: min(100%, 460px);
  padding: 38px;
  border: 1px solid rgba(18, 60, 49, 0.1);
  border-radius: 28px;
  background: rgba(251, 250, 245, 0.96);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 7px 0 6px;
  font-size: 29px;
  letter-spacing: -0.04em;
}

.login-method-title {
  margin: 24px 0 0;
  font-size: 15px;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.login-method-form {
  margin-top: 14px;
}

.login-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 26px 0 0;
  color: var(--muted-2);
  font-size: 11px;
}

.login-divider::before {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid var(--line);
}

.login-divider span {
  position: relative;
  padding: 0 13px;
  background: var(--surface);
}

.sms-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.sms-code-row input {
  width: 100%;
  min-width: 0;
}

.sms-code-row button {
  min-width: 112px;
  padding: 0 12px;
  border: 1px solid rgba(18, 60, 49, 0.13);
  border-radius: 11px;
  color: var(--ink-2);
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.sms-code-row button:disabled {
  color: var(--muted);
  cursor: default;
}

.sms-feedback {
  min-height: 18px;
  color: var(--muted);
  font-size: 11px;
}

.sms-feedback:empty {
  min-height: 0;
}

.account-phone-panel {
  max-width: 560px;
}

.account-phone-panel + .account-phone-panel {
  margin-top: 20px;
}

.ownership-line {
  min-height: 0 !important;
  margin-top: 8px !important;
  color: var(--green) !important;
}

.period-switch {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.62);
}

.period-switch a {
  min-width: 72px;
  padding: 9px 14px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.period-switch a[aria-current="page"] {
  color: white;
  background: var(--ink-2);
}

.performance-note {
  margin: 0 0 20px;
  padding: 13px 16px;
  border-left: 3px solid #6f9a80;
  border-radius: 0 12px 12px 0;
  color: var(--muted);
  background: rgba(226, 236, 228, 0.66);
  font-size: 11px;
}

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

.city-agent-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(251, 250, 245, 0.92);
  box-shadow: var(--shadow);
}

.city-agent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.city-agent-head h2 {
  margin: 13px 0 5px;
  font-size: 21px;
}

.city-agent-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.city-agent-contact,
.city-agent-stats,
.city-agent-money {
  display: grid;
  margin: 18px 0 0;
}

.city-agent-contact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  border-radius: 13px;
  background: var(--soft);
}

.city-agent-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 13px;
  background: rgba(18, 60, 49, 0.08);
}

.city-agent-stats div {
  padding: 13px 10px;
  background: #f0f3ed;
  text-align: center;
}

.city-agent-money {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.city-agent-money div {
  padding: 13px;
  border: 1px solid rgba(18, 60, 49, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
}

.city-agent-contact dt,
.city-agent-stats dt,
.city-agent-money dt {
  color: var(--muted);
  font-size: 9px;
}

.city-agent-contact dd,
.city-agent-stats dd,
.city-agent-money dd {
  margin: 5px 0 0;
  font-size: 13px;
  font-weight: 670;
}

.city-agent-stats dd {
  font-size: 20px;
}

.city-agent-institutions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.city-agent-institutions > span {
  margin-right: 2px;
  color: var(--muted);
  font-size: 10px;
}

.city-agent-institutions strong,
.city-agent-institutions em {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 9px;
  font-style: normal;
  font-weight: 650;
}

.city-agent-institutions em {
  color: var(--muted);
  background: var(--soft);
}

.compact-notice {
  justify-content: space-between;
}

.subtle,
.login-help {
  color: var(--muted);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 28px;
}

.login-help {
  margin: 22px 0 0;
  font-size: 10px;
  text-align: center;
}

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

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

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

@media (max-width: 900px) {
  .sidebar {
    width: min(84vw, 300px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 18px 0 54px rgba(12, 40, 33, 0.22);
  }

  .sidebar-scrim {
    position: fixed;
    z-index: 29;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(8, 28, 23, 0.38);
    backdrop-filter: blur(2px);
    cursor: default;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content {
    margin-left: 0;
    padding: 0 22px 54px;
  }

  .mobile-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -22px 26px;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
    background: rgba(245, 246, 241, 0.92);
    backdrop-filter: blur(16px);
  }

  .mobile-brand {
    font-size: 17px;
    font-weight: 750;
  }

  .mobile-brand span {
    margin-left: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
  }

  .menu-button {
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: white;
  }

  .content-grid,
  .settlement-layout {
    grid-template-columns: 1fr;
  }

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

  .login-story {
    min-height: 360px;
  }

  .login-story h1 {
    max-width: 650px;
  }
}

@media (max-width: 680px) {
  .main-content {
    padding-inline: 15px;
  }

  .mobile-header {
    margin-inline: -15px;
    padding-inline: 15px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .page-heading h1 {
    font-size: 30px;
  }

  .heading-actions {
    width: 100%;
  }

  .heading-actions .button,
  .page-heading > .button {
    flex: 1;
  }

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

  .period-switch {
    width: 100%;
  }

  .period-switch a {
    flex: 1;
  }

  .city-agent-head,
  .compact-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .city-agent-head .button {
    width: 100%;
  }

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

  .city-agent-money {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 136px;
  }

  .field-wide {
    grid-column: auto;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar label,
  .filter-bar input,
  .filter-bar select,
  .filter-bar .button {
    width: 100%;
    flex-basis: auto;
  }

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

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

  .login-panel,
  .login-story {
    padding: 26px 20px;
  }

  .login-card {
    padding: 28px 22px;
  }

  .login-story {
    min-height: 320px;
  }

  .login-story h1 {
    font-size: 38px;
  }

  .message-stack {
    right: 12px;
  }
}

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