/* ============================================================
   UTILITY BILLING SYSTEM
   Design: Minimal white — clean & modern
   Palette: Deep teal + light gray (same design language as
   PrinterShare.Web, so the two admin tools feel like
   one family of internal apps)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300..900;1,14..32,300..900&display=swap');

/* ---------- Tokens ----------
   Retheme: adopts PrinterShare.Web's teal palette + Inter-only
   typography so the two internal admin tools read as one family. */
:root {
  --brand-900: #124E5F;
  --brand-800: #0D3C49;
  --brand-700: #166273;
  --brand-600: #22A699;
  --brand-200: #BFE6DF;
  --brand-100: #D7F0EB;
  --brand-50:  #E9F8F5;

  --gray-950: #0B0F14;
  --gray-900: #101828;
  --gray-800: #1D2939;
  --gray-700: #344054;
  --gray-600: #475467;
  --gray-500: #667085;
  --gray-400: #8A97A8;
  --gray-300: #CAD6E3;
  --gray-200: #DDE5EE;
  --gray-100: #EEF2F6;
  --gray-50:  #F6F8FB;

  --success: #16845B;
  --success-bg: #E7F6EE;
  --success-border: #BFE9DA;
  --error:   #B42318;
  --error-bg: #FDECEC;
  --error-border: #F0C9C1;
  --teal:    #22A699;
  --teal-bg: #E9F8F5;
  --teal-border: #BFE6DF;
  --white: #ffffff;

  --font-display: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-body:    'Inter', 'Segoe UI', system-ui, sans-serif;

  --r-xs:   4px;
  --r-sm:   6px;
  --r-md:   8px;
  --r-lg:   8px;
  --r-xl:   10px;
  --r-2xl:  12px;
  --r-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(16,24,40,0.06);
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.06), 0 4px 10px rgba(16,24,40,0.05);
  --shadow-md: 0 1px 2px rgba(16,24,40,0.06), 0 8px 24px rgba(16,24,40,0.06);
  --shadow-lg: 0 2px 4px rgba(16,24,40,0.06), 0 12px 32px rgba(16,24,40,0.08);
  --shadow-focus-brand: 0 0 0 3px rgba(34,166,153,0.20);

  --ease: cubic-bezier(0.4,0,0.2,1);
  --fast: 120ms;
  --base: 200ms;
  --slow: 320ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 15px;
  min-height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--gray-800);
  background-color: var(--gray-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
}

body > .container { flex: 1 0 auto; }

a { color: var(--brand-700); }

/* ---------- Layout ---------- */
.container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding-left: 32px;
  padding-right: 32px;
}

main { padding-top: 40px; }

/* ---------- Page Card (generic content shell, e.g. client bill list) ---------- */
.page-card {
  border-radius: var(--r-2xl);
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  padding: 32px;
  margin-bottom: 40px;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

/* ---------- Form Elements ---------- */
.field { margin-bottom: 14px; }
.field.full { grid-column: 1 / -1; }

/* Small helper text under a field explaining what it's used for downstream
   (e.g. "this is what the 5/3/2-day reminder reads"), not an error and not
   a file-upload hint (see .file-hint) — just context for a plain input. */
.field-hint {
  margin: 5px 0 0;
  font-size: 0.76rem;
  color: var(--gray-500);
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.field-label-row label {
  margin-bottom: 0;
}

.provider-field {
  position: relative;
}

.field-help-popover {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.field-help-popover summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--teal-border);
  border-radius: var(--r-full);
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}

.field-help-popover summary::-webkit-details-marker {
  display: none;
}

.field-help-popover summary:hover,
.field-help-popover[open] summary {
  border-color: var(--brand-600);
  background: var(--brand-600);
  color: #fff;
  box-shadow: var(--shadow-focus-brand);
}

.field-help-panel {
  position: absolute;
  top: 26px;
  left: -10px;
  z-index: 20;
  width: min(520px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid var(--teal-border);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.field-help-panel::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 14px;
  width: 12px;
  height: 12px;
  border-left: 1px solid var(--teal-border);
  border-top: 1px solid var(--teal-border);
  background: #fff;
  transform: rotate(45deg);
}

.form-example-box {
  margin: -2px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--teal-border);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #fbfffe 0%, var(--brand-50) 100%);
  box-shadow: var(--shadow-xs);
}

.form-example-title {
  margin-bottom: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--brand-800);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-example-grid {
  display: grid;
  grid-template-columns: 86px minmax(120px, 1fr) minmax(150px, 1.25fr);
  gap: 7px 10px;
  align-items: center;
  color: var(--gray-600);
  font-size: 0.8rem;
}

.form-example-grid span,
.form-example-grid strong {
  min-width: 0;
}

.form-example-grid strong {
  color: var(--gray-900);
  font-weight: 700;
}

@media (max-width: 640px) {
  .field-help-panel {
    left: auto;
    right: -8px;
    width: min(360px, calc(100vw - 36px));
  }

  .field-help-panel::before {
    left: auto;
    right: 12px;
  }

  .form-example-grid {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .form-example-grid span:nth-child(3n + 1) {
    margin-top: 7px;
    font-weight: 700;
    color: var(--brand-800);
  }

  .form-example-grid span:first-child {
    margin-top: 0;
  }
}

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

label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  letter-spacing: 0.01em;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--gray-50);
  color: var(--gray-900);
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease),
    background var(--fast) var(--ease);
  appearance: none;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--gray-300);
  background: var(--white);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-600);
  box-shadow: var(--shadow-focus-brand);
  outline: none;
  background: var(--white);
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-400);
  font-size: 0.85rem;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: var(--gray-50);
  border-color: var(--gray-100);
  color: var(--gray-300);
  cursor: not-allowed;
}

/* ---------- Buttons ---------- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 18px;
  border: 0;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 0.845rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition:
    background var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}

.btn-primary {
  background: var(--brand-900);
  color: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-800);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transform: translateY(-1px);
  color: var(--white);
}

.btn-primary:active { transform: none; }

.btn-primary:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
}

/* ---------- Form Actions ---------- */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  border-top: 1px solid var(--gray-100);
  margin-top: 4px;
}

/* ---------- Validation ---------- */
.field-validation-error { display: block; margin-top: 4px; color: var(--error); font-size: 0.78rem; font-weight: 500; }
.validation-summary-errors { display: block; margin-top: 4px; color: var(--error); font-size: 0.8rem; }
.alert:empty, .validation-summary-valid { display: none; }

.alert-danger {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--error-border);
  border-radius: var(--r-md);
  background: var(--error-bg);
  color: var(--error);
  font-size: 0.845rem;
}

.alert-info {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--brand-200);
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 0.845rem;
}

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

.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background:
    radial-gradient(640px circle at 50% -8%, var(--brand-50), transparent 65%),
    var(--gray-100);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 410px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 32px;
  text-align: center;
  overflow: hidden;
}

.login-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  background: var(--brand-900);
  color: var(--white);
  margin-bottom: 18px;
  animation: login-icon-pulse 2.6s ease-in-out infinite;
}

.login-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 22px;
}

.login-logo-img {
  max-width: 240px;
  max-height: 96px;
  width: auto;
  height: auto;
  object-fit: contain;
}

@keyframes login-icon-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(30,45,64,0.30); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(30,45,64,0.10); }
}

.login-brand-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-900);
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}

.login-brand-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0 0 28px;
}

.login-form { text-align: left; }

.login-field { margin-bottom: 14px; }

.login-field input {
  min-height: 48px;
  border-radius: var(--r-lg);
  font-size: 0.9rem;
  padding: 12px 16px;
}

.login-password-wrap { position: relative; }

.login-password-wrap input { padding-right: 44px; }

.login-password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--r-md);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.login-password-toggle:hover { color: var(--gray-700); background: var(--gray-100); }

/* ---------- Register (multi-field variant of login-card) ---------- */
.register-card {
  max-width: 480px;
  text-align: left;
  padding: 36px 36px 30px;
}

.register-card .login-logo-wrap,
.register-card .login-brand-title,
.register-card .login-brand-subtitle {
  text-align: center;
}

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

.field-row .login-field { margin-bottom: 14px; }

.login-field-locked { position: relative; }

.login-field-locked input {
  padding-right: 40px;
  background: var(--gray-100);
  color: var(--gray-600);
  cursor: not-allowed;
}

.login-field-lock-icon {
  position: absolute;
  top: 38px;
  right: 14px;
  display: inline-flex;
  color: var(--gray-400);
  pointer-events: none;
}

.login-field-hint {
  display: block;
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--gray-400);
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 16px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  user-select: none;
}

.login-remember-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  min-height: 0;
  pointer-events: none;
}

.login-remember-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--r-xs);
  background: var(--white);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.login-remember:hover .login-remember-box { border-color: var(--gray-400); }

.login-remember:has(.login-remember-input:checked) .login-remember-box {
  background: var(--brand-700);
  border-color: var(--brand-700);
}

.login-remember-box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform var(--fast) var(--ease);
}

.login-remember:has(.login-remember-input:checked) .login-remember-box::after {
  transform: rotate(45deg) scale(1);
}

.login-remember:has(.login-remember-input:focus-visible) .login-remember-box {
  outline: 2px solid var(--brand-600);
  outline-offset: 2px;
}

.login-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--gray-400);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.login-or::before,
.login-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.login-home-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border-radius: var(--r-full);
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.login-home-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-900);
  transform: translateY(-1px);
}

/* ---------- "Welcome back" one-click sign-in (Remember Me) ---------- */
.login-welcome-back {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-welcome-text {
  margin: 0 0 16px;
  font-size: 0.92rem;
  color: var(--gray-700);
  text-align: center;
}

.login-welcome-text strong {
  color: var(--gray-900);
}

.login-welcome-back .login-form {
  margin: 0;
}

.login-forget-me-form {
  margin: 12px 0 0;
  text-align: center;
}

.login-forget-me-link {
  border: none;
  background: none;
  padding: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-forget-me-link:hover {
  color: var(--brand-700);
}

.login-submit {
  width: 100%;
  min-height: 50px;
  justify-content: center;
  border-radius: var(--r-lg);
  font-size: 0.92rem;
  margin-top: 6px;
}

.login-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 28px 0 16px;
}

.login-footnote {
  margin: 0;
  font-size: 0.78rem;
  color: var(--gray-400);
}

@media (max-width: 480px) {
  .login-page { padding: 28px 16px; }
  .login-card { padding: 30px 22px 24px; }
  .register-card { padding: 26px 20px 22px; }
  .login-logo-wrap { margin-bottom: 14px; }
  .login-logo-img { max-width: 200px; max-height: 68px; }
  .login-brand-title { font-size: 1.28rem; }
  .login-brand-subtitle { margin-bottom: 20px; }
  .login-field { margin-bottom: 12px; }
  .login-divider { margin: 20px 0 14px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .field-row .login-field { margin-bottom: 12px; }
}

/* ---------- Success Modal (e.g. post-registration confirmation) ---------- */
.success-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: successModalFadeIn var(--base) var(--ease);
}

.success-modal-overlay.is-closing {
  animation: successModalFadeOut 180ms var(--ease) forwards;
}

@keyframes successModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes successModalFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.success-modal-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--white);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lg);
  padding: 34px 30px 28px;
  text-align: center;
  animation: successModalPopIn var(--base) var(--ease);
}

@keyframes successModalPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.success-modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
  margin-bottom: 18px;
  animation: successModalIconPop 420ms var(--ease) 100ms both;
}

@keyframes successModalIconPop {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.success-modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}

.success-modal-text {
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--gray-500);
  margin: 0 0 26px;
}

.success-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--brand-900);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.success-modal-btn:hover {
  background: var(--brand-800);
  transform: translateY(-1px);
}

.success-modal-btn:active { transform: none; }

@media (max-width: 480px) {
  .success-modal-card { padding: 28px 22px 22px; }
  .success-modal-icon { width: 52px; height: 52px; }
}

/* ---------- Table ---------- */
.table-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead th {
  padding: 11px 16px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  text-align: left;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--fast) var(--ease);
}

.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }

.table td {
  padding: 13px 16px;
  color: var(--gray-800);
  vertical-align: middle;
}

/* Column headers with a title="" tooltip (e.g. Status vs Encode Access,
   which look similar as green badges but are independent toggles) get a
   dotted underline so the client notices there's more info on hover. */
.table thead th[title] {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  text-decoration-color: var(--gray-300);
  cursor: help;
}

/* ---------- Status Badge (client pages) ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.unpaid              { background: #fffbeb;          color: #d97706;          border: 1px solid #fde68a; }
.status-badge.pendingverification { background: var(--brand-50);  color: var(--brand-700); border: 1px solid var(--brand-100); }
.status-badge.paid                { background: var(--success-bg); color: var(--success);  border: 1px solid var(--success-border); }
.status-badge.rejected            { background: var(--error-bg);   color: var(--error);    border: 1px solid var(--error-border); }
.status-badge.pendingapproval      { background: #fffbeb;          color: #d97706;          border: 1px solid #fde68a; }
.status-badge.encoderejected       { background: var(--error-bg);   color: var(--error);    border: 1px solid var(--error-border); }

/* ---------- Page Header Row (title + action button) ---------- */
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header-row h1 { margin-bottom: 0; }

/* ---------- Meta Text (small muted helper/context text) ---------- */
.meta-text {
  font-size: 0.78rem;
  color: var(--gray-500);
}

/* ---------- Checkbox Field ---------- */
.field-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}
.field-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: unset;
  flex-shrink: 0;
  accent-color: var(--brand-700);
  cursor: pointer;
}
.field-checkbox .meta-text { margin: 0; }

/* ---------- Custom Checkbox (.ub-checkbox) ----------
   The global input reset above (min-height: 40px, padding, appearance: none) wipes out
   the native checkbox, so a bare <input type="checkbox"> renders as a big empty rounded
   box with no check mark. Add class="ub-checkbox" to any plain checkbox that should look
   like a real one (e.g. row selection in tables): it re-draws the box, the check mark,
   and the indeterminate dash. Higher specificity than input:hover/:focus/:disabled above,
   so those global states can't repaint a checked box white. */
input[type="checkbox"].ub-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  vertical-align: middle;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--r-xs);
  background-color: var(--white);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
  cursor: pointer;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

input[type="checkbox"].ub-checkbox:hover { border-color: var(--brand-600); background-color: var(--white); }
input[type="checkbox"].ub-checkbox:focus-visible { border-color: var(--brand-600); box-shadow: var(--shadow-focus-brand); outline: none; }

input[type="checkbox"].ub-checkbox:checked,
input[type="checkbox"].ub-checkbox:indeterminate {
  background-color: var(--brand-700);
  border-color: var(--brand-700);
}

input[type="checkbox"].ub-checkbox:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3.5 8.5 6.5 11.5 12.5 4.5'/%3E%3C/svg%3E");
}

input[type="checkbox"].ub-checkbox:indeterminate {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'%3E%3Cline x1='4' y1='8' x2='12' y2='8'/%3E%3C/svg%3E");
}

input[type="checkbox"].ub-checkbox:disabled {
  background-color: var(--gray-100);
  border-color: var(--gray-200);
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- File Row (styled file input, e.g. bill/receipt attachment) ----------
   Same pattern as SupplierAccreditation.Web's document upload rows: a real
   ::file-selector-button styled as a proper button instead of the raw
   browser control, plus a small feedback line below showing the picked
   filename (replaces relying on the native title-attribute tooltip, which
   overlaps other fields when the filename is long). */
.file-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.file-row input[type="file"] {
  flex: 1;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: 0.8rem;
  /* Native browsers render the picked filename inline using the input's own
     text color -- transparent hides that (avoids showing the filename twice
     alongside .file-feedback below) while leaving the button pseudo-element,
     which sets its own color explicitly, fully visible. */
  color: transparent;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease);
}

.file-row input[type="file"]:hover { border-color: var(--gray-300); }

.file-row input[type="file"]::file-selector-button {
  height: 34px;
  padding: 0 12px;
  margin-right: 10px;
  border: 0;
  border-right: 1px solid var(--gray-200);
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--gray-100);
  color: var(--gray-700);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.file-row input[type="file"]::file-selector-button:hover { background: var(--gray-200); }
.file-row input[type="file"]:disabled { opacity: 0.45; cursor: not-allowed; }

.file-feedback {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--gray-500);
}

/* ---------- File Picked Chip (attachment upload confirmation) ----------
   Shown by UBFileAttachment (wwwroot/js/site.js) once a file is chosen,
   replacing the plain .file-feedback line. A colored card is far more
   noticeable than a text-only change, and stays consistent across every
   form that accepts a file: Bills/Edit, Bills/Encode, Payments/Upload. */
.file-row.is-picked input[type="file"] {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.file-picked {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--success-border);
  border-radius: var(--r-md);
  background: var(--success-bg);
  animation: filePickedPop 220ms var(--ease);
}

.file-picked-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  flex-shrink: 0;
}

.file-picked-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.file-picked-name {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-picked-meta {
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--success);
}

@keyframes filePickedPop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hint line above a file input describing what to actually upload (e.g.
   changes per selected utility type on the Encode Billing form). Same
   visual weight as .file-feedback, kept as its own class since it sits
   above the file-row instead of below it. */
.file-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: var(--gray-500);
}

/* ---------- N/A Toggle (compact, inline next to a file input) ----------
   Same purpose as SupplierAccreditation.Web's na-check/na-toggle pattern —
   lets the client mark a file field as "nothing to attach" instead of
   leaving it blank with no indication. Kept compact (unlike .toggle-row,
   which is a full-width block) since it sits inline beside a file input. */
.na-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 0 10px;
  height: 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-md);
  background: var(--gray-50);
  cursor: pointer;
  user-select: none;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.na-check:hover { border-color: var(--gray-300); }

.na-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  min-height: 0;
  pointer-events: none;
}

.na-toggle {
  display: inline-block;
  width: 28px;
  height: 16px;
  border-radius: var(--r-full);
  background: var(--gray-300);
  position: relative;
  flex-shrink: 0;
  transition: background var(--base) var(--ease);
}

.na-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(0,0,0,0.20);
  transition: transform var(--base) var(--ease);
}

.na-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gray-500);
}

.na-check:has(input:checked) {
  border-color: var(--brand-700);
  background: var(--brand-50);
}

.na-check:has(input:checked) .na-toggle { background: var(--brand-700); }
.na-check:has(input:checked) .na-toggle::after { transform: translateX(12px); }
.na-check:has(input:checked) .na-label { color: var(--brand-800); }

/* ---------- Toggle Row (switch-style checkbox, e.g. "Historical record") ---------- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  background: var(--gray-50);
  margin: 0 0 14px;
  cursor: pointer;
  user-select: none;
  transition:
    border-color var(--fast) var(--ease),
    background var(--fast) var(--ease);
}

.toggle-row:hover {
  border-color: var(--gray-300);
  background: var(--white);
}

.toggle-row-text { min-width: 0; }

.toggle-row-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 2px;
}

.toggle-row-desc {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin: 0;
}

.toggle-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  min-height: 0;
  pointer-events: none;
}

.toggle-switch {
  display: inline-block;
  width: 40px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--gray-300);
  position: relative;
  flex-shrink: 0;
  transition: background var(--base) var(--ease);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.20);
  transition: transform var(--base) var(--ease);
}

.toggle-row:has(input:checked) {
  border-color: var(--brand-700);
  background: var(--brand-50);
}

.toggle-row:has(input:checked) .toggle-row-title { color: var(--brand-800); }
.toggle-row:has(input:checked) .toggle-switch { background: var(--brand-700); }
.toggle-row:has(input:checked) .toggle-switch::after { transform: translateX(18px); }

/* ---------- Form Header (icon + title + subtitle, e.g. Encode Billing) ---------- */
.form-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.form-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--brand-900);
  color: var(--white);
  flex-shrink: 0;
}

.form-header-row h1 { margin: 0; }

.form-subtitle {
  margin: 2px 0 20px;
  font-size: 0.825rem;
  color: var(--gray-500);
}

/* ---------- Empty State ---------- */
.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--gray-400);
}
.empty-state p { margin: 0; font-size: 0.9rem; }

/* ---------- Footer ---------- */
.footer {
  flex-shrink: 0;
  padding: 16px 0;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-400);
  font-size: 0.78rem;
  text-align: center;
}

/* ============================================================
   CLIENT DASHBOARD (v2) — same visual language as the Admin
   Dashboard (dash-hero, dash-section, metric-row/metric-cell)
   so both portals read as one product.
   ============================================================ */

/* ── Hero ── */
.dash-hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: 24px;
  background: linear-gradient(160deg, var(--brand-900) 0%, #0F3540 60%, #0A2830 100%);
  box-shadow: var(--shadow-lg);
}

.dash-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 75% 90% at 25% 0%, black 0%, transparent 72%);
  mask-image: radial-gradient(ellipse 75% 90% at 25% 0%, black 0%, transparent 72%);
  pointer-events: none;
}

.dash-hero-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(560px circle at 92% -8%, rgba(34,166,153,0.35), transparent 62%),
    radial-gradient(420px circle at 6% 118%, rgba(18,78,95,0.35), transparent 60%);
  pointer-events: none;
}

.dash-hero-content {
  position: relative;
  padding: 26px 32px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.dash-hero-text { flex: 1 1 auto; min-width: 0; }

.dash-hero-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.dash-hero-sub {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(255,255,255,0.55);
  max-width: 420px;
}

.dash-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.dash-hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--r-full);
  background: #fff;
  color: var(--brand-900);
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.dash-hero-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.25); color: var(--brand-900); }

.dash-hero-alert-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px 9px 12px;
  border-radius: var(--r-full);
  background: rgba(251,191,36,0.12);
  border: 1px solid rgba(251,191,36,0.35);
  color: #fde68a;
  font-size: 0.80rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.dash-hero-alert-link:hover { background: rgba(251,191,36,0.20); border-color: rgba(251,191,36,0.5); color: #fde68a; }
.dash-hero-alert-link svg { flex-shrink: 0; }

@media (max-width: 640px) {
  .dash-hero-content { padding: 22px 18px; }
  .dash-hero-title { font-size: 1.3rem; }
  .dash-hero-actions { width: 100%; }
  .dash-hero-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* ── Next-due pill (banner between hero and sections) ── */
.due-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-lg);
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-size: 0.845rem;
  font-weight: 600;
}
.due-pill svg { color: #d97706; flex-shrink: 0; }

/* ── Section headers ── */
.dash-section-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.dash-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-md);
  flex-shrink: 0;
}

.dash-section-icon--blue  { background: var(--brand-50); color: var(--brand-700); }
.dash-section-icon--teal  { background: var(--teal-bg);  color: var(--teal); }
.dash-section-icon--gray  { background: var(--gray-100); color: var(--gray-500); }

.dash-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  letter-spacing: -0.01em;
}

.dash-section-count {
  margin-left: auto;
  font-size: 0.76rem;
  color: var(--gray-400);
  font-weight: 500;
}

.dash-section + .dash-section { margin-top: 28px; }

/* ── Metric cards — PrinterShare/Admin-style: separate gapped cards, big
   number, muted uppercase label with accent dot instead of an icon square.
   Highlight reserved for genuine attention items (unpaid/pending). ── */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.metric-cell {
  min-height: 116px;
  padding: 17px 18px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  text-decoration: none;
  color: inherit;
  transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

a.metric-cell:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--gray-300);
}

.metric-cell-icon {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 99px;
  background: var(--gray-400);
  display: inline-block;
}

.metric-cell-icon--blue  { background: var(--brand-700); }
.metric-cell-icon--teal  { background: var(--teal); }
.metric-cell-icon--green { background: var(--success); }
.metric-cell-icon--amber { background: #d97706; }
.metric-cell-icon--red   { background: var(--error); }

.metric-cell-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.metric-cell-toprow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 0;
}

.metric-cell-label {
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-cell-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin: 10px 0 6px;
  font-variant-numeric: tabular-nums;
}

.metric-cell-sub { font-size: 0.82rem; color: var(--gray-500); margin-top: 0; }

.metric-cell-tag {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.metric-cell-tag--danger { color: var(--error); background: var(--error-bg); }

.metric-cell-arrow {
  position: absolute;
  top: 17px;
  right: 16px;
  color: var(--gray-300);
  opacity: 0;
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
a.metric-cell:hover .metric-cell-arrow { opacity: 1; transform: translateX(2px); }

.metric-cell--alert  { border-color: #fde68a; background: linear-gradient(180deg, #fffbeb 0%, #fff 65%); }
.metric-cell--alert .metric-cell-value,
.metric-cell--alert .metric-cell-label { color: #b45309; }

.metric-cell--danger { border-color: var(--error-border); background: linear-gradient(180deg, var(--error-bg) 0%, #fff 65%); }
.metric-cell--danger .metric-cell-value,
.metric-cell--danger .metric-cell-label { color: var(--error); }

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

/* ---------- Mobile ---------- */
@media (max-width: 680px) {
  main:not(.login-split-main) { padding-top: 0; }
  .page-card {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field.full { grid-column: 1; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; padding-top: 16px; }
  .btn-primary, .btn-secondary { justify-content: center; width: 100%; min-height: 42px; }

  /* Table cards can scroll horizontally instead of squishing columns
     (e.g. client "My Bills" table has 7 columns) - pairs with the
     .actions-cell fix below since buttons stay full-width once the
     column itself has room via horizontal scroll. */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Actions column (Edit / Upload Payment, etc.): the generic
     .btn-primary/.btn-secondary width:100% rule above makes each button
     fill the <td>, but with no flex/gap on the cell itself they stack
     directly on top of one another with zero space between - looks like
     one glued block. Turning the cell into a column flex container with
     a gap fixes that without touching the button rule itself. */
  .table .actions-cell,
  .submissions-table .actions-cell {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
