:root {
  --brand-blue: #1e73be;
  --brand-dark: #0e1a2a;
  --brand-light: #f6f9fc;
  --text: #1f2933;
  --muted: #5f6c7b;
  --border: #e5e7eb;
  --success: #10b981;
  --error: #ef4444;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--brand-light);
}

.container {
  width: min(1400px, 95vw);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.brand { display: flex; align-items: center; }
.logo { height: 50px; object-fit: contain; }
.logout-link {
  color: #6b7280;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.logout-link:hover { color: #e07b3c; }

main { padding: 32px 0; }

.page-title {
  font-size: 1.6rem;
  margin: 0;
  color: var(--brand-dark);
}
.page-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 4px 0 0;
}
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.back-link {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 6px;
}
.back-link:hover { color: #e07b3c; }

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.tile {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, box-shadow .15s;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}
.tile-icon { font-size: 1.8rem; }
.tile-body { flex: 1; }
.tile-body h3 { margin: 0 0 4px; font-size: 1.05rem; color: var(--brand-dark); }
.tile-body p { margin: 0; font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.tile-arrow { color: #9ca3af; font-size: 1.2rem; }

.primary-btn {
  display: inline-block;
  background: #e07b3c;
  color: white;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 10px 18px;
  border-radius: 8px;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
  font-family: inherit;
}
.primary-btn:hover:not(:disabled) { background: #c96a28; }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.secondary-btn {
  display: inline-block;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  border: 1px solid var(--border);
  font-family: inherit;
  cursor: pointer;
}
.secondary-btn:hover { color: var(--brand-dark); border-color: var(--brand-dark); }

.empty-state {
  background: white;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.empty-state p {
  color: var(--muted);
  margin: 0 0 16px;
}

.success-banner {
  background: #ecfdf5;
  color: #065f46;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.success-link {
  color: #065f46;
  text-decoration: underline;
  margin-left: 8px;
  font-weight: 700;
}

.error-banner {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 12px;
}

.client-list {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
}
.client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
}
.client-row + .client-row { border-top: 1px solid var(--border); }
.client-row:hover { background: var(--brand-light); }
.client-main {
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.client-name {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--brand-dark);
  margin-bottom: 4px;
}
.client-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.client-types { display: inline-flex; gap: 6px; }
.type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
}
.type-html { background: #e6f0fb; color: #1e73be; }
.type-static { background: #fef3c7; color: #92400e; }
.client-arrow { color: #9ca3af; font-size: 1.1rem; }

.client-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.action-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.action-btn:hover:not(:disabled) {
  border-color: var(--brand-dark);
  color: var(--brand-dark);
  background: white;
}
.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.action-btn.danger:hover:not(:disabled) {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.upload-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.upload-section h2 {
  margin: 0 0 24px;
  color: var(--brand-dark);
  font-size: 24px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--brand-dark);
}

input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--brand-blue);
}

.upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--brand-light);
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--brand-blue);
  background: rgba(30, 115, 190, 0.05);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.upload-area p {
  margin: 8px 0;
  color: var(--text);
}

.upload-hint {
  color: var(--muted);
  font-size: 14px;
}

#file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-list {
  margin: 16px 0;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--brand-light);
  border-radius: 8px;
  margin-bottom: 8px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  font-size: 20px;
}

.file-name {
  font-weight: 500;
}

.file-size {
  color: var(--muted);
  font-size: 14px;
}

.remove-file {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.remove-file:hover {
  background: rgba(239, 68, 68, 0.1);
}

.submit-btn {
  width: 100%;
  padding: 16px;
  background: var(--brand-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.submit-btn:hover:not(:disabled) {
  background: #1565c0;
  transform: translateY(-1px);
}

.submit-btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
  transform: none;
}

.result-section {
  background: white;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-section h3 {
  color: var(--success);
  margin: 0 0 16px;
}

.result-link {
  background: var(--brand-light);
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
}

.result-link a {
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 600;
  word-break: break-all;
}

.new-review-btn {
  padding: 12px 24px;
  background: var(--brand-blue);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 16px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--muted);
  text-align: center;
  background: white;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--brand-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Review page styles */
.review-header {
  background: white;
  border-radius: 12px;
  padding: 24px 32px;
  margin-bottom: 32px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.review-header h1 {
  margin: 0 0 8px;
  color: var(--brand-dark);
}

.review-meta {
  color: var(--muted);
  font-size: 14px;
}

.gallery-container {
  background: white;
  border-radius: 12px;
  padding: 40px 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.grid {
  display: flex;
  flex-wrap: wrap;
  gap: 44px 36px;
  align-items: flex-start;
  justify-content: flex-start;
}

.card {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  max-width: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 10px;
  border-bottom: none;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--brand-dark);
}

.card-sub {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-body {
  padding: 0;
  display: block;
  background: transparent;
}

.scaled-container {
  width: 100%;
  position: relative;
  overflow: visible;
}

.scaled-container iframe {
  border: 0 !important;
  outline: none !important;
  background: transparent !important;
  display: block;
}

.scaled-content {
  transform-origin: top left;
  display: inline-block;
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.ad-image {
  display: block;
  border: none;
  outline: none;
  background: transparent;
}
