/* off-panel admin site, «میز مدیر» (10 Azar 1405).
   The panel's typeface and calm, on a dark indigo bar and a cool grey-lilac paper, so it is never taken for the
   panel (white bar, petrol ink, teal). One memorable thing: the report card is one ruled sheet, not loose cards.
   No inline style anywhere: the site's CSP allows this file alone. No motion. */

@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.cdc140628f11.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.7958481fe611.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #f1f2f6;
  --surface: #ffffff;
  --ink: #1c1a35;
  --ink-soft: #5b5975;
  --line: #dadbe5;
  --line-strong: #b9bacb;
  --bar: #25224a;
  --bar-ink: #e9e8f6;
  --accent: #4338b5;
  --accent-press: #352b97;
  --accent-wash: #ebe9fb;
  --lead: #8a5d0c;
  --lead-wash: #fbf1dc;
  --danger: #a8203c;
  --danger-wash: #fbe9ed;
  --ok: #17694a;
  --ok-wash: #e2f3ea;
  --radius: 6px;
  --font: "Vazirmatn", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.9 var(--font); }
h1, h2, h3, p, dl, dd, figure { margin: 0; }
h1 { font-size: 24px; line-height: 1.6; font-weight: 700; }
h2 { font-size: 18px; line-height: 1.7; font-weight: 700; }
h3 { font-size: 14px; line-height: 1.8; font-weight: 700; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-press); }
small, .soft { color: var(--ink-soft); }
small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[dir="ltr"] { unicode-bidi: isolate; }

/* ---- the bar ------------------------------------------------------------------------------------ */
.skip { position: absolute; top: 8px; right: 8px; z-index: 10; padding: 8px 14px; border-radius: var(--radius); background: var(--surface); color: var(--ink); transform: translateY(-200%); }
.skip:focus { transform: none; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 24px; padding: 10px max(16px, calc((100% - 1120px) / 2)); background: var(--bar); color: var(--bar-ink); }
.topbar :focus-visible { outline-color: #fff; }
.brand { color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; padding-inline-end: 16px; border-inline-end: 1px solid rgba(255, 255, 255, 0.22); }
.brand:hover { color: #fff; }
.topbar nav.bar { display: flex; flex-wrap: wrap; gap: 2px 18px; flex: 1 1 auto; }
.topbar nav.bar a { color: var(--bar-ink); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.topbar nav.bar a:hover { color: #fff; }
.topbar nav.bar a[aria-current="page"] { color: #fff; font-weight: 700; border-bottom-color: #fff; }
.topbar .who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 14px; }
.topbar .who .name { color: #fff; }
.topbar .who a, .topbar .linklike { color: var(--bar-ink); }
.topbar form { margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- the page ----------------------------------------------------------------------------------- */
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.page:focus { outline: none; }
.crumb { display: inline-block; margin-bottom: 8px; font-size: 14px; }
.lead-in { max-width: 66ch; margin: 4px 0 16px; }
.aside { max-width: 72ch; margin-top: 12px; font-size: 13px; }
.section { margin-top: 32px; }
.section.first { margin-top: 12px; }
.section > h2 { margin-bottom: 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head p { max-width: 66ch; }

.team-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.team-head h1 { font-size: 28px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { margin: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 16px 0 8px; border-bottom: 1px solid var(--line-strong); }
.tabs a { padding: 8px 0; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card.pad { padding: 20px; }
.card.narrow { max-width: 560px; }
.empty { color: var(--ink-soft); }

.badge { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: 12px; line-height: 1.9; background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.live { background: var(--ok-wash); color: var(--ok); border-color: transparent; }
.badge.off { background: var(--danger-wash); color: var(--danger); border-color: transparent; }

.notice { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.notice.success { border-color: transparent; background: var(--ok-wash); color: var(--ok); }
.notice.error { border-color: transparent; background: var(--danger-wash); color: var(--danger); }
.notice.warning { border-color: transparent; background: var(--lead-wash); color: var(--lead); }
.notice p + p { margin-top: 4px; }

/* ---- buttons and forms -------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 16px; border-radius: var(--radius); border: 1px solid var(--accent);
       background: var(--accent); color: #fff; font: 700 14px/1.6 var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-press); border-color: var(--accent-press); color: #fff; }
.btn.quiet { background: var(--surface); color: var(--accent); border-color: var(--line-strong); font-weight: 400; }
.btn.quiet:hover { border-color: var(--accent); color: var(--accent-press); }
.btn.small { min-height: 34px; padding: 3px 12px; font-size: 13px; }
.btn.big { min-height: 46px; padding: 8px 22px; font-size: 15px; }
.btn.danger { background: var(--danger); border-color: var(--danger); }

.form { display: grid; gap: 16px; max-width: 620px; }
.form h2 { margin-bottom: -4px; }
.field { display: grid; gap: 4px; }
.field label, .field legend { font-weight: 700; font-size: 14px; }
.field .optional { margin-inline-start: 6px; font-weight: 400; font-size: 12px; color: var(--ink-soft); }
input[type="text"], input[type="password"], input:not([type]), select, input[name="from"], input[name="to"] {
  width: 100%; min-height: 42px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: 400 15px/1.6 var(--font);
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field .hint { font-size: 13px; color: var(--ink-soft); }
.field .error { font-size: 13px; color: var(--danger); font-weight: 700; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.group { display: grid; gap: 12px; padding: 14px 16px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
fieldset.group > legend { padding: 0 6px; font-size: 13px; color: var(--ink-soft); }
fieldset.choice { display: grid; gap: 6px; }
label.option { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
label.option input, .field.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.field.check { grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; }
.field.check .hint { grid-column: 1 / -1; }

/* ---- sign-in and other bare pages --------------------------------------------------------------- */
body.bare { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
            background: linear-gradient(to bottom, var(--bar) 0 168px, var(--paper) 168px); }
.bare-box { width: 100%; max-width: 420px; padding: 28px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.bare-box .mark { margin: -28px -24px 20px; padding: 10px 24px; background: var(--paper); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
                  font-weight: 700; color: var(--accent); }
.bare-box h1 { font-size: 21px; margin-bottom: 4px; }
.bare-box form { display: grid; gap: 14px; margin-top: 18px; }
.bare-box p + p { margin-top: 8px; }

/* ---- the period strip ----------------------------------------------------------------------------- */
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 8px 0 16px; padding: 10px 14px;
          background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.period-name { font-weight: 700; margin-inline-end: auto; }
.period-links { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.period-links a { padding: 5px 12px; text-decoration: none; color: var(--ink); font-size: 14px; }
.period-links a + a { border-inline-start: 1px solid var(--line-strong); }
.period-links a[aria-current="true"] { background: var(--accent); color: #fff; }
.period-box { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.period-box input, .period-box select { width: 9.5em; min-height: 36px; }
.period-box select { width: auto; }

/* ---- tables (they stack on a phone) --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: 13px; color: var(--ink-soft); font-weight: 700; background: var(--paper); }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th, .table tfoot td { border-top: 2px solid var(--line-strong); border-bottom: 0; font-weight: 700; }
.table th[scope="row"] { font-weight: 700; }
.table .num { text-align: left; white-space: nowrap; }
.table tr.off { color: var(--ink-soft); }
.table caption { text-align: right; }
.pager { display: flex; gap: 8px; margin-top: 12px; }

/* ---- a team's people ------------------------------------------------------------------------------ */
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.person { display: grid; grid-template-columns: minmax(200px, 1.2fr) 2fr auto; gap: 8px 20px; align-items: center; padding: 14px 16px; }
.person + .person { border-top: 1px solid var(--line); }
.person.off { background: var(--paper); color: var(--ink-soft); }
.who-cell { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.who-cell .login { font-size: 13px; color: var(--ink-soft); }
.role { font-size: 13px; color: var(--ink-soft); }
.role.lead { color: var(--lead); font-weight: 700; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 24px; font-size: 13px; }
.facts dt { color: var(--ink-soft); }
.facts dd { color: var(--ink); }
.facts.wide { margin: 16px 0; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }
.log { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.log .when { color: var(--ink-soft); margin-inline-end: 8px; }

/* ---- the report card: one ruled sheet ------------------------------------------------------------- */
.figures { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
           background: var(--surface); border: 1px solid var(--ink); border-radius: 2px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line-strong); }
.figure { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; border-inline-start: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.figure:nth-child(3n + 1) { border-inline-start: 0; }
.figure h3 { font-size: 14px; }
.figure .big { font-size: 30px; line-height: 1.3; font-weight: 700; color: var(--ink); }
.figure .big small { font-size: 14px; font-weight: 400; }
.figure .low { color: var(--ink-soft); }
.compare { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; font-size: 13px; }
.compare div { display: contents; }
.compare dt { color: var(--ink-soft); }
.vs { font-size: 12px; }
.vs.up { color: var(--accent); }
.vs.down { color: var(--lead); }
.vs.same { color: var(--ink-soft); }
.meaning { margin-top: auto; padding-top: 8px; border-top: 1px dotted var(--line-strong); font-size: 12.5px; line-height: 1.8; color: var(--ink-soft); }

.chart-box { padding: 16px 16px 8px; }
svg.chart { display: block; width: 100%; height: auto; max-height: 220px; direction: ltr; }   /* oldest day on the left, as the panel's monitor */
svg.chart .bar { fill: var(--accent); }
svg.chart .bar.zero { fill: transparent; }
svg.chart .bar:hover { fill: var(--accent-press); }
svg.chart .base { stroke: var(--line-strong); stroke-width: 1; }
svg.chart .axis { fill: var(--ink-soft); font: 400 12px var(--font); }
details.days { margin-top: 8px; }
details.days summary { cursor: pointer; color: var(--accent); font-size: 14px; width: max-content; }
details.days .table-wrap { margin-top: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---- narrow screens ------------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3n + 1) { border-inline-start: 1px solid var(--line); }
  .figure:nth-child(2n + 1) { border-inline-start: 0; }
  .person { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .page { padding: 16px 16px 48px; }
  h1, .team-head h1 { font-size: 22px; }
  .topbar { gap: 2px 14px; }
  .brand { border: 0; padding: 0; }
  .topbar nav.bar { order: 3; flex-basis: 100%; gap: 2px 16px; }
  .figures { grid-template-columns: 1fr; box-shadow: none; }
  .figure, .figure:nth-child(n) { border-inline-start: 0; }
  .period-name { flex-basis: 100%; }
  .period-box input { width: 8.5em; }

  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody, .table tfoot, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table th[scope="row"] { grid-column: 1 / -1; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table th, .table td { padding: 2px 0; border: 0; text-align: right; }
  .table .num { text-align: right; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-soft); font-size: 13px; }
  .table td:empty { display: none; }
  .table tfoot tr { border-top: 2px solid var(--line-strong); }
}
