/* Vakeel Junction admin — same palette as the public site (navy / amber / paper). */
:root {
  --navy-950: #0a1124; --navy-900: #0f1a33; --navy-800: #16244a; --navy-700: #1f3062; --navy-50: #eef1f8;
  --amber-500: #f2b705; --amber-400: #ffc53d; --amber-100: #ffefb8; --amber-800: #7a5600;
  --paper: #f7f5f0; --stone-100: #f4f1ea; --stone-200: #e8e3d8; --stone-300: #d6cfc0;
  --ink: #0e1526; --ink-soft: #3c4759; --ink-mute: #5f6b7e; --ink-faint: #647085;
  --success: #1e7f4f; --success-soft: #e6f4ec; --danger: #b42318; --danger-soft: #fcebea; --warning: #9a6700; --warning-soft: #fff4cc;
  --radius: 12px; --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(14,21,38,.05), 0 10px 30px -16px rgba(14,21,38,.18);
  --sidebar-w: 248px;
  --font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--paper); }
a { color: var(--navy-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; margin-top: 1.5rem; }
p { margin: 0 0 .75rem; }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--stone-100); padding: .1em .35em; border-radius: 6px; }
pre { font: .8rem/1.45 ui-monospace, Menlo, monospace; background: var(--stone-100); padding: .75rem; border-radius: 8px; overflow: auto; max-height: 18rem; margin: 0; }
.muted { color: var(--ink-mute); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--navy-900); color: #fff; padding: .5rem 1rem; border-radius: 8px; }
.icon { vertical-align: -3px; flex: none; }
.icon.flip { transform: scaleX(-1); }

/* ---- layout ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy-950); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; }
.brand img { border-radius: 9px; }
.brand strong { display: block; font-size: .95rem; letter-spacing: -.01em; line-height: 1.1; }
.brand strong span { color: var(--amber-500); }
.brand small { color: rgba(255,255,255,.55); font-size: .72rem; }
.brand-lg strong { font-size: 1.1rem; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: .5rem .75rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 10px; color: rgba(255,255,255,.72); font-weight: 500; font-size: .925rem; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--amber-500); color: var(--navy-950); }
.sidebar-foot { margin-top: auto; padding: 1rem 1.5rem; font-size: .85rem; }
.sidebar-foot a { color: rgba(255,255,255,.6); display: inline-flex; gap: .4rem; align-items: center; }
.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: rgba(247,245,240,.85); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(14,21,38,.07); }
.page-title { font-size: 1.25rem; font-weight: 700; flex: 1; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.user-chip { display: inline-flex; align-items: center; gap: .6rem; padding: .3rem .6rem .3rem .3rem; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px rgba(14,21,38,.08); color: var(--ink); font-size: .875rem; font-weight: 600; }
.user-chip small { display: block; font-weight: 400; color: var(--ink-mute); font-size: .72rem; line-height: 1; }
.avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--navy-800); color: var(--amber-400); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.main { padding: 1.5rem; max-width: 1400px; width: 100%; }
.only-mobile { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(10,17,36,.5); z-index: 29; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); z-index: 30; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; }
  .only-mobile { display: inline-flex; }
  .only-desktop { display: none; }
  .main { padding: 1rem; }
}

/* ---- auth ---- */
.auth { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; background: radial-gradient(60rem 40rem at 80% -10%, rgba(242,183,5,.18), transparent), var(--navy-950); padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 1.75rem; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.auth-card .brand { padding: 0 0 1.25rem; color: var(--ink); }
.auth-card .brand small { color: var(--ink-mute); }
.auth-title { font-size: 1.35rem; margin-bottom: 1rem; }
.auth-foot { color: rgba(255,255,255,.45); font-size: .8rem; margin-top: 1.25rem; }

/* ---- cards / grids ---- */
.card { background: #fff; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px rgba(14,21,38,.07), 0 1px 2px rgba(14,21,38,.04); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .75rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; }
.stack > * + * { margin-top: 1rem; }
.page-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-actions p { margin: 0; max-width: 60ch; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; background: #fff; border-radius: var(--radius-lg); padding: 1rem 1.1rem; box-shadow: inset 0 0 0 1px rgba(14,21,38,.07); color: var(--ink); }
.stat:hover { text-decoration: none; box-shadow: inset 0 0 0 1px rgba(14,21,38,.15), var(--shadow); }
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-mute); font-weight: 600; }
.stat-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .8rem; color: var(--ink-faint); }
.empty { text-align: center; padding: 3rem 1rem; }
.big-num { font-size: 5rem; font-weight: 800; color: var(--amber-500); margin: 0; line-height: 1; }
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.notice-warning { background: var(--warning-soft); color: var(--warning); }
.notice-info { background: var(--navy-50); color: var(--navy-700); }

/* ---- tables / lists ---- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-mute); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid rgba(14,21,38,.08); }
.table td { padding: .7rem .6rem; border-bottom: 1px solid rgba(14,21,38,.06); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: rgba(14,21,38,.015); }
.table-wrap { overflow-x: auto; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid rgba(14,21,38,.06); }
.list li:last-child { border-bottom: 0; }
.list.compact li { font-size: .875rem; padding: .4rem 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; font-size: .925rem; }
.kv dt { color: var(--ink-mute); } .kv dd { margin: 0; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; font-size: .875rem; }

/* ---- badges ---- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--stone-100); color: var(--ink-soft); text-transform: capitalize; }
.badge-new { background: var(--amber-100); color: var(--amber-800); }
.badge-read { background: var(--navy-50); color: var(--navy-700); }
.badge-replied { background: var(--success-soft); color: var(--success); }
.badge-archived { background: var(--stone-200); color: var(--ink-mute); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.pill-success { background: var(--success-soft); color: var(--success); }
.pill-warning { background: var(--warning-soft); color: var(--warning); }
.pill-muted { background: var(--stone-100); color: var(--ink-mute); }
.pill-draft { background: var(--stone-200); color: var(--ink-soft); }
.pill-published { background: var(--success-soft); color: var(--success); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.5rem; padding: .5rem 1rem; border-radius: 10px; border: 0; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; color: var(--ink); background: var(--stone-100); }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--amber-500); color: var(--navy-950); box-shadow: 0 8px 20px -12px rgba(242,183,5,.8); }
.btn-primary:hover { background: var(--amber-400); }
.btn-dark { background: var(--navy-900); color: #fff; }
.btn-dark:hover { background: var(--navy-800); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(14,21,38,.18); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--stone-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { min-height: 2rem; padding: .3rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; border: 0; background: transparent; color: var(--ink-soft); cursor: pointer; }
.icon-btn:hover { background: var(--stone-200); }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.field label small { font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="number"], input[type="search"], input[type="date"], input[type="tel"], input:not([type]), select, textarea {
  width: 100%; min-height: 2.75rem; padding: .6rem .8rem; border-radius: 10px; border: 0; background: #fff; color: var(--ink); font: inherit;
  box-shadow: inset 0 0 0 1px rgba(14,21,38,.16); transition: box-shadow .15s ease;
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--navy-900), 0 0 0 4px rgba(242,183,5,.25); }
input[aria-invalid="true"], .field.has-error input { box-shadow: inset 0 0 0 1.5px var(--danger); }
.card input, .card select, .card textarea { background: #fff; }
.input-group { display: flex; gap: .4rem; align-items: center; }
.input-group input { flex: 1; }
.error { color: var(--danger); font-size: .82rem; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 1rem; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; }
.check input { width: 1.1rem; height: 1.1rem; min-height: 0; accent-color: var(--navy-900); }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; align-items: center; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(247,245,240,.9); backdrop-filter: blur(8px); padding: .75rem 0; margin-top: .5rem; border-top: 1px solid rgba(14,21,38,.07); }
.form-card { max-width: 880px; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; padding: .75rem 1rem; }
.filters input[type="search"] { flex: 1; min-width: 14rem; }
.filters select { width: auto; min-width: 10rem; }
.code-input { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.secret { display: block; font-size: 1.05rem; letter-spacing: .12em; padding: .6rem .8rem; margin: .4rem 0; cursor: copy; }
.steps { padding-left: 1.2rem; } .steps li + li { margin-top: .5rem; }
.help { font-size: .8rem; color: var(--ink-faint); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid rgba(14,21,38,.08); margin-bottom: 1rem; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: .6rem .9rem; font: inherit; font-weight: 600; color: var(--ink-mute); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--navy-900); border-color: var(--amber-500); }
[data-tab-panel][hidden] { display: none; }

/* ---- repeaters (dynamic lists) ---- */
.repeater { display: flex; flex-direction: column; gap: .5rem; }
.repeater-item { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: start; background: var(--stone-100); padding: .6rem; border-radius: 10px; }
.repeater-item .handle { color: var(--ink-faint); cursor: grab; padding-top: .7rem; }
.repeater-item .fields { display: grid; gap: .4rem; }
.repeater-item .fields.cols-2 { grid-template-columns: 1fr 1fr; }
.repeater-item .fields.cols-3 { grid-template-columns: 1fr 1fr 2fr; }
.repeater-item input, .repeater-item textarea, .repeater-item select { background: #fff; }
.repeater-add { align-self: flex-start; }
@media (max-width: 640px) { .repeater-item .fields.cols-2, .repeater-item .fields.cols-3 { grid-template-columns: 1fr; } }

/* ---- block editor ---- */
.blocks { display: flex; flex-direction: column; gap: .6rem; }
.block { background: var(--stone-100); border-radius: 12px; padding: .7rem; display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: start; }
.block-type { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--amber-800); background: var(--amber-100); padding: .25rem .5rem; border-radius: 999px; }
.block .controls { display: flex; flex-direction: column; gap: .2rem; }
.block-add { display: flex; flex-wrap: wrap; gap: .4rem; padding-top: .5rem; }
.block textarea { min-height: 4.5rem; background: #fff; }
.block .faq-pair { display: grid; gap: .4rem; }
.preview { background: #fff; border-radius: 12px; padding: 1.25rem; box-shadow: inset 0 0 0 1px rgba(14,21,38,.07); font-size: .95rem; line-height: 1.7; }
.preview h2 { font-size: 1.3rem; margin-top: 1.2rem; } .preview h3 { font-size: 1.1rem; }
.preview .callout { padding: .75rem 1rem; border-radius: 10px; background: var(--navy-50); margin: .75rem 0; }
.preview .callout.warning { background: var(--warning-soft); } .preview .callout.tip { background: var(--success-soft); }
.preview blockquote { margin: .75rem 0; padding: .75rem 1rem; border-left: 3px solid var(--amber-500); background: var(--stone-100); }

/* ---- media ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.media-item { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(14,21,38,.08); display: flex; flex-direction: column; }
.media-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--stone-100); display: block; }
.media-item .meta { padding: .5rem .6rem; font-size: .75rem; color: var(--ink-mute); word-break: break-all; }
.media-item .actions { display: flex; gap: .25rem; padding: 0 .4rem .4rem; }
.dropzone { border: 2px dashed var(--stone-300); border-radius: 14px; padding: 1.5rem; text-align: center; color: var(--ink-mute); background: #fff; }
.dropzone.drag { border-color: var(--amber-500); background: var(--amber-100); }
.image-field { display: flex; gap: .75rem; align-items: center; }
.image-field img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: var(--stone-100); }
.image-field .image-field-input { flex: 1; }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(10,17,36,.55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--paper); border-radius: 16px; width: min(100%, 960px); max-height: 90vh; overflow: auto; padding: 1rem; }

/* ---- toasts ---- */
.toasts { position: fixed; right: 1rem; top: 1rem; z-index: 60; display: flex; flex-direction: column; gap: .5rem; max-width: min(92vw, 26rem); }
.toast { display: flex; align-items: flex-start; gap: .5rem; padding: .7rem .9rem; border-radius: 12px; background: var(--navy-900); color: #fff; box-shadow: 0 20px 40px -20px rgba(0,0,0,.5); font-size: .9rem; animation: toast-in .3s ease; }
.toast-success { background: var(--success); } .toast-danger { background: var(--danger); } .toast-warning { background: var(--warning); }
.toast-close { margin-left: auto; background: transparent; border: 0; color: inherit; cursor: pointer; opacity: .8; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---- diff ---- */
.diff summary { list-style: none; display: inline-flex; }
.diff summary::-webkit-details-marker { display: none; }
.diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .5rem; min-width: 28rem; }
.diff-cols pre { font-size: .72rem; }

/* ---- lead detail ---- */
.brief { white-space: pre-wrap; background: var(--stone-100); padding: 1rem; border-radius: 10px; font-size: .95rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .5rem 0 .5rem 1.2rem; border-left: 2px solid var(--stone-200); position: relative; font-size: .875rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .9rem; width: 10px; height: 10px; border-radius: 50%; background: var(--amber-500); }
.sortable-ghost { opacity: .4; }
