/* PaintCheck web: same dark RTL theme as the desktop app */
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Medium.ttf") format("truetype"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("/static/fonts/Vazirmatn-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  --bg: #101316; --panel: #14181c; --panel2: #181c21; --field: #0b0e11; --line: #272d34; --line2: #20262c;
  --text: #e8ecf0; --muted: #8a94a0; --dim: #5b636c; --accent: #1e9bd7; --accent2: #3aaee6; --on-accent: #04121b;
  --danger: #e5584f; --ok: #3fbf7f; --warn: #e5a54f; --gold: #f2b01e; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Vazirmatn", Tahoma, sans-serif; font-size: 14.5px; }
body { min-height: 100vh; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 15px; margin: 0 0 10px; font-weight: 700; }
p { line-height: 1.8; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; }
hr { border: 0; border-top: 1px solid var(--line2); margin: 18px 0; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; background: var(--panel); border-left: 1px solid var(--line2); padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 900; font-size: 19px; letter-spacing: .3px; }
.brand { color: var(--text); text-decoration: none !important; }
.logo-tile { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; flex: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.6); overflow: hidden; }
.logo-tile img { width: 92%; height: 92%; object-fit: contain; display: block; }
.brand.big { flex-direction: column; text-align: center; gap: 12px; }
.brand.big .logo-tile { width: 96px; height: 96px; border-radius: 24px; }
.brand.big small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; margin-top: 4px; letter-spacing: 0; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--panel2); text-decoration: none; }
.nav a.on { background: rgba(30,155,215,.14); color: var(--accent2); font-weight: 700; }
.nav .sec { color: var(--dim); font-size: 12px; padding: 14px 12px 4px; font-weight: 700; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side .foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--line2); font-size: 12.5px; color: var(--muted); }
.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }
.plan-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 13px; }
.plan-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.plan-chip.warn .dot { background: var(--warn); } .plan-chip.bad .dot { background: var(--danger); }

/* ---------- cards / grid ---------- */
.card { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: 800; margin-top: 6px; }
.stat .v small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }
.field { margin-bottom: 14px; }
input[type=text], input[type=password], input[type=number], input[type=tel], input[type=search], input[type=time],
input[type=date], select, textarea {
  width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 11px; font: inherit; outline: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; line-height: 1.8; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; vertical-align: middle; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; cursor: pointer; margin: 0; }
.jdate { display: flex; gap: 6px; }
.jdate select { width: auto; flex: 1; min-width: 0; padding-left: 4px; padding-right: 4px; }
.jdate select.y { flex: 1.2; }
.input-group { display: flex; gap: 6px; } .input-group > * { flex: 1; }
.hint { font-size: 12px; color: var(--dim); margin-top: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 16px; font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: #1f252b; border-color: #3a434d; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--danger); }
.btn.ok { color: var(--ok); }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line2); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line2); white-space: nowrap; }
th { background: var(--panel2); color: var(--muted); font-weight: 600; font-size: 13px; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: left; }
.empty { text-align: center; color: var(--muted); padding: 34px; }

/* ---------- badges / alerts ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: rgba(63,191,127,.35); background: rgba(63,191,127,.08); }
.badge.warn { color: var(--warn); border-color: rgba(229,165,79,.35); background: rgba(229,165,79,.08); }
.badge.bad { color: var(--danger); border-color: rgba(229,88,79,.35); background: rgba(229,88,79,.08); }
.badge.info { color: var(--accent2); border-color: rgba(30,155,215,.35); background: rgba(30,155,215,.08); }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; font-size: 14px; }
.alert.ok { color: var(--ok); border-color: rgba(63,191,127,.35); background: rgba(63,191,127,.07); }
.alert.err { color: #ff8a82; border-color: rgba(229,88,79,.4); background: rgba(229,88,79,.08); }
.alert.warn { color: var(--warn); border-color: rgba(229,165,79,.4); background: rgba(229,165,79,.07); }
.alert.info { color: var(--accent2); border-color: rgba(30,155,215,.35); background: rgba(30,155,215,.07); }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px;
  background: radial-gradient(800px 400px at 80% -10%, rgba(30,155,215,.12), transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 420px; }
.auth .brand { justify-content: center; padding-bottom: 22px; font-size: 24px; }
.auth .card { padding: 26px; }

/* ---------- filters / pager ---------- */
.filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { margin: 0; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }

/* ---------- charts ---------- */
.chart { width: 100%; min-height: 240px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart .grid-l { stroke: var(--line2); stroke-dasharray: 3 4; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar { transition: opacity .15s; } .chart .bar:hover { opacity: .8; }
.legend-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 5px; vertical-align: -1px; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: #0b0e11; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.4); }

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.plan { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.plan .price { font-size: 22px; font-weight: 800; }
.free-plan { border-color: rgba(63,191,127,.45); background: linear-gradient(90deg, rgba(63,191,127,.08), transparent 60%), var(--panel); }
.m0 { margin: 0 !important; }
.plan.pick { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

/* ---------- modal ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: 460px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.6); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .side { position: fixed; right: 0; z-index: 40; transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 40px rgba(0,0,0,.5); }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 50px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
}
