:root {
  --ruby: #6e0b1c;
  --ruby-2: #4a0712;
  --surface: #2a0813;
  --surface-2: #3a0d1b;
  --line: rgba(230, 196, 90, 0.25);
  --gold: #e6c45a;
  --text: #fff;
  --muted: rgba(243, 233, 207, 0.7);
  --green: #34d399;
  --red: #ff6b7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: linear-gradient(160deg, var(--ruby), #1a0409) fixed; color: var(--text); font-family: Vazirmatn, Tahoma, sans-serif; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 12px; text-align: center; }
.login-card h1 { margin: 0; font-size: 22px; }
.logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto; }
label { display: grid; gap: 6px; text-align: right; font-size: 13px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #1a050b; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.error { color: var(--red); min-height: 1em; margin: 0; font-size: 13px; }

.btn { border: 0; border-radius: 12px; padding: 10px 16px; cursor: pointer; font-weight: 600; color: var(--text); background: var(--surface-2); }
.btn:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.gold { background: var(--gold); color: #2a1a02; }
.btn.red { background: rgba(255, 107, 122, 0.15); color: var(--red); border: 1px solid var(--red); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: 13px; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: rgba(26, 4, 9, 0.7); border-left: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--gold); font-size: 18px; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
nav { display: grid; gap: 4px; flex: 1; align-content: start; }
nav button { text-align: right; background: transparent; border: 0; color: var(--muted); padding: 10px 12px; border-radius: 10px; cursor: pointer; }
nav button.on, nav button:hover { background: var(--surface-2); color: var(--text); }
nav button.on { box-shadow: inset -3px 0 0 var(--gold); }
.me { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.content { padding: 20px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.top h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat { padding: 14px; }
.stat b { display: block; font-size: 26px; color: var(--gold); }
.stat span { color: var(--muted); font-size: 13px; }

.bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.bar input, .bar select { width: auto; flex: 1; min-width: 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px; text-align: right; border-bottom: 1px solid rgba(230, 196, 90, 0.12); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: rgba(0, 0, 0, 0.2); position: sticky; top: 0; }
tbody tr:hover { background: rgba(230, 196, 90, 0.06); }
tr.click { cursor: pointer; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--surface-2); }
.tag.green { color: var(--green); }
.tag.red { color: var(--red); }
.tag.gold { color: var(--gold); }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form { display: grid; gap: 10px; max-width: 560px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.check input { width: auto; }

dialog { border: 0; padding: 0; background: transparent; color: var(--text); width: min(560px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg { display: grid; gap: 12px; max-height: 88vh; overflow: auto; }
.dlg h3 { margin: 0; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--gold); padding: 10px 18px; border-radius: 12px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); color: var(--red); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; }
  nav { grid-auto-flow: column; overflow-x: auto; }
  nav button { white-space: nowrap; }
  .content { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
}
