/* ── Custom Sites Business Hub — shared design system ─────────────────── */

:root {
  --primary:        #00bf63;
  --primary-dark:   #009e52;
  --primary-light:  #e6f9ef;
  --accent:         #0f2a44;
  --accent-hover:   #1a3d5c;
  --accent-soft:    #7fa8c9;
  --bg:             #f4f7fa;
  --white:          #ffffff;
  --text:           #0f2a44;
  --text-gray:      #6b7280;
  --border:         #e5e7eb;
  --danger:         #dc2626;
  --danger-bg:      #fee2e2;
  --warn:           #ca8a04;
  --info:           #2563eb;
  --purple:         #7c3aed;
  --radius:         14px;
  --shadow-sm:      0 1px 2px rgba(15, 42, 68, .06);
  --shadow-md:      0 4px 16px rgba(15, 42, 68, .08);
  --shadow-lg:      0 12px 40px rgba(15, 42, 68, .16);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── App header ────────────────────────────────────────────────────────── */

.app-header {
  background: var(--accent);
  color: var(--white);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.app-header .hleft, .app-header .hright {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-header .logo { height: 38px; display: block; }
.app-header .logo-sm { height: 32px; }

.app-header .app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.01em;
  white-space: nowrap;
}

.app-header .header-date {
  font-size: 12.5px;
  color: var(--accent-soft);
  white-space: nowrap;
}

/* header buttons */
.hbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,.06);
  border: 1px solid #3a5a7a;
  color: var(--white);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 9px;
  padding: 8px 14px;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.hbtn:hover { background: var(--accent-hover); }
.hbtn.primary { background: var(--primary); border-color: var(--primary); }
.hbtn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.hbtn.amber { color: #f59e0b; border-color: #f59e0b; }
.hbtn.icon-only { padding: 8px 11px; font-size: 15px; }

/* ── Generic buttons ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9px;
  padding: 9px 16px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(0,191,99,.28); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: var(--white); color: var(--accent); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }

.btn-danger-soft { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.btn-danger-soft:hover { background: #fecaca; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-blue-soft { background: #eff6ff; color: var(--info); border-color: #93c5fd; }
.btn-blue-soft:hover { background: #dbeafe; }

.btn-blue { background: var(--info); color: #fff; }
.btn-blue:hover { background: #1d4ed8; }

.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #6d28d9; }

.btn-orange-soft { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.btn-orange-soft:hover { background: #ffedd5; }

.btn-amber { background: #f59e0b; color: #fff; }
.btn-amber:hover { background: #d97706; }

.btn-ghost { background: transparent; color: var(--text-gray); }
.btn-ghost:hover { background: var(--bg); color: var(--accent); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-gray); }
.field label .req { color: var(--danger); }

.input, select.input, textarea.input {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,191,99,.14); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }

.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); }
.checkbox-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ── Modal ─────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 68, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn .15s ease;
}

.modal {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn .18s ease;
}
.modal.modal-lg { max-width: 720px; }
.modal.modal-sm { max-width: 440px; }

.modal-header {
  background: var(--accent);
  color: var(--white);
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-header .modal-x {
  background: none; border: none; color: var(--accent-soft);
  font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.modal-header .modal-x:hover { color: #fff; background: var(--accent-hover); }

.modal-body { padding: 22px; overflow-y: auto; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--white);
}
.modal-footer .spacer { margin-right: auto; }

.form-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 18px 0 12px;
}
.form-section-title:first-child { margin-top: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ── Toast ─────────────────────────────────────────────────────────────── */

#toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  animation: popIn .18s ease;
}
.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}
table.data thead th {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 12px 14px;
  position: sticky;
  top: 0;
  z-index: 5;
  cursor: pointer;
  user-select: none;
}
table.data thead th:hover { background: var(--accent-hover); }
table.data thead th.no-sort { cursor: default; }
table.data thead th.no-sort:hover { background: var(--accent); }
table.data tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(15,42,68,.05);
  color: var(--text);
}
table.data tbody tr { cursor: pointer; }
table.data tbody tr.selected td { background: var(--primary) !important; color: #fff !important; }
table.data tbody tr.selected td a { color: #fff !important; }

/* ── Progress bar ──────────────────────────────────────────────────────── */

.progress {
  height: 9px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
  width: 100%;
}
.progress > div {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  width: 0%;
  transition: width .25s ease;
}
.progress.blue > div { background: var(--info); }
.progress.purple > div { background: var(--purple); }

/* ── Code / SQL block ──────────────────────────────────────────────────── */

.code-block {
  background: #0d1b2a;
  color: #d4e3f0;
  font-family: 'Consolas', 'Menlo', monospace;
  font-size: 11.5px;
  line-height: 1.55;
  padding: 14px 16px;
  border-radius: 10px;
  overflow: auto;
  max-height: 220px;
  white-space: pre;
}

/* ── Placeholder (under construction) page ─────────────────────────────── */

.uc-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.uc-card {
  text-align: center;
  max-width: 420px;
}
.uc-icon {
  width: 96px; height: 96px;
  margin: 0 auto 26px;
  border-radius: 28px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
}
.uc-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 10px; }
.uc-card p { color: var(--text-gray); font-size: 14.5px; line-height: 1.6; margin-bottom: 30px; }

/* ── Utility ───────────────────────────────────────────────────────────── */

.muted { color: var(--text-gray); }
.hidden { display: none !important; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
