:root {
  color-scheme: light;
  --teal: #005f73;
  --deep: #073e49;
  --ink: #163b40;
  --orange: #eb6723;
  --paper: #f1ece1;
  --canvas: #f8f6f1;
  --white: #fffefa;
  --line: #e6e0d6;
  --muted: #596e6d;
  --green: #176351;
  --shadow: 0 14px 44px #13373e12;
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; }
p { line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.numeric { direction: ltr; unicode-bidi: isolate; display: inline-block; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.spaced { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.button {
  min-height: 43px; padding: .55rem .9rem; border-radius: .6rem; border: 1px solid var(--line);
  color: var(--ink); background: var(--white); display: inline-flex; align-items: center;
  justify-content: center; gap: .45rem; text-decoration: none; font-weight: 650; white-space: nowrap;
}
.button:hover { background: var(--paper); }
.button.primary { background: var(--orange); color: #2a1b12; border-color: var(--orange); }
.button.primary:hover { background: #f47d40; }
.button.teal { background: var(--teal); color: #fff; border-color: var(--teal); }
.button.teal:hover { background: var(--deep); }
.button.danger { color: #a13123; }
.button.compact { padding: .3rem .6rem; min-height: 35px; font-size: .86rem; }
.button[disabled] { opacity: .58; cursor: wait; }
.brand { display: flex; align-items: center; gap: .62rem; }
.flower-mark { display: block; background-color: #f77032; aspect-ratio: 1; mask: url("./assets/flower-official.png?v=5") center / 104% auto no-repeat; mask-mode: alpha; }
.brand .flower-mark { width: 2.8rem; flex: 0 0 auto; }
.brand strong { font-family: Georgia, serif; font-weight: 600; white-space: nowrap; font-size: 1.5rem; }
.brand small { display: block; font-size: .79rem; margin-top: .15rem; }
.demo-label { align-self: center; color: #623314; background: #fae3d4; border-radius: 2rem; padding: .34rem .7rem; font-size: .8rem; white-space: nowrap; }
.login { min-height: 100svh; display: grid; grid-template-columns: minmax(340px, 5fr) minmax(370px, 6fr); }
.login-panel { background: var(--canvas); display: grid; grid-template-rows: auto 1fr auto; padding: clamp(1.25rem, 4vw, 3.5rem); }
.login-panel > .spaced { gap: .5rem; }
.login-inner { width: min(100%, 440px); margin: auto; padding-block: 2rem; }
.login-inner h1 { font-size: clamp(2rem, 4vw, 3.2rem); margin-bottom: .55rem; letter-spacing: -.04em; }
.login-inner > p { margin-bottom: 1.6rem; }
.login-footer { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .83rem; }
.login-art { background: var(--teal); color: var(--paper); position: relative; min-height: 590px; isolation: isolate; overflow: hidden; display: grid; place-items: center; }
.login-art::before, .login-art::after { content: ""; position: absolute; z-index: -1; width: 94%; aspect-ratio: 1; border: 1px solid #f1ece12d; border-radius: 100%; left: 3%; top: 50%; transform: translateY(-49%); }
.login-art::after { width: 76%; left: 12%; }
.login-art .flower-mark { width: min(69%, 550px); mask-position: calc(50% - 8px) center; }
.art-name { position: absolute; inset: auto 0 2.4rem; text-align: center; }
.art-name strong { display: block; font-family: Georgia, serif; font-weight: 400; font-size: clamp(2.7rem, 6vw, 6rem); line-height: 1; }
.accounts { display: grid; gap: .7rem; }
.account {
  display: flex; align-items: center; gap: 1rem; width: 100%; text-align: start; background: var(--white);
  color: var(--ink); border: 1px solid var(--line); border-radius: .75rem; padding: .75rem;
  min-height: 69px;
}
.account:hover { border-color: var(--teal); box-shadow: var(--shadow); }
.account strong, .account small { display: block; }
.account small { color: var(--muted); font-size: .83rem; margin-top: .2rem; }
.account .end { margin-inline-start: auto; color: var(--teal); font-size: .82rem; font-weight: bold; }
.account-icon, .icon-chip { border-radius: .55rem; width: 2.45rem; height: 2.45rem; display: grid; place-items: center; flex: 0 0 auto; color: var(--teal); background: #e4eeed; }
.account:first-child .account-icon, .icon-chip.orange { background: #f9e7d9; color: #903c12; }
.account-secondary { margin-top: 1.15rem; text-align: center; }
.text-button { color: var(--teal); background: transparent; border: 0; border-radius: .3rem; text-decoration: underline; text-underline-offset: 3px; padding: .3rem; }
.shell { min-height: 100svh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { background: var(--deep); color: var(--paper); display: flex; flex-direction: column; padding: 1.55rem 1rem 1rem; position: sticky; top: 0; height: 100svh; }
.sidebar .brand { padding: 0 .3rem 1.45rem; border-bottom: 1px solid #f1ece127; }
.sidebar nav { display: grid; gap: .3rem; margin-top: 1.6rem; }
.nav-item { background: transparent; color: var(--paper); min-height: 44px; text-align: start; border: 1px solid transparent; padding: .55rem .7rem; border-radius: .55rem; display: flex; align-items: center; gap: .65rem; }
.nav-item:hover, .nav-item[aria-current] { background: #ffffff15; border-color: #ffffff15; }
.nav-item[aria-current] { box-shadow: inset -3px 0 var(--orange); font-weight: 700; }
.sidebar-footer { margin-top: auto; display: grid; gap: .65rem; }
.sidebar-footer .nav-item { border-color: #ffffff25; }
.sidebar-caption { color: #e6ddd1; padding-inline: .65rem; font-size: .82rem; }
.main { min-width: 0; }
.topbar { border-bottom: 1px solid var(--line); min-height: 62px; padding: .65rem clamp(1rem, 3vw, 2.5rem); background: var(--white); }
.topbar .location { font-weight: 700; font-size: .92rem; color: var(--deep); }
.topbar-actions .request-notice { background: #fae3d4; border-color: #f0cebb; color: #623314; }
.topbar-actions .request-notice:hover { background: #f8d8c3; }
.request-empty { padding: 0 1.1rem 1rem; }
.container { max-width: 1480px; padding: clamp(1rem, 3vw, 2.5rem); margin-inline: auto; display: grid; align-content: start; gap: 1.25rem; }
.page-head { align-items: flex-end; }
.page-head h1 { font-size: clamp(1.85rem, 3.7vw, 2.8rem); margin-bottom: .35rem; letter-spacing: -.04em; }
.page-head p { font-size: .94rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.stat { min-height: 125px; border: 1px solid var(--line); border-radius: .75rem; background: var(--white); padding: 1rem 1.15rem; display: grid; gap: .65rem; align-content: center; position: relative; overflow: hidden; }
.stat .stat-label { display: flex; gap: .45rem; align-items: center; font-size: .92rem; }
.stat .amount { font-size: clamp(1.1rem, 2.7vw, 1.85rem); font-weight: 750; white-space: nowrap; }
.stat .unit { font-size: .76rem; font-weight: 500; }
.stat.emphasis { background: var(--teal); color: var(--white); border-color: var(--teal); }
.stat.emphasis .flower-mark { position: absolute; width: 8.5rem; left: -2.8rem; bottom: -3.2rem; opacity: .18; pointer-events: none; }
.stat.emphasis .icon-chip { background: #ffffff1c; color: #ffe6d4; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: .8rem; min-width: 0; }
.panel-head { padding: 1rem 1.1rem; }
.panel-head h2 { font-size: 1.3rem; }
[data-supplier-status] { width: auto; min-width: 10rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; padding: 0 1.1rem 1rem; }
.filters label { min-width: 7rem; }
.filters select, .filters input { min-height: 39px; }
.filters .branch-summary { margin-inline-start: auto; align-self: center; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); border-radius: 0 0 .8rem .8rem; }
table { width: 100%; border-collapse: collapse; text-align: start; }
th, td { text-align: start; padding: .83rem .9rem; vertical-align: middle; border-bottom: 1px solid #eee9e1; }
thead th { background: #f4f0e8; white-space: nowrap; color: #395354; font-size: .85rem; }
tbody td { font-size: .88rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #faf8f2; }
.ledger td:nth-child(2) { min-width: 175px; }
.ledger td:nth-child(1), .ledger td:nth-child(3), .ledger td:nth-child(n+4):nth-child(-n+6) { white-space: nowrap; }
.movement-title { font-weight: 700; overflow-wrap: anywhere; }
.movement-note { color: var(--muted); margin-top: .28rem; line-height: 1.45; font-size: .8rem; overflow-wrap: anywhere; }
.amount-in { color: #07576a; font-weight: 700; }
.amount-out { color: var(--green); font-weight: 700; }
.balance { font-weight: 750; }
.pill { display: inline-block; background: #f7e4db; color: #873f25; border-radius: 1rem; padding: .18rem .5rem; font-size: .75rem; margin-inline-start: .35rem; }
.empty { padding: 2.6rem 1.2rem; text-align: center; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: .9rem; }
.card { padding: 1rem; display: grid; align-content: start; gap: .85rem; }
.card h2 { font-size: 1.16rem; }
.card .button { justify-self: start; }
.order-summary { gap: .18rem; }
.order-lines { margin: 0; padding: 0; list-style: none; }
.order-lines li { display: flex; justify-content: space-between; align-items: baseline; gap: .65rem; padding: .54rem 0; border-top: 1px solid var(--line); }
.order-lines li > * { overflow-wrap: anywhere; }
.order-lines li > span { text-align: end; }
.field { display: grid; min-width: 0; gap: .3rem; font-size: .89rem; font-weight: 650; }
.field small { font-weight: normal; }
input, select, textarea {
  color: var(--ink); background: #fff; border: 1px solid #cfcac0; border-radius: .48rem; width: 100%;
  min-height: 44px; padding: .42rem .66rem; font-weight: 400;
}
select { appearance: none; padding-inline-end: 1.7rem; background-image: linear-gradient(45deg, transparent 50%, var(--teal) 50%), linear-gradient(-45deg, transparent 50%, var(--teal) 50%); background-position: left .96rem center, left .68rem center; background-size: .29rem .29rem; background-repeat: no-repeat; }
textarea { min-height: 76px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.form-error:empty { display: none; }
.form-error { color: #903326; background: #f9e7e1; padding: .66rem; border-radius: .45rem; line-height: 1.45; }
.warning { background: #fff0e1; border: 1px solid #efbd91; color: #71350c; border-radius: .5rem; padding: .65rem; }
.warning label { display: flex; gap: .5rem; margin-top: .5rem; align-items: center; }
.warning input { width: 18px; min-height: 18px; }
.allocations { min-width: 0; margin: 0 0 .6rem; padding: .3rem .65rem .6rem; border: 1px solid var(--line); border-radius: .55rem; }
.allocations legend { padding-inline: .35rem; font-weight: 700; }
.allocation { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: .55rem; padding-block: .35rem; }
.allocation-choice { display: flex; gap: .48rem; align-items: center; overflow-wrap: anywhere; }
.allocation-choice input { width: 18px; min-height: 18px; }
.allocation input:disabled { opacity: .55; background: var(--canvas); }
dialog { width: min(95vw, 610px); max-height: 91svh; padding: 0; border: 1px solid var(--line); border-radius: .9rem; color: var(--ink); background: var(--white); box-shadow: 0 24px 95px #00282b46; }
dialog::backdrop { background: #072d37a6; }
.dialog-head { padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 1.3rem; }
.dialog-body { padding: 1.1rem; }
.line-item { display: grid; grid-template-columns: minmax(0, 1fr) 5.75rem 2.3rem; align-items: end; gap: .5rem; }
.line-item.frozen { grid-template-columns: minmax(0, 1fr) 5.75rem; }
.line-item .button { min-width: 0; padding-inline: .35rem; }
.line-summary { padding: .7rem; border-radius: .5rem; background: var(--paper); }
.details { padding: .75rem; border: 1px solid var(--line); border-radius: .55rem; overflow-wrap: anywhere; }
.details + .details { margin-top: .5rem; }
#toast:not(:empty) { z-index: 10; position: fixed; inset: auto auto 1.1rem 1.1rem; background: var(--deep); color: white; border-radius: .55rem; padding: .7rem 1rem; box-shadow: var(--shadow); max-width: calc(100vw - 2.2rem); }
#print { display: none; }
@media (max-width: 950px) {
  .shell { grid-template-columns: 181px minmax(0, 1fr); }
  .sidebar { padding-inline: .65rem; }
  .sidebar .brand strong { font-size: 1.2rem; }
}
@media (max-width: 730px) {
  .login { grid-template-columns: 1fr; }
  .login-panel { min-height: 100svh; }
  .login-art { display: none; }
  .shell { display: block; }
  .sidebar { position: static; height: auto; padding: .48rem .75rem; }
  .sidebar .brand { padding: 0; border: 0; }
  .sidebar .brand .flower-mark { width: 2.25rem; }
  .sidebar .brand small, .sidebar-caption { display: none; }
  .sidebar nav { margin-top: .45rem; display: flex; gap: .2rem; overflow: auto; padding: 3px; }
  .nav-item { min-height: 36px; padding: .32rem .55rem; flex: 0 0 auto; font-size: .82rem; }
  .sidebar-footer { position: absolute; top: .45rem; left: .75rem; }
  .topbar { min-height: 46px; padding-block: .35rem; }
  .stat { min-height: 94px; padding: .62rem; gap: .45rem; }
  .stat .stat-label { font-size: .78rem; }
  .stat .icon-chip { display: none; }
  .stat .amount { font-size: clamp(.87rem, 4vw, 1.5rem); }
  .stats { gap: .4rem; }
  .stat .unit { font-size: .7rem; }
  .container { gap: .95rem; }
  .panel-head { padding: .8rem; }
  .filters { padding: 0 .8rem .8rem; }
  .filters > .field { flex: 1 1 115px; }
  th, td { padding: .68rem .6rem; }
  .ledger, .ledger tbody { display: block; }
  .ledger thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ledger tbody tr { padding: .75rem .8rem; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .3rem; }
  .ledger tbody tr:last-child { border-bottom: 0; }
  .ledger td { padding: 0; border: 0; min-width: 0; }
  .ledger td:nth-child(1) { grid-column: 1 / 3; font-size: .78rem; color: var(--muted); }
  .ledger td:nth-child(2) { grid-column: 1 / -1; min-width: 0; grid-row: 2; }
  .ledger td:nth-child(3) { grid-column: 3; grid-row: 1; text-align: end; font-size: .78rem; color: var(--muted); }
  .ledger td:nth-child(n+4):nth-child(-n+6)::before { content: attr(data-label); display: block; font-size: .74rem; color: var(--muted); font-weight: normal; }
  .ledger td:last-child { grid-column: 1 / -1; }
}
@media (max-width: 370px) {
  .stat .unit { display: block; }
  .login-panel { padding: .85rem; }
  .account { gap: .55rem; padding-inline: .55rem; }
}
@media print {
  @page { size: A4 landscape; margin: 13mm; }
  :root, body { background: white; color: #122b30; }
  #app, #dialog, #toast { display: none !important; }
  #print { display: block; }
  #print .brand .flower-mark { width: 35px; height: 35px; print-color-adjust: exact; }
  #print h1 { margin: 12px 0 6px; }
  #print p { margin-bottom: 8px; }
  #print table { display: table; margin-top: 14px; }
  #print thead { display: table-header-group; }
  #print tbody { display: table-row-group; }
  #print tr { display: table-row; break-inside: avoid; }
  #print td, #print th { display: table-cell; font-size: 10pt; padding: 6px; }
  #print .movement-note { white-space: pre-line; }
  #print th { border-bottom: 2px solid var(--teal); }
}
