/* ==========================================================================
   FINOM Admin — dashboard UI
   ========================================================================== */
:root {
    --blue: #104390;
    --navy: #0a2a5c;
    --navy-deep: #061634;
    --red: #b22222;
    --ink: #1a2432;
    --muted: #6b7a8f;
    --line: #e6edf5;
    --bg: #eef2f7;
    --sidebar-w: 260px;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(16,67,144,0.08);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-head: 'Sora', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body.admin { font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ---------- LOGIN ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(120% 120% at 70% 10%, #123a7a 0%, var(--navy) 45%, var(--navy-deep) 100%); }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 44px 40px;
    box-shadow: 0 40px 90px rgba(6,22,52,0.4); }
.login-logo { height: 42px; margin: 0 auto 28px; }
.login-card h1 { font-size: 1.5rem; text-align: center; margin-bottom: 6px; color: var(--navy); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 28px; }
.login-card .field { margin-bottom: 18px; }
.login-card label { display: block; font-size: 0.8rem; font-weight: 700; margin-bottom: 7px; color: var(--navy); }
.login-card input { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 11px;
    font-family: var(--font); font-size: 0.95rem; background: #f7fafd; transition: border-color .2s, box-shadow .2s; }
.login-card input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(16,67,144,.12); }
.login-hint { font-size: 0.78rem; color: var(--muted); text-align: center; margin-top: 20px; line-height: 1.6; }
.login-hint code { background: #eef2f7; padding: 2px 7px; border-radius: 6px; font-family: var(--mono); color: var(--navy); }

/* ---------- BUTTONS ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer;
    padding: 13px 24px; border-radius: 11px; border: 1.5px solid transparent; font-family: var(--font);
    font-weight: 700; font-size: 0.9rem; transition: transform .2s, box-shadow .2s, background .2s, color .2s; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(16,67,144,.25); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(16,67,144,.35); }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { transform: translateY(-2px); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--navy); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; border-radius: 9px; }
.btn-block { width: 100%; }

/* ---------- SHELL ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: var(--sidebar-w); background: var(--navy-deep); color: #fff; position: fixed; top: 0; left: 0;
    height: 100vh; display: flex; flex-direction: column; z-index: 100; transition: transform .35s cubic-bezier(.16,1,.3,1); }
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 24px 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand img { height: 30px; filter: brightness(0) invert(1); }
.admin-brand span { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 3px; text-transform: uppercase; color: rgba(255,255,255,.6); }
.admin-nav { padding: 18px 14px; flex: 1; overflow-y: auto; }
.admin-link { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-radius: 11px; color: rgba(255,255,255,.72);
    font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; transition: background .2s, color .2s; position: relative; }
.admin-link i { width: 20px; text-align: center; font-size: 1rem; }
.admin-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-link.active { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(16,67,144,.4); }
.admin-link .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 0.7rem; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.admin-sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }

.admin-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 0 28px; height: 68px;
    display: flex; align-items: center; gap: 18px; position: sticky; top: 0; z-index: 50; }
.admin-topbar h1 { font-family: var(--font-head); font-size: 1.15rem; font-weight: 800; color: var(--navy); }
.admin-user { margin-left: auto; display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.admin-user i { font-size: 1.4rem; color: var(--blue); }
.admin-burger { display: none; background: none; border: 0; font-size: 1.3rem; color: var(--navy); cursor: pointer; }
.admin-content { padding: 28px; max-width: 1100px; width: 100%; }

/* ---------- ALERTS ---------- */
.admin-alert { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: 11px; margin-bottom: 22px; font-weight: 600; font-size: 0.92rem; }
.admin-alert-success { background: #e7f6ee; color: #16794a; border: 1px solid #b6e2c8; }
.admin-alert-error { background: #fdeaea; color: #a12020; border: 1px solid #f3c4c4; }

/* ---------- CARDS / GRID ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
    transition: transform .25s, box-shadow .25s; display: block; }
.tile:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(16,67,144,.14); }
.tile .ic { width: 50px; height: 50px; border-radius: 12px; background: #eef4fb; color: var(--blue);
    display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 16px; }
.tile h3 { font-family: var(--font-head); font-size: 1.05rem; color: var(--navy); margin-bottom: 5px; }
.tile p { color: var(--muted); font-size: 0.86rem; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 18px; margin-bottom: 30px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat-card .n { font-family: var(--font-head); font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-card .l { color: var(--muted); font-size: 0.82rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-card.accent { background: linear-gradient(135deg, var(--blue), var(--navy)); color: #fff; border: 0; }
.stat-card.accent .n, .stat-card.accent .l { color: #fff; }

.section-block { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); margin-bottom: 24px; }
.section-block > h2 { font-size: 1.1rem; color: var(--navy); margin-bottom: 6px; }
.section-block > .desc { color: var(--muted); font-size: 0.88rem; margin-bottom: 20px; }

/* ---------- EDITOR PAGE PICKER ---------- */
.page-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.page-pill { padding: 10px 18px; border-radius: 100px; background: #fff; border: 1.5px solid var(--line);
    font-weight: 600; font-size: 0.86rem; color: var(--muted); transition: all .2s; }
.page-pill:hover { border-color: var(--blue); color: var(--blue); }
.page-pill.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- FORM FIELDS ---------- */
.form-field { margin-bottom: 22px; }
.form-field:last-child { margin-bottom: 0; }
.form-field label { display: block; font-weight: 700; font-size: 0.86rem; color: var(--navy); margin-bottom: 4px; }
.form-field .hint { font-size: 0.76rem; color: var(--muted); margin-bottom: 9px; font-family: var(--mono); }
.form-field input[type=text], .form-field input[type=email], .form-field input[type=password],
.form-field textarea, .form-field select {
    width: 100%; padding: 12px 15px; border: 1.5px solid var(--line); border-radius: 10px; font-family: var(--font);
    font-size: 0.92rem; color: var(--ink); background: #f7fafd; transition: border-color .2s, box-shadow .2s, background .2s; }
.form-field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
    outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(16,67,144,.1); }

/* image field */
.img-field { display: flex; gap: 16px; align-items: flex-start; }
.img-preview { width: 120px; height: 90px; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line);
    background: #f0f4f9 center/cover no-repeat; flex-shrink: 0; display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-field .grow { flex: 1; min-width: 0; }

.form-actions { position: sticky; bottom: 0; background: #fff; padding: 18px 0 4px; margin-top: 26px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.form-actions .saved-note { color: var(--muted); font-size: 0.82rem; }

/* ---------- MEDIA LIBRARY ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 16px; }
.media-item { border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.media-item .thumb { aspect-ratio: 4/3; background: #f0f4f9 center/cover no-repeat; }
.media-item .meta { padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.media-item .meta .url { font-size: 0.72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-family: var(--mono); }
.copy-btn { border: 0; background: #eef4fb; color: var(--blue); border-radius: 7px; padding: 6px 8px; cursor: pointer; font-size: 0.75rem; }
.copy-btn:hover { background: var(--blue); color: #fff; }

.upload-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 34px; text-align: center; background: #f7fafd; margin-bottom: 24px; }
.upload-drop i { font-size: 2rem; color: var(--blue); margin-bottom: 12px; }
.upload-drop input[type=file] { display: block; margin: 14px auto 0; }

/* ---------- LEADS TABLE ---------- */
.lead-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.lead-table th { text-align: left; padding: 14px 16px; background: #f5f8fc; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); border-bottom: 1px solid var(--line); }
.lead-table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.88rem; vertical-align: top; }
.lead-table tr:last-child td { border-bottom: 0; }
.lead-table tr.unread td { background: #fbfdff; }
.lead-table tr.unread .lead-name { font-weight: 800; }
.lead-name .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 7px; }
.tag-pill { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 100px; text-transform: uppercase; letter-spacing: .5px; }
.tag-partner { background: #e7f0ff; color: var(--blue); }
.tag-join { background: #e7f6ee; color: #16794a; }
.tag-general { background: #f0f0f4; color: #555; }
.lead-actions { display: flex; gap: 7px; }
.icon-btn { border: 1px solid var(--line); background: #fff; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; color: var(--muted); transition: all .2s; }
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.icon-btn.danger:hover { border-color: var(--red); color: var(--red); }
.lead-msg { color: var(--muted); max-width: 380px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state i { font-size: 2.6rem; color: var(--line); margin-bottom: 14px; }

.admin-backdrop { position: fixed; inset: 0; background: rgba(6,22,52,.5); opacity: 0; visibility: hidden; transition: opacity .3s; z-index: 90; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-100%); }
    body.sidebar-open .admin-sidebar { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.3); }
    body.sidebar-open .admin-backdrop { opacity: 1; visibility: visible; }
    .admin-main { margin-left: 0; }
    .admin-burger { display: block; }
    .admin-content { padding: 20px 16px; }
    .lead-table .hide-sm { display: none; }
    .img-field { flex-direction: column; }
}
