:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e1ec;
  --brand: #07579a;
  --brand-strong: #034175;
  --accent: #0f9f7a;
  --danger-bg: #fff2f2;
  --danger-text: #a31818;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }


.auth-app-shell {
  width: min(100vw, 800px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(16, 24, 40, .04);
  color: #071827;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:has(.auth-app-shell) {
  display: grid;
  place-items: center;
  background: #eef5f3;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-hero {
  height: clamp(258px, 66vw, 390px);
  position: relative;
  overflow: hidden;
  background-color: #07856f;
  background-image: url("images/auth/hero-image.jpg");
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: top center;
}

.auth-hero-shade {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 12% 4%, rgba(255, 255, 255, .2), transparent 24%), linear-gradient(180deg, rgba(0, 100, 84, 0) 64%, rgba(0, 100, 84, .22) 100%);
  pointer-events: none;
}

.auth-panel {
  position: relative;
  z-index: 2;
  margin-top: -72px;
  min-height: calc(100dvh - 244px);
  padding: 38px 24px calc(22px + env(safe-area-inset-bottom));
  background: #ffffff;
  border-radius: 30px 30px 0 0;
  box-shadow: 0 18px 46px rgba(15, 35, 48, .13);
}

.auth-signup-shell .auth-panel {
  padding-top: 34px;
}

.auth-signup-shell .auth-hero {
  height: auto;
  aspect-ratio: 853 / 499;
}

.auth-signup-shell .auth-panel {
  margin-top: clamp(-50px, -5.86vw, -21px);
}

body:has(.auth-login-shell) {
  place-items: start center;
}

.auth-login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.auth-login-shell .auth-panel {
  flex: 1;
  min-height: 0;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

.auth-panel-head,
.auth-form,
.auth-divider,
.auth-social-grid,
.auth-trust-card,
.auth-switch-text,
.auth-footer,
.auth-message {
  width: min(100%, 680px);
  margin-left: auto;
  margin-right: auto;
}

.auth-panel-head {
  margin-bottom: 24px;
}

.auth-signup-shell .auth-panel-head {
  margin-bottom: 18px;
}

.auth-panel-head h1 {
  margin: 0 0 8px;
  color: #071827;
  font-size: 29px;
  line-height: 1.08;
  font-weight: 760;
  letter-spacing: -.45px;
}

.auth-panel-head p {
  margin: 0;
  color: #667085;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-signup-form {
  gap: 10px;
}

.auth-pending-panel {
  display: flex;
  flex-direction: column;
}

.auth-pending-panel .auth-panel-head {
  margin-bottom: 16px;
}

.auth-pending-panel .auth-panel-head h1 {
  margin-bottom: 6px;
  font-size: 26px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -.25px;
}

.auth-pending-panel .auth-panel-head p {
  max-width: 320px;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
}

.auth-pending-card {
  width: min(100%, 680px);
  margin: 0 auto 12px;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 10px;
  padding: 18px 16px;
  text-align: center;
}

.auth-pending-card small {
  margin: 0;
  color: #667085;
}

.auth-pending-details {
  min-width: 0;
  display: grid;
  gap: 7px;
  justify-items: center;
}

.auth-pending-welcome {
  color: #008f78;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 650;
}

.auth-pending-details > strong {
  color: #071827;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 650;
}

.auth-pending-reference {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.auth-pending-reference span {
  color: #667085;
  font-size: 11px;
  line-height: 1.25;
  font-weight: 500;
}

.auth-pending-card b {
  color: #008f78;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: 0;
}

.auth-pending-card small {
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
}

.auth-pending-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #008f78;
  background: #e6f8f3;
  font-size: 20px;
}

.auth-primary-link {
  text-decoration: none;
}

.auth-pending-panel .auth-primary-link {
  width: min(100%, 680px);
  height: 50px;
  margin: 0 auto 14px;
  border-radius: 5px !important;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 143, 115, .16);
}

.auth-pending-panel .auth-primary-link .ti {
  font-size: 20px;
}

.auth-pending-panel .auth-footer {
  margin-top: 0;
}

.auth-signup-shell {
  font-family: Arial, Helvetica, sans-serif;
}

.auth-signup-shell .auth-panel-head h1 {
  font-weight: 700;
  letter-spacing: -.25px;
}

.auth-signup-shell .auth-panel-head p {
  font-weight: 400;
}

.auth-registration-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dce5e9;
  border-radius: 5px;
  background: #fff;
}

.auth-registration-section > strong {
  color: #071827;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 700;
}

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

.auth-form-grid .auth-field {
  width: 100%;
}

.auth-select-field,
.auth-labelled-field {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #344154;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

.auth-select-field b,
.auth-labelled-field b {
  color: #ef3340;
}

.auth-select-field select,
.auth-labelled-field input,
.auth-state-toggle {
  width: 100%;
  min-width: 0;
  height: 46px;
  border: 1px solid #dce5e9;
  border-radius: 5px;
  outline: 0;
  padding: 0 10px;
  background: #fff;
  color: #071827;
  font-size: 13px;
  font-weight: 400;
}

.auth-state-picker {
  position: relative;
}

.auth-state-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}

.auth-state-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-state-toggle .ti {
  flex: 0 0 auto;
  font-size: 15px;
  transition: transform .16s ease;
}

.auth-state-toggle[aria-expanded="true"] .ti {
  transform: rotate(180deg);
}

.auth-state-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 210px;
  overflow-y: auto;
  padding: 3px;
  border: 1px solid #dce5e9;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(7, 24, 39, .12);
}

.auth-state-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 3px;
  padding: 7px 9px;
  background: #fff;
  color: #071827;
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.auth-state-option + .auth-state-option {
  border-top: 1px solid #eef2f4;
}

.auth-state-option:hover,
.auth-state-option:focus,
.auth-state-option.selected {
  outline: 0;
  background: #edf9f5;
  color: #008f73;
}

.auth-select-field select:focus,
.auth-labelled-field input:focus,
.auth-state-toggle:focus {
  border-color: rgba(0, 143, 115, .72);
  box-shadow: 0 0 0 3px rgba(0, 143, 115, .1);
}

.auth-field {
  min-width: 0;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #dce5e9;
  border-radius: 5px;
  background: #ffffff;
  padding: 0 14px;
  color: #667085;
  transition: border-color .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s cubic-bezier(.2, .8, .2, 1), transform .18s cubic-bezier(.2, .8, .2, 1);
}

.auth-signup-form .auth-field {
  height: 54px;
}
.auth-field,
.auth-primary,
.auth-icon-action,
.auth-back-button {
  border-radius: 5px !important;
}

.auth-field:focus-within {
  border-color: rgba(0, 143, 115, .72);
  box-shadow: 0 0 0 4px rgba(0, 143, 115, .1);
  transform: translateY(-1px);
}

.auth-field-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: #008f73;
}

.auth-field-icon .ti {
  font-size: 25px;
  stroke-width: 1.8;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #071827;
  font-size: 15px;
  font-weight: 540;
}

.auth-field input::placeholder {
  color: #7a8494;
  font-weight: 400;
}

.auth-signup-form .auth-field input {
  font-weight: 400;
}

.auth-owner-contact-grid {
  grid-template-columns: minmax(0, 1fr);
}

.auth-required-field .auth-field-icon {
  position: relative;
}

.auth-required-field .auth-field-icon::after {
  content: "*";
  position: absolute;
  top: -3px;
  right: -3px;
  color: #ef3340;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
}

.auth-icon-action {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #6b7687;
  cursor: pointer;
  transition: background-color .18s cubic-bezier(.2, .8, .2, 1), color .18s cubic-bezier(.2, .8, .2, 1), transform .18s cubic-bezier(.2, .8, .2, 1);
}

.auth-icon-action:active {
  transform: scale(.94);
}

.auth-icon-action:hover {
  background: #f1f5f7;
  color: #008f73;
}

.auth-icon-action .ti {
  font-size: 24px;
}

.auth-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 8px;
}

.auth-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #4d596a;
  font-size: 12.5px;
  line-height: 1;
  font-weight: 560;
}

.auth-remember input,
.auth-terms-row input {
  accent-color: #008f73;
}

.auth-form-meta a {
  flex: 0 0 auto;
  color: #008f73;
  font-size: 13px;
  font-weight: 700;
}

.auth-terms-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 2px 4px;
  color: #344154;
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 560;
}

.auth-terms-row input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 1px 0 0;
}

.auth-terms-row a {
  color: #008f73;
  font-weight: 740;
}

.auth-message {
  margin-top: -6px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 640;
}

.auth-error {
  color: #ef4444;
}

.auth-primary,
.auth-secondary {
  position: relative;
  overflow: hidden;
  border: 0;
  cursor: pointer;
  isolation: isolate;
}

.auth-primary {
  height: 56px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 5px;
  background: linear-gradient(135deg, #0cad86, #00745f);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0, 143, 115, .2);
  font-size: 16px;
  line-height: 1;
  font-weight: 740;
  transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s cubic-bezier(.2, .8, .2, 1), opacity .18s cubic-bezier(.2, .8, .2, 1);
}

.auth-primary .ti {
  font-size: 24px;
}

.auth-primary:active {
  transform: scale(.985);
  box-shadow: 0 8px 18px rgba(0, 143, 115, .22);
}

.auth-loader {
  display: none;
}

.auth-ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .36);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  animation: auth-ripple .58s ease-out forwards;
  z-index: -1;
}

.auth-trust-card {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 14px 16px;
  border-radius: 5px;
  background: linear-gradient(135deg, #e9f8f3, #f8fbfa);
  color: #071827;
  box-shadow: inset 0 0 0 1px rgba(0, 143, 115, .08);
}

.auth-trust-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: linear-gradient(145deg, #3bc39d, #00926f);
  color: #fff;
  box-shadow: 0 9px 20px rgba(0, 143, 115, .16);
}

.auth-trust-icon .ti {
  font-size: 30px;
}

.auth-trust-card strong,
.auth-trust-card small {
  display: block;
  min-width: 0;
}

.auth-trust-card strong {
  margin-bottom: 4px;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 760;
}

.auth-trust-card small {
  color: #667085;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
}

.auth-trust-card > .ti {
  color: #5f6b7c;
  font-size: 23px;
}

.auth-switch-text {
  margin: 28px 0 16px;
  color: #667085;
  text-align: center;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
}

.auth-switch-text a {
  color: #008f73;
  font-weight: 760;
}

.auth-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #718096;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.2;
  font-weight: 600;
}

.auth-footer a {
  color: #536175;
  font-size: 10.5px;
  font-weight: 600;
}

.auth-footer strong {
  color: #008f73;
  font-weight: 760;
}

.auth-back-button {
  position: absolute;
  left: 18px;
  top: calc(18px + env(safe-area-inset-top));
  z-index: 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.auth-back-button .ti {
  font-size: 27px;
}

.login-screen,
.login-panel,
.login-logo,
.login-subtitle {
  all: unset;
}

@keyframes auth-ripple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(18);
  }
}

@media (min-width: 431px) {
  body:has(.auth-app-shell) {
    padding: 0;
  }

  .auth-app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
}

.auth-password-help {
  margin: 0 2px 8px;
  color: #6b7687;
  font-size: 12.5px;
  line-height: 1.35;
  font-weight: 560;
}

.auth-signup-form .auth-primary {
  height: 50px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 143, 115, .16);
}

.auth-signup-form .auth-primary .ti {
  font-size: 20px;
}

@media (min-width: 431px) and (max-width: 1024px) {
  .auth-app-shell {
    width: 100vw;
    min-width: 100vw;
    max-width: none;
  }
}

@media (min-width: 600px) {
  .auth-panel {
    margin-top: -24px;
    padding-left: 34px;
    padding-right: 34px;
  }

  .auth-panel-head h1 {
    font-size: 31px;
  }
}

@media (min-width: 720px) {
  .auth-hero {
    height: 360px;
  }

  .auth-panel {
    margin-top: -16px;
    padding-left: 46px;
    padding-right: 46px;
  }
}

@media (max-width: 380px) {
  body:has(.auth-app-shell) {
    display: block;
    background: #ffffff;
  }

  .auth-app-shell {
    width: 100vw;
    min-width: 100vw;
    box-shadow: none;
  }

  .auth-hero {
    height: 268px;
    background-size: 100% auto;
  }

  .auth-panel {
    margin-top: -92px;
    padding-left: 18px;
    padding-right: 18px;
    padding-top: 32px;
  }

  .auth-panel-head h1 {
    font-size: 27px;
  }

  .auth-pending-panel .auth-panel-head h1 {
    font-size: 25px;
  }

  .auth-signup-form .auth-field,
  .auth-field {
    height: 52px;
  }
}

.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; font-weight: 700; }
.brand img { width: 126px; height: auto; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.top-meta form { margin: 0; }
.top-meta button { border: 1px solid var(--line); border-radius: 6px; background: #fff; padding: 8px 10px; cursor: pointer; }

.shell { width: min(1120px, 100%); margin: 0 auto; padding: 18px; }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 18px; }
.summary h1 { margin: 2px 0 0; font-size: 24px; }
.eyebrow { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-card { min-height: 110px; display: grid; align-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; transition: border-color .15s ease, transform .15s ease; }
.module-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.module-card span { font-weight: 700; font-size: 17px; }
.module-card small { color: var(--muted); font-size: 13px; line-height: 1.35; }

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-meta { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .summary { align-items: flex-start; flex-direction: column; }
  .module-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  .brand img { width: 112px; }
}

@media (max-width: 430px) {
  .login-panel { padding: 22px; }
  .module-grid { grid-template-columns: minmax(0, 1fr); }
}
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-title h1 { margin: 2px 0 0; font-size: 26px; }
.back-link { display: inline-block; color: var(--brand); font-size: 13px; margin-bottom: 4px; }
.action { width: auto; min-width: 116px; text-align: center; }
.icon-action { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.icon-action svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.narrow { max-width: 760px; }
.searchbar { display: flex; gap: 10px; margin-bottom: 16px; }
.searchbar input { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.searchbar button, .ghost { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 10px 12px; cursor: pointer; }
.compact-live-search { display: block; margin-bottom: 14px; }
.compact-live-search .opening-item-search { margin: 0; }
.sub-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0 16px; }
.sub-actions .ghost { text-align: center; text-decoration: none; color: var(--text); }
.record-list { display: grid; gap: 12px; }
.record-card { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.record-card > .ghost { text-align: center; text-decoration: none; color: var(--text); white-space: nowrap; }
.compact-record { grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 4px 12px; padding: 12px 14px; min-height: 96px; }
.compact-record > div:first-child { grid-column: 1; grid-row: 1 / span 2; }
.compact-record > .ghost { grid-column: 2; grid-row: 1; padding: 5px 11px; border-radius: 999px; }
.compact-record > .record-meta { grid-column: 2; grid-row: 2; justify-content: flex-end; }
.record-card h2 { margin: 0 0 4px; font-size: 18px; }
.record-card p { margin: 0; color: var(--muted); font-size: 13px; }
.record-meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 12px; }
.record-meta span { border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; background: #f8fafc; }
.empty { background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 20px; color: var(--muted); text-align: center; }
.master-form { display: grid; gap: 14px; }
.master-form section, .master-form details { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.master-form h2 { margin: 0 0 14px; font-size: 17px; }
.master-form select, .master-form textarea, .master-form input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 12px; color: var(--text); background: #fff; }
.master-form input[readonly],
.master-form input:disabled,
.master-form select:disabled,
.master-form textarea:disabled {
  background: #f4fbf8;
  border-color: #d8eee7;
  color: #006955;
  cursor: not-allowed;
  font-weight: 600;
  -webkit-text-fill-color: #006955;
  opacity: 1;
}
.master-form textarea { min-height: 86px; resize: vertical; }
.master-form summary { cursor: pointer; font-weight: 700; }
.master-form details label:first-of-type { margin-top: 14px; }
.field-note { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

@media (max-width: 720px) {
  .page-title { align-items: stretch; flex-direction: column; }
  .action { width: 100%; }
  .searchbar { flex-direction: column; }
  .record-card { grid-template-columns: 1fr auto; align-items: center; }
  .record-card > div:first-child { grid-column: 1 / -1; }
  .record-card > .ghost { padding: 5px 12px; border-radius: 999px; }
  .record-meta { justify-content: flex-start; }
  .compact-record { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .compact-record > div:first-child { grid-column: 1; grid-row: 1 / span 2; }
  .compact-record > .ghost { grid-column: 2; grid-row: 1; }
  .compact-record > .record-meta { grid-column: 2; grid-row: 2; justify-content: flex-end; }
}
.billing-shell { max-width: 1280px; }
.billing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.billing-main { display: grid; gap: 14px; }
.billing-panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.billing-panel h2, .billing-summary h2 { margin: 0 0 14px; font-size: 18px; }
.billing-panel select, .billing-panel input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 12px; color: var(--text); background: #fff; }
.line-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.compact { width: auto; min-width: 150px; }
.draft-list { display: grid; gap: 10px; }
.draft-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.draft-line h3 { margin: 0 0 5px; font-size: 17px; }
.draft-line p { margin: 3px 0; color: var(--muted); font-size: 13px; }
.draft-amount { display: grid; justify-items: end; gap: 3px; min-width: 120px; }
.draft-amount strong { font-size: 19px; }
.draft-amount small { color: var(--muted); font-size: 12px; }
.billing-summary { position: sticky; top: 82px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.billing-summary dl { margin: 0; display: grid; gap: 8px; }
.billing-summary dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #eef2f6; padding-bottom: 7px; }
.billing-summary dt { color: var(--muted); }
.billing-summary dd { margin: 0; font-weight: 700; text-align: right; }
.billing-summary .net { font-size: 18px; color: var(--brand); }
.full { width: 100%; margin-top: 14px; }
.danger { color: var(--danger-text); border-color: #ffd0d0; background: #fffafa; }
.draft-note { color: var(--muted); font-size: 12px; line-height: 1.4; margin: 12px 0 0; }

@media (max-width: 900px) {
  .billing-layout { grid-template-columns: 1fr; }
  .billing-summary { position: static; }
}

@media (max-width: 640px) {
  .line-inputs { grid-template-columns: 1fr; }
  .draft-line { grid-template-columns: 1fr; align-items: stretch; }
  .draft-amount { justify-items: start; }
  .compact { width: 100%; }
}
.bill-view { display: grid; gap: 14px; }
.bill-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
.bill-head h2 { margin: 2px 0 4px; font-size: 22px; }
.bill-head p { margin: 0; color: var(--muted); }
.status-pill { display: inline-block; margin-top: 8px; border: 1px solid #bbf0dd; color: #087453; background: #effdf7; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; }
.bill-total { position: static; }

@media (max-width: 640px) {
  .bill-head { flex-direction: column; }
}
.report-list { gap: 10px; }
.stock-title { margin-bottom: 10px; }
.stock-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
.stock-tabs a { display: grid; place-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font-weight: 700; }
.stock-tabs a.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.opening-document-grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 10px; }
.opening-document-card label { margin-bottom: 0; }
.opening-document-card details { margin-top: 10px; padding: 0; border: 0; background: transparent; }
.opening-document-card details label:first-of-type { margin-top: 10px; }
.opening-item-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  width: 100%;
  margin-bottom: 10px;
}
.opening-item-search input {
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 6px 0 0 6px;
  padding: 10px 11px;
  min-height: 40px;
}
.opening-item-search button {
  border: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  background: #edf2f7;
  color: #0b71df;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.opening-item-search input:focus {
  outline: 0;
  border-color: #b8c7d9;
}
.opening-item-search:focus-within button {
  border-color: #b8c7d9;
}
.opening-item-list { display: grid; gap: 10px; margin-top: 12px; }
.opening-item-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 120px; align-items: end; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; padding: 12px; }
.opening-item-row label { margin: 0; }
.opening-item-info { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; grid-column: 1 / -1; }
.opening-item-info h3 { margin: 0 0 4px; font-size: 16px; }
.opening-item-info p { margin: 0; color: var(--muted); font-size: 12px; }
.opening-item-info small { display: block; margin-top: 5px; color: #42526b; font-size: 12px; }
.stock-badge {
  color: #07579a;
  background: #eaf4ff;
  border: 1px solid #c9e2fb;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 14px;
  white-space: nowrap;
  line-height: 1.15;
}
.opening-view-title {
  align-items: center;
}
.opening-view-title .status-pill {
  margin-top: 0;
}
.opening-view-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.opening-view-summary > div {
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}
.opening-view-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}
.opening-view-list {
  gap: 10px;
}
.opening-view-item {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.opening-view-item h3 {
  margin: 0 0 4px;
  font-size: 17px;
}
.opening-view-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.opening-view-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.opening-view-values span {
  display: grid;
  gap: 3px;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}
.opening-view-values strong {
  color: var(--text);
  font-size: 15px;
}
.stock-adjust-results { margin-top: 10px; }
.stock-adjust-selected { margin-top: 10px; }
.adjust-type-grid,
.adjust-input-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.adjust-choice {
  margin: 0;
}
.adjust-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.adjust-choice span {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}
.adjust-choice input:checked + span {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}
.adjust-input-grid {
  margin-top: 12px;
}
.adjust-input-grid label {
  margin: 0;
}
.report-card { grid-template-columns: minmax(0, 1fr) auto auto; }
.report-value { display: grid; justify-items: end; gap: 3px; min-width: 110px; }
.report-value strong { font-size: 22px; }
.report-value small { color: var(--muted); font-size: 12px; }
.stock-negative strong { color: #b42318; }
.stock-positive strong { color: #087453; }

@media (max-width: 720px) {
  .opening-document-grid { grid-template-columns: 1fr; }
  .opening-item-row { grid-template-columns: 1fr 1fr; }
  .report-card { grid-template-columns: 1fr; }
  .report-value { justify-items: start; }
}

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions .ghost { min-height: 38px; padding: 8px 10px; }
.print-shell { min-height: 100vh; background: #e9eef5; padding: 18px; }
.print-actions { width: min(860px, 100%); margin: 0 auto 12px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.print-actions .back-link { margin-right: auto; }
.bill-print-card { width: min(860px, 100%); margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 26px; color: #111827; box-shadow: 0 10px 30px rgba(15, 31, 52, 0.12); }
.print-header { display: flex; justify-content: space-between; gap: 18px; border-bottom: 2px solid #172033; padding-bottom: 14px; }
.print-header img { max-width: 160px; height: auto; margin-bottom: 8px; }
.print-header h1 { margin: 0; font-size: 24px; }
.print-header p, .print-bill-no small, .print-party p { margin: 4px 0 0; color: var(--muted); }
.print-bill-no { text-align: right; }
.print-bill-no span, .print-party span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.print-bill-no strong { display: block; font-size: 28px; margin: 4px 0; }
.print-party { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.print-party strong { display: block; margin-top: 4px; font-size: 18px; }
.print-items { width: 100%; border-collapse: collapse; margin-top: 16px; }
.print-items th, .print-items td { border-bottom: 1px solid #e5e7eb; padding: 10px 8px; text-align: left; vertical-align: top; }
.print-items th { background: #f8fafc; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.print-items small { display: block; color: var(--muted); margin-top: 3px; }
.print-items .right { text-align: right; }
.print-summary { display: flex; justify-content: flex-end; margin-top: 18px; }
.print-summary dl { width: min(320px, 100%); margin: 0; }
.print-summary dl div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; }
.print-summary dd { margin: 0; font-weight: 700; }
.print-summary .net { color: var(--brand); font-size: 20px; }
.print-footer { margin-top: 24px; text-align: center; color: var(--muted); font-size: 13px; }

@media print {
  body { background: #fff; }
  .topbar, .print-actions { display: none !important; }
  .print-shell { padding: 0; background: #fff; }
  .bill-print-card { width: 100%; border: 0; box-shadow: none; border-radius: 0; }
}

@media (max-width: 640px) {
  .print-shell { padding: 10px; }
  .bill-print-card { padding: 16px; }
  .print-header, .print-party { grid-template-columns: 1fr; flex-direction: column; }
  .print-bill-no { text-align: left; }
  .print-items { font-size: 13px; }
  .print-items th, .print-items td { padding: 8px 5px; }
}
.ajax-search-form { display: grid; gap: 10px; }
.ajax-card label, .item-entry-panel label { margin-bottom: 0; }
.ajax-results { display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.ajax-result { width: 100%; display: grid; gap: 4px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 11px 12px; color: var(--text); cursor: pointer; }
.ajax-result:hover, .ajax-result:focus { border-color: var(--brand); outline: 2px solid rgba(7, 87, 154, 0.12); }
.ajax-result strong { font-size: 15px; }
.ajax-result small, .ajax-empty { color: var(--muted); font-size: 12px; }
.ajax-empty { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.selected-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #cae7e0; border-radius: 8px; background: #f1fbf8; padding: 12px; }
.selected-card strong { display: block; margin-top: 3px; font-size: 16px; }
.selected-card small { display: block; margin-top: 4px; color: var(--muted); }
.muted-card { color: var(--muted); border-color: var(--line); background: #f8fafc; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.bill-meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bill-meta-grid > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.bill-meta-grid strong { display: block; margin-top: 4px; }
.item-entry-panel { display: grid; gap: 12px; }
.gst-chip-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.gst-chip-row button { border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); padding: 10px 8px; cursor: pointer; }
.gst-chip-row button.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.line-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border: 1px solid #cae7e0; border-radius: 8px; background: #f1fbf8; padding: 12px; }
.line-preview span { display: block; color: var(--muted); font-size: 12px; }
.line-preview strong { display: block; margin-top: 4px; color: var(--brand); font-size: 18px; }

@media (max-width: 640px) {
  .billing-shell { padding: 10px; }
  .billing-panel, .billing-summary { border-radius: 8px; padding: 14px; }
  .bill-meta-grid { grid-template-columns: 1fr; }
  .selected-card { align-items: stretch; flex-direction: column; }
  .quick-actions .ghost { text-align: center; flex: 1; }
  .gst-chip-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .line-preview { grid-template-columns: 1fr 1fr; }
}
.mobile-bill-shell { max-width: 1180px; }
.bill-mobile-title { align-items: center; }
.bill-title-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.party-panel { display: grid; gap: 12px; }
.bill-control-strip { padding: 12px; }
.bottom-sheet-panel { position: relative; overflow: visible; }
.bottom-sheet-panel::before { content: ''; display: block; width: 70px; height: 6px; border-radius: 999px; background: #cfd6e2; margin: -4px auto 10px; }
.item-search-box input { min-height: 48px; font-size: 15px; }
.bill-item-list .draft-line { border-color: #dfe7f1; box-shadow: 0 8px 22px rgba(15, 31, 52, 0.06); }
.bill-item-list .draft-line h3 { font-size: 18px; }
.mobile-sticky-summary .primary.full { font-weight: 700; }
.mobile-sticky-summary .danger.full { margin-top: 10px; }

@media (max-width: 640px) {
  body { background: #f7f9fc; }
  .mobile-bill-shell { padding: 8px 10px 18px; }
  .bill-mobile-title { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
  .bill-mobile-title h1 { font-size: 24px; }
  .bill-title-actions { justify-content: stretch; }
  .bill-title-actions .ghost { flex: 1; text-align: center; }
  .bill-title-actions .status-pill { display: grid; place-items: center; min-width: 92px; margin: 0; }
  .billing-layout { gap: 12px; }
  .billing-main { gap: 12px; }
  .billing-panel { border-color: #e3e9f2; box-shadow: 0 8px 24px rgba(15, 31, 52, 0.05); }
  .party-panel h2, .item-entry-panel h2 { font-size: 20px; }
  .bill-control-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .bill-control-strip > div { min-height: 64px; padding: 10px; }
  .bill-control-strip strong { font-size: 14px; word-break: break-word; }
  .bottom-sheet-panel { border-radius: 22px 22px 8px 8px; padding-top: 16px; box-shadow: 0 -6px 32px rgba(15, 31, 52, 0.10); }
  .line-inputs { grid-template-columns: 1fr 1fr; gap: 8px; }
  .line-inputs label:last-child { grid-column: 1 / -1; }
  .line-inputs input { min-height: 48px; text-align: center; font-size: 17px; }
  .gst-chip-row button { min-height: 44px; font-size: 15px; }
  .line-preview { padding: 14px; }
  .line-preview strong { font-size: 20px; }
  .bill-item-list { gap: 12px; }
  .bill-item-list .draft-line { grid-template-columns: 1fr auto; align-items: start; padding: 14px; }
  .bill-item-list .draft-line form { grid-column: 1 / -1; }
  .bill-item-list .draft-line .danger { width: 100%; }
  .draft-amount { justify-items: end; min-width: 96px; }
  .draft-amount strong { color: var(--brand); font-size: 20px; }
  .mobile-sticky-summary { position: sticky; bottom: 0; z-index: 4; border-radius: 18px 18px 0 0; margin: 4px -10px -18px; padding: 14px 14px 18px; box-shadow: 0 -10px 30px rgba(15, 31, 52, 0.14); }
  .mobile-sticky-summary h2 { display: none; }
  .mobile-sticky-summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px; }
  .mobile-sticky-summary dl div { display: grid; gap: 2px; border-bottom: 0; padding: 0; }
  .mobile-sticky-summary dt { font-size: 12px; }
  .mobile-sticky-summary dd { text-align: left; font-size: 16px; }
  .mobile-sticky-summary .net { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #e5eef5; padding-top: 10px; margin-top: 2px; }
  .mobile-sticky-summary .net dd { font-size: 24px; }
  .mobile-sticky-summary .draft-note { display: none; }
}

@media (max-width: 390px) {
  .bill-control-strip { grid-template-columns: 1fr; }
  .gst-chip-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Home mobile structure refinement: keep app navigation compact on small WebView/devices. */
@media (max-width: 430px) {
  .topbar {
    min-height: 56px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
    padding: 8px 10px;
  }
  .brand {
    gap: 8px;
    min-width: 0;
  }
  .brand img {
    width: 104px;
    flex: 0 0 auto;
  }
  .brand span {
    font-size: 14px;
    line-height: 1.15;
  }
  .top-meta {
    width: auto;
    display: contents;
    font-size: 12px;
  }
  .top-meta > span {
    grid-column: 1;
    color: var(--muted);
  }
  .top-meta form {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .top-meta button {
    padding: 8px 9px;
    min-height: 36px;
  }
  .shell {
    padding: 10px;
  }
  .summary {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr);
    align-items: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
  }
  .summary h1 {
    font-size: 19px;
    line-height: 1.15;
  }
  .summary strong {
    display: block;
    margin-top: 2px;
    font-size: 14px;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .module-card {
    min-height: 88px;
    padding: 12px;
    align-content: space-between;
  }
  .module-card span {
    font-size: 16px;
    line-height: 1.15;
  }
  .module-card small {
    font-size: 12px;
    line-height: 1.25;
  }
}

@media (max-width: 340px) {
  .module-grid {
    grid-template-columns: 1fr;
  }
}
/* Sales mobile usability refinement: keep the billing flow readable before sticky perfection. */
@media (max-width: 640px) {
  .mobile-bill-shell {
    padding: 8px 10px 16px;
  }
  .bill-mobile-title {
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .bill-mobile-title > div:first-child {
    min-width: 0;
  }
  .bill-title-actions {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 10px;
  }
  .bill-title-actions .status-pill,
  .bill-title-actions .ghost {
    min-height: 36px;
  }
  .party-panel h2,
  .bottom-sheet-panel h2 {
    font-size: 20px;
    margin-bottom: 10px;
  }
  .party-panel .primary.compact,
  .bottom-sheet-panel .primary.compact {
    min-height: 44px;
  }
  .bottom-sheet-panel {
    border-radius: 14px;
  }
  .bottom-sheet-panel::before {
    display: none;
  }
  .mobile-sticky-summary {
    position: static;
    bottom: auto;
    z-index: auto;
    margin: 0;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 8px 24px rgba(15, 31, 52, 0.08);
  }
  .mobile-sticky-summary h2 {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
  }
  .mobile-sticky-summary dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
  }
  .mobile-sticky-summary dl div {
    display: grid;
    gap: 2px;
    border-bottom: 0;
    padding: 0;
  }
  .mobile-sticky-summary .net {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #e5eef5;
    padding-top: 10px;
    margin-top: 2px;
  }
  .mobile-sticky-summary .net dd {
    font-size: 26px;
  }
  .mobile-sticky-summary .draft-note {
    display: block;
  }
  .mobile-sticky-summary .primary.full,
  .mobile-sticky-summary .danger.full {
    min-height: 44px;
  }
}
/* Sales mobile compact pass: make the active billing workflow visible sooner. */
@media (max-width: 640px) {
  .party-panel,
  .bottom-sheet-panel {
    gap: 10px;
  }
  .party-panel h2,
  .bottom-sheet-panel h2 {
    margin-bottom: 4px;
  }
  .party-panel label,
  .bottom-sheet-panel label {
    gap: 5px;
    font-size: 12px;
  }
  .party-panel input,
  .bottom-sheet-panel input {
    min-height: 42px;
    padding: 10px 11px;
  }
  .party-panel .primary.compact,
  .bottom-sheet-panel .primary.compact {
    min-height: 42px;
    padding: 11px 14px;
  }
  .bill-control-strip,
  .bill-meta-grid.bill-control-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .bill-control-strip > div {
    min-width: 0;
  }
  .bill-control-strip strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }
  .line-inputs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .line-inputs label {
    min-width: 0;
  }
  .gst-chip-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .gst-chip-row button {
    min-height: 36px;
    padding: 8px 4px;
    font-size: 13px;
  }
  .selected-card {
    padding: 10px;
  }
  .line-preview {
    padding: 10px;
  }
}

@media (max-width: 340px) {
  .line-inputs,
  .bill-control-strip,
  .bill-meta-grid.bill-control-strip {
    grid-template-columns: 1fr;
  }
  .gst-chip-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* Sales page heart-flow cleanup: party click selects directly, GST is config-driven. */
.compact-party-panel { gap: 10px; }
.party-auto-form { gap: 8px; }
.selected-party-compact {
  padding: 10px 12px;
  background: #eefaf6;
}
.selected-party-compact strong {
  font-size: 16px;
}
.selected-party-compact small:empty {
  display: none;
}
.bill-control-strip-simple {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 640px) {
  .compact-party-panel {
    padding: 12px 14px;
  }
  .compact-party-panel h2 {
    margin-bottom: 2px;
  }
  .compact-party-panel .selected-card {
    flex-direction: row;
  }
  .bill-control-strip-simple,
  .bill-meta-grid.bill-control-strip-simple {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bill-control-strip-simple > div {
    min-height: 58px;
  }
  .bottom-sheet-panel {
    margin-top: 0;
  }
}

@media (max-width: 340px) {
  .bill-control-strip-simple,
  .bill-meta-grid.bill-control-strip-simple {
    grid-template-columns: 1fr;
  }
}

/* Purchase bill entry: keep primary item entry fields compact and blank-first. */
.purchase-meta-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.supplier-mobile-line {
  display: grid;
  gap: 6px;
}
.supplier-mobile-line input {
  background: #f7fbff;
  color: var(--text);
  font-weight: 800;
  text-align: left;
}
.purchase-line-inputs {
  grid-template-columns: minmax(0, 1fr) minmax(70px, 0.66fr) minmax(78px, 0.72fr) minmax(0, 1fr);
  align-items: end;
}
.purchase-line-inputs label:last-child {
  grid-column: auto;
}
.purchase-line-inputs label {
  font-weight: 700;
}
.purchase-summary dl > div:nth-child(even) {
  justify-self: end;
  min-width: 74px;
  text-align: left;
}
.purchase-summary dl > div:nth-child(even) dd {
  text-align: left;
}
.purchase-summary dl {
  grid-template-columns: minmax(0, 1fr) max-content;
  column-gap: 12px;
  row-gap: 10px;
}
.purchase-summary dl > div:not(.net) {
  display: grid;
  gap: 2px;
  padding-bottom: 0;
  border-bottom: 0;
}
.purchase-summary dl > div:nth-child(odd):not(.net) {
  min-width: 0;
}
.purchase-summary dl > div:nth-child(odd):not(.net) dd {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.purchase-summary dl > div:nth-child(even):not(.net) {
  min-width: 76px;
}
.purchase-summary dl > div:nth-child(even):not(.net) dt,
.purchase-summary dl > div:nth-child(even):not(.net) dd {
  text-align: left;
}
.purchase-summary .net {
  border-top: 1px solid #e5eef5;
}
.purchase-list {
  display: grid;
  gap: 10px;
}
.purchase-list-search {
  margin: 0 0 12px;
}
.purchase-list-search .opening-item-search {
  margin: 0;
}
.purchase-clear-search {
  display: grid;
  place-items: center;
  margin-top: 8px;
  min-height: 38px;
  text-align: center;
}
.purchase-list-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--text);
}
.purchase-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.purchase-list-head h2 {
  margin: 0 0 3px;
  font-size: 17px;
  line-height: 1.2;
}
.purchase-list-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.purchase-list-head strong {
  color: #075a9b;
  font-size: 20px;
  white-space: nowrap;
  line-height: 1.2;
}
.purchase-list-meta,
.purchase-list-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.purchase-list-meta span,
.purchase-list-metrics span {
  border: 1px solid #d7e3ee;
  border-radius: 999px;
  background: #f8fbff;
  padding: 4px 8px;
}
.purchase-list-metrics strong {
  color: var(--text);
}
.purchase-draft-line {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
}
.bill-item-list .purchase-draft-line {
  grid-template-columns: 1fr;
  align-items: stretch;
}
.purchase-line-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}
.purchase-line-head h3 {
  margin: 0 0 3px;
  font-size: 17px;
}
.purchase-line-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.purchase-line-amount {
  color: #075a9b;
  font-size: 18px;
  text-align: right;
  white-space: nowrap;
}
.purchase-line-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.purchase-line-metrics > div {
  border: 1px solid #d7e3ee;
  border-radius: 8px;
  background: #f8fbff;
  padding: 7px 8px;
  min-width: 0;
}
.purchase-line-metrics span,
.purchase-tax-row {
  color: var(--muted);
  font-size: 12px;
}
.purchase-line-metrics strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.purchase-tax-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #edf3f8;
  padding-top: 8px;
}
.purchase-line-remove {
  display: flex;
  justify-content: flex-end;
}
.purchase-line-remove .ghost {
  min-height: 34px;
  padding: 6px 14px;
  width: auto;
}
.bill-item-list .purchase-draft-line .purchase-line-remove .ghost {
  width: auto;
}
@media (max-width: 340px) {
  .purchase-meta-form,
  .bill-meta-grid.purchase-meta-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .purchase-line-inputs {
    grid-template-columns: minmax(0, 1fr) minmax(62px, 0.66fr) minmax(68px, 0.72fr) minmax(0, 1fr);
  }
  .purchase-line-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Settings page baseline: global business controls that drive billing behavior. */
.settings-shell {
  display: grid;
  gap: 14px;
}
.settings-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.settings-status > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 4px;
}
.settings-status strong {
  font-size: 17px;
}
.settings-status small {
  color: var(--muted);
}
.settings-form section {
  gap: 12px;
}
.settings-form textarea {
  min-height: 82px;
  resize: vertical;
}
.field-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}
.state-picker-list {
  display: none;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 6px;
  padding: 4px;
}
.state-picker-list.open {
  display: grid;
  gap: 2px;
}
.state-option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  font: inherit;
  cursor: pointer;
}
.state-option:hover,
.state-option.active {
  background: #eaf4ff;
  color: var(--primary);
}
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}
.checkbox-line input {
  width: 18px;
  height: 18px;
}
.notice {
  border: 1px solid #b8ead7;
  background: #ecfbf5;
  color: #075f46;
  border-radius: 8px;
  padding: 10px 12px;
}
@media (max-width: 640px) {
  .settings-status {
    grid-template-columns: 1fr;
  }
  .settings-status > div {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .settings-status small {
    grid-column: 1 / -1;
  }
}

/* Global field/control radius lock: fields, search, controls and action buttons stay 5px. Bottom sheets and circular icons are excluded. */
:where(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .primary,
  .ghost,
  .back-sale,
  .draft-chip,
  .meta-tile,
  .sales-search,
  .sort-button,
  .locked-list-search,
  .search-box,
  .opening-item-search,
  .calendar-button,
  .customer-search-box,
  .customer-option,
  .add-customer-action,
  .item-search-box,
  .item-search-result,
  .selected-product,
  .sheet-input,
  .sheet-select,
  .sheet-stepper,
  .sheet-actions button,
  .sale-actions button,
  .sale-actions a,
  .tabs button,
  .tabs a,
  .gst-options button,
  .status-options button,
  .payment-option,
  .date-month-row button,
  .date-actions button,
  .discount-field > div,
  .discount-actions button,
  .group-search,
  .group-filter,
  .group-field input,
  .group-field select,
  .group-field textarea,
  .bank-form-panel input,
  .bank-form-panel select,
  .cheque-form-panel input,
  .cheque-form-panel select,
  .cash-payment-card input,
  .state-option,
  .purchase-line-remove button
) {
  border-radius: 5px !important;
}

/* Global radius hard lock v2: no field/control/list row uses more than 5px radius. Sheet shells and circular icon buttons stay excluded. */
:where(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  button:not(.icon-button):not(.plain-icon):not(.sheet-close):not(.group-sheet-close):not(.menu-close):not(.utility-close),
  a.primary,
  a.ghost,
  a.back-sale,
  a.add-customer-action,
  .primary,
  .ghost,
  .back-sale,
  .new-sale,
  .draft-chip,
  .meta-tile,
  .stat-card,
  .mini-stat,
  .invoice-row,
  .record-row,
  .list-row,
  .customer-option,
  .item-search-result,
  .selected-product,
  .selected-item-card,
  .purchase-line,
  .purchase-line-card,
  .purchase-edit-line,
  .purchase-line-remove,
  .purchase-line-remove button,
  .sales-search,
  .search-box,
  .locked-sheet-search,
  .locked-list-search,
  .item-search-box,
  .purchase-item-search-box,
  .group-search,
  .group-filter,
  .tabs,
  .tabs button,
  .filter-pill,
  .status-pill:not(.rounded-pill),
  .sheet-input,
  .sheet-select,
  .sheet-stepper,
  .sheet-actions button,
  .sale-actions button,
  .sale-actions a,
  .gst-options button,
  .status-options button,
  .payment-option,
  .date-month-row button,
  .date-actions button,
  .discount-field > div,
  .discount-actions button,
  .bank-form-panel input,
  .bank-form-panel select,
  .cheque-form-panel input,
  .cheque-form-panel select,
  .cash-payment-card input,
  .state-option
) {
  border-radius: 5px !important;
}
