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

:root {
  --pine: #1f4d3a; --pine-2: #2c6650; --brass: #b08a45; --brass-soft: #f4ecdc;
  --bg: #f7f6f2; --card: #fff; --ink: #1d2320; --muted: #6b726e; --line: #e4e2db;
  --good: #2f7d4f; --good-bg: #e6f3eb; --warn: #9a5b00; --warn-bg: #fdf1dc; --bad: #a33a2f; --bad-bg: #fbe9e6;
  --r: 10px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.7; }
a { color: var(--pine-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; font-weight: 650; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
code { background: var(--brass-soft); padding: 0 .3em; border-radius: 4px; }
pre { white-space: pre-wrap; font-family: inherit; margin: 0; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--pine); color: #fff; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; min-height: 54px; }
.brand { color: #fff; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.brand span { color: #e5cf9f; font-weight: 400; font-size: .85rem; margin-inline-start: .3rem; }
.top nav { display: flex; gap: .2rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.top nav a { color: #dfe9e3; padding: .4rem .7rem; border-radius: 8px; white-space: nowrap; font-size: .93rem; }
.top nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.top nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.badge { background: var(--brass); color: #fff; border-radius: 99px; padding: 0 .45em; font-size: .75rem; margin-inline-start: .3rem; font-weight: 600; }
.usermenu { position: relative; }
.usermenu summary { cursor: pointer; list-style: none; padding: .4rem .7rem; border-radius: 8px; white-space: nowrap; color: #fff; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary::after { content: " ▾"; opacity: .7; }
.usermenu > div { position: absolute; inset-inline-end: 0; top: 110%; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 180px; padding: .4rem; display: flex; flex-direction: column; }
.usermenu > div a, .linkbtn { color: var(--ink); padding: .45rem .7rem; border-radius: 6px; text-align: start; }
.usermenu > div a:hover, .linkbtn:hover { background: var(--bg); text-decoration: none; }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; color: var(--bad); }

main { max-width: 1180px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.card > .head { margin-bottom: .4rem; }
.crumb { margin: 0; font-size: .85rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid2 > .card { margin-bottom: 0; }
.grid2 { margin-bottom: 1rem; }
.note { background: var(--brass-soft); padding: .4rem .7rem; border-radius: 8px; margin: .4rem 0 0; }

/* stats */
.stats { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .6rem 1rem; min-width: 120px; display: flex; flex-direction: column; color: var(--ink); }
.stat:hover { border-color: var(--pine-2); text-decoration: none; }
.stat b { font-size: 1.4rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn { background: var(--warn-bg); border-color: #f0d9b0; }

/* tables & lists */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.card .tbl { border: 0; }
.tbl th { text-align: start; font-weight: 600; color: var(--muted); font-size: .85rem; padding: .55rem .7rem; border-bottom: 1px solid var(--line); background: #fbfaf7; }
.tbl td { padding: .55rem .7rem; border-bottom: 1px solid #f0eee8; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl.compact td { padding: .35rem .5rem; }
.tbl tr.best td { background: var(--good-bg); }
.tbl tr.clickable { cursor: pointer; }
.tbl tr.clickable:hover td { background: #faf9f5; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid #f0eee8; }
.list > li:last-child { border-bottom: 0; }
.list > li > a, .list > li > details > summary { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem .2rem; color: var(--ink); flex-wrap: wrap; }
.list > li > a:hover { background: #faf9f5; text-decoration: none; }
.people details > summary { cursor: pointer; list-style: none; }
.people details > summary::-webkit-details-marker { display: none; }
.people details[open] { background: #fbfaf7; border-radius: 8px; padding-bottom: .6rem; }
.timeline { list-style: none; margin: .6rem 0 0; padding: 0; }
.timeline li { padding: .4rem 0; border-bottom: 1px dashed var(--line); }
.empty { color: var(--muted); text-align: center; padding: 1rem; }
td.empty { text-align: center; }
.unmatched { color: var(--warn); border-bottom: 1px dashed var(--warn); }
.unmatched:hover { text-decoration: none; }

/* pills */
.pill { display: inline-block; background: var(--brass-soft); color: #6b5222; border-radius: 99px; padding: .05rem .6rem; font-size: .82rem; white-space: nowrap; }
.pill.sm { font-size: .75rem; padding: 0 .5rem; }
.pill.good { background: var(--good-bg); color: var(--good); }
.stock { color: var(--good); font-weight: 600; }
.st { display: inline-block; border-radius: 99px; padding: 0 .6rem; font-size: .8rem; white-space: nowrap; }
.st-new { background: #e8eef9; color: #2c4f8f; }
.st-quoted { background: var(--brass-soft); color: #6b5222; }
.st-follow { background: var(--warn-bg); color: var(--warn); }
.st-won { background: var(--good-bg); color: var(--good); }
.st-lost { background: #eeeeee; color: #666; }
.fu.late { color: var(--bad); font-weight: 600; }
.fu.today { color: var(--warn); font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: .3rem; margin-bottom: .8rem; overflow-x: auto; }
.tabs a { padding: .3rem .8rem; border-radius: 99px; color: var(--muted); white-space: nowrap; }
.tabs a.on { background: var(--pine); color: #fff; }

/* forms */
input, select, textarea { font: inherit; border: 1px solid #d6d3ca; border-radius: 8px; padding: .45rem .6rem; background: #fff; color: var(--ink); width: 100%; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pine-2); outline-offset: 0; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
label { display: flex; flex-direction: column; gap: .2rem; font-size: .9rem; color: #3d4441; }
label.radio { flex-direction: row; align-items: center; gap: .4rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .9rem .9rem; display: flex; flex-direction: column; gap: .6rem; }
legend { padding: 0 .4rem; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; margin-top: .7rem; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .actions { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.stack.narrow, form.narrow { max-width: 640px; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row > select { width: auto; }
.search { display: flex; gap: .4rem; flex-wrap: wrap; }
.search input { width: 260px; }
.search select { width: auto; }
details.add > summary, details.inline-add > summary { cursor: pointer; color: var(--pine-2); font-weight: 600; }
details.inline-add { margin-top: .6rem; }
.fu-pick { display: flex; gap: .4rem; }
.fu-pick select { flex: 1; }
.fu-pick input { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 600; font-size: .92rem; border: 1px solid #cfccc2; background: #fff; color: var(--ink); border-radius: 8px; padding: .4rem .9rem; min-height: 40px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--pine-2); text-decoration: none; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.primary:hover { background: var(--pine-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--pine-2); }
.btn.sm { min-height: 32px; padding: .15rem .7rem; font-size: .85rem; }
.btn.wide { width: 100%; }
.btns { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
button.x { border: 0; background: none; color: #b5b1a6; font-size: 1.2rem; cursor: pointer; padding: 0 .3rem; }
button.x:hover { color: var(--bad); }

.flash { padding: .6rem 1rem; border-radius: var(--r); margin-bottom: 1rem; background: var(--good-bg); color: var(--good); border: 1px solid #cbe6d5; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: #f2cfca; }

/* review */
.review-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.rv-name { display: flex; flex-direction: column; }
.rv-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.rv-actions input { width: 170px; }
.rv-actions select { width: 200px; }

/* messages */
.msg header { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; }
.chats { background: #fbfaf7; padding: .6rem; border-radius: 8px; font-size: .85rem; overflow-x: auto; }

/* login */
main.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: .8rem; padding: 1.6rem; }
.login-brand { font-weight: 800; font-size: 1.4rem; color: var(--pine); text-align: center; margin-bottom: .4rem; }
.login-brand span { color: var(--brass); font-weight: 400; font-size: 1rem; }

@media (max-width: 820px) {
  html { font-size: 14.5px; }
  .grid2 { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; padding: .3rem .6rem; gap: .3rem; }
  .top nav { order: 3; flex-basis: 100%; }
  .usermenu { margin-inline-start: auto; }
  .search input { width: 100%; }
  .form-grid .span2 { grid-column: auto; }
  .tbl { display: block; overflow-x: auto; white-space: nowrap; }
  .rv-actions input, .rv-actions select { width: 100%; }
}
