:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --line: #e5e7eb;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Vazirmatn, Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.8;
}
a { color: var(--brand-dark); text-decoration: none; }
.layout { display: flex; min-height: 100vh; }

/* sidebar */
.sidebar {
  width: 250px; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 19px; font-weight: 700; color: #fff; padding: 8px 10px 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: #cbd5e1; padding: 11px 14px; border-radius: 10px; transition: .15s; font-weight: 500;
}
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #1e293b; }
.botname { font-size: 13px; color: #94a3b8; padding: 6px 10px; }
.logout { display: block; padding: 10px 14px; color: #fca5a5; border-radius: 10px; }
.logout:hover { background: #1e293b; }

/* main */
.main { flex: 1; min-width: 0; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); padding: 18px 28px; }
.topbar h1 { margin: 0; font-size: 21px; }
.content { padding: 26px 28px; }
.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 12px 18px; border-radius: 10px; margin: 18px 28px 0; }

/* cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card h2 { margin: 0 0 16px; font-size: 17px; }
.grid { display: grid; gap: 16px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat .num { font-size: 30px; font-weight: 800; color: var(--brand-dark); }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* table */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 13px; font-weight: 600; background: #fafafa; }
tr:hover td { background: #f9fafb; }

/* badges */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-pending { background: #fef3c7; color: #92400e; }
.b-approved { background: #dbeafe; color: #1e40af; }
.b-sold, .b-done { background: #dcfce7; color: #166534; }
.b-rejected { background: #fee2e2; color: #991b1b; }
.b-offered { background: #e0e7ff; color: #3730a3; }
.b-accepted { background: #cffafe; color: #155e75; }
.b-receipt_pending { background: #fce7f3; color: #9d174d; }
.b-card, .b-form { background: #f3f4f6; color: #374151; }

/* buttons & forms */
.btn { display: inline-block; border: none; cursor: pointer; padding: 9px 18px; border-radius: 10px; font-family: inherit; font-size: 14px; font-weight: 600; transition: .15s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-ghost { background: #eef2ff; color: var(--brand-dark); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
label { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 14px; }
.field { margin-bottom: 8px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.muted { color: var(--muted); }
.code { direction: ltr; display: inline-block; background: #f3f4f6; padding: 3px 9px; border-radius: 7px; font-family: monospace; font-size: 13px; user-select: all; }
.copybox { direction: ltr; background: #f8fafc; border: 1px dashed var(--brand); border-radius: 10px; padding: 10px 14px; font-family: monospace; user-select: all; word-break: break-all; }

/* media */
.media-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.media-grid img, .media-grid video { max-width: 220px; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); object-fit: cover; }
.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0d9488, #0f172a); }
.login-card { background: #fff; border-radius: 18px; padding: 38px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { text-align: center; margin: 0 0 6px; font-size: 22px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.login-error { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 9px; text-align: center; margin-bottom: 14px; font-size: 13px; }

/* filter bar */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filterbar a { padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 13px; }
.filterbar a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.detail-list dt { font-weight: 700; color: var(--muted); font-size: 13px; margin-top: 10px; }
.detail-list dd { margin: 2px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2 { grid-template-columns: 1fr; }
}