@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #f4f5f8;
    --surface: #fff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --text: #1f2937;
    --muted: #64748b;
    --line: #e6e8ee;
    --line-strong: #cfd5df;
    --blue: #1236d6;
    --blue-soft: #eef2ff;
    --red: #ed1c24;
    --side: #0c0d12;
    --side-2: #16171f;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .04);
    --side-w: 264px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 'DM Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
input, textarea, select { color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3 { font-family: 'Barlow Condensed', sans-serif; color: var(--ink); letter-spacing: .01em; }
:focus-visible { outline: 3px solid rgba(18, 54, 214, .45); outline-offset: 2px; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: #fff; padding: 10px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.admin-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side); color: #d4d4d8; display: flex; flex-direction: column; z-index: 40; border-right: 1px solid #000; }
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.admin-brand:hover { text-decoration: none; }
.admin-brand img { border-radius: 50%; }
.admin-brand span { font: 800 21px/1 'Barlow Condensed', sans-serif; letter-spacing: .02em; }
.admin-brand b, .topbar-brand b { color: var(--red); }
.admin-brand small { display: block; margin-top: 4px; font: 600 10px 'DM Sans', sans-serif; letter-spacing: .12em; text-transform: uppercase; color: #8b8b95; }
.admin-sidebar nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: grid; align-content: start; gap: 2px; }
.nav-label { margin: 16px 10px 6px; font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #6b6b75; }
.nav-label:first-child { margin-top: 4px; }
.admin-sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: #c9c9d1; font-weight: 600; position: relative; }
.admin-sidebar nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.admin-sidebar nav a.active { background: linear-gradient(90deg, rgba(237, 28, 36, .18), rgba(237, 28, 36, .04)); color: #fff; }
.admin-sidebar nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.admin-sidebar nav a.active .icon { color: #ff6b71; }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin: 12px; padding: 12px; border-radius: 12px; background: var(--side-2); }
.sidebar-user div { min-width: 0; flex: 1; }
.sidebar-user strong { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: #8b8b95; font-size: 11px; }
.sidebar-user .icon-btn { color: #a1a1aa; }
.sidebar-user .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.admin-shell { margin-left: var(--side-w); min-height: 100dvh; }
.admin-topbar { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 35; }
.admin-main { max-width: 1320px; margin: 0 auto; padding: 36px 36px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: 42px; line-height: 1.02; }
.page-sub { margin: 8px 0 0; color: var(--muted); max-width: 720px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Primitives */
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), #6d28d9); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .03em; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; font-size: 17px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
:where(.admin-main button[type=submit]), .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 16px; border: 1px solid var(--blue); border-radius: var(--radius-sm); background: var(--blue); color: #fff; font-weight: 700; font-size: 13px; line-height: 1.2; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
:where(.admin-main button[type=submit]):hover, .btn:hover { background: #0e2aa8; border-color: #0e2aa8; color: #fff; text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: #b4bccb; }
.btn-danger { background: #fff; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.btn-whatsapp { background: #16a34a; border-color: #16a34a; }
.btn-whatsapp:hover { background: #15803d; border-color: #15803d; }
button:disabled { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: #f1f5f9; color: #334155; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-info { background: #e0e7ff; color: #3730a3; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-violet { background: #f3e8ff; color: #6b21a8; }
.badge-dark { background: #1f2937; color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; color: #475569; }
.muted, .empty, .lead-copy { color: var(--muted); }
code { font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); }

/* Notices */
.notice { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 20px; padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid #c7d2fe; background: var(--blue-soft); color: #1e3a8a; font-weight: 500; }
.notice.success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.notice.error { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.notice .icon { margin-top: 1px; }
.callout { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--line-strong); color: var(--muted); font-size: 13px; }

/* Cards */
.card, .admin-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 22px; min-width: 0; }
.card-head, .section-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 18px; }
.card h2, .admin-section h2 { margin: 0; font-size: 26px; line-height: 1.1; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.card h3 { font-size: 19px; margin: 0 0 4px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 20px 24px 0; }
.form-section { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.form-section > p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

/* Metrics */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; color: inherit; }
a.metric:hover { text-decoration: none; border-color: #c7d2fe; }
.metric-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--blue-soft); color: var(--blue); flex: none; }
.metric-icon.red { background: #fee2e2; color: #b91c1c; }
.metric-icon.green { background: #dcfce7; color: #15803d; }
.metric-icon.amber { background: #fef3c7; color: #b45309; }
.metric > div > span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.metric strong { display: block; font: 800 36px/1.05 'Barlow Condensed', sans-serif; color: var(--ink); margin-top: 2px; }
.metric small { color: var(--blue); font-weight: 700; font-size: 12px; }

/* Tabs and filters */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; color: #475569; font-weight: 600; font-size: 13px; border: 1px solid transparent; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; }
.tabs a.active { background: var(--ink); color: #fff; }
.tabs a span { font-size: 11px; padding: 0 7px; border-radius: 999px; background: rgba(100, 116, 139, .15); }
.tabs a.active span { background: rgba(255, 255, 255, .2); }
.filters, .inline-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; }
.search-field { position: relative; display: block; }
.search-field .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 36px !important; min-width: 260px; }

/* Forms */
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--ink); padding: 9px 12px; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(18, 54, 214, .15); }
input:disabled { background: var(--surface-2); color: var(--muted); }
input[type=file] { width: 100%; padding: 8px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--blue); margin: 0; }
.filters input, .filters select { width: auto; }
.form-grid, .seller-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 16px; }
.form-grid label, .seller-fields label, .seller-row label, .inline-form label, .field { display: grid; gap: 6px; min-width: 0; font-size: 12.5px; font-weight: 700; color: #334155; }
.field-hint { font-weight: 500; color: var(--muted); font-size: 12px; }
.span-all { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.seller-check, .check { display: flex !important; align-items: center; gap: 9px; min-height: 40px; font-weight: 600 !important; }
.check-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 10px; }
.check-cards label { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; background: #fff; }
.check-cards label:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); color: #1e3a8a; }
.check-cards label .icon { color: var(--muted); }
.switch { display: inline-flex !important; align-items: center; gap: 10px; cursor: pointer; font-weight: 600 !important; min-height: 40px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked { background: #16a34a; }
.switch input:checked::after { transform: translateX(16px); }

/* Tables */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--surface-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748b; white-space: nowrap; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #fafbff; }
tbody tr.selected { background: var(--blue-soft); }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 2px; font-size: 12px; }
td.nowrap, .nowrap { white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline; }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.cell-person strong { color: var(--ink); }
.cell-person small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { text-align: center; padding: 42px 20px; }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* Lead detail */
.detail-card { border-top: 4px solid var(--blue); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 20px; }
.detail-head h2 { font-size: 30px; }
.detail-head .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; background: #fff; min-width: 0; }
.panel + .panel { margin-top: 16px; }
.panel h3 { font-size: 18px; margin: 0 0 12px; }
.details { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 10px 16px; margin: 0; overflow-wrap: anywhere; }
.details dt { font-weight: 600; color: var(--muted); text-transform: capitalize; font-size: 13px; }
.details dd { margin: 0; color: var(--ink); font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); }
.timeline strong { display: block; color: var(--ink); }
.timeline small { display: block; color: var(--muted); }
.stack { display: grid; gap: 12px; }

/* Split editor */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 22px; align-items: start; }
.split > .sticky { position: sticky; top: 24px; }

/* Sellers */
.seller-form h3 { margin: 0 0 4px; }
.seller-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 40px; gap: 12px; align-items: end; margin-bottom: 10px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.seller-row button { width: 40px; height: 40px; padding: 0; font-size: 20px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: #b91c1c; }
.seller-row button:hover { background: #fef2f2; }
.seller-form input, .seller-form select { min-width: 0; }
.seller-photo { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.seller-photo img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.add-row { margin-top: 4px; }

/* Portfolio */
.project-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.project-form label:not(.check):not(.switch) { display: grid; gap: 6px; font-weight: 700; font-size: 12.5px; color: #334155; }
.project-form label:has(textarea) { grid-column: 1 / -1; }
.project-form textarea { resize: vertical; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 18px; }
.project-grid article { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; min-width: 0; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.project-grid article:hover { box-shadow: 0 10px 30px rgba(15, 23, 42, .1); transform: translateY(-2px); }
.project-grid figure { margin: 0; position: relative; }
.project-grid img { display: block; width: 100%; height: 180px; object-fit: cover; }
.project-grid figure .badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.project-grid article > div { padding: 14px 16px 16px; display: grid; gap: 8px; flex: 1; }
.project-grid strong { color: var(--ink); }
.project-grid p { margin: 0; font-size: 12.5px; color: var(--muted); }
.project-grid .card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }

/* Login */
.login-page { min-height: 100dvh; display: grid; place-items: center; background: radial-gradient(circle at 80% 15%, #3a0a0d, transparent 45%), radial-gradient(circle at 10% 90%, #0d1b5a, transparent 40%), #0a0a0b; padding: 18px; }
.login-box { background: #fff; width: min(430px, 100%); padding: 38px 36px; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.login-box img { border-radius: 50%; }
.login-box > p { margin: 18px 0 4px; font-size: 11px; color: var(--red); font-weight: 700; letter-spacing: .14em; }
.login-box h1 { font-size: 44px; margin: 0 0 24px; line-height: 1; }
.login-box form, .login-box label { display: grid; gap: 7px; }
.login-box label { font-weight: 700; font-size: 12.5px; color: #334155; }
.login-box form { gap: 18px; margin-bottom: 22px; }
.login-box button { min-height: 46px; border: 0; border-radius: var(--radius-sm); background: var(--blue); color: #fff; font-weight: 700; }
.login-box button:hover { background: #0e2aa8; }
.login-box > a { color: var(--muted); font-size: 13px; }

/* Responsive */
@media (max-width: 1180px) {
    .split { grid-template-columns: minmax(0, 1fr); }
    .split > .sticky { position: static; }
}
@media (max-width: 1024px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .3); }
    .sidebar-open .admin-sidebar { transform: none; }
    .admin-shell { margin-left: 0; }
    .admin-topbar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--side); color: #fff; }
    .admin-topbar .icon-btn { color: #fff; }
    .admin-topbar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
    .topbar-brand { flex: 1; font: 800 20px 'Barlow Condensed', sans-serif; }
    .admin-main { padding: 26px 20px 80px; }
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .admin-main { padding: 20px 14px 70px; }
    .page-head h1 { font-size: 34px; }
    .card, .admin-section { padding: 16px; border-radius: 12px; }
    .card-flush { padding: 0; }
    .card-flush > .card-head { padding: 16px 16px 0; }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric { padding: 14px; flex-direction: column; gap: 8px; }
    .metric-icon { width: 34px; height: 34px; }
    .metric strong { font-size: 28px; }
    .filters { align-items: stretch; }
    .filters > *, .filters input, .filters select, .filters button, .search-field input { width: 100%; min-width: 0; }
    .search-field { width: 100%; }
    .project-form { grid-template-columns: minmax(0, 1fr); }
    .details { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .details dd { margin-bottom: 10px; }
    .seller-row { grid-template-columns: minmax(0, 1fr); }
    th, td { padding: 11px 12px; }
    .login-box { padding: 28px 22px; }
}
