[hidden] { display: none !important; }
@font-face { font-family: V; src: url(/static/fonts/Vazirmatn-FD-Regular.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: V; src: url(/static/fonts/Vazirmatn-FD-Medium.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: V; src: url(/static/fonts/Vazirmatn-FD-Bold.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: V; src: url(/static/fonts/Vazirmatn-FD-Black.woff2) format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --navy: #06163D; --navy-2: #0A2A78; --royal: #1447D6;
  --orange: #FF5E00; --orange-hi: #FF8A00; --orange-soft: #FFF0E3;
  --metal: linear-gradient(100deg, #FF3D00 0%, #FF6A00 22%, #FFB25C 44%, #FF7A00 58%, #FF4A00 80%, #FF9A3D 100%);
  --green: #00A26B; --green-soft: #E3F7EF; --red: #D93A1A; --red-soft: #FDECE8;
  --bg: #F2F5FB; --card: #FFFFFF; --ink: #111827; --muted: #5E6A7D; --line: #E2E7F0;
  --r: 14px; --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #070D1F; --card: #0F1A36; --ink: #E8EDF8; --muted: #93A0BA; --line: #1F2C4E;
          --orange-soft: #3A1E0A; --green-soft: #0C2E24; --red-soft: #3A140C; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: V, system-ui, sans-serif; font-size: 15px; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 14px calc(92px + var(--safe-b)); }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: linear-gradient(120deg, #050F2E, #0A2A78 70%, #1447D6 140%); color: #fff;
       padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; }
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--metal); }
.top .in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.top img { height: 30px; }
.top .t { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .bell { position: relative; padding: 6px; }
.top .bell svg { width: 24px; height: 24px; }
.badge { position: absolute; top: 0; left: 0; min-width: 18px; height: 18px; border-radius: 9px; background: var(--orange);
         color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; box-shadow: 0 0 10px rgba(255,94,0,.7); }

/* bottom nav */
.nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line);
       padding-bottom: var(--safe-b); display: flex; justify-content: space-around; }
.nav a { flex: 1; text-align: center; padding: 7px 0 6px; font-size: 11px; color: var(--muted); }
.nav a svg { width: 23px; height: 23px; display: block; margin: 0 auto 1px; }
.nav a.on { color: var(--orange); font-weight: 700; }
.nav a.add { margin-top: -18px; }
.nav a.add span.fab { width: 54px; height: 54px; border-radius: 50%; background: var(--metal); display: grid; place-items: center; margin: 0 auto;
                      box-shadow: 0 6px 18px rgba(255,94,0,.5); color: #fff; }
.nav a.add svg { width: 28px; height: 28px; margin: 0; }

h1 { font-size: 20px; margin: 16px 0 10px; }
h2 { font-size: 16px; margin: 20px 0 8px; display: flex; align-items: center; gap: 8px; }
h2::before { content: ""; width: 5px; height: 18px; border-radius: 3px; background: var(--metal); }
h2 .sp { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.card.link { display: block; }
.card.hot { border-inline-start: 4px solid var(--orange); }
.row { display: flex; gap: 10px; align-items: center; }
.row .grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack > * + * { margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 17px; font-weight: 900; direction: ltr; text-align: right; }
.kpi.navy { background: var(--navy); color: #fff; border: 0; }
.kpi.navy .k { color: #AFC3EE; }
.kpi.navy .v { color: var(--orange-hi); }
.pos { color: var(--red); } .neg { color: var(--green); }
.num { direction: ltr; unicode-bidi: isolate; white-space: nowrap; }

.tag { display: inline-block; font-size: 11.5px; padding: 1px 9px; border-radius: 20px; font-weight: 700; white-space: nowrap; }
.tag.contract { background: #E3EBFF; color: var(--royal); }
.tag.repair, .tag.paid { background: var(--orange-soft); color: #E04E00; }
.tag.warranty, .tag.warranty_travel, .tag.closed { background: var(--green-soft); color: var(--green); }
.tag.paused { background: #FFF6D6; color: #9A6B00; }
.tag.active { background: #E3EBFF; color: var(--royal); }
.tag.due { background: var(--red-soft); color: var(--red); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; font-size: 14px;
         background: var(--card); border: 1px solid var(--line); }
.alert::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 8px; flex: none; background: var(--royal); }
.alert.warn::before { background: var(--orange); box-shadow: 0 0 8px var(--orange); }
.alert.due { border-color: #F6C7BA; background: var(--red-soft); }
.alert.due::before { background: var(--red); }

/* forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1.5px solid var(--line);
  border-radius: 11px; padding: 10px 12px; outline: none; appearance: none; -webkit-appearance: none; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: 16px 50%, 11px 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-left: 28px; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,94,0,.18); }
input.money, input.ltr { direction: ltr; text-align: right; }
textarea { min-height: 80px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.seg { display: flex; background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg label { flex: 1; margin: 0; text-align: center; }
.seg input { display: none; }
.seg span { display: block; padding: 7px 4px; border-radius: 9px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--navy-2); color: #fff; font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--ink); font-size: 14.5px; }
.check input { width: 22px; height: 22px; appearance: auto; -webkit-appearance: checkbox; accent-color: var(--orange); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 12px 12px; margin: 12px 0; background: var(--card); }
legend { font-weight: 700; padding: 0 6px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; border: 0; cursor: pointer;
       border-radius: 12px; padding: 11px 16px; background: var(--navy-2); color: #fff; font-size: 15px; }
.btn.o { background: var(--metal); color: #fff; box-shadow: 0 4px 14px rgba(255,94,0,.35); }
.btn.g { background: var(--green); }
.btn.l { background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.btn.d { background: var(--red-soft); color: var(--red); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.sticky-save { position: sticky; bottom: calc(70px + var(--safe-b)); z-index: 5; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 35%); }

/* lists / tables */
.list .item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1.5px solid var(--line); }
table.t td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.n, table.t th.n { text-align: left; direction: ltr; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

.partrow { border: 1px dashed var(--line); border-radius: 12px; padding: 4px 10px 10px; margin-bottom: 8px; position: relative; }
.partrow .x { position: absolute; left: 6px; top: 6px; background: none; border: 0; color: var(--red); font-size: 20px; cursor: pointer; }
.words { font-size: 12px; color: var(--orange); margin-top: 3px; min-height: 1em; }

.flash { padding: 10px 12px; border-radius: 12px; margin: 12px 0 0; font-weight: 500; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.err { background: var(--red-soft); color: var(--red); }

.day-card { border-radius: var(--r); padding: 14px; background: linear-gradient(135deg, #0A2A78, #06163D); color: #fff; position: relative; overflow: hidden; }
.day-card::after { content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: var(--metal); }
.day-card .muted { color: #AFC3EE; }
.empty { text-align: center; color: var(--muted); padding: 22px 0; }
details > summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
         background: radial-gradient(circle at 30% 20%, #1447D6 0, #0A2A78 35%, #050F2E 80%); }
.login .box { width: 100%; max-width: 360px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25);
              border-radius: 20px; padding: 26px 22px; color: #fff; text-align: center; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.login img { width: 170px; }
.login input { background: rgba(255,255,255,.95); color: #111; }

/* version footer */
.ver { text-align: center; margin: 26px 0 6px; font-size: 12px; color: var(--muted); }
.ver a { opacity: .8; }

/* Jalali date picker (bottom sheet) */
.jdp-back { position: fixed; inset: 0; background: rgba(4,10,30,.45); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.jdp { width: 100%; max-width: 440px; background: var(--card); border-radius: 20px 20px 0 0; padding: 14px 14px calc(14px + var(--safe-b));
       box-shadow: 0 -10px 30px rgba(0,0,0,.25); animation: jdpUp .18s ease-out; }
@keyframes jdpUp { from { transform: translateY(40px); opacity: .6 } to { transform: none; opacity: 1 } }
.jdp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.jdp-head select { flex: 1; padding: 8px 10px; font-weight: 700; }
.jdp-nav { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font-size: 20px; cursor: pointer; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.jdp-grid .wd { font-size: 12px; color: var(--muted); padding: 4px 0; }
.jdp-grid .wd.fri, .jdp-grid button.fri { color: var(--red); }
.jdp-grid button { height: 42px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); font: inherit; font-size: 16px; cursor: pointer; }
.jdp-grid button:active { background: var(--bg); }
.jdp-grid button.today { box-shadow: inset 0 0 0 2px var(--orange); font-weight: 700; }
.jdp-grid button.sel { background: var(--navy-2); color: #fff; font-weight: 700; }
.jdp-foot { display: flex; gap: 8px; margin-top: 12px; }
.jdp-foot .btn { flex: 1; }
input.jdate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF5E00' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px 50%; background-size: 20px; padding-left: 40px; cursor: pointer; }

/* safe delete sheet */
.delbox { display: inline-block; }
.del-back { position: fixed; inset: 0; background: rgba(4,10,30,.5); z-index: 110; display: flex; align-items: flex-end; justify-content: center; }
.del-sheet { width: 100%; max-width: 440px; background: var(--card); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + var(--safe-b));
             border-top: 4px solid var(--red); animation: jdpUp .18s ease-out; text-align: right; }
.del-title { font-weight: 900; font-size: 17px; color: var(--red); }
.del-warn { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 8px 10px; margin-top: 8px; font-size: 13.5px; }
