/* siteforge shared brand stylesheet (storefront, auth + public legal pages) */
:root {
  --ink: #111827;
  --charcoal: #1a1d23;
  --accent: #c026d3;          /* fuchsia-600 - links/highlights on white */
  --accent-dark: #a21caf;     /* hover */
  --brand-cyan: #22d3ee;
  --brand-fuchsia: #d946ef;
  --brand-gradient: linear-gradient(135deg, #22d3ee 0%, #a855f7 50%, #d946ef 100%);
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --bg: #f9fafb;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- header / nav (same as storefront) ---------- */
.header { background: #ffffff; color: var(--ink); position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); }
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand img { width: 30px; height: 30px; border-radius: 6px; }
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.nav a { color: #374151; text-decoration: none; margin-left: 14px; font-size: 14px; font-weight: 600; }
.nav a:hover { color: var(--accent); }
.nav .btn { background: var(--brand-gradient); color: #fff; padding: 8px 14px; border-radius: 8px; }
.nav .btn:hover { filter: brightness(0.94) saturate(1.1); color: #fff; }

/* ---------- hero / storefront ---------- */
.hero { max-width: 1120px; margin: 0 auto; padding: 90px 24px 70px; text-align: center; }
.hero h1 { font-size: 46px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -0.02em; }
.hero h1 span { background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 32px; }
.cta {
  display: inline-block; background: var(--brand-gradient); color: #fff; font-weight: 700;
  font-size: 17px; padding: 13px 28px; border-radius: var(--radius);
  text-decoration: none; border: 1px solid transparent;
}
.cta:hover { filter: brightness(0.94) saturate(1.1); }
.cta.ghost { background: transparent; color: var(--ink); border-color: #d1d5db; margin-left: 12px; }
.features {
  max-width: 1120px; margin: 0 auto; padding: 0 24px 80px; width: 100%;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
}
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.card h3 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- content containers (public + legal pages) ---------- */
.container {
  max-width: 820px; margin: 0 auto; padding: 0 24px; width: 100%;
  flex: 1 0 auto; padding-top: 40px; padding-bottom: 60px;
}
.page-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 26px; }
.page-head h1 { font-size: 30px; margin: 0; letter-spacing: -0.01em; }

/* auth + public content headings */
.auth-card h1 { font-size: 22px; margin: 0 0 6px; }
p.sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }

/* legal prose content */
.prose h2 { font-size: 22px; margin: 34px 0 10px; letter-spacing: -0.01em; }
.prose h3 { font-size: 17px; margin: 24px 0 8px; }
.prose p { margin: 0 0 14px; color: #374151; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; color: #374151; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); text-decoration: none; font-weight: 600; }
.prose a:hover { text-decoration: underline; }
.prose strong { color: var(--ink); }

/* ---------- forms (auth pages) ---------- */
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 32px; box-shadow: 0 2px 12px rgba(0,0,0,0.05); margin: 0 auto;
}
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #374151; }
input[type=email], input[type=password], input[type=text], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
select { appearance: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(192,38,211,.18); }
button.primary, button[type=submit] {
  width: 100%; background: var(--brand-gradient); color: #fff; border: 0; padding: 11px;
  border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
}
button.primary:hover, button[type=submit]:hover { filter: brightness(0.94) saturate(1.1); }
.links { font-size: 14px; color: var(--muted); margin-top: 18px; text-align: center; }
.links a { color: var(--accent); text-decoration: none; font-weight: 600; }
.links a:hover { text-decoration: underline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; align-items: start; }
.contact-info { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.contact-info h3 { margin: 0 0 14px; font-size: 17px; }
.contact-info ul { list-style: none; margin: 0; padding: 0; }
.contact-info li { padding: 8px 0; font-size: 14px; color: #374151; border-bottom: 1px solid #f3f4f6; }
.contact-info li:last-child { border-bottom: 0; }
.contact-info li b { color: var(--ink); }
.contact-info a { color: var(--accent); text-decoration: none; }

/* ---------- flashes ---------- */
.flashes { width: 100%; max-width: 820px; margin: 18px auto -30px; padding: 0 24px; }
.flash { border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 8px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error, .flash-warning { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

/* ---------- footer ---------- */
.footer { background: var(--charcoal); color: #9ca3af; margin-top: auto; }
.footer-inner { max-width: 1120px; margin: 0 auto; padding: 36px 24px; text-align: center; }
.footer .brand { justify-content: center; color: #fff; margin-bottom: 14px; }
.footer a { color: #d1d5db; text-decoration: none; margin: 0 10px; font-size: 14px; }
.footer a:hover { color: #fff; }
.footer .copy { margin-top: 14px; font-size: 13px; }

/* ---------- admin ---------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.admin-layout { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 230px; flex-shrink: 0; background: var(--charcoal); color: #d1d5db;
  padding: 18px 12px 24px; display: flex; flex-direction: column;
}
.sidebar h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
              color: #7c8188; margin: 0 0 8px; padding: 0 10px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: #d1d5db; text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 2px;
}
.sidebar a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar a.active { background: var(--brand-gradient); color: #fff; }
.sidebar .spacer { flex: 1; }
.admin-main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
.admin-main h1 { font-size: 24px; margin: 0 0 4px; }
.admin-main .lede { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 800; }
.stat .label { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f3f4f6; color: #374151; }
.admin-actions { margin-top: 8px; }
.btn-sm { border: 0; border-radius: 6px; padding: 6px 11px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-accent { background: var(--brand-gradient); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid #d1d5db; }
.btn-red { background: #fee2e2; color: #991b1b; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-form { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.admin-form h3 { margin: 0 0 12px; font-size: 16px; }

/* ---------- generic admin helpers ---------- */
.mono, textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--muted); }
.num { text-align: right; }
th.num { text-align: right; }
.back-link { display: inline-block; font-size: 13px; font-weight: 600; margin-bottom: 8px; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.table-wrap { overflow-x: auto; }
.sector-name { font-weight: 700; color: var(--accent); text-decoration: none; }
.sector-name:hover { text-decoration: underline; }

/* ---------- sectors admin list ---------- */
.sector-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sector-search { display: flex; gap: 8px; align-items: center; }
.sector-search input[type=text] { width: 260px; }

/* ---------- sector dedicated editor ---------- */
.sector-editor-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.sector-editor-form textarea { width: 100%; min-height: 130px; }
.sector-aside { display: flex; flex-direction: column; gap: 18px; }
.sector-aside .admin-form h3 { display: flex; align-items: center; justify-content: space-between; }
.sector-aside .table th { font-size: 11px; padding: 6px 8px; }
.sector-aside .table td { font-size: 12px; padding: 6px 8px; }

/* ---------- tenant portal ---------- */
.portal { max-width: 880px; margin: 0 auto; padding: 28px 20px 80px; width: 100%; }
.portal-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(34,211,238,0.10) 0%, rgba(217,70,239,0.12) 100%);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-bottom: 20px;
}
.portal-hero h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
.portal-hero .lede { margin: 0; }
.usage-badge { min-width: 220px; }
.usage-copy { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.usage-copy .num { color: var(--accent); font-size: 18px; }
.usage-track { height: 8px; border-radius: 999px; background: #e5e7eb; overflow: hidden; }
.usage-track span { display: block; height: 100%; background: var(--brand-gradient); border-radius: 999px; }
.portal-flashes { margin-bottom: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; margin: 0; letter-spacing: -0.01em; }
.section-head .muted { font-size: 13px; }

.plugin-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.plugin-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plugin-title { flex: 1; min-width: 0; }
.plugin-title h3 { margin: 0; font-size: 17px; }
.plugin-title .muted { font-size: 12.5px; }
.grip, .tab-grip { color: #c4c8cf; cursor: grab; letter-spacing: -2px; user-select: none; font-size: 16px; }
.reorder { display: flex; gap: 6px; }
.reorder .btn-sm:disabled { opacity: 0.35; cursor: default; }
.plugin-meta { display: flex; gap: 26px; flex-wrap: wrap; margin: 14px 0 4px; font-size: 13px; }
.meta-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.panel-details { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.panel-details summary { cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--accent); }
.panel-details[open] summary { margin-bottom: 12px; }
.snippet-box { display: flex; gap: 10px; align-items: flex-start; }
.snippet-box pre {
  flex: 1; margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; white-space: pre-wrap; word-break: break-word; user-select: all; font-size: 12.5px;
}
.plugin-form .form-row { margin-bottom: 2px; }
.brand-colors input[type=color] { height: 42px; padding: 4px; cursor: pointer; }
.plugin-form textarea[name=branding] { min-height: 90px; }
.tab-picker { list-style: none; margin: 8px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; }
.tab-picker li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tab-picker li:last-child { border-bottom: 0; }
.tab-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; flex: 1; margin: 0; }
.tab-check input { accent-color: var(--accent); width: 16px; height: 16px; }
.tab-check .badge { margin-left: auto; }
.plugin-actions { display: flex; gap: 8px; margin-top: 14px; }

.offering-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.offering-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 6px;
}
.offering-card h3 { margin: 0; font-size: 16px; }
.offering-card .price { margin: 2px 0; }
.offering-card .price .num { font-size: 20px; font-weight: 800; background: var(--brand-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.offering-card form { margin-top: auto; }
.new-install { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: 720px; }
.empty-state { border: 1px dashed var(--line); border-radius: 14px; padding: 34px; text-align: center; background: var(--surface); }

@media (max-width: 760px) {
  .sector-editor-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .sector-search input[type=text] { width: 100%; }
}