:root {
  --ink: #17221d;
  --muted: #52605a;
  --line: #dfe7e2;
  --surface: #ffffff;
  --surface-soft: #f3f7f4;
  --canvas: #eaf0ec;
  --green: #0c6848;
  --green-dark: #084b36;
  --green-soft: #dff2e9;
  --lime: #bce47d;
  --amber: #7a4e00;
  --amber-soft: #fff0c7;
  --red: #a63131;
  --red-soft: #fde5e5;
  --blue: #315ea8;
  --blue-soft: #e7efff;
  --shadow: 0 18px 44px rgb(24 52 39 / 10%);
  --radius: 18px;
  font-family:
    Inter, "Segoe UI", "Noto Sans Arabic", "Noto Nastaliq Urdu", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 4%, rgb(188 228 125 / 24%), transparent 24rem),
    var(--canvas);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
label.file-button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(12 104 72 / 24%);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
dl,
dd,
figure {
  margin: 0;
}

h1,
h2,
h3,
strong {
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.brand-lockup > span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-lockup strong {
  font-size: 18px;
}

.brand-lockup small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--green), var(--green-dark));
  box-shadow: 0 8px 24px rgb(8 75 54 / 24%);
  color: white;
  font-size: 21px;
  font-weight: 900;
}

.brand-lockup--light strong,
.brand-lockup--light small {
  color: white;
}

.brand-lockup--light .brand-mark {
  background: var(--lime);
  box-shadow: none;
  color: var(--green-dark);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
}

.auth-story {
  display: flex;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgb(8 75 54 / 96%), rgb(4 49 36 / 98%)),
    var(--green-dark);
  color: white;
  position: relative;
}

.auth-story::after {
  position: absolute;
  right: -110px;
  bottom: 10%;
  width: 340px;
  height: 340px;
  border: 74px solid rgb(188 228 125 / 10%);
  border-radius: 50%;
  content: "";
}

.auth-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.auth-copy .eyebrow {
  color: var(--lime);
}

.auth-copy h1 {
  max-width: 720px;
  margin-bottom: 22px;
  font-size: clamp(42px, 5vw, 74px);
  line-height: 0.99;
}

.auth-copy p {
  max-width: 570px;
  color: rgb(255 255 255 / 72%);
  font-size: 18px;
  line-height: 1.7;
}

.auth-contact {
  display: flex;
  position: relative;
  z-index: 1;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  color: rgb(255 255 255 / 72%);
}

.auth-contact strong {
  color: white;
}

.auth-panel {
  display: grid;
  min-height: 100vh;
  padding: 40px;
  place-items: center;
  background:
    linear-gradient(rgb(255 255 255 / 70%), rgb(255 255 255 / 70%)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 14px,
      rgb(12 104 72 / 3%) 14px,
      rgb(12 104 72 / 3%) 15px
    );
}

.auth-card {
  display: flex;
  width: min(520px, 100%);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 26px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow);
  flex-direction: column;
  gap: 18px;
}

.auth-card h2 {
  margin-top: 8px;
  font-size: 34px;
}

.status-pill {
  align-self: flex-start;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.role-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-subtle);
  margin-top: 4px;
}

.role-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 150ms ease;
}

.role-tab:hover {
  color: var(--ink);
}

.role-tab.is-active {
  border-color: var(--line);
  background: white;
  color: var(--green-dark);
  box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-badge--admin {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.role-badge--manager {
  background: #cce5ff;
  color: #004085;
  border: 1px solid #b8daff;
}

.operator-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--surface-subtle);
  color: var(--muted);
  border: 1px solid var(--line);
  margin-left: 6px;
}

.account-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.account-type-badge--pos {
  background: #eff8ff;
  color: #175cd3;
  border: 1px solid #b2ddff;
}

.account-type-badge--card {
  background: #fdf2fa;
  color: #c11574;
  border: 1px solid #fcceee;
}

.account-type-badge--account {
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid #a6f4c5;
}

.sensitive-masked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #6b7280;
  font-family: monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.admin-only-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fee4e2;
  color: #b42318;
  border: 1px solid #fecdca;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

label {
  display: flex;
  color: var(--ink);
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

label small,
.form-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.checkbox-field {
  display: flex;
  padding: 13px;
  align-items: flex-start;
  flex-direction: row;
  gap: 10px;
  border: 1px solid #cce1d5;
  border-radius: 11px;
  background: var(--green-soft);
  cursor: pointer;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.checkbox-field > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checkbox-field small {
  color: var(--green-dark);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: var(--ink);
  transition:
    border 150ms ease,
    box-shadow 150ms ease;
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 92px;
  padding: 11px 13px;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #bdcbc2;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgb(12 104 72 / 8%);
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

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

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

.form-errors {
  padding: 13px 15px;
  border: 1px solid #f2bcbc;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.form-errors p + p {
  margin-top: 5px;
}

.auth-warning {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  min-height: 43px;
  padding: 0 17px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    background 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button--wide {
  width: 100%;
}

.button--primary {
  background: var(--green);
  box-shadow: 0 8px 20px rgb(12 104 72 / 19%);
  color: white;
}

.button--primary:hover:not(:disabled) {
  background: var(--green-dark);
}

.button--soft {
  border-color: #cce1d5;
  background: var(--green-soft);
  color: var(--green-dark);
}

.button--ghost {
  border-color: var(--line);
  background: white;
  color: var(--ink);
}

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

.sidebar {
  display: flex;
  height: 100vh;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  flex-direction: column;
  border-right: 1px solid rgb(255 255 255 / 8%);
  background: #10251c;
  color: white;
}

.sidebar .brand-lockup {
  padding: 0 8px;
}

.sidebar .brand-lockup small {
  color: rgb(255 255 255 / 48%);
}

.workspace-card {
  display: flex;
  margin: 26px 0;
  padding: 14px;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 14px;
  background: rgb(255 255 255 / 5%);
  flex-direction: column;
}

.workspace-card span {
  color: rgb(255 255 255 / 52%);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.workspace-card strong {
  margin: 4px 0;
  font-size: 14px;
}

.workspace-card small {
  color: var(--lime);
  font-size: 11px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  width: 100%;
  padding: 12px 13px;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: rgb(255 255 255 / 70%);
  cursor: pointer;
  text-align: left;
}

.nav-item span {
  font-size: 14px;
  font-weight: 800;
}

.nav-item small {
  color: rgb(255 255 255 / 60%);
  font-size: 11px;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgb(255 255 255 / 9%);
  color: white;
}

.nav-item.is-active small {
  color: var(--lime);
}

.sidebar-bottom {
  margin-top: auto;
}

.sidebar-bottom .button--ghost {
  border-color: rgb(255 255 255 / 14%);
  background: rgb(255 255 255 / 7%);
  color: white;
}

.lock-button {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border: 0;
  background: transparent;
  color: rgb(255 255 255 / 55%);
  cursor: pointer;
  font-size: 12px;
}

.sidebar-bottom p {
  margin-top: 20px;
  color: rgb(255 255 255 / 60%);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.main-shell {
  min-width: 0;
}

.mobile-header {
  display: none;
}

.page {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 36px clamp(22px, 4vw, 56px) 60px;
}

.page-header {
  display: flex;
  margin-bottom: 28px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-header h1 {
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.08;
}

.page-header p {
  margin-top: 7px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.metric-grid {
  display: grid;
  margin-bottom: 22px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  display: flex;
  min-height: 138px;
  padding: 20px;
  justify-content: center;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 82%);
  box-shadow: 0 8px 28px rgb(24 52 39 / 5%);
  flex-direction: column;
}

.metric-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  margin: 8px 0 4px;
  font-size: clamp(24px, 2.6vw, 38px);
  line-height: 1.05;
}

.metric-card small {
  color: var(--muted);
  font-size: 11px;
}

.metric-card--dark {
  border-color: #1f4736;
  background:
    radial-gradient(circle at 100% 0%, rgb(188 228 125 / 18%), transparent 9rem),
    #163a2b;
  color: white;
}

.metric-card--dark > span,
.metric-card--dark small {
  color: rgb(255 255 255 / 62%);
}

.metric-card--warning {
  border-color: #f4dfad;
  background: var(--amber-soft);
}

.metric-card--warning > span,
.metric-card--warning small {
  color: #6b4a00;
}

.metric-grid--compact .metric-card {
  min-height: 110px;
}

.metric-grid--compact .metric-card strong {
  font-size: 28px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

.panel {
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 75%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 10px 32px rgb(24 52 39 / 6%);
}

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

.panel-heading h2 {
  font-size: 22px;
}

.text-button {
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.search-box {
  position: relative;
}

.search-box > span {
  position: absolute;
  top: 50%;
  left: 13px;
  z-index: 1;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search-box input {
  padding-left: 38px;
  background:
    linear-gradient(90deg, transparent 13px, var(--green) 13px, var(--green) 15px, transparent 15px),
    white;
}

.quick-results,
.activity-list,
.customer-list {
  display: flex;
  margin-top: 12px;
  flex-direction: column;
}

.quick-row,
.activity-row,
.customer-row {
  display: flex;
  width: 100%;
  padding: 13px 4px;
  align-items: center;
  gap: 13px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.quick-row:hover,
.activity-row:hover,
.customer-row:hover {
  background: var(--surface-soft);
}

.quick-row:last-child,
.activity-row:last-child,
.customer-row:last-child {
  border-bottom: 0;
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}

.avatar--large {
  width: 44px;
  height: 44px;
  border-radius: 13px;
}

.quick-row__copy,
.activity-row > span:first-child {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.quick-row small,
.activity-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-row__amount,
.activity-amount {
  color: var(--green-dark);
  font-size: 13px;
  white-space: nowrap;
}

.empty-state {
  padding: 36px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state p {
  margin-top: 4px;
  font-size: 13px;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.filter-bar .search-box--wide {
  flex: 1;
}

.result-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-row {
  display: grid;
  padding: 15px 10px;
  grid-template-columns: 54px minmax(160px, 1.4fr) repeat(3, minmax(110px, 1fr)) 70px;
}

.customer-row > span:not(.avatar) {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.customer-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.customer-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow {
  color: var(--green) !important;
  font-size: 11px;
  font-weight: 800;
}

.back-button {
  margin: -14px 0 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.profile-grid {
  display: grid;
  margin-bottom: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-card {
  padding: 20px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 88%);
}

.profile-card h2 {
  margin-bottom: 15px;
  font-size: 21px;
}

.profile-card dl {
  display: grid;
  gap: 8px;
}

.profile-card dl div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
}

.profile-card dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.profile-card dd {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 700;
}

.document-row {
  display: flex;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 6px;
}

.document-chip {
  padding: 6px 9px;
  border: 1px solid #cce1d5;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.document-chip--empty {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: default;
}

.ledger-panel {
  padding: 0;
  overflow: hidden;
}

.ledger-heading {
  margin: 0;
  padding: 20px;
  align-items: flex-end;
}

.ledger-heading .filter-bar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ledger-heading input {
  width: 170px;
  min-height: 38px;
}

.ledger-heading label {
  font-size: 10px;
}

.table-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

.ledger-table {
  width: 100%;
  min-width: 1420px;
  border-collapse: collapse;
  background: white;
  font-size: 11px;
}

.ledger-table th,
.ledger-table td {
  padding: 10px 8px;
  border-right: 1px solid #e9eeeb;
  border-bottom: 1px solid #e9eeeb;
  vertical-align: top;
}

.ledger-table th {
  background: #edf3ef;
  color: #4e5f56;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
}

/* Ledger 4-Color Group Headers */
.ledger-table .th-group {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  text-align: center;
  border-top-width: 4px;
  border-top-style: solid;
}

.ledger-table .th-group--red {
  border-top-color: #d92d20;
  background: #fef3f2;
  color: #b42318;
}

.ledger-table .th-sub--red {
  background: #fffbfa;
  color: #b42318;
  font-weight: 700;
}

.ledger-table .th-group--yellow {
  border-top-color: #eaaa08;
  background: #fefbe8;
  color: #713f12;
}

.ledger-table .th-sub--yellow {
  background: #fffef0;
  color: #713f12;
  font-weight: 700;
}

.ledger-table .th-group--green {
  border-top-color: #12b76a;
  background: #ecfdf3;
  color: #027a48;
}

.ledger-table .th-sub--green {
  background: #f6fef9;
  color: #027a48;
  font-weight: 700;
}

.ledger-table .th-group--blue {
  border-top-color: #1570ef;
  background: #eff8ff;
  color: #175cd3;
}

.ledger-table .th-sub--blue {
  background: #f8fbff;
  color: #175cd3;
  font-weight: 700;
}

.ledger-table .th-group--neutral {
  border-top-color: var(--line);
  background: #edf3ef;
  color: #4e5f56;
}

.ledger-table .th-sub--neutral {
  background: #edf3ef;
  color: #4e5f56;
}

.ledger-table tfoot .total-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  font-size: 11px;
  white-space: nowrap;
}

.ledger-table tfoot .total-cell--red {
  background: #fef3f2;
  color: #b42318;
}

.ledger-table tfoot .total-cell--yellow {
  background: #fefbe8;
  color: #713f12;
}

.ledger-table tfoot .total-cell--green {
  background: #ecfdf3;
  color: #027a48;
}

.ledger-table tfoot .total-cell--blue {
  background: #eff8ff;
  color: #175cd3;
}

.ledger-table tbody tr:hover {
  background: #fbfdfc;
}

.ledger-table tfoot td {
  background: #edf3ef;
  font-weight: 900;
}

.ledger-table .money {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  white-space: nowrap;
}

.proof-button {
  padding: 4px 7px;
  border: 0;
  border-radius: 7px;
  background: var(--green-soft);
  color: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}

.identifier-tag,
.status-tag {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.identifier-tag--till {
  background: var(--blue-soft);
  color: var(--blue);
}

.identifier-tag--psid {
  background: #f2e9ff;
  color: #68449a;
}

.status-tag--pending {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-tag--settled {
  background: var(--green-soft);
  color: var(--green);
}

.status-tag--returned,
.status-tag--cancelled {
  background: var(--red-soft);
  color: var(--red);
}

.cell-helper {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.table-actions {
  display: flex;
  gap: 4px;
}

.table-actions button {
  display: inline-flex;
  min-width: 32px;
  min-height: 32px;
  padding: 6px 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.table-actions button:last-child {
  color: var(--red);
}

.table-muted {
  color: #a9b4ae;
}

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

.evidence-appendix {
  margin-top: 18px;
  padding: 24px;
  border-radius: var(--radius);
  background: white;
}

.evidence-appendix > p {
  margin: 5px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

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

.evidence-grid figure {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.evidence-grid img {
  width: 100%;
  height: 220px;
  border-radius: 7px;
  object-fit: contain;
  background: #eef1ef;
}

.evidence-grid figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.file-placeholder {
  display: grid;
  height: 150px;
  padding: 16px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.print-footer {
  display: flex;
  margin-top: 18px;
  padding-top: 12px;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.print-only {
  display: none;
}

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

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

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-form .button {
  align-self: flex-start;
}

.stack-actions {
  display: flex;
  margin-top: 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.installation-card {
  display: flex;
  margin-top: 18px;
  padding: 14px;
  border-radius: 11px;
  background: var(--surface-soft);
  flex-direction: column;
}

.installation-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.installation-card code {
  margin: 5px 0;
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 900;
}

.installation-card small {
  color: var(--muted);
}

.audit-list {
  display: flex;
  max-height: 390px;
  overflow-y: auto;
  flex-direction: column;
}

.audit-row {
  display: flex;
  padding: 10px 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.audit-row > span {
  display: flex;
  flex-direction: column;
}

.audit-row strong {
  font-size: 12px;
}

.audit-row small,
.audit-row time {
  color: var(--muted);
  font-size: 10px;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  display: grid;
  position: fixed;
  z-index: 100;
  inset: 0;
  padding: 24px;
  overflow-y: auto;
  place-items: start center;
  background: rgb(7 20 14 / 74%);
  backdrop-filter: blur(8px);
}

.modal {
  width: min(600px, 100%);
  margin: 3vh auto;
  overflow: hidden;
  border-radius: 22px;
  background: white;
  box-shadow: 0 30px 80px rgb(0 0 0 / 28%);
}

.modal--wide {
  width: min(900px, 100%);
}

.modal--large {
  width: min(1040px, 100%);
}

.modal-header {
  display: flex;
  padding: 23px 25px 18px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 26px;
}

.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.modal-form {
  padding: 0 25px 25px;
}

.form-section {
  padding: 23px 0;
  border-bottom: 1px solid var(--line);
}

.section-title {
  display: flex;
  margin-bottom: 17px;
  align-items: flex-start;
  gap: 10px;
}

.section-title > span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--green-dark);
  color: white;
  font-size: 10px;
  font-weight: 900;
}

.section-title h3 {
  font-size: 16px;
}

.section-title p {
  color: var(--muted);
  font-size: 11px;
}

.file-field {
  padding: 12px;
  border: 1px dashed #aebdb4;
  border-radius: 11px;
  background: var(--surface-soft);
}

.file-field input {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
}

.form-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: #fff8e7;
}

.modal-footer {
  display: flex;
  padding-top: 20px;
  justify-content: flex-end;
  gap: 8px;
}

.is-hidden {
  display: none !important;
}

.attachment-viewer {
  display: grid;
  padding: 22px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.attachment-viewer figure {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.attachment-viewer img {
  width: 100%;
  max-height: 560px;
  border-radius: 8px;
  object-fit: contain;
  background: #eef1ef;
}

.attachment-viewer figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.file-download {
  display: grid;
  min-height: 150px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--green);
  font-weight: 800;
}

.toast-root {
  display: flex;
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  flex-direction: column;
  gap: 8px;
}

.toast {
  max-width: 380px;
  padding: 12px 15px;
  border-radius: 11px;
  background: #183c2d;
  box-shadow: var(--shadow);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.toast--error {
  background: #8d2f2f;
}

.fatal-error {
  width: min(700px, calc(100% - 40px));
  margin: 12vh auto;
  padding: 32px;
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}

.fatal-error p {
  margin: 12px 0;
  color: var(--muted);
}

.fatal-error pre {
  overflow: auto;
  padding: 12px;
  background: var(--surface-soft);
}

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

  .dashboard-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

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

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .customer-row {
    grid-template-columns: 50px minmax(150px, 1.3fr) repeat(2, minmax(100px, 1fr)) 60px;
  }

  .customer-row > span:nth-child(3) {
    display: none;
  }
}

@media (max-width: 820px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-story {
    min-height: 360px;
    padding: 30px;
  }

  .auth-copy h1 {
    margin-top: 50px;
    font-size: 43px;
  }

  .auth-copy p {
    font-size: 15px;
  }

  .auth-contact {
    margin-top: 40px;
  }

  .auth-panel {
    min-height: auto;
    padding: 24px 16px 50px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
    padding: 13px 16px;
    position: sticky;
    z-index: 20;
    top: 0;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgb(255 255 255 / 92%);
    backdrop-filter: blur(12px);
  }

  .brand-lockup--compact .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 17px;
  }

  .brand-lockup--compact strong {
    font-size: 15px;
  }

  .page {
    padding: 24px 16px 80px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .customer-row {
    grid-template-columns: 48px minmax(140px, 1fr) minmax(100px, 0.7fr) 54px;
  }

  .customer-row > span:nth-child(3),
  .customer-row > span:nth-child(4) {
    display: none;
  }

  .form-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .auth-story {
    min-height: 330px;
  }

  .auth-copy h1 {
    margin-top: 32px;
    font-size: 36px;
  }

  .auth-contact {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .auth-card {
    padding: 25px 19px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 108px;
  }

  .form-grid--2,
  .form-grid--3,
  .form-grid--4,
  .attachment-viewer,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .customer-row {
    grid-template-columns: 44px minmax(120px, 1fr) 54px;
  }

  .customer-row > span:nth-child(3),
  .customer-row > span:nth-child(4),
  .customer-row > span:nth-child(5) {
    display: none;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .result-count {
    align-self: flex-end;
  }

  .profile-card dl div {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .modal-backdrop {
    padding: 0;
  }

  .modal {
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .modal-header {
    padding: 18px 17px;
    position: sticky;
    z-index: 2;
    top: 0;
    background: white;
  }

  .modal-form {
    padding: 0 17px 22px;
  }

  .modal-footer {
    position: sticky;
    bottom: 0;
    padding: 13px 0;
    background: white;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 9mm;
  }

  :root,
  html,
  body {
    background: white !important;
  }

  body {
    color: black;
    font-size: 9pt;
  }

  .sidebar,
  .mobile-header,
  .no-print,
  .page-header .page-actions,
  .toast-root,
  #modal-root {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .page {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  .page-header {
    margin-bottom: 7mm;
  }

  .page-header h1 {
    font-size: 22pt;
  }

  .page-header p {
    font-size: 9pt;
  }

  .profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3mm;
  }

  .profile-card,
  .metric-card,
  .panel,
  .evidence-appendix {
    border: 0.3mm solid #b8c1bc;
    box-shadow: none;
    break-inside: avoid;
  }

  .profile-card {
    padding: 4mm;
  }

  .profile-card h2 {
    font-size: 12pt;
  }

  .document-chip {
    border: 0;
    padding: 0;
    background: none;
    color: #333;
  }

  .metric-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3mm;
  }

  .metric-card,
  .metric-grid--compact .metric-card {
    min-height: 22mm;
    padding: 4mm;
    background: white !important;
    color: black !important;
  }

  .metric-card > span,
  .metric-card small {
    color: #444 !important;
  }

  .metric-card strong,
  .metric-grid--compact .metric-card strong {
    font-size: 15pt;
  }

  .ledger-panel {
    overflow: visible;
  }

  .ledger-heading {
    padding: 4mm;
  }

  .table-scroll {
    overflow: visible;
  }

  .ledger-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 6.2pt;
  }

  .ledger-table th,
  .ledger-table td {
    padding: 1.3mm 1mm;
    border: 0.2mm solid #c8cfcb;
    overflow-wrap: anywhere;
  }

  .ledger-table th {
    font-size: 5.3pt;
  }

  .ledger-table th:nth-child(14),
  .ledger-table td:nth-child(14) {
    display: none;
  }

  .print-only {
    display: inline;
  }

  .identifier-tag,
  .status-tag {
    padding: 0;
    background: none;
    color: black;
    white-space: normal;
  }

  .evidence-appendix {
    margin-top: 7mm;
    padding: 5mm;
    break-before: page;
  }

  .evidence-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm;
  }

  .evidence-grid figure {
    break-inside: avoid;
  }

  .evidence-grid img {
    height: 48mm;
  }

  .print-footer {
    display: flex;
  }
}
