* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.6 "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", Arial, sans-serif;
  color: #0f172a;
  background: #f5f7fb;
}
a { color: #0b5fff; text-decoration: none; }
a:hover { text-decoration: underline; }

header.topbar {
  background: #0f172a;
  color: #fff;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.topbar .brand { font-weight: 700; letter-spacing: .02em; font-size: 16px; color:#fff }
.topbar .brand span { color: #38bdf8; }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a, .topbar nav button {
  color: #cbd5e1; font-size: 13px; background: none; border: none; cursor: pointer;
}
.topbar nav button:hover, .topbar nav a:hover { color: #fff; }

main { max-width: 1100px; margin: 0 auto; padding: 28px; }
h1 { font-size: 22px; margin: 0 0 18px; font-weight: 700; }
h2 { font-size: 17px; margin: 24px 0 12px; font-weight: 600; }

.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: 600 13px inherit;
  cursor: pointer;
  background: #f1f5f9;
  color: #0f172a;
  transition: .12s;
}
.btn:hover { background: #e2e8f0; }
.btn.primary { background: #0b5fff; color: #fff; }
.btn.primary:hover { background: #094be0; }
.btn.danger  { background: #fee2e2; color: #991b1b; }
.btn.danger:hover { background: #fecaca; }
.btn.ghost   { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 5px 9px; font-size: 12px; }

.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.site-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 18px;
  transition: transform .12s, box-shadow .12s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(15, 23, 42, .08); border-color: #cbd5e1; }
.site-card .name { font-size: 16px; font-weight: 600; }
.site-card .domain { font-size: 12px; color: #64748b; word-break: break-all; direction: ltr; text-align: start; }
.site-card .counts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pill {
  font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; font-weight: 500;
}
.pill.open { background: #fee2e2; color: #b91c1c; }
.pill.in_progress { background: #fef3c7; color: #92400e; }
.pill.closed { background: #d1fae5; color: #065f46; }
.pill.issue { background: #fde2e1; color: #b91c1c; }
.pill.improve { background: #ddebff; color: #0b5fff; }
.pill.total { background: #e0e7ff; color: #3730a3; }

input[type=text], input[type=password], input[type=email], textarea, select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font: 14px inherit;
  color: #0f172a;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #0b5fff; box-shadow: 0 0 0 3px rgba(11, 95, 255, .15);
}
label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.field { margin-bottom: 14px; }

table.tickets { width: 100%; border-collapse: collapse; }
table.tickets th, table.tickets td {
  text-align: start; padding: 12px 10px; border-bottom: 1px solid #e2e8f0; font-size: 13px;
  vertical-align: top;
}
table.tickets th { font-size: 11px; letter-spacing: .02em; color: #475569; font-weight: 600; }
table.tickets tr:hover td { background: #f8fafc; }
table.tickets td .desc { max-width: 540px; overflow: hidden; text-overflow: ellipsis; }

.modal-bp { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; max-width: 640px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.modal header { padding: 16px 20px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.modal header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .body { padding: 18px 20px; overflow: auto; }
.modal footer { padding: 14px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 8px; }

.codebox {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 8px;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-x: auto;
  white-space: pre;
  direction: ltr;
  text-align: left;
}
.copy-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.copy-row .key {
  font: 12px ui-monospace, Menlo, Consolas, monospace;
  background: #f1f5f9; padding: 6px 10px; border-radius: 6px; flex: 1;
  word-break: break-all; direction: ltr; text-align: left;
}

.error { color: #b91c1c; font-size: 13px; padding: 8px 0; }
.success { color: #15803d; font-size: 13px; padding: 8px 0; }
.muted { color: #64748b; }
.empty { color: #64748b; text-align: center; padding: 40px 20px; }

.screenshot-thumb { max-width: 80px; max-height: 50px; border: 1px solid #e2e8f0; border-radius: 4px; cursor: pointer; display: block; }
.screenshot-full { max-width: 100%; max-height: 70vh; border: 1px solid #e2e8f0; border-radius: 8px; display: block; margin: 0 auto; }

/* Force LTR for things that should stay LTR: URLs, code, timestamps, user-agent. */
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 12px 16px; }
  table.tickets th:nth-child(4), table.tickets td:nth-child(4),
  table.tickets th:nth-child(5), table.tickets td:nth-child(5) { display: none; }
}
