:root {
  --navy: #0b3d5c; --navy2: #125a85; --accent: #f29f05; --bg: #eef2f6; --card: #fff; --text: #1b2430; --muted: #6b7785;
  --ok: #17895a; --bad: #c8372d; --line: #dde3ea; --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
h1 { margin: 0 0 18px; color: var(--navy); text-align: center; }
h2 { margin: 0 0 12px; font-size: 1.15rem; color: var(--navy); }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy2); border-color: transparent; }
label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--line); color: var(--text); font-weight: 600; }
button.primary { background: var(--navy); color: #fff; }
button.success { background: var(--ok); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); }
button.danger { color: var(--bad); border-color: #f0c9c6; }
button.small { padding: 6px 10px; font-size: .85rem; }
button.block { width: 100%; padding: 14px; font-size: 1.05rem; margin-bottom: 14px; }
a { color: var(--navy2); font-weight: 600; }
.muted { color: var(--muted); font-size: .88rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(11, 61, 92, .08); }

/* auth */
.auth { max-width: 420px; margin: 0 auto; padding: 24px 16px; }
.auth-top { display: flex; justify-content: flex-end; }
.logo { font-size: 56px; text-align: center; margin-top: 12px; }
.auth form button.primary { width: 100%; padding: 13px; margin-top: 4px; }
.server summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.server form { margin-top: 10px; flex-wrap: nowrap; }
.server input { margin: 0; }

/* shell */
header { background: var(--navy); color: #fff; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
header .brand { font-weight: 800; font-size: 1.1rem; }
header .who { flex: 1; font-size: .9rem; opacity: .95; }
header .hdr-actions { display: flex; gap: 6px; }
header button.ghost { color: #fff; border-color: rgba(255, 255, 255, .35); padding: 7px 12px; font-size: .88rem; }
nav { display: flex; background: var(--navy2); }
nav button { flex: 1; background: transparent; color: rgba(255, 255, 255, .8); border-radius: 0; padding: 12px; border-bottom: 3px solid transparent; }
nav button.on { color: #fff; border-bottom-color: var(--accent); }
main { max-width: 820px; margin: 0 auto; padding: 16px; }
.banner { background: #fff4dc; color: #7a5200; text-align: center; padding: 8px; font-size: .88rem; font-weight: 600; }
.notice { background: #eef6fb; color: var(--navy); padding: 10px 12px; border-radius: 10px; font-size: .88rem; margin: 4px 0 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; font-size: .88rem; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.order.active { border-inline-start: 5px solid var(--accent); }
.order.completed { border-inline-start: 5px solid var(--ok); }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.order-head select { width: auto; margin: 0; padding: 6px 8px; }
.company { font-size: 1.1rem; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 14px; }
.facts span { display: block; font-size: .78rem; color: var(--muted); }
.facts b { font-weight: 600; }
.notes { background: var(--bg); padding: 8px 10px; border-radius: 8px; margin: 10px 0 0; font-size: .92rem; white-space: pre-wrap; }
.loc { margin-top: 10px; padding: 10px; border-radius: 10px; background: #fff8ea; font-size: .9rem; }
.maplink { margin-inline-start: 8px; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.st-active { background: #fff1d1; color: #8a5a00; }
.st-completed { background: #d9f3e6; color: #0f6b44; }
.role-owner { background: var(--accent); color: #fff; }
.role-boss { background: #dfe9ff; color: #22408a; }
.role-employee { background: rgba(255, 255, 255, .2); color: inherit; border: 1px solid rgba(255, 255, 255, .4); }
main .role-employee { background: var(--bg); border: 0; }

.user.off { opacity: .6; }
.cred { margin: 4px 0; font-size: .92rem; display: flex; align-items: center; gap: 8px; }
.cred span { color: var(--muted); min-width: 90px; }
code { background: var(--bg); padding: 2px 8px; border-radius: 6px; direction: ltr; unicode-bidi: embed; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: start; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: #1b2430; color: #fff; padding: 12px 18px; border-radius: 12px; max-width: 90vw; z-index: 10; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
.toast.bad { background: var(--bad); }

/* search, summary */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { margin: 0; flex: 1; }
.searchbar select { margin: 0; width: auto; }
.stats summary { cursor: pointer; color: var(--navy); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.tiles div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.tiles span { display: block; font-size: .78rem; color: var(--muted); }
.tiles b { font-size: 1.15rem; color: var(--navy); }
nav button { padding: 12px 6px; font-size: .92rem; }

/* switched account, team list, code */
.switched { background: #6b2fa3; color: #fff; padding: 9px 14px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: .92rem; }
.switched button { background: #fff; color: #6b2fa3; }
.teamrow { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.teamrow:last-child { border-bottom: 0; }
.teamrow.off { opacity: .55; }
.codeinput { font-size: 1.6rem; letter-spacing: .4em; text-align: center; direction: ltr; }

.fishtag { display: inline-block; margin: 3px 0; padding: 2px 10px; border-radius: 999px; background: #e3f1fb; color: var(--navy); font-size: .85rem; font-weight: 600; }


/* fish lines, accounting */
.item-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 2px; margin-bottom: 10px; background: #fafcfe; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; color: var(--navy); }
.item-row > select { margin: 0 0 10px; }
.block-sm { width: 100%; margin-bottom: 12px; border-style: dashed; }
.items { margin: 4px 0 10px; }
.item-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.item-line b { margin-inline-start: auto; }
.badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.pay-paid { background: #d9f3e6; color: #0f6b44; } .pay-unpaid { background: #fde2e0; color: #b3261e; } .pay-partial { background: #fff1d1; color: #8a5a00; }
.accfilters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; }
.acctable td.acts { white-space: nowrap; } .acctable td.acts button { margin: 2px; }
.warn { color: #b3261e; }

/* printing: only the report is printed */
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  body { background: #fff; padding: 0; }
}
 #printArea .rpt { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif; color: #1b2430; font-size: 12px; line-height: 1.4; } #printArea .rpt h1 { font-size: 20px; margin: 0 0 4px; color: #0b3d5c; } #printArea .rpt .meta { color: #6b7785; margin-bottom: 12px; } #printArea .rpt .tiles { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; } #printArea .rpt .tiles div { border: 1px solid #dde3ea; border-radius: 6px; padding: 6px 10px; min-width: 110px; } #printArea .rpt .tiles span { display: block; color: #6b7785; font-size: 10px; } #printArea .rpt .tiles b { font-size: 14px; color: #0b3d5c; } #printArea .rpt h2 { font-size: 14px; margin: 16px 0 6px; color: #0b3d5c; } #printArea .rpt table { width: 100%; border-collapse: collapse; } #printArea .rpt th, #printArea .rpt td { border: 1px solid #dde3ea; padding: 5px 6px; text-align: start; vertical-align: top; } #printArea .rpt th { background: #eef2f6; font-weight: 600; } #printArea .rpt td.n, #printArea .rpt th.n { text-align: end; white-space: nowrap; } #printArea .rpt tfoot td { font-weight: 700; background: #f6f8fa; } #printArea .rpt .fl { white-space: nowrap; } #printArea .rpt .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; margin: 8px 0 12px; } #printArea .rpt .grid span { color: #6b7785; } #printArea .rpt .st-paid { color: #0f6b44; font-weight: 600; } #printArea .rpt .st-unpaid { color: #b3261e; font-weight: 600; } #printArea .rpt .st-partial { color: #8a5a00; font-weight: 600; } #printArea .rpt tr { page-break-inside: avoid; }

.updatebar { background: #17895a; color: #fff; padding: 9px 14px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; font-weight: 600; }
.updatebar button { background: #fff; color: #17895a; }
.updatebar .hint { font-weight: 400; font-size: .85rem; opacity: .9; }


/* ===== Professional theme + motion (v1.2) ===== */
:root {
  --navy: #0d3b66; --navy2: #14507f; --accent: #f4a259; --bg: #f2f5f9; --line: #e3e8ef;
  --shadow: 0 1px 2px rgba(13, 59, 102, .06), 0 4px 14px rgba(13, 59, 102, .06);
  --shadow-hover: 0 2px 4px rgba(13, 59, 102, .08), 0 10px 28px rgba(13, 59, 102, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
html, body { font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", Tahoma, sans-serif; -webkit-font-smoothing: antialiased; }
.card { border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.card.order:hover, .card.user:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
header { background: linear-gradient(120deg, #0b2f52, #14507f 60%, #1b6aa5); box-shadow: 0 2px 10px rgba(0, 0, 0, .12); position: sticky; top: 0; z-index: 5; }
nav { background: #fff; border-bottom: 1px solid var(--line); }
nav button { color: var(--muted); border-bottom-width: 3px; transition: color .2s, border-color .25s var(--ease), background .2s; }
nav button:hover { background: #f5f8fc; color: var(--navy); }
nav button.on { color: var(--navy); border-bottom-color: var(--accent); background: transparent; }
button { transition: transform .12s var(--ease), box-shadow .2s, background .2s, filter .2s; }
button:hover { filter: brightness(1.06); }
button:active { transform: scale(.96); }
button.primary { background: linear-gradient(135deg, #0d3b66, #1b6aa5); box-shadow: 0 3px 10px rgba(13, 59, 102, .25); }
button.success { background: linear-gradient(135deg, #12805a, #1fa374); box-shadow: 0 3px 10px rgba(18, 128, 90, .25); }
input, select, textarea { transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #1b6aa5; box-shadow: 0 0 0 3px rgba(27, 106, 165, .15); }
.chip { transition: all .2s var(--ease); }
.chip.on { box-shadow: 0 2px 8px rgba(13, 59, 102, .25); }
.badge { letter-spacing: .02em; }
.tiles div { transition: transform .2s var(--ease); }
.tiles div:hover { transform: translateY(-2px); }
.auth .card { box-shadow: 0 10px 40px rgba(13, 59, 102, .12); }
.auth { background: radial-gradient(circle at 50% 0, #dbe8f5, transparent 60%); min-height: 100vh; }
.logo { animation: float 3.5s ease-in-out infinite; }
.toast { animation: toastIn .35s var(--ease); border-radius: 14px; }
.updatebar, .switched, .banner { animation: slideDown .35s var(--ease); }

/* entrance animations only when the screen changes (not on the 15-second refresh) */
.enter main > *, .enter .auth > * { animation: rise .45s var(--ease) both; }
.enter main > *:nth-child(2) { animation-delay: .04s; } .enter main > *:nth-child(3) { animation-delay: .08s; }
.enter main > *:nth-child(4) { animation-delay: .12s; } .enter main > *:nth-child(5) { animation-delay: .16s; }
.enter main > *:nth-child(n+6) { animation-delay: .2s; }
.enter .auth > *:nth-child(2) { animation-delay: .05s; } .enter .auth > *:nth-child(3) { animation-delay: .1s; } .enter .auth > *:nth-child(4) { animation-delay: .15s; }
.item-row { animation: rise .3s var(--ease) both; }
details[open] > :not(summary) { animation: fade .3s var(--ease); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ===== Website look (v1.3) ===== */
body {
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(27,106,165,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(244,162,89,.10), transparent 60%),
    radial-gradient(rgba(13,59,102,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    #f2f5f9;
  background-attachment: fixed;
}
main { max-width: 1100px; padding: 22px 18px 10px; }
.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 18px 10px 26px; }
header { padding: 14px 24px; }
header .brand { font-size: 1.2rem; letter-spacing: .01em; }
nav { justify-content: center; gap: 6px; padding: 6px 10px; background: rgba(255,255,255,.85); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 4; }
nav button { flex: 0 1 auto; border-radius: 999px; padding: 9px 18px; border-bottom: 0; }
nav button.on { background: var(--navy); color: #fff; box-shadow: 0 3px 10px rgba(13,59,102,.25); }
nav button.on:hover { background: var(--navy); color: #fff; }
.section-title { color: var(--navy); margin: 4px 4px 12px; }
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.teamgrid .card { margin: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #0d3b66, #1b6aa5); flex: none; }
.grow { flex: 1; }
.order-head { align-items: center; }

/* sign-in page: brand panel + form */
.auth-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.hero { background: linear-gradient(150deg, #0b2f52, #14507f 55%, #1b6aa5); color: #fff; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; overflow: hidden; }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.06); }
.hero::before { width: 420px; height: 420px; top: -120px; inset-inline-end: -120px; animation: float 9s ease-in-out infinite; }
.hero::after { width: 300px; height: 300px; bottom: -90px; inset-inline-start: -80px; background: rgba(244,162,89,.12); animation: float 11s ease-in-out infinite reverse; }
.hero-in { position: relative; max-width: 420px; animation: rise .6s var(--ease) both; }
.hero h1 { color: #fff; text-align: start; font-size: 2.4rem; margin: 10px 0 6px; }
.hero-logo { font-size: 56px; }
.tagline { font-size: 1.1rem; opacity: .9; margin: 0 0 22px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.features li { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 10px 14px; border-radius: 12px; animation: rise .6s var(--ease) both; }
.features li:nth-child(2) { animation-delay: .08s; } .features li:nth-child(3) { animation-delay: .16s; } .features li:nth-child(4) { animation-delay: .24s; }
.auth-page .auth { background: none; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 440px; margin: 0 auto; }
@media (max-width: 860px) {
  .auth-page { grid-template-columns: 1fr; }
  .hero { padding: 28px 20px; }
  .hero h1 { font-size: 1.8rem; } .features { display: none; }
}

@media (min-width: 861px) { .auth-page .auth > .logo, .auth-page .auth > h1 { display: none; } }


.paypanel { border: 2px solid #1b6aa5; animation: rise .35s var(--ease) both; }
.paypanel h2 { margin: 0; } .payform { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; } .payform h3 { margin: 0 0 8px; color: var(--navy); font-size: 1rem; }


#printArea .doc { font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif; color: #1b2430; font-size: 12px; }
#printArea .doc .top { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid #0d3b66; padding-bottom: 12px; margin-bottom: 14px; }
#printArea .doc .biz div { color: #4a5563; margin-top: 2px; }
#printArea .doc .title { text-align: end; }
#printArea .doc .title h1 { margin: 0; font-size: 24px; color: #0d3b66; letter-spacing: .02em; }
#printArea .doc .title .no { font-size: 14px; font-weight: 700; margin-top: 4px; }
#printArea .doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-bottom: 14px; }
#printArea .doc .meta span { color: #6b7785; }
#printArea .doc table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
#printArea .doc th, #printArea .doc td { border: 1px solid #dde3ea; padding: 7px 8px; text-align: start; }
#printArea .doc th { background: #0d3b66; color: #fff; font-weight: 600; }
#printArea .doc td.n, #printArea .doc th.n { text-align: end; white-space: nowrap; }
#printArea .doc .totals { width: 50%; margin-inline-start: auto; }
#printArea .doc .totals td:first-child { color: #4a5563; }
#printArea .doc .totals tr.grand td { font-weight: 800; font-size: 14px; background: #eef2f6; }
#printArea .doc .words { background: #f6f8fa; border: 1px dashed #c9d3de; padding: 8px 10px; border-radius: 6px; margin: 10px 0; }
#printArea .doc .amountbox { display: inline-block; border: 2px solid #0d3b66; border-radius: 8px; padding: 8px 16px; font-size: 18px; font-weight: 800; color: #0d3b66; }
#printArea .doc .sign { display: flex; justify-content: space-between; margin-top: 50px; }
#printArea .doc .sign div { border-top: 1px solid #6b7785; padding-top: 6px; width: 40%; text-align: center; color: #4a5563; }
#printArea .doc p.big { font-size: 14px; }
#printArea .doc .foot { margin-top: 18px; color: #6b7785; text-align: center; }
#printArea .doc .st-paid { color: #0f6b44; font-weight: 700; } #printArea .doc .st-unpaid { color: #b3261e; font-weight: 700; } #printArea .doc .st-partial { color: #8a5a00; font-weight: 700; }

/* complete-order window */
.modal-back { position: fixed; inset: 0; background: rgba(11, 30, 50, .45); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 20; padding: 16px; animation: fade .2s ease both; }
.modal { width: 100%; max-width: 460px; margin: 0; animation: rise .3s var(--ease) both; }
.modal h2 { margin-top: 0; }
.paychoice { display: grid; gap: 8px; margin: 12px 0; }
.paychoice label { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; cursor: pointer; color: var(--text); font-size: 1rem; transition: border-color .2s, background .2s; }
.paychoice input { width: auto; margin: 0; accent-color: var(--navy); }
.paychoice label:has(input:checked) { border-color: #1b6aa5; background: #eef6fb; font-weight: 600; }
