/* ============================================================================
   NewsPlatform Admin Console — design system
   Premium newsroom console: neutral surfaces, strong type hierarchy, dense.
   ============================================================================ */

:root {
    --np-bg: #f6f7f8;
    --np-surface: #ffffff;
    --np-surface-alt: #fafbfc;
    --np-border: #e4e7eb;
    --np-border-strong: #d3d8de;
    --np-text: #14181f;
    --np-text-muted: #5b6472;
    --np-text-faint: #8a91a0;
    --np-primary: #1a3fb0;
    --np-primary-hover: #142f87;
    --np-accent: #c81e2c;
    --np-success: #16794f;
    --np-warning: #b5760a;
    --np-danger: #c81e2c;
    --np-info: #0e6ba8;
    --np-radius-sm: 4px;
    --np-radius: 8px;
    --np-radius-lg: 12px;
    --np-shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.06);
    --np-shadow: 0 2px 8px rgba(20, 24, 31, 0.08);
    --np-shadow-lg: 0 8px 28px rgba(20, 24, 31, 0.14);
    --np-sidebar-w: 248px;
    --np-sidebar-w-collapsed: 64px;
    --np-topbar-h: 56px;
    --np-font-sans: "Noto Sans Tamil", "Nirmala UI", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    --np-font-serif: Georgia, "Source Serif 4", "Times New Roman", serif;
}

* { box-sizing: border-box; }

body.np-admin {
    margin: 0;
    background: var(--np-bg);
    color: var(--np-text);
    font-family: var(--np-font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    color-scheme: light;
}

a { color: inherit; text-decoration: none; }

/* --- Shell layout --------------------------------------------------------- */

.np-shell {
    display: grid;
    grid-template-columns: var(--np-sidebar-w) 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns .15s ease;
}

.np-shell.np-collapsed {
    grid-template-columns: var(--np-sidebar-w-collapsed) 1fr;
}

/* --- Sidebar --------------------------------------------------------------- */

.np-sidebar {
    background: #12141a;
    color: #cfd3dc;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.np-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    font-weight: 700;
    letter-spacing: .04em;
    font-size: 13px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
    overflow: hidden;
}

.np-sidebar-brand .np-mark {
    width: 26px; height: 26px; border-radius: 6px;
    background: linear-gradient(135deg, var(--np-primary), var(--np-accent));
    flex: none;
}

.np-nav { padding: 10px 8px; flex: 1; }

.np-nav-section {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6b7280;
    padding: 14px 10px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.np-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--np-radius-sm);
    font-size: 13.5px;
    color: #cfd3dc;
    white-space: nowrap;
    overflow: hidden;
}

.np-nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.np-nav-item.active { background: var(--np-primary); color: #fff; }
.np-nav-item.disabled { color: #565c68; cursor: default; }
.np-nav-item.disabled:hover { background: none; color: #565c68; }

.np-nav-item .np-icon { width: 16px; text-align: center; flex: none; font-size: 13px; }
.np-nav-children { padding-left: 22px; }
.np-nav-children .np-nav-item { font-size: 13px; padding: 6px 10px; }

.np-shell.np-collapsed .np-nav-section,
.np-shell.np-collapsed .np-nav-item span.np-label,
.np-shell.np-collapsed .np-sidebar-brand span.np-label { display: none; }
.np-shell.np-collapsed .np-nav-children { display: none; }

/* --- Topbar ------------------------------------------------------------------ */

.np-topbar {
    height: var(--np-topbar-h);
    background: var(--np-surface);
    border-bottom: 1px solid var(--np-border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 18px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.np-topbar-toggle {
    border: none; background: none; cursor: pointer;
    font-size: 16px; color: var(--np-text-muted); padding: 6px;
    border-radius: var(--np-radius-sm);
}
.np-topbar-toggle:hover { background: var(--np-surface-alt); }

.np-command-bar {
    flex: 1; max-width: 520px;
    display: flex; align-items: center; gap: 8px;
    background: var(--np-surface-alt);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius);
    padding: 7px 12px;
    color: var(--np-text-faint);
    font-size: 13px;
}

.np-command-bar kbd {
    margin-left: auto;
    font-size: 10.5px;
    border: 1px solid var(--np-border-strong);
    border-radius: 4px;
    padding: 1px 5px;
    color: var(--np-text-muted);
    background: var(--np-surface);
}

.np-topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.np-main {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.np-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 26px;
}

.np-content:has(.np-editor-shell),
.np-content:has(.np-composer-shell) {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.np-user-chip {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 600;
}
.np-user-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--np-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}

/* --- Content ------------------------------------------------------------- */

.np-logo-picker { display: flex; flex-direction: column; gap: 10px; }
.np-logo-preview {
    display: flex; align-items: center; justify-content: center;
    min-height: 72px; max-width: 320px;
    padding: 12px; border: 1px solid var(--np-border); border-radius: var(--np-radius);
    background: var(--np-surface-alt);
}
.np-logo-preview img { max-height: 56px; max-width: 100%; width: auto; display: block; }

.np-page-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.np-page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.np-page-subtitle { color: var(--np-text-muted); font-size: 13px; margin-top: 2px; }

.np-grid { display: grid; gap: 16px; }
.np-grid-4 { grid-template-columns: repeat(4, 1fr); }
.np-grid-3 { grid-template-columns: repeat(3, 1fr); }
.np-grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1100px) {
    .np-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .np-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

.np-card {
    background: var(--np-surface);
    border: 1px solid var(--np-border);
    border-radius: var(--np-radius);
    box-shadow: var(--np-shadow-sm);
}

.np-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 1px solid var(--np-border);
    font-weight: 600; font-size: 13.5px;
}

.np-card-body { padding: 16px; }

.np-stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--np-text-muted); }
.np-stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.np-stat-trend { font-size: 12px; margin-top: 6px; color: var(--np-text-muted); }

.np-activity-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--np-border); font-size: 13px; }
.np-activity-item:last-child { border-bottom: none; }
.np-activity-time { color: var(--np-text-faint); font-variant-numeric: tabular-nums; flex: none; width: 74px; }
.np-activity-text strong { font-weight: 600; }

.np-empty-state {
    text-align: center; padding: 48px 20px; color: var(--np-text-muted);
}
.np-empty-state .np-icon-lg { font-size: 30px; margin-bottom: 10px; opacity: .5; }

/* --- Self-built charts (no external chart library) ----------------------------- */

.np-bar-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.np-bar-label { flex: 0 0 130px; color: var(--np-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-bar-track { flex: 1; background: var(--np-surface-alt); border-radius: 4px; height: 16px; overflow: hidden; }
.np-bar-fill { height: 100%; background: var(--np-primary); border-radius: 4px; min-width: 2px; }
.np-bar-value { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; width: 46px; text-align: right; }

.np-trend-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 8px; }
.np-trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.np-trend-bar { width: 100%; background: var(--np-primary); border-radius: 3px 3px 0 0; min-height: 2px; }
.np-trend-label { font-size: 10px; color: var(--np-text-faint); margin-top: 6px; white-space: nowrap; }

.np-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    padding: 2px 8px; border-radius: 100px;
}
.np-badge-neutral { background: #eef0f3; color: var(--np-text-muted); }
.np-badge-primary { background: #e7ecfb; color: var(--np-primary); }
.np-badge-success { background: #e2f4ec; color: var(--np-success); }
.np-badge-warning { background: #fbf0dc; color: var(--np-warning); }
.np-badge-danger  { background: #fbe4e6; color: var(--np-danger); }

.np-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; padding: 7px 14px;
    border-radius: var(--np-radius-sm); border: 1px solid var(--np-border-strong);
    background: var(--np-surface); cursor: pointer;
}
.np-btn:hover { background: var(--np-surface-alt); }
.np-btn-primary { background: var(--np-primary); border-color: var(--np-primary); color: #fff; }
.np-btn-primary:hover { background: var(--np-primary-hover); }
.np-icon-btn {
    padding: 5px 8px;
    font-size: 16px;
    line-height: 1;
    min-width: 34px;
    justify-content: center;
}

.np-soon { font-size: 10px; margin-left: auto; color: #8a91a0; }

/* --- Toolbar / list ------------------------------------------------------- */

.np-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.np-toolbar .np-spacer { flex: 1; }

.np-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.np-table th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--np-text-muted); padding: 8px 12px; border-bottom: 1px solid var(--np-border);
}
.np-table td { padding: 9px 12px; border-bottom: 1px solid var(--np-border); vertical-align: middle; }
.np-table tr:last-child td { border-bottom: none; }
.np-table tr:hover td { background: var(--np-surface-alt); }

.np-tree-row { display: flex; align-items: center; gap: 8px; }
.np-tree-row .np-drag-handle { cursor: grab; color: var(--np-text-faint); }
.np-tree-row.np-drop-target td { background: #e7ecfb; }

.np-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.np-row-actions button, .np-row-actions a { font-size: 12px; padding: 4px 9px; }

/* --- Drawer ---------------------------------------------------------------- */

.np-drawer-overlay {
    position: fixed; inset: 0; background: rgba(15,17,22,.35);
    display: none; z-index: 100;
}
.np-drawer-overlay.open { display: block; }

.np-drawer {
    position: fixed; top: 0; right: 0; height: 100vh; width: 420px;
    background: var(--np-surface); box-shadow: var(--np-shadow-lg);
    transform: translateX(100%); transition: transform .18s ease;
    z-index: 101; display: flex; flex-direction: column;
}
.np-drawer.open { transform: translateX(0); }

.np-drawer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid var(--np-border); font-weight: 700; font-size: 15px;
}
.np-drawer-close { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--np-text-muted); }
.np-drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.np-drawer-footer { padding: 14px 20px; border-top: 1px solid var(--np-border); display: flex; gap: 8px; justify-content: flex-end; }

.np-form-field { margin-bottom: 14px; }
.np-form-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--np-text-muted); }
.np-form-field input[type=text], .np-form-field input[type=email], .np-form-field input[type=tel],
.np-form-field input[type=url], .np-form-field input[type=number], .np-form-field textarea, .np-form-field select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--np-border-strong); border-radius: var(--np-radius-sm); font-size: 13.5px; font-family: inherit;
}
.np-form-field textarea { resize: vertical; min-height: 70px; }
.np-form-hint { font-size: 11.5px; color: var(--np-text-faint); margin-top: 4px; }
.np-form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* --- Toast ------------------------------------------------------------------ */

.np-toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.np-toast {
    background: #14181f; color: #fff; font-size: 13px; padding: 10px 14px;
    border-radius: var(--np-radius-sm); box-shadow: var(--np-shadow); opacity: 0; transform: translateY(6px);
    transition: opacity .15s ease, transform .15s ease;
}
.np-toast.show { opacity: 1; transform: translateY(0); }

/* --- Media library --------------------------------------------------------- */

.np-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.np-media-card {
    border: 1px solid var(--np-border); border-radius: var(--np-radius); overflow: hidden;
    background: var(--np-surface); cursor: pointer; transition: box-shadow .12s ease;
}
.np-media-card:hover { box-shadow: var(--np-shadow); }
.np-media-thumb { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--np-bg); display: block; }
.np-media-card-body { padding: 8px 10px; }
.np-media-card-title { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-media-card-meta { font-size: 11px; color: var(--np-text-muted); margin-top: 2px; }

.np-dropzone {
    border: 2px dashed var(--np-border-strong); border-radius: var(--np-radius); padding: 26px;
    text-align: center; color: var(--np-text-muted); font-size: 13px; margin-bottom: 16px;
    background: var(--np-surface-alt);
}
.np-dropzone.dragover { border-color: var(--np-primary); background: #e7ecfb; color: var(--np-primary); }
.np-dropzone-compact { padding: 14px 12px; margin-bottom: 12px; outline: none; }
.np-dropzone-compact:focus { border-color: var(--np-primary); }
#media-picker-drawer .np-media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.np-focal-picker { position: relative; display: inline-block; max-width: 100%; cursor: crosshair; }
.np-focal-picker img { max-width: 100%; display: block; border-radius: var(--np-radius-sm); }
.np-focal-dot {
    position: absolute; width: 16px; height: 16px; border-radius: 50%;
    background: var(--np-accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--np-accent);
    transform: translate(-50%, -50%); pointer-events: none;
}

.np-crop-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.np-crop-preview-grid img { width: 100%; border-radius: 4px; border: 1px solid var(--np-border); }
.np-crop-preview-label { font-size: 10.5px; color: var(--np-text-muted); text-align: center; margin-top: 3px; }

.np-media-detail-drawer { width: 480px; }
.np-usage-list { font-size: 12.5px; }
.np-usage-list li { padding: 4px 0; border-bottom: 1px solid var(--np-border); }

/* --- News Desk Kanban ------------------------------------------------------ */

.np-kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.np-kanban-column { background: var(--np-surface-alt); border: 1px solid var(--np-border); border-radius: var(--np-radius); min-height: 200px; }
.np-kanban-column-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--np-border); font-weight: 700; font-size: 13px; }
.np-kanban-count { margin-left: auto; font-size: 11.5px; color: var(--np-text-muted); font-weight: 600; background: var(--np-border); border-radius: 100px; padding: 1px 8px; }
.np-kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.np-kanban-cards.np-drop-hover { background: #e7ecfb; border-radius: var(--np-radius-sm); }

.np-kanban-card {
    background: var(--np-surface); border: 1px solid var(--np-border); border-radius: var(--np-radius-sm);
    padding: 10px; font-size: 13px; cursor: grab; box-shadow: var(--np-shadow-sm);
}
.np-kanban-card:active { cursor: grabbing; }
.np-kanban-card.dragging { opacity: .4; }
.np-kanban-card-title { font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.np-kanban-card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--np-text-muted); flex-wrap: wrap; }

/* --- Editorial Calendar ------------------------------------------------------ */

.np-calendar-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.np-calendar-nav .np-calendar-label { font-weight: 700; font-size: 15px; min-width: 160px; text-align: center; }
.np-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--np-border); border-radius: var(--np-radius); overflow: hidden; }
.np-calendar-dow { background: var(--np-surface-alt); padding: 7px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--np-text-muted); border-bottom: 1px solid var(--np-border); }
.np-calendar-cell { min-height: 110px; border-right: 1px solid var(--np-border); border-bottom: 1px solid var(--np-border); padding: 6px; background: var(--np-surface); }
.np-calendar-cell.np-dim { background: var(--np-surface-alt); color: var(--np-text-faint); }
.np-calendar-cell.np-today { background: #e7ecfb; }
.np-calendar-date { font-size: 11.5px; font-weight: 700; margin-bottom: 4px; }
.np-calendar-item {
    font-size: 10.5px; padding: 3px 6px; border-radius: 4px; margin-bottom: 3px; cursor: grab;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.np-calendar-item.scheduled { background: #e2f4ec; color: var(--np-success); }
.np-calendar-item.deadline { background: #fbf0dc; color: #a4720c; cursor: default; }
.np-calendar-cell.np-drop-hover { background: #e7ecfb; }
