/* ===================================================================
   سامانه هماهنگی کار — design system

   Concept: the working sheet.
   This is a system of record for technical agreements, so it is drawn
   as a ruled document rather than a dashboard of floating cards.
   Content sits on ruled sheets with generous margins; spec items carry
   margin numbers because they genuinely are an ordered sequence.

   One accent only. Teal marks verified work — an acceptance criterion
   that has been met, and nothing else. When the eye finds teal on a
   page, it means "this part is proven".
   =================================================================== */

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --ink:        #142238;
  --ink-soft:   #536074;
  --ink-faint:  #8b96a6;
  --paper:      #eaeef4;
  --sheet:      #ffffff;
  --rule:       #dde4ed;
  --rule-firm:  #bfcada;

  /* Signals. Teal is reserved: it means verified, nowhere else. */
  --verified:   #0e7c6b;
  --verified-bg:#dff0ec;
  --attention:  #a8342c;
  --attention-bg:#fae9e7;
  --pending:    #8a5d10;
  --pending-bg: #fbf0da;
  --active:     #2b4f86;
  --active-bg:  #e4ecf8;

  /* Project identity palette. Assigned per project, used only as a
     colour chip so a project is recognisable at a glance. */
  --p1: #2b4f86; --p2: #0e7c6b; --p3: #7a4a86;
  --p4: #a8342c; --p5: #8a5d10; --p6: #1f6b7a;

  /* 16px base, 1.25 scale */
  --t-xs:  0.8rem;
  --t-sm:  0.9rem;
  --t-md:  1rem;
  --t-lg:  1.25rem;
  --t-xl:  1.563rem;

  --gap:   1.5rem;
  --sheet-pad: 1.75rem;
  --radius: 3px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: var(--t-md);
  line-height: 1.8;
  font-feature-settings: 'ss01';
}

a { color: var(--ink); text-decoration-color: var(--rule-firm);
    text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- shell */

.masthead {
  background: linear-gradient(105deg, #12203a 0%, #1b3357 58%, #1d4a5e 100%);
  color: #e9eef6;
}
.masthead .mark b { color: #fff; }
.masthead nav a { color: #a9bcd6; }
.masthead nav a:hover { color: #fff; border-bottom-color: #4d6b96; }
.masthead nav a[aria-current] { color: #fff; border-bottom-color: #3fb3a0; }
.masthead .whoami { color: #a9bcd6; }
.masthead button.bare { color: #a9bcd6; }
.masthead button.bare:hover { color: #fff; }
.masthead .mark svg rect { fill: rgba(255,255,255,.12); }
.masthead-inner {
  max-width: 1060px; margin: 0 auto; padding: 0 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; min-height: 60px;
}
.mark { display: flex; align-items: center; gap: .6rem; flex: 0 0 auto; }
.mark svg { display: block; }
.mark b { font-weight: 500; font-size: var(--t-sm); letter-spacing: .01em; }

.masthead nav { display: flex; gap: 1.1rem; flex: 1 1 auto; }
.masthead nav a {
  font-size: var(--t-sm); color: var(--ink-soft); text-decoration: none;
  padding: .2rem 0; border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--rule-firm); }
.masthead nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }

.whoami { display: flex; align-items: center; gap: .6rem;
          font-size: var(--t-sm); color: var(--ink-soft); }

main { max-width: 1060px; margin: 1.75rem auto 4rem; padding: 0 1.25rem; }

/* ---------------------------------------------------------------- sheet */

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--sheet-pad);
  margin-bottom: var(--gap);
}
.sheet > :first-child { margin-top: 0; }
.sheet > :last-child { margin-bottom: 0; }

.sheet-title {
  font-size: var(--t-md); font-weight: 500; margin: 0 0 .25rem;
}
.sheet-note {
  font-size: var(--t-sm); color: var(--ink-soft);
  margin: 0 0 1.25rem; max-width: 64ch;
}
h3 { font-size: var(--t-sm); font-weight: 500; color: var(--ink-soft);
     margin: 1.75rem 0 .6rem; }

.page-head { margin-bottom: 1.25rem; }
.page-head h1 { font-size: var(--t-xl); font-weight: 700; margin: 0 0 .2rem;
                line-height: 1.4; }
.page-head p { margin: 0; color: var(--ink-soft); font-size: var(--t-sm); }

/* --------------------------------------------------------------- ledger */

.ledger { width: 100%; border-collapse: collapse; }
.ledger th, .ledger td {
  text-align: right; padding: .7rem .75rem;
  border-bottom: 1px solid var(--rule); vertical-align: middle;
}
.ledger thead th {
  font-size: var(--t-xs); font-weight: 500; color: var(--ink-faint);
  border-bottom: 1px solid var(--rule-firm); padding-bottom: .45rem;
}
.ledger tbody tr:last-child td { border-bottom: none; }
.ledger tbody tr:hover { background: #f8fafb; }
.ledger .num { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.ledger .lead { font-weight: 500; }

/* progress drawn as a rule that fills, not a pill */
.measure { display: flex; align-items: center; gap: .6rem; min-width: 8rem; }
.measure-track { flex: 1 1 auto; height: 2px; background: var(--rule-firm); }
.measure-fill  { display: block; height: 2px; background: var(--verified); }
.measure-text  { font-size: var(--t-xs); color: var(--ink-soft);
                 font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure.complete .measure-text { color: var(--verified); }

/* ---------------------------------------------------------------- flags */

.flag {
  display: inline-block; font-size: var(--t-xs); line-height: 1.6;
  padding: 0 .45rem; border-radius: 2px; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--rule);
}
.flag-verified  { color: var(--verified);  background: var(--verified-bg);
                  border-color: transparent; }
.flag-attention { color: var(--attention); background: var(--attention-bg);
                  border-color: transparent; }
.flag-pending   { color: var(--pending);   background: var(--pending-bg);
                  border-color: transparent; }

.soft { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.alert-text { color: var(--attention); }

/* -------------------------------------------------------------- decision
   The one strip that answers "what needs me right now". Only drawn when
   something is actually waiting. */

.decision {
  background: var(--pending-bg);
  border: 1px solid #e5d4ad;
  border-radius: var(--radius);
  padding: .9rem 1.1rem; margin-bottom: var(--gap);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  font-size: var(--t-sm);
}
.decision strong { font-weight: 500; }

/* ----------------------------------------------------------- spec items */

.spec-list { counter-reset: spec; margin: 0; padding: 0; list-style: none; }
.spec {
  counter-increment: spec;
  position: relative;
  padding: .9rem 2.6rem .9rem 0;
  border-bottom: 1px solid var(--rule);
}
.spec:last-child { border-bottom: none; }
.spec::before {
  content: counter(spec);
  position: absolute; right: 0; top: 1rem;
  width: 1.8rem; text-align: left;
  font-size: var(--t-xs); color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.spec-head { display: flex; align-items: center; gap: .5rem;
             flex-wrap: wrap; margin-bottom: .25rem; }
.spec-kind { font-size: var(--t-xs); color: var(--ink-soft); }
.spec.is-proposed { background: var(--pending-bg); }
.spec.is-proposed::before { color: var(--pending); }
.spec.is-rejected { opacity: .5; }
.spec.is-met::before { color: var(--verified); }

.prose { max-width: 70ch; }
.prose p { margin: .3rem 0; }
.prose ul, .prose ol { margin: .3rem 0; padding-right: 1.2rem; }
.prose code {
  direction: ltr; unicode-bidi: isolate;
  font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace;
  font-size: .86em; background: var(--paper); padding: .05em .3em;
  border-radius: 2px;
}
.prose pre {
  direction: ltr; text-align: left;
  background: var(--ink); color: #dbe3ea;
  padding: .85rem 1rem; border-radius: var(--radius);
  overflow-x: auto; font-size: .86rem; line-height: 1.6;
}
.prose pre code { background: none; color: inherit; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--rule); padding: .35rem .5rem;
                       text-align: right; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: var(--t-xs); color: var(--ink-soft);
        margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: var(--t-sm);
  padding: .55rem .65rem; color: var(--ink);
  background: var(--sheet); border: 1px solid var(--rule-firm);
  border-radius: var(--radius); margin-bottom: .9rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { min-height: 6rem; resize: vertical; line-height: 1.75; }
.field-row { display: flex; gap: .9rem; flex-wrap: wrap; }
.field-row > * { flex: 1 1 190px; }

button {
  font: inherit; font-size: var(--t-sm); font-weight: 500;
  padding: .5rem 1.1rem; cursor: pointer;
  background: var(--ink); color: #fff;
  border: 1px solid var(--ink); border-radius: var(--radius);
}
button:hover { background: #22303f; }
button.quiet { background: transparent; color: var(--ink);
               border-color: var(--rule-firm); }
button.quiet:hover { border-color: var(--ink); }
button.bare { background: none; border: none; color: var(--ink-soft);
              padding: .2rem .3rem; text-decoration: underline;
              text-decoration-color: var(--rule-firm); }
button.bare:hover { color: var(--ink); }
.inline { display: inline; }

.checkline { display: flex; align-items: center; gap: .5rem;
             font-size: var(--t-sm); color: var(--ink-soft);
             margin-bottom: .9rem; }
.checkline input { width: auto; margin: 0; }

.notice {
  background: var(--attention-bg); border: 1px solid #e6c4bd;
  color: var(--attention); padding: .6rem .8rem;
  border-radius: var(--radius); font-size: var(--t-sm);
  margin-bottom: 1.1rem;
}

.empty { color: var(--ink-faint); font-size: var(--t-sm); margin: .5rem 0 0; }

/* ---------------------------------------------------------------- entry */

.entry { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }

.entry-form {
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem clamp(1.5rem, 6vw, 5rem); background: var(--sheet);
}
.entry-form-inner { width: 100%; max-width: 21rem; }
.entry h1 { font-size: var(--t-xl); font-weight: 700; margin: 1.5rem 0 .3rem;
            line-height: 1.4; }
.entry .lede { color: var(--ink-soft); font-size: var(--t-sm);
               margin: 0 0 2rem; max-width: 34ch; }
.entry button { width: 100%; padding: .65rem; }
.entry-foot { margin-top: 2.5rem; font-size: var(--t-xs); color: var(--ink-faint); }

.entry-plate {
  position: relative; background: var(--ink);
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end;
}
.entry-plate::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,16,22,.88), rgba(10,16,22,.25));
}
.entry-plate figcaption {
  position: relative; z-index: 1; color: #e7edf2;
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
  font-size: var(--t-sm); line-height: 1.9; max-width: 34ch;
}
.entry-plate figcaption b { display: block; font-weight: 500;
                            font-size: var(--t-lg); margin-bottom: .4rem; }

@media (max-width: 800px) {
  .entry { grid-template-columns: 1fr; min-height: 100dvh; }
  .entry-plate { min-height: 9rem; order: -1; }
  .entry-plate figcaption { padding: 1.25rem; }
  .entry-plate figcaption b { font-size: var(--t-md); }
  .entry-form { padding: 2rem 1.5rem 3rem; }
}

@media (max-width: 640px) {
  :root { --sheet-pad: 1.1rem; --gap: 1rem; }
  .masthead-inner { flex-wrap: wrap; gap: .6rem; padding: .6rem 1rem; }
  .masthead nav { order: 3; width: 100%; }
  main { padding: 0 .85rem; }
  .ledger th:nth-child(n+4), .ledger td:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .measure-fill { transition: width .4s ease; }
}


/* ---------------------------------------------------------------- tiles
   Four figures that answer: how much is open, how much is proven, what
   needs me, what is late. Tinted so each reads at a glance. */

.tiles {
  display: grid; gap: .75rem; margin-bottom: var(--gap);
  grid-template-columns: repeat(4, 1fr);
}
.tile {
  border-radius: var(--radius); padding: .9rem 1rem;
  border: 1px solid transparent; background: var(--sheet);
  border-color: var(--rule);
}
.tile .figure {
  display: block; font-size: 1.7rem; font-weight: 700; line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.tile .caption { display: block; font-size: var(--t-xs); color: var(--ink-soft); }
.tile .sub { display: block; font-size: var(--t-xs); color: var(--ink-faint); }

.tile-open     { background: var(--active-bg);    border-color: #cbdcf2; }
.tile-open .figure     { color: var(--active); }
.tile-verified { background: var(--verified-bg);  border-color: #bcdfd7; }
.tile-verified .figure { color: var(--verified); }
.tile-pending  { background: var(--pending-bg);   border-color: #ead7ab; }
.tile-pending .figure  { color: var(--pending); }
.tile-late     { background: var(--attention-bg); border-color: #f0cbc6; }
.tile-late .figure     { color: var(--attention); }
.tile-quiet .figure    { color: var(--ink-faint); }

@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* ------------------------------------------------------- project identity */

.pchip {
  display: inline-block; width: .55rem; height: .55rem; border-radius: 2px;
  background: var(--pc, var(--ink-faint)); margin-left: .5rem;
  vertical-align: baseline;
}
.ledger tr.project-row td:first-child { border-right: 3px solid var(--pc); }

/* ----------------------------------------------------------- status pills */

.status {
  display: inline-block; font-size: var(--t-xs); line-height: 1.7;
  padding: 0 .5rem; border-radius: 10px; white-space: nowrap;
  background: var(--paper); color: var(--ink-soft);
}
.status-in_progress { background: var(--active-bg);    color: var(--active); }
.status-review      { background: var(--pending-bg);   color: var(--pending); }
.status-blocked     { background: var(--attention-bg); color: var(--attention); }
.status-done        { background: var(--verified-bg);  color: var(--verified); }
.status-cancelled   { color: var(--ink-faint); }

/* sheet headings gain a coloured rule so sections read apart */
.sheet-title {
  display: flex; align-items: center; gap: .55rem;
}
.sheet-title::before {
  content: ''; width: 3px; height: 1.05em; border-radius: 2px;
  background: var(--active);
}
.sheet-title.t-verified::before { background: var(--verified); }
.sheet-title.t-pending::before  { background: var(--pending); }
