/* Minimal, functional admin styling - Phase 1 priority is correctness, not
   visual design. Fine to restyle later without touching any route logic. */
body { font-family: -apple-system, Segoe UI, Arial, sans-serif; margin: 0; background: #f4f5f7; color: #1a1a1a; }
header.topbar { background: #1c4c04; color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
header.topbar a { color: #fff; text-decoration: none; margin-left: 16px; }
main { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 20px; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e2e2e2; font-size: 13px; }
th { background: #eef0ea; }
.card { background: #fff; border-radius: 6px; padding: 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; }
.status-active { background: #dff5df; color: #1c4c04; }
.status-awaiting_payment { background: #eee; color: #666; }
.status-pending_review { background: #fff3cd; color: #7a5b00; }
.status-completed { background: #e0e8ff; color: #1a3a8a; }
.status-rejected { background: #ffe0e0; color: #8a1a1a; }
.status-paused { background: #f0e0ff; color: #4a1a8a; }
label { display: block; margin-top: 12px; font-size: 13px; font-weight: bold; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: 8px; margin-top: 4px; box-sizing: border-box; border: 1px solid #ccc; border-radius: 4px;
}
button, input[type=submit] {
  margin-top: 16px; background: #2e6b0a; color: #fff; border: 0; padding: 10px 18px;
  border-radius: 4px; cursor: pointer; font-size: 14px;
}
button.danger { background: #a31c1c; }
button.secondary { background: #666; }
.error { background: #ffe0e0; color: #8a1a1a; padding: 10px; border-radius: 4px; margin-bottom: 12px; }
.muted { color: #777; font-size: 12px; }
.inline-form { display: inline; }

/* Order form (src/views/order.ejs) */
.product-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.product-option { flex: 1 1 180px; border: 2px solid #ddd; border-radius: 6px; padding: 12px; cursor: pointer; }
.product-option.selected { border-color: #2e6b0a; background: #f4fbf0; }
.product-option h3 { margin: 0 0 4px; font-size: 15px; }
.product-option .price { font-size: 20px; font-weight: bold; color: #2e6b0a; }
.creative-grid { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.creative-option { border: 2px solid #ddd; border-radius: 4px; padding: 4px; cursor: pointer; }
.creative-option.selected { border-color: #2e6b0a; }
.creative-option img { display: block; max-width: 100px; }
.char-counter { font-size: 11px; color: #777; margin-top: 4px; }
.char-counter.over { color: #a31c1c; font-weight: bold; }
#coupon-status { font-size: 12px; margin-top: 4px; }
#coupon-status.over { color: #a31c1c; font-weight: bold; }
.live-preview { border: 1px solid #ccc; border-radius: 6px; padding: 12px; background: #fafafa; position: sticky; top: 16px; }
.preview-image-ad { position: relative; }
.preview-image-ad img { display: block; width: 200px; }
.preview-caption { width: 200px; box-sizing: border-box; padding: 4px 6px; font-size: 12px; text-align: center; background: rgba(255,255,255,.9); border: 1px solid #ddd; border-top: none; }
.preview-text-ad { width: 200px; }
.preview-text-ad .title { display: block; font-weight: bold; color: #2e6b0a; text-decoration: underline; margin-bottom: 4px; }
.preview-text-ad .body { font-size: 12px; color: #333; }
.order-layout { display: flex; gap: 24px; align-items: flex-start; }
.order-form-col { flex: 1 1 auto; min-width: 0; }
.order-preview-col { flex: 0 0 240px; }

/* Self-serve UX additions (2026-09-01 pass, inspired by Google Ads/Taboola's
   own advertiser dashboards - see ad-system-plan-v2.md's update of the same
   date): account-level summary cards, a spend/delivery progress bar, a
   filter bar, and row-level self-serve action buttons. */
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-card { flex: 1 1 140px; background: #fff; border-radius: 6px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.stat-value { font-size: 22px; font-weight: bold; color: #1c4c04; }
.stat-label { font-size: 12px; color: #777; margin-top: 2px; }

.delivery-bar { width: 140px; height: 6px; background: #e2e2e2; border-radius: 3px; margin-top: 4px; overflow: hidden; }
.delivery-bar-fill { height: 100%; background: #2e6b0a; }

.filter-bar { display: flex; gap: 20px; align-items: flex-end; background: #fff; border-radius: 6px; padding: 12px 16px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.filter-bar label { margin-top: 0; }
.filter-bar select { margin-top: 4px; width: auto; }

.row-actions { display: flex; gap: 8px; align-items: center; }
.row-actions form { margin: 0; }
.row-actions button { margin-top: 0; padding: 5px 10px; font-size: 12px; }
.secondary-link { color: #666; font-size: 12px; text-decoration: underline; }

/* Sites page (src/views/sites.ejs): a real toggle-switch control instead of
   a text button for active/visible-to-advertisers, and a small external-
   link icon next to each domain so you can check a site without leaving
   the admin panel. */
.visit-link { color: #1a1a1a; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.visit-link:hover { text-decoration: underline; }
.visit-link-icon { color: #888; flex: 0 0 auto; }
.visit-link:hover .visit-link-icon { color: #2e6b0a; }

.toggle-form { display: inline-block; }
.toggle-switch {
  margin-top: 0; position: relative; width: 40px; height: 22px; border-radius: 11px;
  border: 0; padding: 0; cursor: pointer; background: #ccc; transition: background .15s ease;
}
.toggle-switch.on { background: #2e6b0a; }
.toggle-switch .toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s ease;
}
.toggle-switch.on .toggle-knob { left: 20px; }
