:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e1;
  --accent: #1a5d3a;
  --accent-light: #e8f3ec;
  --warn: #b87a00;
  --warn-light: #fcf3e0;
  --danger: #b03030;
  --danger-light: #f7e0e0;
  --done: #1a5d3a;
  --done-light: #d9ebe0;
  --pending: #6b6b6b;
  --pending-light: #ececec;
}
* { box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", "Heebo", "Assistant", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  margin: 0;
  padding: 24px 16px 80px;
  line-height: 1.55;
  direction: rtl;
}
.container { max-width: 1180px; margin: 0 auto; }
header.top {
  background: linear-gradient(135deg, #1a5d3a 0%, #2a8559 100%);
  color: #fff;
  padding: 22px 28px 20px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(26,93,58,0.15);
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
header.top h1 { margin: 0; font-size: 22px; font-weight: 700; }
header.top .subtitle { font-size: 13px; opacity: 0.9; margin-top: 4px; }
header.top nav { display: flex; gap: 14px; align-items: center; }
header.top .brand {
  display: flex; align-items: center; gap: 14px;
}
header.top .brand-logo {
  height: 34px; width: auto; display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
header.top .brand-divider {
  width: 1px; height: 38px;
  background: rgba(255,255,255,0.35);
}
header.top .brand-title h1 { line-height: 1.15; }
header.top .product-tag {
  display: inline-block;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,0.18);
  margin-bottom: 6px;
}
.powered-by {
  text-align: center;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 28px;
  padding: 14px 0 4px;
  letter-spacing: 0.03em;
}
.powered-by .ocw-mark {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); font-weight: 700;
  text-decoration: none;
}
.powered-by .ocw-mark svg { height: 14px; width: auto; }
.powered-by .ocw-mark svg path { fill: var(--accent); }
header.top nav a {
  color: #fff; text-decoration: none; font-size: 13.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; background: rgba(255,255,255,0.12);
}
header.top nav a:hover { background: rgba(255,255,255,0.22); }
header.top nav a.active { background: rgba(255,255,255,0.95); color: var(--accent); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 18px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 10px;
}
.card.kpi { padding: 16px 20px; }
.kpi .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 700; color: var(--ink); }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 760px) {
  .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

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

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pill.paid { background: var(--done); color: #fff; }
.status-pill.pending { background: var(--pending-light); color: var(--muted); }
.status-pill.warn { background: var(--warn); color: #fff; }
.status-pill.danger { background: var(--danger); color: #fff; }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.filters a {
  padding: 6px 14px; border-radius: 999px; text-decoration: none;
  background: #fafaf8; color: var(--muted); font-size: 13px; font-weight: 600;
  border: 1px solid var(--line);
}
.filters a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  position: relative;
  padding-right: 22px;
  padding-bottom: 14px;
  border-right: 2px solid var(--line);
  margin-right: 6px;
}
.timeline li:last-child { border-right-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; right: -7px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--pending-light); border: 2px solid var(--card);
}
.timeline li.ok::before { background: var(--accent); }
.timeline li.warn::before { background: var(--warn); }
.timeline li.fail::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-light); }
.timeline .date { font-size: 12px; color: var(--muted); font-weight: 600; }
.timeline .event { font-size: 13.5px; margin-top: 2px; }
.timeline .details { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: monospace; }

.issue { padding: 10px 14px; border-radius: 8px; background: var(--warn-light); border-right: 4px solid var(--warn); margin-bottom: 8px; font-size: 13.5px; }
.issue.danger { background: var(--danger-light); border-color: var(--danger); }
.issue.resolved { background: var(--done-light); border-color: var(--accent); opacity: 0.7; }
.issue .label { font-weight: 700; }
.issue .meta { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: monospace; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  border: 0;
  cursor: pointer;
}
.btn.warn { background: var(--warn); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

input[type=text], input[type=password], input[type=number], input[type=email], select, textarea {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafaf8;
  width: 100%;
}

a { color: var(--accent); }
.muted { color: var(--muted); }
.mono { font-family: "SF Mono", Menlo, monospace; font-size: 12px; }

footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 28px; }

/* Audit timeline additions (2026-05-17) */
.timeline.audit li { padding: 10px 14px; border-right: 4px solid var(--line); margin-bottom: 8px; background: #fafaf8; border-radius: 6px; }
.timeline.audit li.ok   { border-right-color: #2e7d32; }
.timeline.audit li.info { border-right-color: #1565c0; }
.timeline.audit li.warn { border-right-color: var(--warn); }
.timeline.audit li.fail { border-right-color: var(--danger); background: #fff5f5; }
.timeline.audit .ev-icon { display: inline-block; margin-left: 6px; }
.timeline.audit .email-block { margin-top: 8px; padding: 8px 10px; background: #fff; border: 1px dashed var(--line); border-radius: 6px; font-size: 13px; }
.timeline.audit .details { font-family: "SF Mono", Menlo, monospace; font-size: 11px; white-space: pre-wrap; background: #f7f7f7; padding: 6px; border-radius: 4px; margin-top: 4px; max-height: 250px; overflow: auto; }
.status-pill.info { background: #e3f2fd; color: #1565c0; }
.email-icon { font-size: 14px; }

/* Files grid + modal (2026-05-18) */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.file-card {
  background: #fafaf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  user-select: none;
}
.file-card:hover {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(26,93,58,0.12);
  transform: translateY(-1px);
}
.file-icon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.file-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.35;
  margin-bottom: 4px;
  min-height: 34px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.file-meta { font-size: 11px; color: var(--muted); }

.modal { position: fixed; inset: 0; z-index: 1000; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.modal-box {
  position: absolute; top: 4vh; left: 4vw; right: 4vw; bottom: 4vh;
  background: #fff; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fafaf8;
}
.modal-head strong { font-size: 14px; word-break: break-word; }
.modal-body { flex: 1; overflow: hidden; }

/* Findings list inside table (2026-05-18) */
.findings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; max-width: 340px; }
.finding-item {
  font-size: 12px; line-height: 1.4;
  padding: 4px 9px 4px 9px;
  border-radius: 6px;
  border-right: 3px solid var(--warn);
  background: var(--warn-light);
  color: #5a3a00;
}
.finding-item.blocker { border-right-color: var(--danger); background: var(--danger-light); color: #6a1a1a; }
.finding-more { font-size: 11px; color: var(--muted); padding: 0 4px; font-weight: 600; }

/* Email cell — full subject + colored dot (2026-05-18) */
.email-cell { display: inline-flex; align-items: flex-start; gap: 6px; max-width: 280px; }
.email-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}
.email-status-dot.paid    { background: var(--done); }
.email-status-dot.warn    { background: var(--warn); }
.email-status-dot.danger  { background: var(--danger); }
.email-status-dot.pending { background: var(--pending); }
.email-subject-text {
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

/* Email tooltip on hover (2026-05-18) */
.has-tip { position: relative; display: inline-block; }
.has-tip .tip {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  width: 360px;
  max-width: 92vw;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 12px 14px;
  text-align: right;
  font-size: 12.5px;
  line-height: 1.5;
  direction: rtl;
}
.has-tip:hover .tip,
.has-tip:focus-within .tip { display: block; }
.has-tip .tip::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  transform: rotate(-45deg);
}
.tip-row { color: var(--ink); margin-bottom: 4px; }
.tip-k { color: var(--muted); font-weight: 600; margin-left: 4px; }
.tip-subj { font-weight: 600; }
.tip-body {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: #333;
  font-size: 12px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}
