/* ============================================================
   css/organization.css  –  THIQLA Struktur Organisasi
   ============================================================ */

/* ── Page Loader ─────────────────────────────────────────── */
#orgLoader {
    position: fixed; inset: 0;
    background: rgba(255,255,255,.9);
    display: flex; align-items: center; justify-content: center;
    gap: 14px; font-size: 14px; color: #64748b;
    z-index: 9999;
}
.org-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: orgSpin .8s linear infinite;
}
@keyframes orgSpin { to { transform: rotate(360deg); } }

/* ── Hero Header ─────────────────────────────────────────── */
.org-hero-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 60%, #6366f1 100%);
}

/* ── Admin Toolbar ───────────────────────────────────────── */
.org-admin-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    background: linear-gradient(90deg, #1e3a8a, #2563eb);
    color: white;
    padding: 12px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
}
.org-admin-label {
    font-size: 13px; font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    opacity: .9;
}
.org-admin-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.org-adm-btn {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.28);
    color: white;
    padding: 7px 16px; border-radius: 8px;
    font-size: 12.5px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    transition: background .2s;
}
.org-adm-btn:hover { background: rgba(255,255,255,.28); }

/* ── Tabs ────────────────────────────────────────────────── */
.org-tabs {
    display: flex; gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.org-tab {
    padding: 11px 22px;
    border: none; background: none; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #64748b;
    display: flex; align-items: center; gap: 8px;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .18s, border-color .18s;
    border-radius: 8px 8px 0 0;
}
.org-tab:hover   { color: #6366f1; background: #f5f3ff; }
.org-tab.active  { color: #6366f1; border-bottom-color: #6366f1; background: #f5f3ff; }

/* ── Tab Content ─────────────────────────────────────────── */
.org-tab-content { display: none; }
.org-tab-content.active { display: block; }

/* ── Section Header ──────────────────────────────────────── */
.org-section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}
.org-section-header h2 {
    font-size: 17px; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 10px;
}
.org-section-header h2 i { color: #6366f1; }
.org-add-btn {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white; border: none;
    padding: 8px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 7px;
    transition: opacity .2s;
}
.org-add-btn:hover { opacity: .88; }

/* ── ORG CHART ───────────────────────────────────────────── */
.org-chart-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;        /* clip rounded corners; scroll is on child */
    margin-bottom: 24px;
    width: 100%;             /* stay within .page-content, never grow wider */
    min-width: 0;            /* flex child fix */
    box-sizing: border-box;
}
.org-chart-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap;
    background: #fafbff;
    border-radius: 16px 16px 0 0;
}
.org-chart-header h3 {
    font-size: 15px; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 8px; margin: 0; flex: 1;
}
.org-chart-header h3 i { color: #6366f1; }
.org-chart-sub { font-size: 12px; color: #94a3b8; }

/* Zoom controls in header */
.org-zoom-controls {
    display: flex; align-items: center; gap: 6px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px 8px;
}
.org-zoom-btn {
    width: 28px; height: 28px; border-radius: 7px;
    border: none; background: white;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #475569;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}
.org-zoom-btn:hover { background: #6366f1; color: white; border-color: #6366f1; }
.org-zoom-label {
    font-size: 12px; font-weight: 700; color: #475569;
    min-width: 38px; text-align: center;
}

/* Scroll wrapper — the actual scrollable container */
.org-chart-scroll {
    overflow: scroll;                 /* always show both scrollbars        */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: auto;            /* Firefox: never thin/none            */
    scrollbar-color: #a5b4fc #e8edf5; /* Firefox custom colors              */
    height: 560px;                    /* fixed height → vertical scroll      */
    min-height: 200px;
    /* ↓ Critical: must be constrained so content can overflow it */
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    position: relative;
    background: #fafbff;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

/* Custom scrollbars — visible and styled (WebKit: Chrome, Edge, Safari) */
/* Use !important to override the global ::-webkit-scrollbar rule in style.css */
.org-chart-scroll::-webkit-scrollbar {
    width: 12px !important;
    height: 12px !important;
    display: block !important;
}
.org-chart-scroll::-webkit-scrollbar-track {
    background: #e8edf5 !important;
    border-radius: 6px;
}
.org-chart-scroll::-webkit-scrollbar-thumb {
    background: #a5b4fc !important;
    border-radius: 6px;
    border: 2px solid #e8edf5;
}
.org-chart-scroll::-webkit-scrollbar-thumb:hover {
    background: #6366f1 !important;
}
.org-chart-scroll::-webkit-scrollbar-corner {
    background: #e8edf5;
}
/* Hint at the bottom of the inner content area */
.org-chart-resize-hint {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    font-size: 11px; color: #94a3b8;
    margin-top: 16px;
    padding: 6px 12px;
    pointer-events: none;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
    width: fit-content;
    margin-left: auto; margin-right: auto;
}

/* ── Tree Layout ─────────────────────────────────────────── */
.org-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: inherit;
    padding-bottom: 16px;
    min-width: max-content;
}

/* Inner wrapper — receives the CSS transform for zoom */
.org-chart-inner {
    padding: 36px 48px 48px;
    display: inline-block;   /* shrink-wrap to tree's natural width          */
    min-width: 100%;         /* but at least fill the scroll container       */
    box-sizing: border-box;
    /* transform applied via JS */
    transform-origin: top left;
    transition: transform .18s ease;
}

/* Simple vertical stem */
.org-v-line {
    width: 2px;
    height: 32px;
    background: #c7d7ff;
    margin: 0 auto;
    flex-shrink: 0;
}

/* A level-row that holds sibling branches */
.org-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* One column in a row */
.org-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;   /* ← gap between siblings */
}

/* ── Connector group (parent → children) ────────────────── */
/* Wraps: v-line-down + h-bar + child-row */
.org-children-wrap {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

/* Horizontal bar spanning all children */
.org-h-bar-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    width: 100%;
}

/* The coloured horizontal line drawn as a pseudo-element
   It stretches from the centre of the first child to the centre of the last child.
   We achieve this by letting each child branch carry a half-bar on its top border. */
.org-branch-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
    position: relative;
}

/* Top border of every branch-drop = the horizontal connector */
.org-branch-drop::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0; right: 0;
    height: 2px;
    background: #c7d7ff;
}

/* First child: connector starts at centre → right */
.org-branch-drop:first-child::before {
    left: 50%;
}

/* Last child: connector starts at left → centre */
.org-branch-drop:last-child::before {
    right: 50%;
}

/* Single child: no horizontal bar needed */
.org-branch-drop:first-child:last-child::before {
    display: none;
}

/* Short vertical drop inside each branch-drop */
.org-branch-drop .org-v-drop {
    width: 2px;
    height: 24px;
    background: #c7d7ff;
    flex-shrink: 0;
}

/* Single child variant — no horizontal bar */
.org-branch-drop-single::before {
    display: none !important;
}

/* ── Node Box ────────────────────────────────────────────── */
.org-node {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    padding: 14px 16px;
    min-width: 148px; max-width: 180px;
    transition: transform .2s, box-shadow .2s;
    cursor: default;
    position: relative;
}
.org-node:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

/* ── Level-specific node styles are injected dynamically by injectLevelStyles() ──
   Do NOT add hardcoded .org-node.level-xxx rules here — they will conflict
   with the database-driven styles and break synchronization.            */

.org-node-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    margin: 0 auto 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    /* Default fallback — overridden per-level by #org-level-styles */
    background: #e2e8f0; color: #64748b;
}

.org-node-name  { font-size: 12px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.org-node-title { font-size: 10.5px; opacity: .8; line-height: 1.3; }

/* Admin action buttons on nodes */
.org-node-actions {
    display: none;
    position: absolute; top: 4px; right: 4px;
    gap: 4px;
}
.org-node:hover .org-node-actions { display: flex; }
.org-node-btn {
    width: 22px; height: 22px; border-radius: 5px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; line-height: 1;
}
.org-node-btn.edit   { background: rgba(255,255,255,.35); color: inherit; }
.org-node-btn.del    { background: rgba(239,68,68,.25); color: #ef4444; }
.org-node.level-ceo .org-node-btn.edit,
.org-node.level-dir .org-node-btn.edit { color: rgba(255,255,255,.9); }
.org-node-btn:hover { filter: brightness(1.15); }

/* ── Divisi Grid ─────────────────────────────────────────── */
.org-div-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.org-div-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.org-div-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.org-div-card-header {
    padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}
.org-div-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.org-div-card-header h3 { font-size: 14px; font-weight: 700; color: #0f172a; margin: 0 0 3px; }
.org-div-card-header p  { font-size: 11.5px; color: #64748b; margin: 0; }

.org-div-card-actions {
    position: absolute; top: 10px; right: 12px;
    display: none; gap: 5px;
}
.org-div-card:hover .org-div-card-actions { display: flex; }
.org-div-card-btn {
    width: 28px; height: 28px; border-radius: 7px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: background .15s;
}
.org-div-card-btn.edit { background: #eff6ff; color: #2563eb; }
.org-div-card-btn.del  { background: #fef2f2; color: #dc2626; }
.org-div-card-btn.edit:hover { background: #dbeafe; }
.org-div-card-btn.del:hover  { background: #fee2e2; }

.org-div-card-body { padding: 4px 20px 12px; }
.org-div-member {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #f1f5f9;
}
.org-div-member:last-child { border-bottom: none; }
.org-div-member-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
}
.org-div-member-info .m-name { font-size: 12.5px; font-weight: 600; color: #0f172a; }
.org-div-member-info .m-pos  { font-size: 11px; color: #64748b; }

.org-div-card-footer {
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 11.5px; color: #64748b;
}
.org-div-badge {
    font-size: 11px; font-weight: 700;
    background: #eff6ff; color: #2563eb;
    padding: 2px 10px; border-radius: 10px;
}
.org-inactive-badge {
    font-size: 10px; font-weight: 700;
    background: #f1f5f9; color: #94a3b8;
    padding: 2px 8px; border-radius: 10px;
    margin-left: 6px;
}

/* ── Level Jabatan List ───────────────────────────────────── */
.org-level-list {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 24px;
}
.org-level-item {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.org-level-item:last-child { border-bottom: none; }
.org-level-item:hover { background: #f8fafc; }
.org-level-swatch {
    width: 52px; height: 24px; border-radius: 5px;
    flex-shrink: 0;
}
.org-level-info { flex: 1; }
.org-level-info .lv-name { font-size: 14px; font-weight: 700; color: #0f172a; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.org-level-info .lv-desc { font-size: 12px; color: #64748b; margin-top: 2px; }
/* Key badge shown next to level name for admins */
.lv-key-badge {
    font-size: 10px; font-weight: 600;
    background: #ede9fe; color: #6d28d9;
    border: 1px solid #ddd6fe;
    border-radius: 4px; padding: 1px 6px;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}
.org-level-item-actions { display: none; gap: 6px; }
.org-level-item:hover .org-level-item-actions { display: flex; }
.org-level-btn {
    width: 30px; height: 30px; border-radius: 7px;
    border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
}
.org-level-btn.edit { background: #eff6ff; color: #2563eb; }
.org-level-btn.del  { background: #fef2f2; color: #dc2626; }
.org-level-btn.edit:hover { background: #dbeafe; }
.org-level-btn.del:hover  { background: #fee2e2; }

/* ── Form ────────────────────────────────────────────────── */
.org-form-row {
    display: flex; gap: 14px; margin-bottom: 16px;
    flex-wrap: wrap;
}
.org-field { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 5px; }
.org-field-full { flex: 0 0 100%; }
.org-field-toggle {
    flex-direction: row; align-items: center; gap: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 10px 14px;
    flex: 0 0 auto;
}
.org-field label { font-size: 12px; font-weight: 600; color: #475569; }
.req { color: #ef4444; }
.org-field small { font-size: 11px; color: #94a3b8; }
.org-field code  { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.org-field input[type=text],
.org-field input[type=number],
.org-field select,
.org-field textarea {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13.5px; font-family: inherit; color: #0f172a;
    outline: none; transition: border-color .18s, box-shadow .18s;
}
.org-field input:focus, .org-field select:focus, .org-field textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

/* Color picker row */
.org-color-row { display: flex; gap: 8px; align-items: center; }
.org-color-row input[type=text]  { flex: 1; }
.org-color-row input[type=color] { width: 38px; height: 38px; padding: 2px; border-radius: 7px; border: 1px solid #e2e8f0; cursor: pointer; }

/* ── Toggle Switch ───────────────────────────────────────── */
.org-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.org-switch input { opacity: 0; width: 0; height: 0; }
.org-slider {
    position: absolute; inset: 0;
    background: #cbd5e1; border-radius: 24px;
    cursor: pointer; transition: .3s;
}
.org-slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: .3s;
}
.org-switch input:checked + .org-slider { background: #22c55e; }
.org-switch input:checked + .org-slider::before { transform: translateX(20px); }

/* ── Node Preview ────────────────────────────────────────── */
.org-node-preview {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 16px;
    margin-top: 4px;
}
.org-preview-label {
    font-size: 11px; font-weight: 700; color: #94a3b8;
    text-transform: uppercase; letter-spacing: .8px;
    display: block; margin-bottom: 12px;
}
.org-node-preview-box {
    display: flex; justify-content: center;
}

/* ── Level Preview ───────────────────────────────────────── */
.org-level-preview-wrap {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 14px 16px;
    margin-top: 4px;
}
.org-preview-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .6px; color: #94a3b8;
    display: flex; align-items: center; gap: 6px;
}
/* Live node preview inside the level modal */
#levelNodePreview .org-node {
    cursor: default;
    min-width: 160px;
    max-width: 200px;
    border: 2px solid #e2e8f0;  /* default border, overridden by inline style */
}
.org-level-preview-row { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.org-level-preview-label-text { font-size: 14px; font-weight: 600; color: #0f172a; }

/* ── Members sub-section ─────────────────────────────────── */
.org-members-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
    margin-top: 4px;
}
.org-members-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
    font-size: 13px; font-weight: 700; color: #475569;
}
.org-members-header span { display: flex; align-items: center; gap: 7px; }
.org-add-member-btn {
    background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d;
    padding: 5px 12px; border-radius: 7px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 6px;
}
.org-add-member-btn:hover { background: #dcfce7; }
.org-member-rows { display: flex; flex-direction: column; gap: 8px; }
.org-member-row {
    display: flex; gap: 8px; align-items: center;
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 10px 12px;
}
.org-member-row input {
    border: 1px solid #e2e8f0; border-radius: 7px;
    padding: 7px 10px; font-size: 13px; font-family: inherit;
    color: #0f172a; flex: 1; outline: none;
}
.org-member-row input:focus { border-color: #6366f1; }
.org-member-is-lead { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #64748b; white-space: nowrap; }
.org-member-is-lead input[type=checkbox] { width: 14px; height: 14px; accent-color: #6366f1; cursor: pointer; }
.org-member-remove {
    width: 28px; height: 28px; border-radius: 7px;
    background: #fef2f2; border: none; color: #dc2626;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0;
}
.org-member-remove:hover { background: #fee2e2; }

/* ── Modal ───────────────────────────────────────────────── */
.org-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1300;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.org-modal {
    background: white; border-radius: 20px;
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    animation: orgModalIn .25s ease;
}
.org-modal-lg  { max-width: 700px; }
.org-modal-sm  { max-width: 400px; }
@keyframes orgModalIn {
    from { transform: scale(.94) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}
.org-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
}
.org-modal-header h2 {
    font-size: 16px; font-weight: 800; color: #0f172a;
    display: flex; align-items: center; gap: 8px; margin: 0;
}
.org-modal-header h2 i { color: #6366f1; }
.org-modal-danger h2 i { color: #dc2626; }
.org-modal-x {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #64748b;
}
.org-modal-x:hover { background: #fee2e2; color: #dc2626; }
.org-modal-body   { padding: 20px 24px; }
.org-modal-footer {
    padding: 16px 24px; border-top: 1px solid #e2e8f0;
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.org-btn-save {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white; border: none;
    padding: 10px 24px; border-radius: 10px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: opacity .2s;
}
.org-btn-save:disabled { opacity: .55; cursor: not-allowed; }
.org-btn-cancel {
    background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0;
    padding: 10px 20px; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
}
.org-btn-cancel:hover { background: #e2e8f0; }
.org-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white; border: none;
    padding: 10px 22px; border-radius: 10px;
    font-size: 14px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 8px;
}
.org-btn-danger:disabled { opacity: .55; cursor: not-allowed; }

/* ── Delete Warning ──────────────────────────────────────── */
.org-delete-warn {
    text-align: center; padding: 16px 8px;
}
.org-delete-warn > i { font-size: 42px; color: #f59e0b; display: block; margin-bottom: 12px; }
.org-delete-warn p { font-size: 14px; color: #475569; margin: 0 0 8px; }
.org-delete-warn strong { display: block; font-size: 15px; color: #0f172a; margin-bottom: 8px; }
.org-delete-note { font-size: 12px; color: #94a3b8 !important; }

/* ── Toast ───────────────────────────────────────────────── */
#orgToast {
    position: fixed; bottom: 28px; right: 28px;
    background: #0f172a; color: white;
    padding: 12px 20px; border-radius: 12px;
    font-size: 13.5px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
    z-index: 9999; max-width: 360px;
    animation: orgToastIn .25s ease;
    transition: opacity .3s;
}
@keyframes orgToastIn {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
#orgToast.org-toast-success { background: #059669; }
#orgToast.org-toast-error   { background: #dc2626; }

/* ── Empty State ─────────────────────────────────────────── */
.org-empty {
    text-align: center; padding: 60px 20px; color: #94a3b8;
}
.org-empty i { font-size: 48px; display: block; margin-bottom: 14px; }
.org-empty p { font-size: 14px; }

/* ── Utility ─────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Level Item Mini-Node Preview ───────────────────────────── */
.org-level-item {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 14px; padding: 12px 16px;
    margin-bottom: 10px;
    transition: box-shadow .18s;
}
.org-level-item:hover { box-shadow: 0 4px 16px rgba(99,102,241,.08); }

.org-level-node-mini {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 14px 8px 9px;
    border-radius: 10px;
    border: 2px solid rgba(0,0,0,.07);
    flex-shrink: 0; min-width: 160px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.org-level-node-mini-av {
    width: 32px; height: 32px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.org-level-node-mini-label {
    font-size: 12px; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Node Level Sync Info ────────────────────────────────────── */
.org-node-level-sync {
    display: flex; align-items: center; gap: 8px;
    background: #eff6ff; border: 1px solid #bfdbfe;
    border-radius: 8px; padding: 8px 13px;
    font-size: 12.5px; color: #1d4ed8; font-weight: 500;
    margin: 8px 0 4px;
}
.org-node-level-sync i { color: #3b82f6; }

/* ══════════════════════════════════════════════════════════════
   LEVEL VISUAL EDITOR
══════════════════════════════════════════════════════════════ */
.lv-editor-wrap {
    background: #f8fafc; border: 1.5px solid #e2e8f0;
    border-radius: 14px; padding: 18px;
    margin: 14px 0;
}
.lv-editor-title {
    font-size: 13.5px; font-weight: 700; color: #1e293b;
    margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px;
}
.lv-editor-section {
    background: #fff; border: 1px solid #e2e8f0;
    border-radius: 10px; padding: 14px 16px;
    margin-bottom: 12px;
}
.lv-editor-section-label {
    font-size: 12px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 12px;
}
.lv-editor-row {
    display: flex; flex-wrap: wrap; gap: 16px;
    align-items: flex-start;
}
.lv-editor-field {
    display: flex; flex-direction: column; gap: 5px;
    min-width: 110px;
}
.lv-editor-field-wide { min-width: 240px; flex: 1; }
.lv-field-label {
    font-size: 11.5px; font-weight: 600; color: #475569;
}

/* Color picker + swatch row */
.lv-picker-row {
    display: flex; flex-direction: column; gap: 5px;
}
.lv-color-inp {
    width: 44px; height: 30px;
    border: 2px solid #e2e8f0; border-radius: 7px;
    cursor: pointer; padding: 2px;
    background: transparent;
}
.lv-color-inp:hover { border-color: #6366f1; }

/* Current avatar color swatch (shows effective color including rgba) */
.lv-av-current {
    width: 22px; height: 22px;
    border-radius: 50%; border: 2px solid #e2e8f0;
    flex-shrink: 0; cursor: default;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    align-self: center;
}

/* Semi-transparent chip row */
.lv-rgba-chips {
    display: flex; align-items: center; gap: 5px;
    flex-wrap: wrap; margin-top: 3px;
}
.lv-rgba-label {
    font-size: 10.5px; color: #94a3b8; font-weight: 600;
}
.lv-rgba-chip {
    padding: 2px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; cursor: pointer;
    color: #475569; transition: transform .12s, box-shadow .12s;
    user-select: none;
}
.lv-rgba-chip:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Palette swatch grid */
.lv-palette {
    display: flex; flex-wrap: wrap; gap: 3px;
    max-width: 220px;
}
.lv-swatch {
    width: 14px; height: 14px;
    border-radius: 3px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: transform .12s, border-color .12s;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.lv-swatch:hover {
    transform: scale(1.35);
    border-color: #1e293b;
    z-index: 2;
}

/* Segment control (Solid / Gradient) */
.lv-seg {
    display: flex; border-radius: 8px; overflow: hidden;
    border: 1.5px solid #e2e8f0;
}
.lv-seg-btn {
    padding: 5px 13px; background: #f8fafc;
    border: none; font-size: 12px; font-weight: 600;
    color: #64748b; cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.lv-seg-btn:not(:last-child) { border-right: 1.5px solid #e2e8f0; }
.lv-seg-btn.active { background: #6366f1; color: #fff; }
.lv-seg-btn:hover:not(.active) { background: #ede9fe; color: #4338ca; }

/* Presets */
.lv-presets {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.lv-preset-btn {
    padding: 5px 11px; border-radius: 20px;
    background: #f1f5f9; border: 1.5px solid #e2e8f0;
    font-size: 11.5px; font-weight: 600; color: #475569;
    cursor: pointer; transition: all .15s;
    white-space: nowrap;
}
.lv-preset-btn:hover { background: #6366f1; color: #fff; border-color: #6366f1; }

/* Generated CSS display */
.lv-css-generated {
    background: #1e293b; border-radius: 8px;
    padding: 10px 14px; margin-top: 12px;
    display: flex; flex-direction: column; gap: 6px;
}
.lv-css-label {
    font-size: 11px; font-weight: 600; color: #7dd3fc;
    text-transform: uppercase; letter-spacing: .5px;
}
.lv-css-code {
    font-family: 'Courier New', monospace;
    font-size: 11px; color: #a5f3fc;
    white-space: pre-wrap; word-break: break-all;
    line-height: 1.6;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .org-div-grid { grid-template-columns: 1fr 1fr; }
    .org-admin-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
    .org-div-grid { grid-template-columns: 1fr; }
    .org-tabs { gap: 0; }
    .org-tab  { padding: 9px 14px; font-size: 12.5px; }
    .org-modal { border-radius: 14px; }
    .org-form-row { flex-direction: column; }
    .lv-editor-row { flex-direction: column; }
    .lv-palette { max-width: 180px; }
}
