:root {
  color-scheme: light;
  --page: #f6f7f9; --surface: #ffffff; --ink: #1f2937; --ink2: #4b5563; --muted: #6b7280;
  --line: #e3e6ec; --line2: #c9ced8; --navy: #203f78; --blue: #2c55a3; --bright: #376dcf;
  --tint: #eaf0fa; --tint2: #d5e0f5; --mid: #9db5e4; --red: #c53038; --redt: #fbe9ea; --good: #1d7a46; --goodt: #e6f4ec;
  --warn: #9a6400; --warnt: #fdf3dc;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: "Vazirmatn", Tahoma, "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.8; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.num { font-variant-numeric: tabular-nums; }

/* header */
.top { background: var(--navy); color: #fff; }
.top .in { max-width: 1280px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 22px; min-height: 54px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 15px; color: #fff; }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { color: #dce5f5; padding: 6px 12px; border-radius: 6px; }
.top nav a:hover, .top nav a.on { background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #dce5f5; }
.who a { color: #fff; }
.who form { margin: 0; }
.linkbtn { background: none; border: 1px solid rgba(255, 255, 255, .45); color: #fff; border-radius: 6px; padding: 3px 10px; font: inherit; cursor: pointer; }

main { max-width: 1280px; margin: 0 auto; padding: 20px 20px 60px; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.grid2 > .card { margin-top: 0; }
.stack { display: grid; gap: 16px; margin-top: 16px; }

.navback { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.navback .btn { padding: 4px 14px; font-size: 13px; }

/* messages */
.msg { border-radius: 8px; padding: 9px 14px; margin-bottom: 12px; background: var(--goodt); color: var(--good); border: 1px solid #bfe3cd; }
.msg.error, .errors { background: var(--redt); color: var(--red); border: 1px solid #f0c4c7; }
.errors { border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; }
.errorlist { list-style: none; margin: 4px 0 0; padding: 0; color: var(--red); font-size: 12px; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.tile .l { font-size: 13px; color: var(--ink2); }
.tile .v { font-size: 30px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--muted); }
.tile.dark .l, .tile.dark .s { color: #dce5f5; }
.tile a { color: inherit; }

/* tables */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: right; font-weight: 600; color: var(--ink2); font-size: 12px; padding: 7px 8px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.n, th.n { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 1px solid var(--line2); border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
.desc { min-width: 220px; display: inline-block; }
.empty { color: var(--muted); padding: 14px 0; }

/* chips */
.chip { display: inline-block; border-radius: 999px; padding: 0 9px; font-size: 12px; line-height: 1.8; white-space: nowrap; background: #eef0f4; color: var(--ink2); border: 1px solid var(--line); }
.chip.p1 { background: var(--tint); color: var(--navy); border-color: var(--tint2); }
.chip.late { background: var(--redt); color: var(--red); border-color: #f0c4c7; }
.chip.ok { background: var(--goodt); color: var(--good); border-color: #bfe3cd; }
.chip.warn { background: var(--warnt); color: var(--warn); border-color: #f1dca6; }

/* bars */
.bars { display: grid; gap: 7px; }
.bar { display: grid; grid-template-columns: 210px 1fr 44px; gap: 10px; align-items: center; }
.bar .lab { font-size: 13px; }
.bar .track { height: 14px; display: flex; }
.bar .fill { background: var(--blue); border-radius: 4px 0 0 4px; min-width: 3px; height: 100%; }
.bar .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 2px; height: 24px; margin: 6px 0 10px; }
.seg > div, .seg > a { display: flex; align-items: center; justify-content: center; font-size: 12px; min-width: 3px; color: #fff; text-decoration: none; }
.seg > a:hover, .seg > a:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.seg .a1, .legend .a1 { background: #c9d8f2; color: var(--ink); } .seg .a2, .legend .a2 { background: #8fade3; color: var(--ink); } .seg .a3, .legend .a3 { background: #5383d6; }
.seg .a4, .legend .a4 { background: var(--blue); } .seg .a5, .legend .a5 { background: #16294f; } .seg .a6, .legend .a6 { background: #d0d4db; color: var(--ink); }
.legend a { color: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 6px; }
.cols { display: flex; align-items: flex-end; gap: 18px; height: 150px; padding-top: 22px; border-bottom: 1px solid var(--line2); }
.cols .c { flex: 1; max-width: 70px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.cols .c b { font-size: 12px; font-variant-numeric: tabular-nums; }
.cols .c span { width: 100%; background: var(--mid); border-radius: 4px 4px 0 0; min-height: 3px; }
.cols .c { color: inherit; text-decoration: none; }
.cols .c:hover span { background: var(--bright); }
.cols .c.on span { background: var(--navy); }
.cols .c.on b { color: var(--navy); }
.colx { display: flex; gap: 18px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.colx div { flex: 1; max-width: 70px; text-align: center; }

/* forms */
form.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; }
form.filters label { display: grid; gap: 2px; font-size: 12px; color: var(--ink2); }
input[type=text], input[type=password], input[type=search], select, textarea { font: inherit; padding: 6px 9px; border: 1px solid var(--line2); border-radius: 7px; background: #fff; color: var(--ink); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mid); outline-offset: 0; border-color: var(--bright); }
textarea { width: 100%; }
input.date { width: 120px; text-align: center; }
.btn { font: inherit; border: 1px solid var(--navy); background: var(--navy); color: #fff; border-radius: 7px; padding: 6px 16px; cursor: pointer; display: inline-block; }
.btn:hover { background: var(--blue); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--navy); }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.check { display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 5px !important; font-size: 13px !important; color: var(--ink) !important; padding-bottom: 6px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 16px; }
.fields label { display: grid; gap: 3px; font-size: 12px; color: var(--ink2); }
.fields label.wide { grid-column: 1 / -1; }
.fields input[type=text], .fields select { width: 100%; }
.actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.req { color: var(--red); }

/* detail */
.head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 22px; }
.kv div { border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-right: 3px solid var(--tint2); padding: 2px 12px 10px 0; margin-right: 4px; }
.timeline li.action { border-color: var(--blue); }
.timeline .meta { font-size: 12px; color: var(--muted); }
.timeline .note { color: var(--ink2); }
details.panel { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
details.panel summary { cursor: pointer; font-weight: 600; }

/* sign-in */
.login { max-width: 380px; margin: 9vh auto 0; }
.login .card { padding: 24px; }
.login label { display: grid; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--ink2); }
.login input { width: 100%; }
.login .btn { width: 100%; padding: 8px; }

.pager { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; color: var(--ink2); font-size: 13px; }
.pager label { display: inline-flex; align-items: center; gap: 6px; }
.pager input[type=number] { font: inherit; width: 76px; padding: 4px 6px; text-align: center; border: 1px solid var(--line2); border-radius: 7px; }
.pager .btn { padding: 4px 12px; }
.pager .steps { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.pager .total b { color: var(--ink); }
@media (max-width: 720px) { .bar { grid-template-columns: 130px 1fr 36px; } .grid2 { grid-template-columns: 1fr; } main { padding: 14px 12px 40px; } }
