/* Growth Ninjas Workflow Dashboard — UI styling
   Brand: #006EB9 / #005691 / #e6f0f8
   Text: #1a1a1a   Secondary: #5a6a7d   BG: #f7f9fc   Borders: #dfe5ec */

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: #f7f9fc;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: #006EB9; text-decoration: none; }
a:hover { color: #005691; text-decoration: underline; }

/* ── Topbar ── */
.topbar {
  background: #fff; padding: 12px 24px; display: flex; align-items: center; gap: 20px;
  border-bottom: 1px solid #dfe5ec; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.topbar .logo-link { display: flex; align-items: center; }
.topbar img.logo { height: 36px; width: auto; display: block; }
.topbar .divider { width: 1px; height: 28px; background: #dfe5ec; }
.topbar .title { font-size: 14px; font-weight: 600; color: #1a1a1a; letter-spacing: -.005em; }
.topbar .title .accent { color: #006EB9; }
.topbar .topnav { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; }
.topbar .topnav a { color: #5a6a7d; font-weight: 500; }
.topbar .topnav a:hover { color: #006EB9; text-decoration: none; }
.topbar .topnav .user { color: #1a1a1a; font-weight: 600; padding-left: 18px; border-left: 1px solid #dfe5ec; }
.topbar .topnav .logout { color: #a92020; }
.topbar .topnav .logout:hover { color: #7a1818; }

.topbar .title-home { color: #1a1a1a; text-decoration: none; }
.topbar .title-home:hover { color: #006EB9; }
.topbar .title-sep { color: #cbd6e2; margin: 0 4px; }
.topbar .title-portal { display: inline-flex; align-items: center; gap: 8px; }
.topbar .title-portal img.portal-logo { height: 24px; max-width: 80px; display: block; }

/* Sub-navigation (admin section) */
.subnav {
  display: flex; gap: 4px; margin-bottom: 24px; border-bottom: 1px solid #dfe5ec;
}
.subnav a {
  padding: 10px 16px; font-size: 13px; font-weight: 600; color: #5a6a7d;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
  text-decoration: none; transition: color .15s, border-color .15s;
}
.subnav a:hover { color: #1a1a1a; text-decoration: none; }
.subnav a.active { color: #006EB9; border-bottom-color: #006EB9; }

/* Iframe wrapper for catalog view (topbar persists) */
.catalog-wrap {
  position: fixed; top: 60px; left: 0; right: 0; bottom: 0; background: #f7f9fc;
}
.catalog-frame {
  width: 100%; height: 100%; border: 0; display: block;
}

/* Portal card logo (primary identifier when present — bigger than just an icon) */
.portal-card .portal-card-logo {
  height: 56px; max-width: 100%; width: auto; display: block;
  margin: 4px 0 12px; object-fit: contain; object-position: left center;
}

/* Status pills (used in admin/portals) */
.status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.status-pill.status-stuck { background: #fde8e8; color: #a92020; }
.status-pill.status-pending { background: #fef3c7; color: #92400e; }
.status-pill.status-done { background: #d8f3dc; color: #1a7e3e; }

/* Markdown-rendered manual */
.manual-content {
  background: #fff; border: 1px solid #dfe5ec; border-radius: 8px;
  padding: 32px 40px; max-width: 900px; margin: 0 auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.03); line-height: 1.65;
}
.manual-content h1,
.manual-content h2,
.manual-content h3,
.manual-content h4,
.manual-content h5 { color: #1a1a1a; letter-spacing: -.01em; line-height: 1.25; }
.manual-content h1 { font-size: 28px; font-weight: 700; margin: 0 0 4px; }
.manual-content h2 { font-size: 22px; font-weight: 700; margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 1px solid #eef1f6; }
.manual-content h3 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.manual-content h4 { font-size: 14px; font-weight: 700; margin: 18px 0 6px; color: #5a6a7d; text-transform: uppercase; letter-spacing: .04em; }
.manual-content p  { margin: 0 0 14px; }
.manual-content ul,
.manual-content ol { margin: 0 0 14px 24px; }
.manual-content ul li,
.manual-content ol li { margin-bottom: 6px; }
.manual-content a  { color: #006EB9; }
.manual-content a:hover { color: #005691; }
.manual-content strong { color: #1a1a1a; font-weight: 600; }
.manual-content em { color: #5a6a7d; }
.manual-content hr { border: 0; border-top: 1px solid #eef1f6; margin: 32px 0; }
.manual-content blockquote {
  border-left: 3px solid #006EB9; background: #e6f0f8;
  padding: 12px 18px; margin: 14px 0; border-radius: 0 4px 4px 0; color: #1a1a1a;
}
.manual-content code {
  background: #eef1f6; padding: 2px 6px; border-radius: 3px;
  font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: .9em; color: #1a1a1a;
}
.manual-content pre {
  background: #1a1a1a; color: #f7f9fc; padding: 14px 16px; border-radius: 6px;
  overflow-x: auto; margin: 14px 0; font-size: 12px; line-height: 1.55;
}
.manual-content pre code { background: transparent; padding: 0; color: inherit; font-size: inherit; }
.manual-content table {
  border-collapse: collapse; margin: 16px 0; font-size: 13px;
  border: 1px solid #dfe5ec; border-radius: 6px; overflow: hidden;
}
.manual-content table th,
.manual-content table td { padding: 8px 12px; border-bottom: 1px solid #eef1f6; vertical-align: top; text-align: left; }
.manual-content table th {
  background: #f7f9fc; font-weight: 700; font-size: 11px;
  color: #5a6a7d; text-transform: uppercase; letter-spacing: .04em;
}
.manual-content table tr:last-child td { border-bottom: none; }
.manual-content .heading-permalink {
  color: #cbd6e2; text-decoration: none; margin-left: 6px; font-weight: 400;
}
.manual-content h2:hover .heading-permalink,
.manual-content h3:hover .heading-permalink,
.manual-content h4:hover .heading-permalink { color: #006EB9; }
.manual-content img { max-width: 100%; height: auto; border-radius: 6px; }

/* File input styling */
input[type="file"] {
  padding: 8px; border: 1px solid #dfe5ec; border-radius: 6px;
  font-size: 13px; font-family: inherit; background: #f7f9fc;
}
input[type="file"]::file-selector-button {
  background: #fff; border: 1px solid #dfe5ec; border-radius: 4px;
  padding: 4px 12px; font-size: 12px; font-weight: 500; cursor: pointer;
  color: #1a1a1a; margin-right: 12px; font-family: inherit;
}
input[type="file"]::file-selector-button:hover { background: #e6f0f8; border-color: #006EB9; color: #006EB9; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 32px auto; padding: 0 24px; }
.container-narrow { max-width: 640px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.page-head .muted { font-size: 13px; }
.muted { color: #5a6a7d; }
.hint { color: #7c98b6; font-size: 11px; font-weight: 400; }

/* ── Auth (login) ── */
.auth-shell { min-height: calc(100vh - 100px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border: 1px solid #dfe5ec;
  border-radius: 8px; padding: 32px; box-shadow: 0 4px 12px rgba(0,0,0,.04);
}
.auth-card h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; }
.auth-card .muted { margin-bottom: 24px; font-size: 13px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 20px 0; color: #7c98b6; font-size: 12px;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: #dfe5ec; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 16px; border-radius: 6px; font-size: 14px; font-weight: 600;
  background: #fff; color: #1a1a1a; border: 1px solid #dfe5ec; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-google:hover { background: #f7f9fc; border-color: #006EB9; text-decoration: none; }

/* ── Forms ── */
input[type="text"], input[type="password"], input[type="email"] {
  padding: 10px 12px; border: 1px solid #dfe5ec; border-radius: 6px; font-size: 14px;
  font-family: inherit; color: #1a1a1a; transition: border-color .15s, box-shadow .15s; background: #fff;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus {
  outline: none; border-color: #006EB9; box-shadow: 0 0 0 3px rgba(0,110,185,.12);
}
.form-card {
  background: #fff; border: 1px solid #dfe5ec; border-radius: 8px; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.form-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.form-card label.cb { flex-direction: row; gap: 8px; align-items: center; font-weight: 400; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; border-top: 1px solid #eef1f6; }
.form-meta { font-size: 12px; color: #5a6a7d; padding: 12px; background: #f7f9fc; border-radius: 4px; }
.form-meta div { margin-bottom: 4px; }
.field-err { color: #a92020; font-size: 12px; font-weight: 500; }

fieldset.portals-field {
  border: 1px solid #dfe5ec; border-radius: 6px; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
fieldset.portals-field legend {
  font-size: 12px; font-weight: 700; color: #5a6a7d; text-transform: uppercase;
  letter-spacing: .04em; padding: 0 6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s; font-family: inherit;
}
.btn-primary { background: #006EB9; color: #fff; border-color: #006EB9; }
.btn-primary:hover { background: #005691; border-color: #005691; color: #fff; text-decoration: none; }
.btn-secondary { background: #fff; color: #1a1a1a; border-color: #dfe5ec; }
.btn-secondary:hover { background: #f7f9fc; border-color: #006EB9; color: #006EB9; text-decoration: none; }
.btn-link {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: #006EB9; text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }
.btn-danger { color: #a92020; }
.btn-danger:hover { color: #7a1818; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.alert-ok  { background: #d8f3dc; color: #1a7e3e; border: 1px solid #a7e0b4; }
.alert-err { background: #fde8e8; color: #a92020; border: 1px solid #f5c2c2; }

/* ── Portal grid (home page) ── */
.portal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.portal-card {
  background: #fff; border: 1px solid #dfe5ec; border-radius: 8px; padding: 20px;
  display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: #1a1a1a;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.portal-card:hover {
  border-color: #006EB9; box-shadow: 0 4px 12px rgba(0,110,185,.08);
  transform: translateY(-2px); text-decoration: none;
}
.portal-card.is-empty { opacity: .6; }
.portal-name { font-size: 18px; font-weight: 600; color: #006EB9; }
.portal-desc { font-size: 13px; color: #5a6a7d; }
.portal-meta {
  margin-top: auto; padding-top: 12px; border-top: 1px solid #eef1f6;
  display: flex; justify-content: space-between; gap: 8px; font-size: 11px;
}
.portal-slug { color: #5a6a7d; font-family: 'SF Mono', Menlo, Consolas, monospace; }
.portal-synced { color: #1a7e3e; font-weight: 500; }
.portal-warning { color: #a92020; font-weight: 500; }

.empty-state {
  background: #fff; border: 1px dashed #dfe5ec; border-radius: 8px;
  padding: 48px 24px; text-align: center; color: #5a6a7d;
}
.empty-state h2 { font-size: 16px; color: #1a1a1a; margin-bottom: 8px; }

/* ── Data table (admin user list) ── */
.data-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid #dfe5ec; border-radius: 8px; overflow: hidden;
}
.data-table th {
  background: #f7f9fc; text-align: left; padding: 12px 14px; font-size: 11px;
  font-weight: 700; color: #5a6a7d; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid #dfe5ec;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid #eef1f6; vertical-align: middle; font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f7f9fc; }
.data-table .actions { display: flex; gap: 12px; }

/* ── Pills / tags ── */
.role-pill {
  display: inline-block; background: #006EB9; color: #fff; padding: 2px 8px;
  border-radius: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.role-pill.role-user { background: #5a6a7d; }
.portal-tag {
  display: inline-block; background: #e6f0f8; color: #005691;
  padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 500;
  font-family: 'SF Mono', Menlo, Consolas, monospace; margin-right: 4px;
}

/* ── Error pages ── */
.error-page {
  background: #fff; border: 1px solid #dfe5ec; border-radius: 8px;
  padding: 64px 24px; text-align: center;
}
.error-code { font-size: 64px; font-weight: 700; color: #006EB9; line-height: 1; margin-bottom: 16px; }
.error-page h1 { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.error-page .btn { margin-top: 24px; }
