:root {
  --navy:#0e2b59;
  --navy-2:#17386d;
  --teal:#0c8bb0;
  --teal-2:#2ba8cb;
  --gold:#efc75a;
  --gold-border:#dba431;
  --text:#1f2f4d;
  --muted:#5a6a82;
  --border:#dbe2ec;
  --surface:#ffffff;
  --background:#f4f7fb;
  --shadow:0 18px 50px rgba(22,43,75,.12);
}

* { box-sizing:border-box; }

html { color-scheme:light; }

body {
  margin:0;
  min-height:100vh;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(12,139,176,.08), transparent 28%),
    linear-gradient(180deg,#fbfdff 0%,var(--background) 100%);
}

a { color:inherit; }

button, input { font:inherit; }

.skip-link {
  position:absolute;
  left:-9999px;
}

.skip-link:focus {
  left:16px;
  top:16px;
  z-index:1000;
  padding:10px 14px;
  border-radius:10px;
  background:#fff;
  box-shadow:var(--shadow);
}

.site-header {
  position:sticky;
  top:0;
  z-index:30;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(14,43,89,.09);
}

.header-inner {
  width:min(1240px,calc(100% - 32px));
  min-height:82px;
  margin:0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:22px;
}

.brand {
  display:flex;
  align-items:center;
  gap:14px;
  text-decoration:none;
}

.brand img {
  width:72px;
  height:auto;
}

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

.brand-text strong {
  color:var(--navy);
  font-size:1rem;
}

.brand-text span {
  margin-top:3px;
  color:var(--teal);
  font-size:.82rem;
  font-weight:800;
}

.header-actions {
  display:flex;
  align-items:center;
  gap:12px;
}

.link-button,
.primary-button,
.secondary-button,
.signout-button {
  min-height:46px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 18px;
  border-radius:12px;
  text-decoration:none;
  font-weight:800;
  cursor:pointer;
}

.primary-button {
  border:0;
  color:#fff;
  background:linear-gradient(135deg,var(--teal),#1265a9);
  box-shadow:0 12px 28px rgba(12,139,176,.22);
}

.secondary-button,
.link-button {
  color:var(--navy);
  background:#fff;
  border:1px solid var(--border);
}

.signout-button {
  border:1px solid var(--border);
  background:#fff;
  color:var(--navy);
}

.page-shell {
  width:min(1240px,calc(100% - 32px));
  margin:30px auto 48px;
}

.auth-layout {
  display:grid;
  grid-template-columns:250px minmax(0,1fr);
  gap:24px;
  align-items:start;
}

.sidebar {
  position:sticky;
  top:106px;
  padding:18px;
  border:1px solid var(--border);
  border-radius:20px;
  background:rgba(255,255,255,.94);
  box-shadow:0 10px 30px rgba(22,43,75,.08);
}

.sidebar-title {
  margin:0 0 14px;
  color:var(--muted);
  font-size:.75rem;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.sidebar nav {
  display:grid;
  gap:7px;
}

.sidebar a {
  padding:12px 13px;
  border-radius:10px;
  text-decoration:none;
  color:var(--navy);
  font-weight:700;
}

.sidebar a[aria-current="page"] {
  color:#fff;
  background:linear-gradient(135deg,var(--teal),#1265a9);
}

.dashboard {
  min-width:0;
}

.welcome-card {
  position:relative;
  overflow:hidden;
  padding:30px;
  border-radius:24px;
  color:#fff;
  background:linear-gradient(135deg,var(--teal),#155d9c);
  box-shadow:var(--shadow);
}

.welcome-card::after {
  content:"";
  position:absolute;
  right:-75px;
  bottom:-85px;
  width:260px;
  height:260px;
  border:38px solid rgba(255,255,255,.12);
  border-radius:50%;
}

.eyebrow {
  margin:0 0 8px;
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:rgba(255,255,255,.78);
}

.welcome-card h1 {
  margin:0;
  font-size:clamp(2rem,4vw,3.3rem);
  letter-spacing:-.04em;
}

.welcome-card p {
  max-width:700px;
  margin:14px 0 0;
  color:rgba(255,255,255,.9);
  line-height:1.65;
}

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

.info-card {
  min-height:180px;
  padding:22px;
  border:1px solid var(--border);
  border-radius:18px;
  background:var(--surface);
  box-shadow:0 8px 26px rgba(22,43,75,.06);
}

.info-card .label {
  display:block;
  margin-bottom:10px;
  color:var(--teal);
  font-size:.76rem;
  font-weight:900;
  letter-spacing:.11em;
  text-transform:uppercase;
}

.info-card h2 {
  margin:0 0 10px;
  color:var(--navy);
  font-size:1.15rem;
}

.info-card p {
  margin:0;
  color:var(--muted);
  line-height:1.58;
}

.status-pill {
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:14px;
  padding:7px 10px;
  border-radius:999px;
  color:#6f5000;
  background:#fff4ca;
  font-size:.8rem;
  font-weight:800;
}

.callback-shell {
  width:min(680px,calc(100% - 32px));
  margin:70px auto;
  padding:34px;
  text-align:center;
  border:1px solid var(--border);
  border-radius:22px;
  background:#fff;
  box-shadow:var(--shadow);
}

.callback-logo {
  width:130px;
  margin:0 auto 18px;
}

.spinner {
  width:48px;
  height:48px;
  margin:22px auto;
  border:5px solid #e4eaf2;
  border-top-color:var(--teal);
  border-radius:50%;
  animation:spin .9s linear infinite;
}

.error-message {
  display:none;
  margin-top:18px;
  padding:14px;
  border:1px solid #efb8b8;
  border-radius:12px;
  color:#7e1f1f;
  background:#fff1f1;
  text-align:left;
  line-height:1.5;
}

.footer {
  width:min(1240px,calc(100% - 32px));
  margin:0 auto;
  padding:20px 0 34px;
  color:var(--muted);
  font-size:.88rem;
}

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

@media (max-width:850px) {
  .auth-layout { grid-template-columns:1fr; }
  .sidebar { position:static; }
  .sidebar nav { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .sidebar a { text-align:center; }
}

@media (max-width:650px) {
  .brand-text strong { font-size:.9rem; }
  .brand-text span { font-size:.74rem; }
  .header-actions .link-button { display:none; }
  .card-grid { grid-template-columns:1fr; }
  .sidebar nav { grid-template-columns:1fr; }
  .welcome-card { padding:24px; }
}


.page-heading { margin-bottom:20px; }
.page-heading .eyebrow { color:var(--teal); }
.page-heading h1 {
  margin:0;
  color:var(--navy);
  font-size:clamp(2rem,4vw,3rem);
  letter-spacing:-.04em;
}
.page-heading p {
  max-width:760px;
  margin:12px 0 0;
  color:var(--muted);
  line-height:1.65;
}
.placeholder-panel {
  padding:26px;
  border:1px solid var(--border);
  border-radius:20px;
  background:#fff;
  box-shadow:0 8px 26px rgba(22,43,75,.06);
}
.placeholder-panel + .placeholder-panel { margin-top:18px; }
.placeholder-panel h2 {
  margin:0 0 10px;
  color:var(--navy);
  font-size:1.2rem;
}
.placeholder-panel p {
  margin:0;
  color:var(--muted);
  line-height:1.6;
}
.placeholder-list {
  margin:18px 0 0;
  padding:0;
  list-style:none;
  display:grid;
  gap:10px;
}
.placeholder-list li {
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#f8fafc;
  color:#465773;
}
.page-actions {
  margin-top:18px;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.empty-state {
  min-height:280px;
  display:grid;
  place-items:center;
  text-align:center;
  padding:34px;
}
.empty-state-icon {
  width:72px;
  height:72px;
  margin:0 auto 18px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#eef8fb;
  color:var(--teal);
  font-size:1.8rem;
  font-weight:900;
}


.role-badge {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:900;
  letter-spacing:.02em;
  border:1px solid #d7dee8;
  background:#f5f7fa;
  color:#516078;
}

.role-badge[data-role="administrator"] {
  color:#6f4b00;
  background:#fff3c4;
  border-color:#e8c564;
}

.role-badge[data-role="staff"] {
  color:#0b5f7a;
  background:#e9f8fc;
  border-color:#b8e5ef;
}

.role-badge[data-role="customer"] {
  color:#245d34;
  background:#edf8ef;
  border-color:#c9e7cf;
}

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

.role-detail {
  padding:16px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#f8fafc;
}

.role-detail .label {
  display:block;
  margin-bottom:6px;
  color:var(--teal);
  font-size:.72rem;
  font-weight:900;
  letter-spacing:.1em;
  text-transform:uppercase;
}

.role-detail strong {
  color:var(--navy);
}

@media (max-width:650px) {
  .role-badge {
    min-height:30px;
    padding:0 10px;
    font-size:.72rem;
  }

  .role-detail-grid {
    grid-template-columns:1fr;
  }
}


.profile-status {
  display:inline-flex;
  align-items:center;
  min-height:32px;
  padding:0 11px;
  border-radius:999px;
  font-size:.76rem;
  font-weight:900;
  background:#f4f6f9;
  color:#5b687b;
  border:1px solid #dce2ea;
}

.profile-status[data-status="connected"] {
  color:#245d34;
  background:#edf8ef;
  border-color:#c9e7cf;
}

.profile-status[data-status="error"] {
  color:#7e2020;
  background:#fff1f1;
  border-color:#edbcbc;
}


.portal-link-disabled {
  opacity: .48;
  cursor: not-allowed;
  pointer-events: auto;
}

.portal-link-disabled:hover,
.portal-link-disabled:focus {
  transform: none;
}


.page-access-level {
  margin-top: .55rem;
  font-size: .9rem;
  color: #59677a;
}

[data-current-permission],
.permission-list dd {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #d9e0e8;
  background: #f5f7fa;
  color: #39485a;
  font-size: .78rem;
  font-weight: 800;
}

.page-access-level [data-permission-level="read"],
.permission-list [data-permission-level="read"] {
  background: #eef5ff;
  border-color: #c7dcf5;
  color: #234e76;
}

.page-access-level [data-permission-level="write"],
.permission-list [data-permission-level="write"] {
  background: #edf8ef;
  border-color: #c8e6ce;
  color: #245d34;
}

.page-access-level [data-permission-level="admin"],
.permission-list [data-permission-level="admin"] {
  background: #fff5d9;
  border-color: #ecd58c;
  color: #735200;
}

.permission-summary-card {
  margin-top: 1.25rem;
}

.permission-list {
  display: grid;
  gap: .7rem;
  margin: 1rem 0 0;
}

.permission-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .7rem;
  border-bottom: 1px solid #e4e9ef;
}

.permission-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.permission-list dt {
  font-weight: 800;
  color: #24344a;
}

.permission-list dd {
  margin: 0;
}

.access-denied-panel {
  max-width: 720px;
  padding: 2rem;
  border: 1px solid #efbcbc;
  border-radius: 18px;
  background: #fff8f8;
}

.access-denied-panel h1 {
  margin: .35rem 0 .75rem;
}

.access-denied-panel .primary-button {
  display: inline-flex;
  margin-top: 1.25rem;
}


.documents-panel {
  margin-top: 1.25rem;
}

.documents-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.documents-api-status {
  margin-top: 1rem;
  padding: .8rem 1rem;
  border: 1px solid #dce2ea;
  border-radius: 12px;
  background: #f5f7fa;
  color: #526174;
  font-weight: 700;
}

.documents-api-status[data-status="connected"] {
  border-color: #c9e7cf;
  background: #edf8ef;
  color: #245d34;
}

.documents-api-status[data-status="error"] {
  border-color: #edbcbc;
  background: #fff1f1;
  color: #7e2020;
}

.documents-empty-state {
  margin-top: 1rem;
  padding: 2rem;
  border: 1px dashed #cfd7e1;
  border-radius: 14px;
  text-align: center;
  background: #fafbfd;
}

.documents-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
}

.documents-table th,
.documents-table td {
  padding: .9rem 1rem;
  border-bottom: 1px solid #e2e7ed;
  text-align: left;
}

.documents-table th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #5c697a;
}


.users-panel {
  margin-top: 1.25rem;
}

.users-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.users-api-status {
  margin-top: 1rem;
  padding: .8rem 1rem;
  border: 1px solid #dce2ea;
  border-radius: 12px;
  background: #f5f7fa;
  color: #526174;
  font-weight: 700;
}

.users-api-status[data-status="connected"] {
  border-color: #c9e7cf;
  background: #edf8ef;
  color: #245d34;
}

.users-api-status[data-status="error"] {
  border-color: #edbcbc;
  background: #fff1f1;
  color: #7e2020;
}

.users-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: .9rem 1rem;
  border-bottom: 1px solid #e2e7ed;
  text-align: left;
  vertical-align: top;
}

.users-table th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #5c697a;
}

.user-secondary {
  display: block;
  margin-top: .25rem;
  color: #667487;
  font-size: .86rem;
}

.user-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #d9e0e8;
  background: #f5f7fa;
  color: #39485a;
  font-size: .78rem;
  font-weight: 800;
}

.user-status-badge[data-user-status="active"] {
  border-color: #c9e7cf;
  background: #edf8ef;
  color: #245d34;
}

.user-status-badge[data-user-status="inactive"] {
  border-color: #edbcbc;
  background: #fff1f1;
  color: #7e2020;
}

.users-empty-state {
  margin-top: 1rem;
  padding: 2rem;
  border: 1px dashed #cfd7e1;
  border-radius: 14px;
  text-align: center;
  background: #fafbfd;
}


/* User Administration only: horizontal customer workspace navigation */
body[data-page="users"] .portal-shell {
  display: block;
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
}

body[data-page="users"] [data-portal-sidebar] {
  display: block;
  width: 100%;
}

body[data-page="users"] .sidebar {
  width: 100%;
  margin: 1rem 0 1.25rem;
  padding: .7rem .85rem;
  border: 1px solid #dfe5ec;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(26, 42, 64, .06);
}

body[data-page="users"] .sidebar-title {
  margin: 0 0 .65rem;
  color: #59677a;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

body[data-page="users"] .sidebar nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  padding-bottom: .2rem;
}

body[data-page="users"] .sidebar nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  padding: .62rem .88rem;
  border-radius: 10px;
  color: #34445a;
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

body[data-page="users"] .sidebar nav a:hover,
body[data-page="users"] .sidebar nav a:focus-visible {
  background: #f1f5f9;
  color: #173a67;
}

body[data-page="users"] .sidebar nav a[aria-current="page"] {
  background: #173a67;
  color: #ffffff;
  box-shadow: 0 5px 14px rgba(23, 58, 103, .18);
}

body[data-page="users"] .sidebar nav a[hidden] {
  display: none;
}

body[data-page="users"] .portal-shell > .dashboard {
  width: 100%;
  min-width: 0;
}

@media (max-width: 820px) {
  body[data-page="users"] .portal-shell {
    width: min(100% - 20px, 1440px);
  }
}


/* Step 17G: invite user dialog and form */
.portal-dialog {
  width: min(920px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(15, 31, 53, .28);
}

.portal-dialog::backdrop {
  background: rgba(12, 24, 40, .62);
  backdrop-filter: blur(3px);
}

.invite-user-form {
  padding: 1.4rem;
  overflow: auto;
  max-height: calc(100vh - 40px);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e1e6ec;
}

.dialog-header h2 {
  margin: .2rem 0 .35rem;
}

.dialog-header p {
  margin-bottom: 0;
}

.dialog-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #d8dfe7;
  border-radius: 50%;
  background: #ffffff;
  color: #2f4055;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.invite-user-form fieldset {
  margin: 1.25rem 0 0;
  padding: 1rem;
  border: 1px solid #dfe5ec;
  border-radius: 14px;
}

.invite-user-form legend {
  padding: 0 .4rem;
  color: #183a65;
  font-weight: 900;
}

.fieldset-help {
  margin: 0 0 .9rem;
  color: #657286;
}

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

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

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

.invite-user-form label {
  display: block;
  color: #334359;
  font-weight: 800;
}

.invite-user-form label > span {
  display: block;
  margin-bottom: .38rem;
}

.invite-user-form input,
.invite-user-form select,
.invite-user-form textarea {
  width: 100%;
  padding: .72rem .78rem;
  border: 1px solid #cdd6e0;
  border-radius: 10px;
  background: #ffffff;
  color: #203247;
  font: inherit;
}

.invite-user-form input:focus,
.invite-user-form select:focus,
.invite-user-form textarea:focus {
  outline: 3px solid rgba(36, 89, 148, .18);
  border-color: #245994;
}

.invite-user-form small {
  display: block;
  margin-top: .3rem;
  color: #69778a;
  font-weight: 500;
}

.invite-user-form em {
  color: #6d7886;
  font-style: normal;
  font-weight: 500;
}

.field-error {
  min-height: 1.05em;
  color: #9a2020 !important;
  font-weight: 700 !important;
}

.checkbox-row {
  display: flex !important;
  align-items: flex-start;
  gap: .7rem;
  margin-top: 1rem;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  margin-top: .15rem;
}

.checkbox-row span,
.checkbox-row small {
  margin: 0;
}

.form-message {
  margin-top: 1rem;
  padding: .8rem 1rem;
  border: 1px solid #d7dee7;
  border-radius: 10px;
  background: #f5f7fa;
  color: #35465c;
  font-weight: 700;
}

.form-message[data-type="success"] {
  border-color: #c9e7cf;
  background: #edf8ef;
  color: #245d34;
}

.form-message[data-type="error"] {
  border-color: #edbcbc;
  background: #fff1f1;
  color: #7e2020;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e6ec;
}

@media (max-width: 760px) {
  .form-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

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

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }
}


/* Step 17I: required indicators and validation states */
.required-fields-note {
  margin: 1rem 0 0;
  color: #59677a;
  font-size: .9rem;
  font-weight: 700;
}

.required-marker {
  color: #b42318;
  font-weight: 900;
}

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

.invite-user-form label.field-invalid > span {
  color: #b42318;
}

.invite-user-form label.field-invalid input,
.invite-user-form label.field-invalid select,
.invite-user-form label.field-invalid textarea,
.invite-user-form input[aria-invalid="true"],
.invite-user-form select[aria-invalid="true"],
.invite-user-form textarea[aria-invalid="true"] {
  border-color: #b42318;
  background: #fff5f5;
  color: #7a271a;
}

.invite-user-form input[aria-invalid="true"]:focus,
.invite-user-form select[aria-invalid="true"]:focus,
.invite-user-form textarea[aria-invalid="true"]:focus {
  outline-color: rgba(180, 35, 24, .2);
  border-color: #b42318;
}

.invite-user-form label.field-invalid .field-error {
  color: #b42318 !important;
}

.invite-user-form label.field-invalid small:not(.field-error) {
  color: #7a271a;
}


/* Step 17M: edit-user actions */
.table-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: .48rem .75rem;
  border: 1px solid #b9c7d7;
  border-radius: 9px;
  background: #ffffff;
  color: #173a67;
  font-weight: 800;
  cursor: pointer;
}

.table-action-button:hover,
.table-action-button:focus-visible {
  border-color: #173a67;
  background: #f1f5f9;
}

.users-table th:last-child,
.users-table td:last-child {
  width: 1%;
  white-space: nowrap;
}


/* Step 17P: delete-user actions and confirmation */
.user-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.table-action-danger {
  border-color: #d7a5a1;
  color: #9b2c23;
}

.table-action-danger:hover,
.table-action-danger:focus-visible {
  border-color: #b42318;
  background: #fff3f2;
  color: #8f1f17;
}

.table-action-button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.delete-user-dialog {
  width: min(620px, calc(100% - 32px));
}

.delete-user-form {
  padding: 1.4rem;
}

.delete-warning {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #e8aaa5;
  border-radius: 12px;
  background: #fff3f2;
  color: #7a271a;
}

.delete-warning p {
  margin: .45rem 0 0;
}

.delete-confirm-label {
  display: block;
  margin-top: 1.1rem;
  color: #334359;
  font-weight: 800;
}

.delete-confirm-label > span {
  display: block;
  margin-bottom: .4rem;
}

.delete-confirm-label input {
  width: 100%;
  padding: .72rem .78rem;
  border: 1px solid #cdd6e0;
  border-radius: 10px;
  background: #ffffff;
  color: #203247;
  font: inherit;
}

.delete-confirm-label input[aria-invalid="true"] {
  border-color: #b42318;
  background: #fff5f5;
  color: #7a271a;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .65rem 1rem;
  border: 1px solid #b42318;
  border-radius: 10px;
  background: #b42318;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.danger-button:hover,
.danger-button:focus-visible {
  background: #8f1f17;
  border-color: #8f1f17;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: .5;
}

@media (max-width: 620px) {
  .user-actions {
    align-items: stretch;
    flex-direction: column;
  }
}


/* Step 17Q: User Administration cleanup and hardening */
.users-panel-summary {
  margin: .35rem 0 0;
  color: #647286;
}

.users-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
}

.users-search {
  flex: 1 1 420px;
}

.users-filter {
  flex: 0 0 180px;
}

.users-search input,
.users-filter select {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem;
  border: 1px solid #ccd6e1;
  border-radius: 10px;
  background: #ffffff;
  color: #24364b;
  font: inherit;
}

.users-search input:focus,
.users-filter select:focus {
  outline: 3px solid rgba(36, 89, 148, .16);
  border-color: #245994;
}

.role-badge,
.invitation-status-badge,
.current-user-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid #d7dee7;
  border-radius: 999px;
  background: #f5f7fa;
  color: #39485a;
  font-size: .77rem;
  font-weight: 800;
  white-space: nowrap;
}

.role-badge[data-role="administrator"] {
  border-color: #c7b8e8;
  background: #f4f0ff;
  color: #57358a;
}

.role-badge[data-role="staff"] {
  border-color: #b9d5ec;
  background: #eff7fd;
  color: #23577f;
}

.role-badge[data-role="customer"] {
  border-color: #d6dce4;
  background: #f7f8fa;
  color: #49596c;
}

.invitation-status-badge[data-invitation-status="accepted"] {
  border-color: #c9e7cf;
  background: #edf8ef;
  color: #245d34;
}

.invitation-status-badge[data-invitation-status="sent"] {
  border-color: #b9d5ec;
  background: #eff7fd;
  color: #23577f;
}

.invitation-status-badge[data-invitation-status="expired"] {
  border-color: #edbcbc;
  background: #fff1f1;
  color: #7e2020;
}

.invitation-status-badge[data-invitation-status="not_sent"] {
  border-color: #e5d4a8;
  background: #fff9e8;
  color: #725313;
}

.current-user-badge {
  margin-top: .35rem;
  border-color: #c7b8e8;
  background: #f4f0ff;
  color: #57358a;
}

.override-summary {
  display: block;
  max-width: 260px;
  color: #56657a;
  overflow-wrap: anywhere;
}

.users-table tbody tr:hover {
  background: #fafbfd;
}

.users-table tbody tr:focus-within {
  background: #f4f7fb;
}

@media (max-width: 900px) {
  .users-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .users-search,
  .users-filter {
    flex: 1 1 auto;
    width: 100%;
  }

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

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

  .users-table tbody {
    display: grid;
    gap: .85rem;
  }

  .users-table tr {
    padding: .85rem;
    border: 1px solid #dfe5ec;
    border-radius: 14px;
    background: #ffffff;
  }

  .users-table td {
    display: grid;
    grid-template-columns: minmax(105px, .45fr) minmax(0, 1fr);
    gap: .65rem;
    padding: .55rem 0;
    border-bottom: 1px solid #edf0f4;
  }

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

  .users-table td::before {
    content: attr(data-label);
    color: #667487;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  .users-table th:last-child,
  .users-table td:last-child {
    width: auto;
    white-space: normal;
  }

  .user-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .users-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .users-panel-header .primary-button {
    width: 100%;
  }

  .users-table td {
    grid-template-columns: 1fr;
  }

  .users-table td::before {
    margin-bottom: -.25rem;
  }

  .user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .user-actions button {
    width: 100%;
  }
}


/* Step 17R: advanced filters, sorting, and alphabet navigation */
.users-toolbar {
  flex-wrap: wrap;
}

.users-toolbar .users-search {
  flex: 1 1 320px;
}

.users-toolbar .users-filter {
  flex: 1 1 165px;
  max-width: 220px;
}

.users-toolbar .users-sort {
  flex-basis: 190px;
}

.users-clear-filters {
  flex: 0 0 auto;
  min-height: 42px;
}

.alphabet-filter {
  display: flex;
  align-items: center;
  gap: .3rem;
  margin-top: .85rem;
  padding: .65rem;
  overflow-x: auto;
  border: 1px solid #dfe5ec;
  border-radius: 12px;
  background: #fafbfd;
  scrollbar-width: thin;
}

.alphabet-filter button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 34px;
  min-height: 34px;
  padding: .3rem .45rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #43536a;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}

.alphabet-filter button:hover,
.alphabet-filter button:focus-visible {
  border-color: #b8c7d8;
  background: #ffffff;
  color: #173a67;
}

.alphabet-filter button[aria-pressed="true"] {
  border-color: #173a67;
  background: #173a67;
  color: #ffffff;
}

@media (max-width: 900px) {
  .users-toolbar .users-filter,
  .users-toolbar .users-sort {
    max-width: none;
  }

  .users-clear-filters {
    width: 100%;
  }
}


/* Step 17S: organization/company column and filter */
.users-organization-filter {
  flex-basis: 210px;
}

.organization-name {
  display: block;
  min-width: 150px;
  color: #39485a;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .users-organization-filter {
    max-width: none;
  }
}


/* Step 17T: free-text organization/company filter */
.users-organization-filter input {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem;
  border: 1px solid #ccd6e1;
  border-radius: 10px;
  background: #ffffff;
  color: #24364b;
  font: inherit;
}

.users-organization-filter input:focus {
  outline: 3px solid rgba(36, 89, 148, .16);
  border-color: #245994;
}


/* Step 17U: custom Organization / Company field in Invite/Edit form */
.portal-dialog input[name="companyName"] {
  width: 100%;
  min-height: 42px;
  padding: .65rem .75rem;
  border: 1px solid #ccd6e1;
  border-radius: 10px;
  background: #ffffff;
  color: #24364b;
  font: inherit;
}

.portal-dialog input[name="companyName"]:focus {
  outline: 3px solid rgba(36, 89, 148, .16);
  border-color: #245994;
}

.portal-dialog input[name="companyName"][aria-invalid="true"] {
  border-color: #b42318;
  background: #fff5f5;
}


/* Step 17X: restore AxisBridge gold treatment for top Administrator badge */
.site-header .role-badge[data-role="administrator"] {
  color: #6f4b00;
  background: #fff3c4;
  border-color: #e8c564;
}


/* Step 20: public portal/intake entry and intake preview */
.portal-entry-page {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(239, 199, 90, .18), transparent 30%),
    radial-gradient(circle at 8% 18%, rgba(12, 139, 176, .08), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, #f2f5f8 100%);
  color: #1f2f4d;
}

.portal-entry-header {
  border-bottom: 1px solid rgba(14, 43, 89, .09);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .03);
}

.portal-entry-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 40px));
  min-height: 96px;
  margin: 0 auto;
}

.portal-entry-brand {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  color: #0e2b59;
  text-decoration: none;
}

.portal-entry-brand img {
  width: 76px;
  height: auto;
}

.portal-entry-brand span {
  display: grid;
  gap: 4px;
}

.portal-entry-brand strong {
  font-size: 1.03rem;
  letter-spacing: .02em;
}

.portal-entry-brand small {
  color: #0c8bb0;
  font-size: .82rem;
  font-weight: 800;
}

.portal-entry-main-site-link {
  color: #0e2b59;
  font-weight: 800;
  text-decoration: none;
}

.portal-entry-main-site-link:hover,
.portal-entry-main-site-link:focus-visible {
  text-decoration: underline;
}

.portal-entry-main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0 46px;
}

.portal-entry-intro {
  max-width: 830px;
  margin: 0 auto 34px;
  text-align: center;
}

.portal-entry-kicker,
.portal-entry-card-label {
  margin: 0 0 9px;
  color: #9a7422;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.portal-entry-intro h1 {
  margin: 0;
  color: #0e2b59;
  font-size: clamp(2.15rem, 5vw, 3.7rem);
  line-height: 1.06;
  letter-spacing: -.04em;
}

.portal-entry-intro > p:last-child {
  max-width: 790px;
  margin: 20px auto 0;
  color: #56667e;
  font-size: 1.08rem;
  line-height: 1.7;
}

.portal-entry-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.portal-entry-card {
  display: flex;
  flex-direction: column;
  min-height: 500px;
  padding: 32px;
  border: 1px solid #d8e0e8;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(22, 43, 75, .1);
}

.portal-entry-card-client {
  border-top: 5px solid #0e2b59;
}

.portal-entry-card-intake {
  border-top: 5px solid #efc75a;
}

.portal-entry-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  margin-bottom: 21px;
  border-radius: 15px;
  background: #edf3f8;
  color: #0e2b59;
  font-size: 1.42rem;
  font-weight: 900;
}

.portal-entry-card-intake .portal-entry-icon {
  background: #fff7dc;
  color: #7a5710;
}

.portal-entry-card h2 {
  margin: 0 0 14px;
  color: #0e2b59;
  font-size: 1.7rem;
  line-height: 1.25;
}

.portal-entry-card-copy {
  margin: 0;
  color: #5a6a7a;
  line-height: 1.68;
}

.portal-entry-feature-list {
  display: grid;
  gap: 11px;
  margin: 25px 0 30px;
  padding: 0;
  list-style: none;
}

.portal-entry-feature-list li {
  position: relative;
  padding-left: 25px;
  color: #3c4c5e;
}

.portal-entry-feature-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #9a7422;
  font-weight: 900;
}

.portal-entry-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 13px 21px;
  border-radius: 12px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.portal-entry-card .portal-entry-button {
  margin-top: auto;
}

.portal-entry-button-primary {
  background: linear-gradient(135deg, #0c8bb0, #1265a9);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(12, 139, 176, .22);
}

.portal-entry-button-primary:hover,
.portal-entry-button-primary:focus-visible {
  background: linear-gradient(135deg, #0a7898, #0e538d);
}

.portal-entry-button-gold {
  border: 1px solid #dba431;
  background: #efc75a;
  color: #0e2b59;
}

.portal-entry-button-gold:hover,
.portal-entry-button-gold:focus-visible {
  background: #f4d474;
}

.portal-entry-button-secondary {
  border: 1px solid #d8e0e8;
  background: #ffffff;
  color: #0e2b59;
}

.portal-entry-note {
  margin: 14px 0 0;
  color: #73808d;
  font-size: .84rem;
  line-height: 1.45;
  text-align: center;
}

.portal-entry-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-top: 28px;
  padding: 27px 29px;
  border: 1px solid #d8e0e8;
  border-radius: 17px;
  background: rgba(255, 255, 255, .86);
}

.portal-entry-help h2 {
  margin: 0 0 7px;
  color: #0e2b59;
  font-size: 1.28rem;
}

.portal-entry-help p {
  margin: 0;
  color: #62707d;
}

.portal-entry-help > a {
  flex: 0 0 auto;
  color: #0e2b59;
  font-weight: 900;
}

.portal-entry-security {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 17px 19px;
  border-radius: 13px;
  background: #e9f0f5;
  color: #4f6070;
  font-size: .91rem;
}

.portal-entry-security strong {
  color: #0e2b59;
}

.portal-entry-footer {
  padding: 28px 20px 38px;
  color: #72808d;
  font-size: .83rem;
  text-align: center;
}

.portal-entry-footer p {
  margin: 4px 0;
}

.portal-intake-review-intro {
  margin-bottom: 30px;
}

.portal-intake-preview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.portal-intake-preview-grid article {
  padding: 24px;
  border: 1px solid #d8e0e8;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(22, 43, 75, .08);
}

.portal-intake-preview-grid span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #efc75a;
  color: #0e2b59;
  font-weight: 900;
}

.portal-intake-preview-grid h2 {
  margin: 18px 0 10px;
  color: #0e2b59;
  font-size: 1.1rem;
}

.portal-intake-preview-grid p {
  margin: 0;
  color: #5a6977;
  line-height: 1.58;
}

.portal-intake-review-actions {
  display: flex;
  justify-content: center;
  gap: 13px;
  margin-top: 28px;
}

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

@media (max-width: 780px) {
  .portal-entry-header-inner,
  .portal-entry-help {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-entry-options {
    grid-template-columns: 1fr;
  }

  .portal-entry-card {
    min-height: auto;
  }

  .portal-entry-main {
    padding-top: 42px;
  }
}

@media (max-width: 560px) {
  .portal-entry-header-inner,
  .portal-entry-main {
    width: min(100% - 24px, 1180px);
  }

  .portal-entry-card {
    padding: 24px;
  }

  .portal-entry-help {
    padding: 22px;
  }

  .portal-entry-security,
  .portal-intake-review-actions {
    flex-direction: column;
  }

  .portal-intake-preview-grid {
    grid-template-columns: 1fr;
  }

  .portal-intake-review-actions .portal-entry-button {
    width: 100%;
  }
}

/* QBO-2A: Customer Billing invoice list */
.billing-panel {
  padding:24px;border:1px solid var(--border);border-radius:20px;
  background:var(--surface);box-shadow:0 8px 26px rgba(22,43,75,.06);
}
.billing-panel-header {
  display:flex;align-items:flex-start;justify-content:space-between;gap:1.25rem;
}
.billing-section-label {
  margin:0 0 6px;color:var(--teal);font-size:.76rem;font-weight:900;
  letter-spacing:.11em;text-transform:uppercase;
}
.billing-panel h2 { margin:0 0 8px;color:var(--navy);font-size:1.35rem; }
.billing-panel-header p:not(.billing-section-label) {
  margin:0;color:var(--muted);line-height:1.55;
}
.billing-summary { display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.6rem; }
.billing-summary span {
  display:inline-flex;align-items:center;min-height:38px;padding:0 12px;
  border:1px solid #dce2ea;border-radius:999px;background:#f7f9fc;color:#42536a;font-size:.84rem;
}
.billing-summary strong { margin-right:.35rem;color:var(--navy); }
.billing-api-status {
  margin-top:1rem;padding:.8rem 1rem;border:1px solid #dce2ea;border-radius:12px;
  background:#f5f7fa;color:#526174;font-weight:700;
}
.billing-api-status[data-status="connected"] { border-color:#c9e7cf;background:#edf8ef;color:#245d34; }
.billing-api-status[data-status="empty"] { border-color:#e6d7a9;background:#fff9e9;color:#6d5513; }
.billing-api-status[data-status="error"] { border-color:#edbcbc;background:#fff1f1;color:#7e2020; }
.billing-table-wrap { margin-top:1rem;overflow-x:auto; }
.billing-table { width:100%;border-collapse:collapse; }
.billing-table th,.billing-table td {
  padding:.9rem;border-bottom:1px solid #e2e7ed;text-align:left;vertical-align:middle;white-space:nowrap;
}
.billing-table th {
  color:#5c697a;font-size:.78rem;font-weight:900;letter-spacing:.05em;text-transform:uppercase;
}
.billing-table tbody tr:last-child td { border-bottom:0; }
.billing-table tbody tr:hover { background:#fafcfe; }
.billing-money { font-variant-numeric:tabular-nums; }
.billing-status-badge {
  display:inline-flex;align-items:center;min-height:30px;padding:0 10px;
  border:1px solid #d9e0e8;border-radius:999px;background:#f5f7fa;
  color:#39485a;font-size:.78rem;font-weight:900;
}
.billing-status-badge[data-invoice-status="PAID"] { border-color:#c9e7cf;background:#edf8ef;color:#245d34; }
.billing-status-badge[data-invoice-status="OPEN"] { border-color:#c7dcf5;background:#eef5ff;color:#234e76; }
.billing-status-badge[data-invoice-status="PAST_DUE"] { border-color:#edbcbc;background:#fff1f1;color:#8a2424; }
.billing-empty-state {
  margin-top:1rem;padding:2.25rem;border:1px dashed #cfd7e1;border-radius:14px;
  text-align:center;background:#fafbfd;
}
.billing-empty-state h2 { margin:0 0 8px; }
.billing-empty-state p { margin:0;color:var(--muted); }
@media (max-width:760px) {
  .billing-panel-header { flex-direction:column; }
  .billing-summary { justify-content:flex-start; }
}

/* QBO-2B: Read-only invoice detail */
.invoice-link {
  color:var(--link,#1d5f86);text-decoration:none;font-weight:800;
}
.invoice-link:hover,.invoice-link:focus { text-decoration:underline; }

.invoice-detail-back { margin-bottom:1rem; }
.invoice-back-link {
  display:inline-flex;align-items:center;gap:.35rem;color:var(--link,#1d5f86);
  text-decoration:none;font-weight:800;
}
.invoice-back-link:hover,.invoice-back-link:focus { text-decoration:underline; }

.invoice-heading-row {
  display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;
}
.invoice-detail-status { margin-top:.35rem; }

.invoice-detail-shell { display:grid;gap:1rem; }
.invoice-detail-meta-grid {
  display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem;
}
.invoice-meta-card,.invoice-detail-card {
  border:1px solid var(--border);border-radius:16px;background:var(--surface);
  box-shadow:0 8px 24px rgba(22,43,75,.05);
}
.invoice-meta-card { padding:1rem 1.1rem; }
.invoice-meta-card span {
  display:block;margin-bottom:.35rem;color:var(--muted);font-size:.76rem;
  font-weight:900;letter-spacing:.05em;text-transform:uppercase;
}
.invoice-meta-card strong { color:var(--navy);font-size:1.05rem; }

.invoice-detail-grid {
  display:grid;grid-template-columns:minmax(0,1.3fr) minmax(280px,.7fr);gap:1rem;
}
.invoice-detail-card { padding:1.25rem; }
.invoice-detail-card h2 { margin:.2rem 0 .75rem;color:var(--navy); }
.invoice-address { color:#42536a;line-height:1.6; }

.invoice-summary-list { margin:0; }
.invoice-summary-list div {
  display:flex;justify-content:space-between;gap:1rem;padding:.55rem 0;
  border-bottom:1px solid #e7ebf0;
}
.invoice-summary-list div:last-child { border-bottom:0; }
.invoice-summary-list dt { color:var(--muted); }
.invoice-summary-list dd { margin:0;color:var(--navy);font-weight:800; }
.invoice-summary-list .invoice-summary-total {
  margin-top:.25rem;padding-top:.8rem;border-top:2px solid #dce3ea;
}
.invoice-summary-list .invoice-summary-total dt,
.invoice-summary-list .invoice-summary-total dd { font-size:1.02rem; }

.invoice-lines-card { padding-bottom:.75rem; }
.invoice-card-heading { display:flex;justify-content:space-between;align-items:flex-start; }
.invoice-description-cell { white-space:normal!important;min-width:260px;line-height:1.45; }
.invoice-customer-memo { margin:.35rem 0 0;color:#42536a;line-height:1.6; }
.invoice-readonly-note {
  margin:.25rem 0 0;padding:.9rem 1rem;border:1px solid #dce3ea;border-radius:12px;
  background:#f7f9fc;color:#5a6777;font-size:.88rem;
}

@media (max-width:900px) {
  .invoice-detail-meta-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .invoice-detail-grid { grid-template-columns:1fr; }
}
@media (max-width:560px) {
  .invoice-detail-meta-grid { grid-template-columns:1fr; }
  .invoice-heading-row { flex-direction:column; }
}

/* QBO-2C: Sortable Billing + official QBO PDF */
.billing-sort-button{appearance:none;border:0;background:transparent;padding:0;color:inherit;font:inherit;font-weight:900;letter-spacing:inherit;text-transform:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:.35rem}
.billing-sort-button:hover,.billing-sort-button:focus{color:var(--navy)}
.billing-sort-button:focus-visible{outline:2px solid var(--teal);outline-offset:4px;border-radius:3px}
.billing-sort-button.is-active{color:var(--navy)}
.invoice-detail-actions{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap;justify-content:flex-end}
.invoice-pdf-button{white-space:nowrap;min-height:36px}
@media(max-width:560px){.invoice-detail-actions{justify-content:flex-start}}

/* QBO-2D: Billing overview, payments, activity, profile */
.billing-extended{display:grid;gap:1.25rem;margin-top:1.25rem}
.billing-extended-loading{margin-top:1rem;padding:1rem 1.1rem;border:1px solid var(--border);border-radius:14px;background:var(--surface);color:var(--muted)}
.billing-overview-section,.billing-panel{border:1px solid var(--border);border-radius:16px;background:var(--surface);padding:1.25rem;box-shadow:0 8px 24px rgba(22,43,75,.05)}
.billing-section-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:1.5rem;margin-bottom:1rem}
.billing-section-heading h2{margin:.15rem 0 0;color:var(--navy)}
.billing-section-heading>p{margin:.2rem 0 0;color:var(--muted);max-width:520px;text-align:right}
.billing-summary-grid-extended{grid-template-columns:repeat(3,minmax(0,1fr))}
.billing-profile-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;margin:0;border:1px solid var(--border);border-radius:12px;overflow:hidden}
.billing-profile-grid>div{padding:1rem;border-bottom:1px solid var(--border)}
.billing-profile-grid>div:nth-child(odd){border-right:1px solid var(--border)}
.billing-profile-grid dt{color:var(--muted);font-size:.76rem;font-weight:900;letter-spacing:.05em;text-transform:uppercase;margin-bottom:.4rem}
.billing-profile-grid dd{margin:0;color:var(--navy);font-weight:700;line-height:1.5}
.billing-activity-type{display:inline-block;padding:.2rem .5rem;border-radius:999px;background:#eef3f8;color:var(--navy);font-size:.74rem;font-weight:900;text-transform:uppercase;letter-spacing:.04em}
@media(max-width:900px){.billing-summary-grid-extended{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.billing-summary-grid-extended,.billing-profile-grid{grid-template-columns:1fr}.billing-profile-grid>div:nth-child(odd){border-right:0}.billing-section-heading{flex-direction:column}.billing-section-heading>p{text-align:left}}

/* QBO-2D.1: Payment method label refinement */
.payment-method-key {
  margin:.75rem 0 0;
  padding:.75rem .9rem;
  border:1px solid var(--border);
  border-radius:10px;
  background:#f7f9fc;
  color:var(--muted);
  font-size:.84rem;
  line-height:1.5;
}

/* QBO-2D.2: Billing table visual polish */

/* Stronger header/data separation across Billing tables */
.billing-table thead th {
  background:#163B63;
  color:#FFFFFF;
  border-bottom:2px solid #102844;
  font-weight:800;
  letter-spacing:.025em;
  vertical-align:middle;
}

.billing-table thead th:first-child {
  border-top-left-radius:8px;
}

.billing-table thead th:last-child {
  border-top-right-radius:8px;
}

/* Keep sortable header controls readable on the darker header */
.billing-table thead .billing-sort-button {
  color:#FFFFFF;
}

.billing-table thead .billing-sort-button:hover,
.billing-table thead .billing-sort-button:focus,
.billing-table thead .billing-sort-button.is-active {
  color:#FFFFFF;
  text-decoration:underline;
  text-underline-offset:3px;
}

/* Alternating row colors make long horizontal records easier to follow */
.billing-table tbody tr:nth-child(odd) td {
  background:#FFFFFF;
}

.billing-table tbody tr:nth-child(even) td {
  background:#F5F9FC;
}

/* Clearer separation without creating a heavy spreadsheet appearance */
.billing-table tbody td {
  border-bottom:1px solid #DCE8EE;
}

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

.billing-table tbody tr:hover td {
  background:#EEF6FA;
}

/* Account Activity type pills */
.billing-activity-type {
  min-width:78px;
  text-align:center;
  border:1px solid transparent;
  box-shadow:0 1px 2px rgba(16,40,68,.06);
}

.billing-activity-type[data-activity-type="INVOICE"] {
  background:#E8F1FA;
  color:#163B63;
  border-color:#BFD3E7;
}

.billing-activity-type[data-activity-type="PAYMENT"] {
  background:#EAF6EF;
  color:#24633D;
  border-color:#BEDDC9;
}

/* Payment History and Account Activity scanability */
.billing-panel .billing-table tbody td:first-child {
  font-weight:650;
  color:#263746;
}

.billing-panel .billing-table tbody tr {
  transition:background-color .12s ease;
}

/* Subtle section distinction around each table */
.billing-table-wrap {
  border:1px solid #DCE8EE;
  border-radius:10px;
  overflow:auto;
  background:#FFFFFF;
}

/* Improve numeric-column visual anchoring */
.billing-money {
  font-variant-numeric:tabular-nums;
}

/* Preserve compact mobile readability */
@media (max-width:700px) {
  .billing-table thead th {
    white-space:nowrap;
  }
  .billing-activity-type {
    min-width:68px;
  }
}

/* QBO-3A: Portal Organizations Administration */
.organizations-summary-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem;margin:0 0 1.25rem}
.organization-toolbar{display:grid;grid-template-columns:minmax(240px,1fr) 220px;gap:1rem;margin:0 0 1rem}
.organization-toolbar label{display:grid;gap:.35rem;color:var(--navy);font-weight:800}
.organization-toolbar input,.organization-toolbar select{width:100%}
.organizations-table small{color:var(--muted);font-weight:600}
.organization-id-cell{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.78rem;overflow-wrap:anywhere}
.mapping-pill{display:inline-flex;padding:.25rem .55rem;border-radius:999px;font-size:.74rem;font-weight:900;border:1px solid}
.mapping-pill-connected{background:#eaf6ef;color:#24633d;border-color:#beddc9}
.mapping-pill-not-connected{background:#f4f6f8;color:#5e6874;border-color:#dce3ea}
.mapping-pill-attention{background:#fff5e7;color:#8a5a14;border-color:#ead1a5}
@media(max-width:800px){.organizations-summary-grid,.organization-toolbar{grid-template-columns:1fr}}

/* QBO-3B: Portal admin mapping controls + Billing accounting contact */
.organization-summary-card{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:.38rem;
}
.organization-summary-card span{display:block;}
.organization-summary-card strong{
  display:block;
  margin-top:.1rem;
  font-size:1.5rem;
  line-height:1;
}
.org-inline-edit-label{
  display:grid;
  gap:.35rem;
  min-width:230px;
  font-size:.75rem;
  font-weight:800;
  color:var(--navy);
}
.org-inline-edit-label input{
  width:100%;
  min-width:0;
}
.org-inline-edit-label small{
  color:var(--muted);
  font-weight:600;
}
.org-row-actions{
  display:flex;
  gap:.5rem;
  flex-wrap:wrap;
}
.organizations-table td:last-child{white-space:nowrap;}
.billing-accounting-help{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin:0 0 1.25rem;
  padding:1rem 1.1rem;
  border:1px solid #dce8ee;
  border-radius:12px;
  background:#f7fcfd;
}
.billing-accounting-help strong{color:#163b63;}
.billing-accounting-help p{
  margin:.3rem 0 0;
  color:#526577;
}
.billing-accounting-email{
  flex:0 0 auto;
  text-decoration:none;
}
@media(max-width:760px){
  .billing-accounting-help{
    align-items:flex-start;
    flex-direction:column;
  }
}
