/*!
 * Inkfold newsroom UI
 * Author: Ahsan Alam (https://artintechsolution.com/)
 */
:root {
    --ik-brand: #1f3a5f;
    --ik-brand-600: #172d4a;
    --ik-brand-50: #eaf0f7;
    --ik-accent: #c8102e;
    --ik-ink: #121a26;
    --ik-side: #101826;
    --ik-side-2: #1a2536;
    --ik-text: #253041;
    --ik-muted: #6a7486;
    --ik-line: #e3e7ee;
    --ik-bg: #f4f6f9;
    --ik-card: #ffffff;
    --ik-ok: #15803d;
    --ik-ok-50: #e7f6ec;
    --ik-warn: #b45309;
    --ik-warn-50: #fdf3e2;
    --ik-bad: #c62828;
    --ik-bad-50: #fdecec;
    --ik-info: #1d4ed8;
    --ik-info-50: #e8effd;
    --ik-radius: 12px;
    --ik-shadow: 0 1px 2px rgba(18, 26, 38, .05), 0 6px 18px rgba(18, 26, 38, .05);
    --ik-side-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ik-bg); color: var(--ik-text); font: 14px/1.55 "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--ik-brand); text-decoration: none; }
a:hover { color: var(--ik-accent); }
h1, h2, h3, h4 { margin: 0; color: var(--ik-ink); font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 .75rem; }
code { background: var(--ik-bg); border: 1px solid var(--ik-line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--ik-line); margin: 16px 0; }
img { max-width: 100%; }

/* ---------- Shell ---------- */
.ik-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--ik-side-w); z-index: 40; background: var(--ik-side); color: #c3cad6; display: flex; flex-direction: column; transition: transform .25s ease; }
.ik-brandbar { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.ik-mark { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, var(--ik-accent), #8f0b20); color: #fff; font: 700 18px/1 Georgia, "Times New Roman", serif; }
.ik-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.ik-mark img.ik-mark-default { background: none; }
.ik-brandbar strong { display: block; color: #fff; font-size: 15px; line-height: 1.2; }
.ik-brandbar small { color: #8592a6; font-size: 12px; }
.ik-nav { flex: 1; overflow-y: auto; padding: 8px 10px 20px; }
.ik-nav h6 { margin: 16px 10px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #6d7a90; font-weight: 600; }
.ik-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c3cad6; font-weight: 500; }
.ik-nav a i { font-size: 16px; width: 18px; text-align: center; opacity: .85; }
.ik-nav a:hover { background: var(--ik-side-2); color: #fff; }
.ik-nav a.active { background: var(--ik-brand); color: #fff; box-shadow: inset 3px 0 0 var(--ik-accent); }
.ik-sidefoot { padding: 12px 18px; font-size: 11.5px; color: #6d7a90; border-top: 1px solid rgba(255,255,255,.06); }
.ik-sidefoot a { color: #9aa6b8; }

.ik-main { margin-left: var(--ik-side-w); min-height: 100vh; display: flex; flex-direction: column; }
.ik-topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--ik-line); }
.ik-topbar .crumb { color: var(--ik-muted); font-size: 13px; }
.ik-topbar .spacer { flex: 1; }
.ik-burger { display: none; border: 0; background: none; font-size: 22px; color: var(--ik-ink); cursor: pointer; padding: 2px 6px; }
.ik-user { display: flex; align-items: center; gap: 10px; }
.ik-avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ik-brand-50); color: var(--ik-brand); font-weight: 700; font-size: 12px; }
.ik-user small { display: block; color: var(--ik-muted); font-size: 11.5px; line-height: 1.2; }
.ik-user strong { font-size: 13px; line-height: 1.2; }
.ik-content { padding: 24px; flex: 1; max-width: 1480px; width: 100%; }
.ik-demo-bar { background: #fff7e0; color: #7a5200; border-bottom: 1px solid #f1dfac; padding: 7px 24px; font-size: 13px; }

/* ---------- Page head, cards, grids ---------- */
.ik-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ik-pagehead h1 { font-size: 22px; }
.ik-pagehead p { margin: 4px 0 0; color: var(--ik-muted); }
.ik-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ik-card { background: var(--ik-card); border: 1px solid var(--ik-line); border-radius: var(--ik-radius); box-shadow: var(--ik-shadow); margin-bottom: 20px; min-width: 0; }
.ik-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--ik-line); }
.ik-card-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ik-card-head h3 i { color: var(--ik-brand); }
.ik-card-body { padding: 18px; }
.ik-card-foot { padding: 12px 18px; border-top: 1px solid var(--ik-line); background: #fafbfc; border-radius: 0 0 var(--ik-radius) var(--ik-radius); }
.ik-grid { display: grid; gap: 20px; }
.ik-grid > * { min-width: 0; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.ik-grid .ik-card { margin-bottom: 0; }
.mb-0 { margin-bottom: 0 !important; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.muted { color: var(--ik-muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; }

/* ---------- Stats ---------- */
.ik-stat { background: var(--ik-card); border: 1px solid var(--ik-line); border-radius: var(--ik-radius); box-shadow: var(--ik-shadow); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.ik-stat .ico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex: none; background: var(--ik-brand-50); color: var(--ik-brand); }
.ik-stat .ico.red { background: #fdecef; color: var(--ik-accent); } .ik-stat .ico.green { background: var(--ik-ok-50); color: var(--ik-ok); } .ik-stat .ico.amber { background: var(--ik-warn-50); color: var(--ik-warn); }
.ik-stat .label { color: var(--ik-muted); font-size: 12.5px; }
.ik-stat .value { font-size: 24px; font-weight: 700; color: var(--ik-ink); line-height: 1.2; }
.ik-stat .sub { font-size: 12px; color: var(--ik-muted); }
.up { color: var(--ik-ok); } .down { color: var(--ik-bad); }

/* ---------- Bar chart (server-rendered) ---------- */
.ik-bars { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 10px; }
.ik-bars .bar { flex: 1; background: linear-gradient(180deg, var(--ik-brand) 0%, #3d6596 100%); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.ik-bars .bar:hover { background: var(--ik-accent); }
.ik-bars .bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ik-ink); color: #fff; font-size: 11.5px; padding: 3px 7px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.ik-bars-axis { display: flex; justify-content: space-between; color: var(--ik-muted); font-size: 11.5px; margin-top: 6px; }
.ik-meter { height: 8px; border-radius: 6px; background: var(--ik-bg); overflow: hidden; }
.ik-meter span { display: block; height: 100%; background: var(--ik-brand); border-radius: 6px; }

/* ---------- Tables ---------- */
.ik-table-wrap { overflow-x: auto; }
.ik-table { width: 100%; border-collapse: collapse; }
.ik-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ik-muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--ik-line); background: #fafbfc; white-space: nowrap; }
.ik-table td { padding: 11px 14px; border-bottom: 1px solid var(--ik-line); vertical-align: middle; }
.ik-table tr:last-child td { border-bottom: 0; }
.ik-table tr:hover td { background: #fbfcfe; }
.ik-table .thumb { width: 44px; height: 62px; object-fit: cover; border-radius: 4px; border: 1px solid var(--ik-line); background: #f0f2f5; display: block; }
.ik-table .title { font-weight: 600; color: var(--ik-ink); }

/* ---------- Badges, buttons ---------- */
.ik-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--ik-bg); color: var(--ik-muted); white-space: nowrap; }
.ik-badge.green { background: var(--ik-ok-50); color: var(--ik-ok); } .ik-badge.amber { background: var(--ik-warn-50); color: var(--ik-warn); }
.ik-badge.red { background: var(--ik-bad-50); color: var(--ik-bad); } .ik-badge.blue { background: var(--ik-info-50); color: var(--ik-info); }
.ik-badge.dark { background: var(--ik-ink); color: #fff; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--ik-line); background: #fff; color: var(--ik-text); font: 600 13.5px/1.2 inherit; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--ik-bg); color: var(--ik-ink); }
.btn-primary { background: var(--ik-brand); border-color: var(--ik-brand); color: #fff; }
.btn-primary:hover { background: var(--ik-brand-600); color: #fff; }
.btn-accent { background: var(--ik-accent); border-color: var(--ik-accent); color: #fff; }
.btn-accent:hover { background: #a70d26; color: #fff; }
.btn-success { background: var(--ik-ok); border-color: var(--ik-ok); color: #fff; }
.btn-success:hover { background: #116a32; color: #fff; }
.btn-danger { color: var(--ik-bad); border-color: #f2c6c6; }
.btn-danger:hover { background: var(--ik-bad-50); color: var(--ik-bad); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { padding: 6px 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }

/* ---------- Forms ---------- */
.ik-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.ik-form.cols-1 { grid-template-columns: 1fr; }
.ik-form.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ik-field.span-2, .ik-form .span-2 { grid-column: span 2; }
.ik-form.cols-3 .span-3 { grid-column: span 3; }
.ik-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ik-ink); }
.ik-label .req { color: var(--ik-bad); }
.ik-input, .ik-select, .ik-textarea { width: 100%; padding: 9px 12px; border: 1px solid #d5dbe4; border-radius: 8px; background: #fff; color: var(--ik-text); font: inherit; transition: border-color .15s, box-shadow .15s; }
.ik-input:focus, .ik-select:focus, .ik-textarea:focus { outline: 0; border-color: var(--ik-brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, .14); }
.ik-input[type=color] { padding: 3px; height: 40px; }
.ik-textarea { min-height: 110px; resize: vertical; }
.ik-textarea.code { font: 12.5px/1.5 ui-monospace, Consolas, monospace; }
.is-invalid { border-color: var(--ik-bad) !important; }
.ik-hint { color: var(--ik-muted); font-size: 12px; margin-top: 5px; }
.ik-error { color: var(--ik-bad); font-size: 12.5px; margin-top: 5px; }
.ik-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 10px 12px; border: 1px solid var(--ik-line); border-radius: 8px; background: #fbfcfd; }
.ik-check input { margin-top: 3px; accent-color: var(--ik-brand); width: 16px; height: 16px; }
.ik-check strong { display: block; font-size: 13px; color: var(--ik-ink); }
.ik-check small { color: var(--ik-muted); font-size: 12px; }
.ik-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--ik-line); }
.ik-filters .ik-input, .ik-filters .ik-select { width: auto; min-width: 150px; padding: 7px 10px; }

/* ---------- Alerts ---------- */
.ik-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; font-weight: 500; }
.ik-alert.success { background: var(--ik-ok-50); border-color: #bfe5cb; color: #14532d; }
.ik-alert.error { background: var(--ik-bad-50); border-color: #f3c3c3; color: #7f1d1d; }
.ik-alert.info { background: var(--ik-info-50); border-color: #c7d6f8; color: #1e3a8a; }
.ik-alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- Tabs ---------- */
.ik-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ik-line); margin-bottom: 20px; overflow-x: auto; }
.ik-tabs a { padding: 10px 14px; color: var(--ik-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.ik-tabs a.active { color: var(--ik-brand); border-bottom-color: var(--ik-accent); }

/* ---------- Empty, pagination ---------- */
.ik-empty { text-align: center; padding: 40px 20px; color: var(--ik-muted); }
.ik-empty i { font-size: 34px; display: block; margin-bottom: 8px; color: #b3bccb; }
.ik-pagination { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; padding: 14px; }
.ik-pagination a, .ik-pagination span { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 10px; border-radius: 8px; border: 1px solid var(--ik-line); background: #fff; color: var(--ik-text); font-weight: 600; font-size: 13px; }
.ik-pagination .active { background: var(--ik-brand); border-color: var(--ik-brand); color: #fff; }
.ik-pagination .disabled { opacity: .45; }

/* ---------- Edition workspace ---------- */
.ik-cover-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.ik-pagecard { background: #fff; border: 1px solid var(--ik-line); border-radius: 10px; overflow: hidden; position: relative; cursor: grab; transition: box-shadow .15s, transform .15s; }
.ik-pagecard:hover { box-shadow: 0 8px 22px rgba(18, 26, 38, .12); }
.ik-pagecard.dragging { opacity: .5; }
.ik-pagecard.drop-before { box-shadow: -4px 0 0 var(--ik-accent); }
.ik-pagecard img { display: block; width: 100%; aspect-ratio: 2/3; object-fit: cover; object-position: top; background: #eef1f5; }
.ik-pagecard .meta { padding: 8px 10px; font-size: 12.5px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.ik-pagecard .no { position: absolute; top: 8px; left: 8px; background: var(--ik-ink); color: #fff; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 8px; }
.ik-pagecard .stories { position: absolute; top: 8px; right: 8px; }
.ik-drop { border: 2px dashed #c6cfdc; border-radius: 12px; padding: 26px; text-align: center; background: #fafbfd; transition: border-color .15s, background .15s; }
.ik-drop.over { border-color: var(--ik-brand); background: var(--ik-brand-50); }
.ik-drop i { font-size: 30px; color: var(--ik-brand); }
.ik-progress { height: 8px; border-radius: 6px; background: var(--ik-bg); overflow: hidden; margin-top: 10px; display: none; }
.ik-progress span { display: block; height: 100%; width: 0; background: var(--ik-ok); transition: width .2s; }
.ik-issue-thumb { width: 100%; max-width: 220px; border-radius: 8px; border: 1px solid var(--ik-line); box-shadow: var(--ik-shadow); }
.ik-kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13.5px; }
.ik-kv dt { color: var(--ik-muted); }
.ik-kv dd { margin: 0; color: var(--ik-ink); font-weight: 500; }

/* ---------- Story mapper ---------- */
.ik-mapper { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; }
.ik-mapper-stage { position: relative; background: #2a3342; border-radius: var(--ik-radius); padding: 14px; overflow: auto; max-height: calc(100vh - 150px); }
.ik-mapper-canvas { position: relative; margin: 0 auto; user-select: none; cursor: crosshair; touch-action: none; }
.ik-mapper-canvas img { display: block; width: 100%; height: auto; pointer-events: none; box-shadow: 0 4px 20px rgba(0,0,0,.35); }
.ik-region { position: absolute; border: 2px solid rgba(29, 78, 216, .9); background: rgba(29, 78, 216, .14); border-radius: 2px; cursor: pointer; }
.ik-region span { position: absolute; top: -1px; left: -1px; background: #1d4ed8; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 0 0 4px 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ik-region:hover { background: rgba(29, 78, 216, .25); }
.ik-region.selected { border-color: var(--ik-accent); background: rgba(200, 16, 46, .16); z-index: 2; }
.ik-region.selected span { background: var(--ik-accent); }
.ik-region.draft { border-style: dashed; border-color: #f59e0b; background: rgba(245, 158, 11, .18); }
.ik-mapper-side { position: sticky; top: 70px; }
.ik-story-list { max-height: 300px; overflow-y: auto; }
.ik-story-list a { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--ik-line); color: var(--ik-text); }
.ik-story-list a:hover, .ik-story-list a.active { background: var(--ik-brand-50); }
.ik-story-list .n { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--ik-brand); color: #fff; font-size: 11px; font-weight: 700; flex: none; }
.ik-pagestrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.ik-pagestrip a { flex: none; width: 54px; text-align: center; font-size: 11px; color: var(--ik-muted); }
.ik-pagestrip img { width: 54px; height: 78px; object-fit: cover; object-position: top; border-radius: 4px; border: 2px solid transparent; display: block; }
.ik-pagestrip a.active img { border-color: var(--ik-accent); }

/* ---------- Clips grid ---------- */
.ik-clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; padding: 18px; }
.ik-clip { border: 1px solid var(--ik-line); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.ik-clip img { width: 100%; height: 160px; object-fit: cover; object-position: top; background: #eef1f5; display: block; }
.ik-clip .meta { padding: 10px 12px; font-size: 12.5px; flex: 1; }

/* ---------- Auth ---------- */
.ik-auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.ik-auth-art { background: radial-gradient(circle at 20% 20%, #2b4d7a 0, var(--ik-side) 60%); color: #dfe6f1; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.ik-auth-art h2 { color: #fff; font: 700 40px/1.15 Georgia, "Times New Roman", serif; margin: 18px 0 14px; max-width: 520px; }
.ik-auth-art p { color: #b8c4d6; max-width: 480px; font-size: 15px; }
.ik-auth-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.ik-auth-art li { display: flex; gap: 10px; align-items: center; color: #d5deea; }
.ik-auth-art li i { color: #ff9aa9; }
.ik-auth-art .paper { position: absolute; right: -60px; bottom: -40px; width: 300px; height: 400px; background: repeating-linear-gradient(180deg, rgba(255,255,255,.08) 0 6px, transparent 6px 14px); border: 1px solid rgba(255,255,255,.12); transform: rotate(-8deg); border-radius: 6px; }
.ik-auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.ik-auth-box { width: 100%; max-width: 380px; }
.ik-auth-box h1 { font-size: 24px; margin-bottom: 6px; }
.ik-demo-box { margin-top: 22px; border: 1px dashed #cdd5e1; border-radius: 10px; padding: 12px 14px; background: #fafbfd; font-size: 12.5px; }
.ik-demo-box button { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
    .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ik-mapper { grid-template-columns: 1fr; }
    .ik-mapper-side { position: static; }
}
@media (max-width: 960px) {
    .ik-sidebar { transform: translateX(-100%); }
    body.nav-open .ik-sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .ik-main { margin-left: 0; }
    .ik-burger { display: inline-block; }
    .cols-2, .cols-3, .cols-main { grid-template-columns: 1fr; }
    .ik-auth { grid-template-columns: 1fr; }
    .ik-auth-art { display: none; }
}
@media (max-width: 640px) {
    .ik-content { padding: 16px; }
    .cols-4 { grid-template-columns: 1fr; }
    .ik-form, .ik-form.cols-3 { grid-template-columns: 1fr; }
    .ik-field.span-2, .ik-form .span-2, .ik-form.cols-3 .span-3 { grid-column: auto; }
    .ik-topbar { padding: 10px 16px; }
    .ik-user div { display: none; }
}
