@font-face { font-family: "Vazirmatn"; src: local("Vazirmatn"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: local("Vazirmatn Bold"), local("Vazirmatn-Bold"); font-weight: 700; font-display: swap; }

:root {
  --sky-50: #f0f9ff; --sky-100: #e0f2fe; --sky-200: #bae6fd; --sky-300: #7dd3fc; --sky-400: #38bdf8;
  --sky-500: #0ea5e9; --sky-600: #0284c7; --sky-700: #0369a1; --sky-800: #075985; --sky-900: #0c4a6e;
  --bg: #ffffff; --surface: #ffffff; --line: #e2edf5; --line-2: #cfe3f1;
  --text: #0f2a3d; --muted: #5b7185; --faint: #94a8b8;
  --ok: #15803d; --ok-bg: #e9f8ef; --warn: #b45309; --warn-bg: #fdf4e3; --bad: #c2410c; --bad-bg: #fdeee7; --err: #dc2626;
  --radius: 12px; --shadow: 0 1px 2px rgba(12,74,110,.06), 0 6px 18px rgba(12,74,110,.06);
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sky-700); text-decoration: none; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.hidden { display: none !important; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 110% -10%, var(--sky-100), transparent 60%), radial-gradient(900px 500px at -10% 110%, var(--sky-50), transparent 60%), #fff; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 50px rgba(12,74,110,.10); padding: 34px 30px 26px; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { width: 64px; height: 64px; }
.login-brand h1 { margin: 12px 0 2px; font-size: 21px; color: var(--sky-800); }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.login-foot { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line-2); text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- form ---------- */
.field { margin-bottom: 14px; }
.field label, .lbl { display: block; font-size: 12.5px; font-weight: 700; color: var(--sky-900); margin-bottom: 5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line-2); background: #fff; border-radius: 10px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--sky-400); box-shadow: 0 0 0 3px rgba(14,165,233,.15); }
textarea.input { min-height: 84px; resize: vertical; }
.input-icon { position: relative; }
.input-icon .input { padding-left: 42px; }
.input-icon .eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.input-icon .eye:hover { background: var(--sky-50); color: var(--sky-700); }
.ltr { direction: ltr; text-align: left; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--sky-600); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-section { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 4px; margin-bottom: 16px; background: #fff; }
.form-section h3 { margin: 0 0 12px; font-size: 14px; color: var(--sky-700); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 6px 0 12px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.radio-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.radio-card input { margin-top: 5px; accent-color: var(--sky-600); }
.radio-card b { display: block; font-size: 13.5px; }
.radio-card span { font-size: 12px; color: var(--muted); }
.radio-card:has(input:checked) { border-color: var(--sky-500); background: var(--sky-50); }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; padding: 6px 0 20px; }
.err-box { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; font-size: 13px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 8px 16px; cursor: pointer; font-weight: 700; font-size: 13.5px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--sky-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--sky-700); }
.btn-soft { background: var(--sky-50); color: var(--sky-700); border-color: var(--sky-100); }
.btn-soft:hover:not(:disabled) { background: var(--sky-100); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { color: var(--sky-700); border-color: var(--sky-300); }
.btn-ok { background: var(--ok); color: #fff; } .btn-ok:hover:not(:disabled) { filter: brightness(1.08); }
.btn-bad { background: #fff; color: var(--bad); border-color: #f5c6b4; } .btn-bad:hover:not(:disabled) { background: var(--bad-bg); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; padding: 11px; font-size: 15px; }
.icon-btn { border: 1px solid var(--line-2); background: #fff; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; color: var(--sky-700); }
.icon-btn:hover { background: var(--sky-50); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; grid-template-rows: 64px 1fr; grid-template-areas: "side head" "side main"; min-height: 100vh; }
.head { grid-area: head; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 20; }
.head .title { font-weight: 700; color: var(--sky-800); font-size: 15px; }
.head .title small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; line-height: 1.2; }
.head .spacer { flex: 1; }
.hello { background: var(--sky-50); color: var(--sky-800); border: 1px solid var(--sky-100); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 700; }
.head .year-pick { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.head .year-pick select { width: auto; padding: 5px 10px; }
.power { color: var(--err); }
.side { grid-area: side; background: var(--sky-50); border-left: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 16px; margin-bottom: 8px; border-bottom: 1px solid var(--sky-100); }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; color: var(--sky-800); font-size: 15px; }
.brand span { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.nav-group { margin: 12px 0 4px; }
.nav-title { font-size: 11.5px; font-weight: 700; color: var(--sky-700); padding: 4px 10px; letter-spacing: .2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 12px; border-radius: 9px; color: var(--text); font-size: 13.5px; margin: 1px 0; }
.nav a:hover { background: var(--sky-100); }
.nav a.active { background: var(--sky-600); color: #fff; font-weight: 700; }
.nav a.active .badge { background: #fff; color: var(--sky-700); }
.badge { display: inline-block; min-width: 20px; text-align: center; padding: 0 6px; border-radius: 999px; background: var(--sky-500); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px; }
.badge.red { background: var(--bad); }
.main { grid-area: main; padding: 22px 26px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; color: var(--sky-900); }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.menu-toggle { display: none; }

/* ---------- cards / tables ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-h h3 { margin: 0; font-size: 14.5px; color: var(--sky-800); }
.card-b { padding: 16px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; font-weight: 700; color: var(--sky-800); background: var(--sky-50); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12.5px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fbfdff; }
.tbl tr.dim td { color: var(--faint); background: #fafafa; }
.tbl .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fname { font-weight: 700; color: var(--text); word-break: break-word; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty .ico { font-size: 28px; color: var(--sky-300); display: block; margin-bottom: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.toolbar .field { margin: 0; min-width: 150px; }
.toolbar select.input, .toolbar .input { padding: 6px 10px; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--sky-100); color: var(--sky-700); }
.pill.gray { background: #f1f5f9; color: #64748b; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--sky-500); }
.switch input:checked + span::after { transform: translateX(-18px); }

/* ---------- watchlist ---------- */
.watch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.wcard { border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(180deg, var(--sky-50), #fff 55%); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 196px; box-shadow: var(--shadow); }
.wcard .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.wcard h3 { margin: 0; font-size: 16px; color: var(--sky-900); }
.wcard .sub { color: var(--muted); font-size: 12px; }
.wstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wstat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; text-align: center; }
.wstat b { display: block; font-size: 18px; line-height: 1.3; color: var(--sky-800); }
.wstat.bad b { color: var(--bad); } .wstat.warn b { color: var(--warn); }
.wstat span { font-size: 11px; color: var(--muted); }
.wcard .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wcard.empty-slot { border: 2px dashed var(--sky-200); background: #fff; box-shadow: none; align-items: center; justify-content: center; color: var(--sky-600); cursor: pointer; font-weight: 700; }
.wcard.empty-slot:hover { background: var(--sky-50); }

/* category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cat-tile { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 13px; }
.cat-tile:hover, .cat-tile.active { border-color: var(--sky-400); background: var(--sky-50); }
.cat-tile.active { box-shadow: inset 0 0 0 1px var(--sky-400); }

/* ---------- upload ---------- */
.drop { border: 2px dashed var(--sky-300); border-radius: 14px; background: var(--sky-50); padding: 26px 16px; text-align: center; color: var(--sky-800); cursor: pointer; transition: .15s; }
.drop:hover, .drop.over { background: var(--sky-100); border-color: var(--sky-500); }
.drop b { display: block; font-size: 15px; }
.drop span { font-size: 12.5px; color: var(--muted); }
.up-list { margin-top: 10px; display: grid; gap: 6px; }
.up-item { display: grid; grid-template-columns: 1fr 120px 70px; gap: 10px; align-items: center; font-size: 12.5px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.bar { height: 6px; background: var(--sky-100); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--sky-500); transition: width .2s; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 12px; min-height: 60vh; }
.col { flex: 0 0 228px; background: var(--sky-50); border: 1px solid var(--sky-100); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.col-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--sky-100); }
.col-h .t { font-weight: 700; color: var(--sky-900); cursor: text; flex: 1; border-radius: 6px; padding: 0 4px; }
.col-h .t:hover { background: #fff; }
.col-h .cnt { font-size: 12px; color: var(--muted); }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; flex: 1; }
.col-body.over { background: var(--sky-100); border-radius: 0 0 14px 14px; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: grab; box-shadow: 0 1px 2px rgba(12,74,110,.05); }
.kcard:hover { border-color: var(--sky-300); }
.kcard.dragging { opacity: .45; }
.kcard b { display: block; font-size: 13.5px; word-break: break-word; }
.kcard p { margin: 3px 0 0; font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 4.8em; overflow: hidden; }
.add-card { padding: 8px 10px 10px; }
.add-card .input { padding: 6px 10px; }
.col.add-col { flex-basis: 150px; background: #fff; border-style: dashed; border-color: var(--sky-200); justify-content: center; align-items: center; min-height: 80px; cursor: pointer; color: var(--sky-600); font-weight: 700; }
.drop-marker { height: 3px; background: var(--sky-500); border-radius: 3px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(12,42,61,.35); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 16px; box-shadow: 0 30px 60px rgba(12,74,110,.25); }
.modal.wide { width: min(760px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-h h3 { margin: 0; font-size: 15.5px; color: var(--sky-900); }
.modal-b { padding: 16px 18px; }
.modal-f { display: flex; gap: 8px; justify-content: flex-start; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.x { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
@keyframes fade { from { opacity: 0; } }

/* thread */
.thread { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; padding: 4px 2px 10px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 13px; }
.msg.liana { align-self: flex-start; background: var(--sky-50); border: 1px solid var(--sky-100); border-top-right-radius: 4px; }
.msg.client { align-self: flex-end; background: #f8fafc; border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.sys-rejected { border-color: #f5c6b4; background: var(--bad-bg); }
.msg.sys-approved { border-color: #bfe6cc; background: var(--ok-bg); }
.msg .who { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; justify-content: space-between; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.doc-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; font-size: 12.5px; background: var(--sky-50); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.doc-meta b { color: var(--sky-900); }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 18px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--sky-800); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13px; max-width: 360px; animation: fade .2s; }
.toast.err { background: var(--err); } .toast.ok { background: var(--ok); }

/* report matrix */
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #e2e8f0; }
.dot.approved { background: #22c55e; } .dot.pending { background: #f59e0b; } .dot.rejected { background: #ea580c; } .dot.draft { background: var(--sky-300); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.note-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 12px; font-size: 12.5px; white-space: pre-wrap; }
.stack { display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.alert { border-radius: 12px; padding: 10px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--sky-50); color: var(--sky-800); border: 1px solid var(--sky-100); }

@media (max-width: 1100px) { .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .row2 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "head" "main"; grid-template-rows: 60px 1fr; }
  .side { position: fixed; right: 0; top: 0; width: 270px; z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 30px rgba(0,0,0,.1); }
  .side.open { transform: none; }
  .menu-toggle { display: inline-grid; }
  .head { padding: 0 10px; gap: 8px; } .head .title { display: none; }
  .hello { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; padding: 4px 10px; }
  .head .year-pick span { display: none; }
  .main { padding: 16px 14px 32px; }
  .watch-grid, .grid-2, .grid-3, .radio-cards { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .up-item { grid-template-columns: 1fr 70px; } .up-item .bar { display: none; }
  .doc-meta { grid-template-columns: 1fr; }
}

.tbl td.fname, .tbl td a.fname { white-space: nowrap; }
