:root {
  --navy: #101e32;
  --navy-deep: #0c1729;
  --ink: #17283e;
  --muted: #52657b;
  --line: #d7e1eb;
  --canvas: #edf2f7;
  --surface: #fff;
  --accent: #00677a;
  --accent-light: #4cd8e9;
  color: var(--ink);
  background: var(--canvas);
  font: 15px/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
header {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 65px;
  padding: 10px clamp(14px, 2.4vw, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  background: var(--navy-deep);
  border-bottom: 2px solid #2cb7c9;
}

.brand, .session-controls { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { font-size: 1.15rem; font-weight: 750; line-height: 1.18; letter-spacing: -.015em; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand small, .session-label small { display: block; color: #a7cfdf; font-size: .73rem; font-weight: 550; }
.session-label { min-width: 0; overflow-wrap: anywhere; text-align: right; line-height: 1.25; }
.session-controls button { border-color: #537087; background: #192e46; color: #edf9ff; }

#workspace { min-height: calc(100dvh - 65px); }
.workspace-bar {
  position: sticky;
  top: 65px;
  z-index: 2;
  min-height: 47px;
  padding-inline: clamp(14px, 2.4vw, 36px);
  display: flex;
  align-items: center;
  background: var(--navy);
  border-bottom: 1px solid #284158;
}
.workspace-nav { display: flex; align-items: stretch; gap: 5px; }
.nav-toggle { display: none; }
.nav-menu { position: relative; }
.nav-menu summary, .nav-root {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px;
  min-height: 46px;
  border: 0;
  border-radius: 0;
  color: #e4eff8;
  background: transparent;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
  list-style: none;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: "▾"; color: #9dc5d4; font-size: .75rem; }
.nav-menu.current > summary, .nav-root[aria-pressed=true] {
  box-shadow: inset 0 -3px var(--accent-light);
  color: #fff;
}
.nav-menu[open] > summary, .nav-root:hover, .nav-menu summary:hover { background: #20394f; }
.nav-menu-items {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: max(100%, 190px);
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 7px 20px #13273c33;
}
.nav-menu-items .nav-button {
  display: block;
  width: 100%;
  background: transparent;
  color: #27465e;
  text-align: left;
  text-decoration: none;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  white-space: nowrap;
}
.nav-menu-items .nav-button[aria-pressed=true], .nav-menu-items .nav-button:hover:not(:disabled) {
  background: #e2f5f7;
  color: #0a5666;
}

.workspace-content { min-width: 0; width: 100%; max-width: 1480px; margin-inline: auto; padding: 24px clamp(16px, 3vw, 42px) 36px; }
h1, h2, h3, p { margin: 0; }
h1 { margin-bottom: 16px; font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.18; letter-spacing: -.025em; }
h2 { font-size: 1.16rem; overflow-wrap: anywhere; }
h3 { font-size: 1rem; }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 2px 5px #0c172909;
}
.login { max-width: 430px; margin: min(14vh, 105px) auto 16px; padding: 28px; display: grid; gap: 14px; }
.login h1 { margin-bottom: 2px; }
.login button { width: 100%; margin-top: 4px; }

label { display: block; margin-bottom: 4px; color: #42546c; font-weight: 650; font-size: .86rem; }
input, textarea, select, button { font: inherit; border-radius: 6px; min-height: 39px; }
input, textarea, select { background: #fff; color: var(--ink); border: 1px solid #98aabd; padding: 7px 10px; }
input, textarea { width: 100%; min-width: 0; }
textarea { resize: vertical; }
button {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 7px 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(.92); }
.secondary { background: #fff; color: #294660; border-color: #afc1d2; }
.secondary[aria-pressed=true] { border-color: #73adba; background: #e2f5f7; color: #0a5666; }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #20acc1; outline-offset: 3px; }

.search { margin-bottom: 14px; }
.search div, .inventory-controls { display: flex; align-items: end; gap: 8px; }
.muted { color: var(--muted); font-size: .84rem; }
.freshness { margin: 7px 0 14px; }
.error, #notice:not(:empty) { color: #a02f1a; }
.error:empty { display: none; }
#notice:not(:empty) { margin-top: 12px; }

.balance {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
  background: #f9fcff;
  border-left: 4px solid #1597a9;
}
.balance strong { display: block; font-size: clamp(1.25rem, 3vw, 1.7rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric { border-left: 1px solid var(--line); padding-left: 14px; }
.metric span { color: var(--muted); font-size: .8rem; }
#status { display: inline-block; margin-top: 5px; padding: 1px 9px; border-radius: 20px; background: #e5eaf0; color: #354e72; font-size: .78rem; font-weight: 650; }
#status[data-state=unblocked] { background: #d9f3e7; color: #175a43; }
#status[data-state=blocked] { background: #f7dedb; color: #86302e; }

.account-tools {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 7px;
  max-width: 520px;
  margin-bottom: 12px;
}
.action-button { min-width: 0; min-height: 46px; }
.action-button.secondary[aria-expanded=true] { border-color: #67a8b8; background: #e4f6f7; color: #09596b; }
.action-panel { margin-bottom: 12px; }
.action-panel form {
  padding: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
}
.action-panel form > label:not(:first-child) { margin-top: 7px; }
.action-panel .inventory-edit { margin-top: 0; }
#funding-status { margin-top: 7px; }

.panel-title { margin-bottom: 10px; }
.activity-header, .switch { display: flex; gap: 6px; flex-wrap: wrap; }
.activity-header { justify-content: space-between; margin-bottom: 7px; }
.records { list-style: none; padding: 0; margin: 8px -16px -16px; }
.records li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 45px; border-top: 1px solid var(--line); padding: 7px 16px; overflow-wrap: anywhere; }
.records li:nth-child(odd) { background: #f7fafd; }
.records li:last-child { border-radius: 0 0 10px 10px; }
.records small { display: block; color: var(--muted); }
.records span { text-align: right; font-size: .86rem; }

.inventory-controls { flex-wrap: wrap; margin-bottom: 10px; }
.inventory-controls input { flex: 1 1 130px; }
.inventory-controls select { max-width: 100%; }
.inventory-table { overflow-x: auto; margin: 10px -16px; }
.inventory-table table { width: 100%; border-collapse: collapse; text-align: left; }
.inventory-table th, .inventory-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.inventory-table th { background: #e4ecf4; font-size: .79rem; letter-spacing: .015em; color: #344b63; }
.inventory-table tbody tr:nth-child(even) { background: #f7fafd; }
.inventory-table th:last-child, .inventory-table td:last-child { text-align: right; }
.inventory-table td button { min-height: 32px; padding: 4px 11px; }
#inventory-pages { margin-bottom: 0; }
.inventory-edit { margin-top: 14px; }
.inventory-edit h3 { margin-bottom: 8px; }
.inventory-edit textarea, .inventory-edit select { display: block; width: 100%; margin-bottom: 8px; }
.inventory-edit .inventory-controls { margin-top: 10px; }

@media (max-width: 760px) {
  .workspace-bar { padding: 4px 12px; }
  .nav-toggle {
    display: flex; align-items: center; gap: 8px;
    background: #1b3850; border-color: #476278; color: #effaff;
  }
  .workspace-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: min(72dvh, 570px);
    overflow: auto;
    border-bottom: 2px solid #2cb7c9;
    background: var(--navy);
    padding: 6px 12px;
  }
  .nav-toggle[aria-expanded=true] + .workspace-nav { display: block; }
  .nav-menu summary, .nav-root { width: 100%; justify-content: space-between; text-align: left; }
  .nav-menu-items { position: static; box-shadow: none; border: 0; border-radius: 6px; margin: 0 0 4px; }
  .workspace-content { padding: 16px 12px 26px; }
  .login { margin: 65px 16px 16px; padding: 20px; }
  input, textarea, select { font-size: 16px; }
  button, input, select { min-height: 44px; }
  .balance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .balance > :first-child { grid-column: 1 / -1; }
  .metric { padding: 8px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .session-label { font-size: .73rem; }
  .session-controls button { padding-inline: 8px; }
  .activity-header button { padding-inline: 7px; font-size: .82rem; }
  .inventory-table { margin-inline: -16px; }
}

@media (min-width: 480px) and (max-width: 760px) {
  .login { margin-inline: auto; }
}

@media (max-width: 760px) {
  .inventory-table table[data-section=accounts] { min-width: 720px; }
}

.inventory-table td[data-field=available_credits] { font-weight: 600; }
.inventory-table td button.account-name {
  background: transparent;
  border: 0;
  color: #00677a;
  font: inherit;
  font-weight: 600;
  padding-inline: 0;
}
.inventory-table td button.account-name:hover { text-decoration: underline; }
.account-status {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.account-status:is([data-status=Registered], [data-status=Blocked], [data-status=Expired]) {
  box-shadow: inset 0 0 0 2px currentColor, inset 0 0 0 3px white;
  background: currentColor;
}
.account-status[data-status=Registered] { color: #389447; }
.account-status[data-status=Blocked] { color: #ba353b; }
.account-status[data-status=Expired] { color: #a3630b; }


#payments-table td:last-child {
  min-width: 180px;
  max-width: 400px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
#payments-table th:last-child { text-align: left; }


.android-download { text-decoration: none; }
.workspace-nav .android-download { color: #b7eef4; }

.account-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 3px;
  max-width: 520px;
  margin-bottom: 12px;
  border: 1px solid #d5e0eb;
  border-radius: 12px;
  background: #e7eef5;
}
.account-tabs button {
  min-height: 44px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #42586f;
}
.account-tabs button[aria-pressed=true] {
  border-color: #d3e2ea;
  background: #fff;
  color: #076679;
  box-shadow: 0 1px 3px #152b4012;
}
.account-tabs button:focus-visible { z-index: 1; }
#account-profile-status:empty { display: none; }
#account-profile-retry { margin-top: 8px; }
.profile-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr)); gap: 12px; }
.profile-groups section { min-width: 0; border-top: 1px solid var(--line); padding-top: 7px; }
.profile-groups dl { margin: 4px 0; }
.profile-groups dl div { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(0, 1fr); gap: 7px; padding: 4px 0; }
.profile-groups dt { color: var(--muted); font-size: .85rem; }
.profile-groups dd { margin: 0; overflow-wrap: anywhere; }
#account-rule-edit label:not(:first-child) { margin-top: 8px; }


.app-update {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 12px;
  background: #dcf4f6;
  color: #155467;
}
@media (max-width: 480px) {
  #account-workspace h1 { margin-bottom: 10px; }
  #lookup { padding: 10px 12px; margin-bottom: 10px; }
  #details > .balance { padding: 10px 12px; gap: 8px; }
  #details > .freshness { margin: 4px 0 8px; }
  .account-tabs, .account-tools { margin-bottom: 8px; }
  .account-tabs button, .action-button { font-size: .79rem; padding-inline: 5px; }
  .action-panel .search div { flex-wrap: wrap; }
  .action-panel .search div button { width: 100%; }
  #account-calls-panel .activity-header { flex-wrap: nowrap; }
  #account-calls-panel .switch { flex-wrap: nowrap; }
}

.account-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.account-heading h1 { margin: 0 !important; }
#change-account { border-color: transparent; background: transparent; color: var(--accent); }
#details > .balance {
  background: linear-gradient(130deg, #102740, #153a4a);
  border: 0;
  color: #f5fbff;
  border-radius: 16px;
  padding: clamp(14px, 2.4vw, 22px);
}
#details .balance .muted, #details .balance .metric span { color: #bdd5e2; }
#details .balance .metric { border-color: #426478; }
#details .balance h2 { font-size: 1.3rem; }
#details #status[data-state=unblocked] { background: #d3f0e2; }
#account-profile-panel { background: transparent; border: 0; box-shadow: none; padding: 2px 0; }
#account-profile-panel > .panel-title { padding-left: 2px; }
.profile-groups section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.profile-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.profile-card-heading button { border-color: transparent; color: var(--accent); background: #e7f5f7; }
.profile-groups dl div + div { border-top: 1px solid #ecf1f5; }
.profile-groups dl div { padding: 6px 0; }
.rule-list { list-style: none; margin: 8px 0; padding: 0; }
.rule-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rule-list li > div { min-width: 0; overflow-wrap: anywhere; }
.rule-list small { display: block; color: var(--muted); }
.account-editor {
  width: min(660px, calc(100% - 24px));
  max-height: min(88dvh, 760px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  color: var(--ink);
  overflow: auto;
  box-shadow: 0 16px 70px #11274147;
}
.account-editor::backdrop { background: #0c172980; }
.account-editor form { padding: 0 16px; }
.editor-heading, .editor-footer {
  position: sticky;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  padding-block: 9px;
  z-index: 1;
}
.editor-heading { top: 0; justify-content: space-between; border-bottom: 1px solid var(--line); }
.editor-footer { bottom: 0; justify-content: flex-end; border-top: 1px solid var(--line); }
.editor-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; padding: 12px 0; }
.editor-fields select { width: 100%; }
#account-editor-status { min-height: 1.45em; margin: 5px 0; }
@media (max-width: 520px) {
  .account-editor {
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: 16px 16px 0 0;
  }
  .editor-footer button { width: 100%; }
  #change-account { font-size: .79rem; padding-inline: 5px; }
  #details > .balance { padding: 12px; }
}

.passkey-content { padding: 12px 0; }
#passkey-status { margin-top: 6px; min-height: 1.4em; }
#passkey-list:empty { display: none; }

.passkey-setup {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  border-left: 3px solid var(--accent);
}
.passkey-setup div { flex: 1 1 300px; }
#passkey-sign-in-help { margin-top: -6px; }

.passkey-test-area {
  display: grid;
  gap: 5px;
  justify-items: start;
  border-bottom: 1px solid var(--line);
  padding: 6px 0 12px;
  margin-bottom: 12px;
}

.passkey-shell { padding-inline: 16px; }
.passkey-shell form { padding-inline: 0; }
#passkey-remove-description { margin: 4px 0 10px; }
#passkey-remove-form .editor-footer button { width: auto; }
button.danger { background: #9c2a22; border-color: #9c2a22; }

.app-settings .nav-menu-items { left: auto; right: 0; z-index: 20; }
.app-settings summary { padding-inline: 8px; }

#self-care-balance-status, #self-care-history-status { margin-block: 8px; }
.self-care-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 16px; }
.self-care-nav button[aria-pressed=true] { background: #d7eff2; border-color: #4997a4; }
.self-care-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  align-items: end;
  gap: 12px;
  margin-block: 14px;
}
.self-care-filters input, .self-care-filters select { width: 100%; min-width: 0; }
.self-care-profile { display: grid; grid-template-columns: minmax(90px, 1fr) 2fr; gap: 8px 12px; }
.self-care-profile dt { color: var(--muted); }
.self-care-profile dd { margin: 0; overflow-wrap: anywhere; }

body[data-portal=customer] { background: #eef3f8; }
body[data-portal=customer] :is(.customer-portal-link,.app-settings,.session-label) { display: none; }
.customer-portal-link { display: inline-block; margin-top: 12px; }
#self-care { max-width: 1160px; }
.self-care-hero {
  color: #fff;
  background: linear-gradient(115deg, #10243c, #16435a);
  border-radius: 18px;
  padding: clamp(18px, 3.5vw, 36px);
}
.self-care-hero-heading, .self-care-hero-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.self-care-hero h1 { margin: 4px 0 0; }
.self-care-eyebrow, .self-care-hero .metric span, #self-care-balance-status { color: #cee3ef; }
.self-care-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.self-care-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 3vw, 28px);
  margin: 24px 0 16px;
}
.self-care-metrics .metric { padding: 10px 0; border-top: 1px solid #6c8c9f; }
.self-care-metrics strong { display: block; font-size: clamp(1.2rem, 3vw, 1.8rem); overflow-wrap: anywhere; }
#self-care .inventory-panel { border-radius: 14px; }
#self-care .inventory-table { margin-inline: 0; }

.self-care-layout {
  display: grid;
  grid-template-columns: minmax(175px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}
.self-care-menu { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px; }
.self-care-menu summary { cursor: pointer; font-weight: 650; }
.self-care-menu .self-care-nav { display: grid; margin-block: 10px 0; gap: 5px; }
.self-care-menu .self-care-nav button { width: 100%; text-align: left; }
.self-care-password { max-width: 420px; display: grid; gap: 8px; margin-block: 14px; }
.self-care-password button { justify-self: start; margin-top: 6px; }
@media (max-width: 680px) {
  .self-care-layout { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .self-care-menu { padding: 10px 12px; }
}

.customer-icon {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -.2em;
  margin-inline-end: .45em;
  flex: 0 0 auto;
}
.self-care-menu .self-care-nav button { display: flex; align-items: center; }
.self-care-menu summary .customer-icon, .self-care-nav .customer-icon { color: #14667a; }
.self-care-eyebrow .customer-icon { color: #9cdeeb; }
body[data-portal=operations] #logout .customer-icon { display: none; }
