/* Elora admin portal */
:root {
  --ink: #0B1220; --ink-2: #141C2E; --line: #E2D9C9; --cream: #F5F1EA; --paper: #FFFDF9;
  --accent: #B4471F; --accent-dark: #8A3416; --accent-light: #E8875C;
  --muted: #555B68; --danger: #A12A12;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent-light); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
h1 { font-family: var(--serif); font-weight: 400; font-size: 42px; line-height: 1.1; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }
h3 { font-size: 15px; font-weight: 700; margin: 24px 0 12px; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; margin: 12px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
code { background: #EFE8DC; padding: 1px 6px; border-radius: 4px; }

/* top bar */
.topbar { background: var(--ink); color: var(--cream); }
.zig-band {
  height: 6px; background-color: var(--ink);
  background-image: linear-gradient(135deg, var(--accent) 25%, transparent 25%), linear-gradient(225deg, var(--accent) 25%, transparent 25%), linear-gradient(315deg, var(--accent) 25%, transparent 25%), linear-gradient(45deg, var(--accent) 25%, transparent 25%);
  background-size: 16px 16px; background-position: -8px 0, -8px 0, 0 0, 0 0;
}
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--cream); text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand span { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--accent-light); font-weight: 700; border: 1px solid #3A4458; border-radius: 999px; padding: 3px 10px; }
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: #C9CED9; text-decoration: none; font-weight: 600; padding: 6px 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover, .topbar nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent-light); }
.logout { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-size: 13px; color: #A9B0BF; }
.who strong { color: var(--cream); }

.admin-main { max-width: 1280px; margin: 0 auto; padding: 36px 24px 80px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; background: none; }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--cream); }
.btn-ghost { border-color: #4A5468; color: var(--cream); }
.btn-ghost:hover { border-color: var(--cream); color: #fff; }
.btn-wa { background: #1F8F4E; color: #fff; }
.btn-wa:hover { background: #18733E; color: #fff; }
.btn-link { color: var(--accent); padding: 6px 4px; min-height: 0; font-weight: 600; text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-block { width: 100%; }

/* alerts */
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-weight: 600; }
.alert-ok { background: #E3F1E6; color: #1E5A2C; }
.alert-err { background: #FBE4DC; color: #8A2A10; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13.5px; font-weight: 700; }
.field input, .field select, .field textarea { font: inherit; padding: 11px 13px; border: 1px solid #BDB3A1; border-radius: 10px; background: var(--paper); color: var(--ink); width: 100%; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* auth */
.auth-card { max-width: 420px; margin: 8vh auto 0; background: var(--ink); color: var(--cream); border-radius: 24px; padding: 36px; box-shadow: 0 24px 60px rgba(11,18,32,.25); }
.auth-card h1 { color: var(--cream); margin: 18px 0 20px; font-size: 38px; }
.auth-card .muted { color: #B7BDCB; margin: 0 0 16px; }
.auth-card .field > span { color: var(--cream); }
.auth-card a { color: var(--accent-light); }
.auth-logo { height: 40px; width: auto; }

/* page head */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head p { margin: 6px 0 0; }
.head-actions { display: flex; gap: 10px; }
.back { display: inline-block; font-weight: 600; margin-bottom: 8px; text-decoration: none; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
a.stat:hover { border-color: var(--ink); color: var(--muted); }
.stat-num { font-family: var(--serif); font-size: 44px; line-height: 1; color: var(--ink); }
.stat-accent { background: var(--ink); border-color: var(--ink); color: #B7BDCB; }
.stat-accent .stat-num { color: var(--accent-light); }
a.stat-accent:hover { color: #fff; }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 12px; margin-bottom: 16px; }
.filters .grow { flex: 1 1 260px; }
.filters .field select { min-width: 170px; }

/* table */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; }
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 16px; border-bottom: 1px solid var(--line); background: #FAF6EE; }
.table td { padding: 14px 16px; border-bottom: 1px solid #EFE8DC; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #FBF8F2; }
.table tr.unread td { background: #FFF6EF; }
.table .row-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.table .row-link:hover { color: var(--accent); text-decoration: underline; }
.table tr.unread .row-link { color: var(--accent-dark); }
.sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.snippet { max-width: 420px; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px !important; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: middle; }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; color: var(--muted); }

/* badges (each passes 4.5:1) */
.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.badge-new { background: #FBE4DC; color: #8A2A10; }
.badge-contacted { background: #E1ECF8; color: #1D4C80; }
.badge-proposal { background: #F3E8FA; color: #5E2A86; }
.badge-won { background: #E3F1E6; color: #1E5A2C; }
.badge-lost { background: #ECEBE8; color: #4A4A46; }
.badge-spam { background: #ECEBE8; color: #6A6A66; text-decoration: line-through; }

/* detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 26px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 20px; margin: 0 0 20px; }
.meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.meta dd { margin: 2px 0 0; font-weight: 600; word-break: break-word; }
.message { background: var(--cream); border-radius: 14px; padding: 18px 20px; font-size: 16px; line-height: 1.65; white-space: normal; word-break: break-word; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.danger-zone { display: flex; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 20px; padding-top: 12px; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #EFE8DC; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .logout { margin-left: 0; width: 100%; justify-content: space-between; }
  h1 { font-size: 34px; }
}

/* ---------- Content manager ---------- */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.hub-card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 24px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s; }
.hub-card:hover { border-color: var(--ink); transform: translateY(-2px); color: var(--ink); }
.hub-title { font-family: var(--serif); font-size: 28px; line-height: 1.1; }
.hub-text { color: var(--muted); font-size: 14.5px; flex-grow: 1; }
.hub-meta { font-size: 13px; font-weight: 700; color: var(--accent); }
.hub-main { background: var(--ink); color: var(--cream); border-color: var(--ink); grid-column: 1 / -1; }
.hub-main:hover { color: var(--cream); }
.hub-main .hub-text { color: #B7BDCB; }
.hub-go { font-weight: 700; color: var(--accent-light); }

.form-panel { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .field .label { font-size: 13.5px; font-weight: 700; }
.req { color: var(--accent); }
.help { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; padding: 10px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.check.small { font-size: 13.5px; padding: 6px 0 0; }
.check .help { margin-left: 4px; }
.image-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.image-field input[type=file] { font: inherit; font-size: 14px; }
.thumb { width: 180px; height: 110px; object-fit: contain; background: #EFE8DC; border-radius: 12px; border: 1px solid var(--line); }
.thumb.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--cream) 30%); padding: 22px 0 18px; display: flex; justify-content: flex-end; }

.group-head { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 12px; }
.group-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 28px; }
.inline { display: inline; margin: 0; }
.row-actions { white-space: nowrap; text-align: right; }
.list-thumb { height: 34px; width: auto; max-width: 110px; object-fit: contain; }
.table tr.is-hidden td { color: #8A8F9C; }
.table tr.is-hidden .row-link { color: #6A6F7C; }
.toggle { font: inherit; font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 5px 12px; cursor: pointer; border: 1.5px solid; min-height: 32px; }
.toggle.on { background: #E3F1E6; color: #1E5A2C; border-color: #BFDCC6; }
.toggle.off { background: #F1EEE8; color: #5A5A56; border-color: #D8D2C6; }
@media (max-width: 760px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* Tech accent line (matches the website) */
.zig-band { height: 4px; background: linear-gradient(90deg, #B4471F, #E8875C 45%, #1292EE); }

/* ---------- Login / install: animated technology background ---------- */
body.is-auth {
  min-height: 100vh; background-color: var(--ink);
  background-image:
    radial-gradient(45% 55% at 90% 5%, rgba(232, 135, 92, .25), transparent 70%),
    radial-gradient(40% 50% at 5% 100%, rgba(18, 146, 238, .2), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}
body.is-auth .admin-main { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding-top: 24px; padding-bottom: 24px; }
body.is-auth .auth-card { margin: 0; width: 100%; background: rgba(15, 23, 40, .72); border: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 30px 80px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06); position: relative; overflow: hidden; }
body.is-auth .auth-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, #B4471F, #E8875C 45%, #1292EE); }
body.is-auth .auth-card .field input { background: rgba(255, 255, 255, .95); }
body.is-auth .alert { position: relative; }
.auth-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.auth-bg .tech-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.tech-layer .traces { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tech-layer .traces rect { stroke: rgba(255, 255, 255, .1); }
.tech-layer .pulses path { fill: none; stroke: #E8875C; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 34 966; stroke-dashoffset: 1000; filter: drop-shadow(0 0 4px rgba(232, 135, 92, .9)); }
.tech-layer .pulses path.blue { stroke: #4FB3FF; filter: drop-shadow(0 0 4px rgba(79, 179, 255, .9)); }
.tech-layer .nodes circle { fill: #0B1220; stroke: rgba(232, 135, 92, .55); stroke-width: 1.6; }
.tech-layer .mark path { fill: none; stroke: rgba(255, 255, 255, .06); stroke-width: 9; stroke-linecap: square; }
.tech-layer .mark .mk1, .tech-layer .mark .mk3 { stroke: rgba(232, 135, 92, .12); }
.tech-layer .mark { transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
  .tech-layer .pulses path { animation: signal 7s linear infinite; }
  .tech-layer .pulses .p1 { animation-duration: 9s; animation-delay: -2s; }
  .tech-layer .pulses .p2 { animation-duration: 6s; animation-delay: -4s; }
  .tech-layer .pulses .p3 { animation-duration: 11s; animation-delay: -1s; }
  .tech-layer .pulses .p4 { animation-duration: 8s; animation-delay: -6s; }
  .tech-layer .pulses .p5 { animation-duration: 10s; animation-delay: -3s; }
  .tech-layer .nodes circle { animation: node-blink 4s ease-in-out infinite; }
  .tech-layer .nodes .n1 { animation-delay: -1s; } .tech-layer .nodes .n2 { animation-delay: -2s; } .tech-layer .nodes .n3 { animation-delay: -3s; }
  .tech-layer .mark { animation: mark-spin 90s linear infinite; }
}
@keyframes signal { to { stroke-dashoffset: 0; } }
@keyframes node-blink { 0%, 100% { stroke: rgba(232, 135, 92, .35); } 50% { stroke: rgba(232, 135, 92, 1); fill: rgba(232, 135, 92, .25); } }
@keyframes mark-spin { to { transform: rotate(360deg); } }
