@font-face {
  font-family: "Vazirmatn";
  src: url("/vendor/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --text: #1c2230;
  --muted: #5d6677;
  --border: #e1e4ea;
  --accent: #1f5fae;
  --accent-soft: #e6eefa;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --warn: #9a6400;
  --warn-soft: #fdf1d8;
  --bad: #b3261e;
  --bad-soft: #fbe5e3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --surface: #1a1f28; --surface-2: #202633; --text: #e6e9ef; --muted: #9aa3b2;
    --border: #2c3442; --accent: #7fb0f0; --accent-soft: #1e2d44;
    --ok: #6fd39a; --ok-soft: #173525; --warn: #f0c060; --warn-soft: #3a2f14; --bad: #f28b82; --bad-soft: #3d1e1c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #1a1f28; --surface-2: #202633; --text: #e6e9ef; --muted: #9aa3b2;
  --border: #2c3442; --accent: #7fb0f0; --accent-soft: #1e2d44;
  --ok: #6fd39a; --ok-soft: #173525; --warn: #f0c060; --warn-soft: #3a2f14; --bad: #f28b82; --bad-soft: #3d1e1c;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.75 "Vazirmatn", Tahoma, sans-serif;
  font-feature-settings: "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .5em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; margin-top: 1.4em; }
h3 { font-size: 1rem; }
code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; direction: ltr; unicode-bidi: embed; }
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* layout */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.top-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 800; color: var(--text); white-space: nowrap; }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
nav.main a { padding: 6px 12px; border-radius: 8px; color: var(--muted); }
nav.main a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav.main a:hover { text-decoration: none; color: var(--text); }
.logout { color: var(--muted); font-size: .9rem; }
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.grid2 > .card + .card { margin-top: 0; }

/* controls */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
input[type=text], input[type=number], input[type=search], input[type=password], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; min-height: 38px;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 8px; padding: 6px 12px; min-height: 38px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; cursor: pointer; background: var(--surface); font-size: .9rem; min-height: 32px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
label.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; }

/* badges */
.badge { display: inline-block; font-size: .78rem; padding: 1px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }

/* needs list */
.need-row { display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: start; color: inherit; }
.need-row:hover { text-decoration: none; border-color: var(--accent); }
.need-row .title { font-weight: 700; }
.deadline { text-align: center; border-radius: 8px; padding: 6px 4px; background: var(--surface-2); font-size: .85rem; line-height: 1.5; }
.deadline b { display: block; font-size: 1.05rem; }
.deadline.urgent { background: var(--bad-soft); color: var(--bad); }
.deadline.soon { background: var(--warn-soft); color: var(--warn); }
.deadline.past { opacity: .6; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list > .card + .card { margin-top: 0; }

/* need detail */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 22px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.callout { border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; font-weight: 600; }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.bad { background: var(--bad-soft); color: var(--bad); }
ul.clean { margin: 0; padding-inline-start: 20px; }
ul.clean li + li { margin-top: 4px; }
ul.checks { list-style: none; padding: 0; margin: 0; }
ul.checks li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
ul.checks input { margin-top: 7px; }
.shot { max-width: 100%; border: 1px solid var(--border); border-radius: 8px; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num { white-space: nowrap; }
tr.dim td { opacity: .65; }

.copy { border: 0; background: none; padding: 0 4px; min-height: 0; color: var(--muted); cursor: pointer; }
.copy:hover { color: var(--accent); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-size: .9rem; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* products */
.spec-box { display: flex; gap: 18px; flex-wrap: wrap; align-items: end; }
.spec-box .field { display: flex; flex-direction: column; gap: 4px; }
.spec-box .field span { color: var(--muted); font-size: .82rem; }
.spec-box input[type=number] { width: 110px; }
.dims { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.dims div b { font-size: 1.1rem; }

/* docs */
.docs { display: grid; grid-template-columns: 200px 1fr; gap: 18px; }
.docs nav a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.docs nav a.active { background: var(--accent-soft); color: var(--accent); }
.md { overflow-wrap: anywhere; }
.md table { margin: 10px 0; border: 1px solid var(--border); }
.md pre { background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; }

/* login */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.login h1 { font-size: 1.15rem; text-align: center; margin-bottom: 8px; }
.login button { background: var(--accent); color: #fff; border: 0; margin-top: 6px; }
.error { color: var(--bad); margin: 0; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 720px) {
  .docs { grid-template-columns: 1fr; }
  .need-row { grid-template-columns: 1fr; }
  .deadline { display: flex; gap: 8px; justify-content: center; align-items: baseline; }
  .deadline b { display: inline; }
}
