:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #16211c;
  --muted: #637069;
  --line: #dce3dc;
  --green: #1f7a4d;
  --green-dark: #125b38;
  --blue: #2366b3;
  --red: #b33636;
  --gold: #a87012;
  --shadow: 0 18px 55px rgba(33, 48, 39, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body.customer-app {
  background: #eef3ef;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.customer-shell {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.customer-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  border-radius: 8px;
  background: #102018;
  color: #f9fff9;
  padding: 20px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 22px;
  background: #102018;
  color: #f9fff9;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #37a06b;
  font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel h4,
.panel p {
  margin: 0;
}

.brand h1 {
  font-size: 1.35rem;
}

.brand p {
  color: #b9c9bf;
  font-size: 0.9rem;
}

.customer-app .login-panel {
  max-width: 430px;
  margin: 0 auto;
}

.customer-app .customer-panel {
  box-shadow: var(--shadow);
}

.launcher-panel {
  max-width: 560px;
  margin: 0 auto;
}

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

.launcher-link {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--ink);
  font-weight: 850;
}

.launcher-link:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #e6f2eb;
  text-align: left;
  padding: 0 14px;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.1);
}

.quick-stats {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.quick-stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.quick-stats span {
  color: #b9c9bf;
  font-size: 0.85rem;
}

.quick-stats strong {
  font-size: 1.25rem;
}

main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.eyebrow {
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-grid,
.checkout-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(300px, 1fr);
  gap: 18px;
}

.manager-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(260px, 0.8fr) minmax(340px, 1.2fr);
}

.portal-layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(320px, 1fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.compact-panel {
  align-self: start;
  justify-self: start;
  width: min(100%, 420px);
}

.credit-bills-panel {
  grid-column: 3;
  grid-row: 2;
}

.wide {
  grid-column: span 2;
}

.manager-accounts-panel {
  grid-column: 1 / span 2;
  grid-row: 2;
}

.panel-heading,
.customer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel h3 {
  margin-top: 4px;
  font-size: 1.25rem;
}

.panel h4 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.form-stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #3c4841;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 43px;
  border: 1px solid #cdd7cf;
  border-radius: 7px;
  background: #fbfdfb;
  color: var(--ink);
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(31, 122, 77, 0.14);
}

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

.primary-button,
.ghost-button,
.pay-button,
.danger-button,
.small-button {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button,
.pay-button {
  background: var(--green);
  color: #fff;
}

.primary-button:hover,
.pay-button:hover {
  background: var(--green-dark);
}

.ghost-button,
.small-button {
  border-color: #cbd7cf;
  background: #fff;
  color: var(--ink);
}

.danger-button {
  border-color: rgba(179, 54, 54, 0.22);
  background: #fff5f5;
  color: var(--red);
}

.pay-button {
  width: 100%;
  min-height: 54px;
  font-size: 1.08rem;
}

.record-list,
.cart-list,
.purchase-list,
.card-grid {
  display: grid;
  gap: 12px;
}

.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 14px;
}

.record-top,
.record-actions,
.money-row,
.cart-row,
.purchase-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.record-title {
  font-weight: 850;
}

.record-meta,
.helper-text,
.mini,
.purchase-items {
  color: var(--muted);
  font-size: 0.88rem;
}

.record-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 12px;
}

.order-actions,
.account-heading-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.card-note-readout {
  margin-top: 8px;
  border-left: 3px solid #cbd7cf;
  color: var(--muted);
  font-size: 0.88rem;
  padding-left: 10px;
}

.inline-money-control {
  grid-template-columns: auto 120px;
  align-items: center;
  min-height: 40px;
}

.inline-money-control input {
  min-height: 40px;
}

.cards-inside {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.card-history {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.bank-card {
  display: grid;
  gap: 10px;
  min-height: 148px;
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, #203229, #246947);
  color: white;
}

.bank-card.credit {
  background: linear-gradient(135deg, #1e3152, #2366b3);
}

.card-number {
  font-size: 1.1rem;
  font-weight: 850;
  word-spacing: 5px;
}

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-note-control {
  color: rgba(255, 255, 255, 0.86);
}

.card-note-control textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 10px;
}

.card-note-control textarea::placeholder {
  color: rgba(255, 255, 255, 0.62);
}

.card-note-control textarea:focus {
  border-color: rgba(255, 255, 255, 0.7);
  outline: 3px solid rgba(255, 255, 255, 0.14);
}

.card-note-button {
  justify-self: start;
}

.balance-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.balance-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf7;
  padding: 14px;
}

.balance-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.balance-tile strong {
  font-size: 1.25rem;
}

.panel-subsection {
  margin-top: 20px;
}

.item-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 130px 90px 82px;
  gap: 10px;
}

.subscription-form {
  grid-template-columns: minmax(160px, 1fr) 130px minmax(220px, 1fr) 82px;
  margin-bottom: 14px;
}

.bankmo-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 140px 92px;
  gap: 10px;
}

.cart-list {
  margin-top: 18px;
}

.cart-row {
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.cart-main {
  min-width: 140px;
}

.line-discount-control {
  grid-template-columns: auto 96px;
  align-items: center;
  margin-left: auto;
}

.line-discount-control input {
  min-height: 38px;
}

.unit-discount-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 8px;
  flex: 1 1 100%;
}

.unit-discount-grid label {
  gap: 5px;
  font-size: 0.78rem;
}

.unit-discount-grid input {
  min-height: 36px;
  padding: 0 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #edd2d2;
  border-radius: 7px;
  background: #fff5f5;
  color: var(--red);
  font-weight: 900;
}

.total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf8;
  padding: 18px;
  margin-bottom: 16px;
}

.total-box span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.total-box strong {
  font-size: 2rem;
}

.total-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.order-discount-control {
  grid-template-columns: 1fr 120px;
  align-items: center;
  margin-bottom: 16px;
}

.method-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}

.method-tabs legend {
  grid-column: 1 / -1;
  margin-bottom: 7px;
  color: #3c4841;
  font-size: 0.88rem;
  font-weight: 800;
}

.method-tabs label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid #cdd7cf;
  border-radius: 7px;
  background: #fff;
}

.method-tabs input {
  width: auto;
  min-height: auto;
}

.split-heading,
.split-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.split-heading {
  margin-bottom: 10px;
  color: #3c4841;
  font-size: 0.88rem;
  font-weight: 800;
}

.split-card-list {
  display: grid;
  gap: 12px;
}

.split-card-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 12px;
}

.split-card-title strong {
  font-size: 0.92rem;
}

.status-message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-weight: 750;
}

.status-message.success {
  color: var(--green);
}

.status-message.error {
  color: var(--red);
}

.purchase {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #e8f3ed;
  color: var(--green-dark);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.badge.credit {
  background: #e8f0fb;
  color: #1e5796;
}

.badge.cash {
  background: #fff4dc;
  color: var(--gold);
}

.hidden {
  display: none !important;
}

.empty {
  border: 1px dashed #c7d3cb;
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

@media (max-width: 1120px) {
  .app-shell,
  .manager-grid,
  .portal-layout,
  .checkout-layout,
  .screen-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .wide {
    grid-column: auto;
  }

  .credit-bills-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .manager-accounts-panel {
    grid-column: auto;
    grid-row: auto;
  }

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

  .nav-button {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 700px) {
  main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .customer-header,
  .record-top,
  .purchase-top,
  .history-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav,
  .two-col,
  .balance-strip,
  .item-form,
  .bankmo-form,
  .subscription-form,
  .launcher-grid {
    grid-template-columns: 1fr;
  }

  .card-foot,
  .money-row,
  .cart-row,
  .inline-money-control,
  .line-discount-control,
  .account-heading-actions,
  .order-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-money-control,
  .line-discount-control,
  .order-discount-control {
    grid-template-columns: 1fr;
    width: 100%;
  }
}
