/* ══════════════════════════════════════════════════════════════════════════════
   SOP Manager - Main Stylesheet
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── RESET & BASE ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #e0e6ed;
    overflow-x: hidden;
    background-color: #0a0e27;
}

/* ── PARALLAX STAR FIELD ── */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

#stars-sm,
#stars-md,
#stars-lg {
    position: absolute;
    top: 0;
    left: 0;
    background: transparent;
}

/* ── Small Stars (distant, slow) ── */
#stars-sm {
    width: 1px;
    height: 1px;
    box-shadow:
        42px 118px #fff, 187px 371px rgba(255,255,255,0.8), 329px 67px #fff,
        503px 489px rgba(255,255,255,0.7), 611px 232px #fff, 78px 891px rgba(255,255,255,0.9),
        834px 1023px #fff, 952px 155px rgba(255,255,255,0.6), 1107px 742px #fff,
        1289px 1387px rgba(255,255,255,0.8), 1401px 298px #fff, 1563px 1821px rgba(255,255,255,0.7),
        1720px 456px #fff, 1887px 1102px rgba(255,255,255,0.9), 2034px 678px #fff,
        2198px 1543px rgba(255,255,255,0.6), 2351px 89px #fff, 2489px 934px rgba(255,255,255,0.8),
        123px 1456px #fff, 267px 1789px rgba(255,255,255,0.7), 445px 1234px #fff,
        589px 1678px rgba(255,255,255,0.9), 721px 345px #fff, 867px 1567px rgba(255,255,255,0.6),
        1012px 1890px #fff, 1156px 423px rgba(255,255,255,0.8), 1334px 876px #fff,
        1478px 1234px rgba(255,255,255,0.7), 1623px 567px #fff, 1789px 1678px rgba(255,255,255,0.9),
        1934px 234px #fff, 2078px 1345px rgba(255,255,255,0.6), 2234px 789px #fff,
        2389px 1567px rgba(255,255,255,0.8), 56px 567px #fff, 198px 1023px rgba(255,255,255,0.7),
        378px 1678px #fff, 534px 234px rgba(255,255,255,0.9), 689px 1456px #fff,
        845px 678px rgba(255,255,255,0.6), 1001px 1234px #fff, 1167px 1890px rgba(255,255,255,0.8),
        1323px 456px #fff, 1489px 1678px rgba(255,255,255,0.7), 1645px 1023px #fff,
        1812px 345px rgba(255,255,255,0.9), 1967px 1567px #fff, 2123px 178px rgba(255,255,255,0.6),
        2278px 1234px #fff, 2434px 567px rgba(255,255,255,0.8), 145px 789px #fff,
        312px 1345px rgba(255,255,255,0.7), 467px 78px #fff, 623px 1890px rgba(255,255,255,0.9),
        778px 1123px #fff, 934px 345px rgba(255,255,255,0.6), 1089px 1567px #fff,
        1245px 678px rgba(255,255,255,0.8), 1412px 1890px #fff, 1567px 1234px rgba(255,255,255,0.7),
        1723px 890px #fff, 1878px 123px rgba(255,255,255,0.9), 2045px 1456px #fff,
        2201px 345px rgba(255,255,255,0.6), 2356px 1678px #fff, 2501px 234px rgba(255,255,255,0.8),
        89px 1678px #fff, 234px 456px rgba(255,255,255,0.7), 401px 1890px #fff,
        556px 789px rgba(255,255,255,0.9), 712px 1567px #fff, 878px 234px rgba(255,255,255,0.6),
        1034px 1789px #fff, 1189px 567px rgba(255,255,255,0.8), 1356px 1345px #fff,
        1512px 89px rgba(255,255,255,0.7), 1678px 1678px #fff, 1834px 789px rgba(255,255,255,0.9),
        1989px 1890px #fff, 2145px 567px rgba(255,255,255,0.6), 2312px 1123px #fff,
        2467px 1789px rgba(255,255,255,0.8), 167px 1234px #fff, 345px 567px rgba(255,255,255,0.7),
        512px 1890px #fff, 678px 345px rgba(255,255,255,0.9), 823px 1678px #fff,
        989px 789px rgba(255,255,255,0.6), 1145px 1345px #fff, 1312px 123px rgba(255,255,255,0.8),
        1467px 1789px #fff, 1634px 456px rgba(255,255,255,0.7), 1801px 1567px #fff,
        1956px 678px rgba(255,255,255,0.9), 2112px 1890px #fff, 2278px 234px rgba(255,255,255,0.6),
        2445px 1345px #fff, 34px 1890px rgba(255,255,255,0.8), 201px 234px #fff,
        356px 1456px rgba(255,255,255,0.7), 523px 678px #fff, 689px 1234px rgba(255,255,255,0.9),
        856px 1890px #fff, 1023px 456px rgba(255,255,255,0.6), 1178px 1678px #fff,
        1345px 234px rgba(255,255,255,0.8), 1501px 1345px #fff, 1667px 789px rgba(255,255,255,0.7);
    animation: starDrift 180s linear infinite;
}

#stars-sm::after {
    content: '';
    position: absolute;
    top: -2000px;
    width: 1px;
    height: 1px;
    box-shadow: inherit;
}

/* ── Medium Stars (mid-distance, moderate speed) ── */
#stars-md {
    width: 2px;
    height: 2px;
    box-shadow:
        156px 312px rgba(255,255,255,0.9), 423px 1567px rgba(200,220,255,0.8),
        678px 89px rgba(255,255,255,0.85), 934px 1234px rgba(200,220,255,0.9),
        1189px 567px rgba(255,255,255,0.8), 1445px 1789px rgba(200,220,255,0.85),
        1701px 234px rgba(255,255,255,0.9), 1956px 1456px rgba(200,220,255,0.8),
        2212px 678px rgba(255,255,255,0.85), 2467px 1890px rgba(200,220,255,0.9),
        89px 1890px rgba(255,255,255,0.8), 345px 678px rgba(200,220,255,0.85),
        601px 1345px rgba(255,255,255,0.9), 856px 456px rgba(200,220,255,0.8),
        1112px 1678px rgba(255,255,255,0.85), 1367px 234px rgba(200,220,255,0.9),
        1623px 1567px rgba(255,255,255,0.8), 1878px 789px rgba(200,220,255,0.85),
        2134px 1234px rgba(255,255,255,0.9), 2389px 345px rgba(200,220,255,0.8),
        234px 1123px rgba(255,255,255,0.85), 489px 456px rgba(200,220,255,0.9),
        745px 1789px rgba(255,255,255,0.8), 1001px 890px rgba(200,220,255,0.85),
        1256px 1456px rgba(255,255,255,0.9), 1512px 123px rgba(200,220,255,0.8),
        1767px 1890px rgba(255,255,255,0.85), 2023px 567px rgba(200,220,255,0.9),
        2278px 1345px rgba(255,255,255,0.8), 2534px 789px rgba(200,220,255,0.85),
        67px 456px rgba(255,255,255,0.9), 312px 1678px rgba(200,220,255,0.8),
        567px 890px rgba(255,255,255,0.85), 823px 1234px rgba(200,220,255,0.9),
        1078px 345px rgba(255,255,255,0.8), 1334px 1789px rgba(200,220,255,0.85),
        1589px 678px rgba(255,255,255,0.9), 1845px 1456px rgba(200,220,255,0.8),
        2101px 123px rgba(255,255,255,0.85), 2356px 1567px rgba(200,220,255,0.9);
    animation: starDrift 120s linear infinite;
}

#stars-md::after {
    content: '';
    position: absolute;
    top: -2000px;
    width: 2px;
    height: 2px;
    box-shadow: inherit;
}

/* ── Large Stars (close, faster + twinkle) ── */
#stars-lg {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow:
        234px 567px rgba(255,255,255,0.95), 678px 1345px rgba(200,220,255,0.9),
        1123px 234px rgba(255,240,220,0.95), 1567px 1789px rgba(255,255,255,0.9),
        2012px 678px rgba(200,220,255,0.95), 2456px 1234px rgba(255,240,220,0.9),
        345px 1890px rgba(255,255,255,0.95), 789px 456px rgba(200,220,255,0.9),
        1234px 1567px rgba(255,240,220,0.95), 1678px 890px rgba(255,255,255,0.9),
        2123px 1456px rgba(200,220,255,0.95), 456px 1123px rgba(255,240,220,0.9),
        901px 1789px rgba(255,255,255,0.95), 1345px 345px rgba(200,220,255,0.9),
        1789px 1234px rgba(255,240,220,0.95), 2234px 567px rgba(255,255,255,0.9),
        123px 678px rgba(200,220,255,0.95), 567px 1678px rgba(255,240,220,0.9),
        1012px 123px rgba(255,255,255,0.95), 1456px 1456px rgba(200,220,255,0.9);
    animation: starDrift 80s linear infinite, starTwinkle 4s ease-in-out infinite alternate;
}

#stars-lg::after {
    content: '';
    position: absolute;
    top: -2000px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow: inherit;
}

@keyframes starDrift {
    from { transform: translateY(0); }
    to   { transform: translateY(-2000px); }
}

@keyframes starTwinkle {
    0%   { opacity: 1; }
    50%  { opacity: 0.4; }
    100% { opacity: 1; }
}


/* ── HIDDEN FORMS ── */
.hidden-form {
    display: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: #e0e6ed;
}

/* ══════════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════════════ */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.notification.success {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: #0a0e27;
}

.notification.error {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════════════════════ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 320px;
    height: 100vh;
    background: #0a0f26bd;
    border-right: 1px solid rgba(102, 126, 234, 0.2);
    padding: 20px 0 0 0;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 3px;
}

.sidebar.collapsed {
    width: 56px;
}

.sidebar.collapsed .sidebar-header h2,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-add,
.sidebar.collapsed .sop-list,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-bottom-bar {
    display: none;
}

/* ── Sidebar Header ── */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo {
    width: 120px;
    height: auto;
    visibility: hidden;
}

.sidebar-logo.ready {
    visibility: visible;
}

.collapsed .sidebar-header{
    flex-direction: column;
}

.sidebar-toggle {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.05);
}

/* ── Sidebar Toolbar (Search + Add) ── */
.sidebar-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    flex-shrink: 0;
}

.sidebar-toolbar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    color: rgba(224, 230, 237, 0.6);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-toolbar-btn:hover {
    background: rgba(102, 126, 234, 0.18);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.35);
}

.sidebar.collapsed .sidebar-toolbar {
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

/* ── Search ── */
.sidebar-search {
    position: relative;
    padding: 15px 20px;
}

.sidebar-search input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    transition: all 0.2s;
}

.sidebar-search input:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(102, 126, 234, 0.1);
}

.sidebar-search input::placeholder {
    color: rgba(224, 230, 237, 0.4);
}

.sidebar-search .search-icon {
    position: absolute;
    left: 35px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(224, 230, 237, 0.4);
    pointer-events: none;
}

/* ── Action Buttons ── */
.sidebar-add {
    padding: 10px 16px;
    position: relative;
    flex-shrink: 0;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
}

.btn-add-new {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border: 1px dashed rgba(102, 126, 234, 0.4);
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.06);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-new:hover {
    background: rgba(102, 126, 234, 0.14);
    border-color: rgba(102, 126, 234, 0.6);
    color: #fff;
}

.btn-add-new i {
    font-size: 12px;
}

.add-new-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 16px;
    right: 16px;
    background: #111938;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 10px;
    padding: 6px;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.add-new-menu.open {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.add-new-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.add-new-menu button:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #fff;
}

.add-new-menu button i {
    width: 18px;
    text-align: center;
    color: rgba(102, 126, 234, 0.8);
    font-size: 14px;
}

/* ── SOP List ── */
.sop-list {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}

.sop-list::-webkit-scrollbar {
    width: 6px;
}

.sop-list::-webkit-scrollbar-track {
    background: transparent;
}

.sop-list::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 3px;
}

.sop-list::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

/* ── Department Header ── */
.department-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(224, 230, 237, 0.7);
    transition: all 0.2s;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    min-width: 0;
}

.department-header > span {
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

.department-header .department-actions {
    opacity: 0;
    transition: opacity 0.2s;
}

.department-header:hover .department-actions {
    opacity: 1;
}

.department-header:hover {
    background: rgba(102, 126, 234, 0.08);
    color: rgba(224, 230, 237, 0.95);
}

.department-header.open {
    color: #4facfe;
}

.department-count {
    font-size: 11px;
    opacity: 0.6;
    margin-left: 5px;
}

.department-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}

.department-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    margin-left: 5px;
    transform: rotate(-90deg);
}

.department-arrow.open {
    transform: rotate(0deg);
}

/* ── Department Categories Container ── */
.department-categories {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.department-categories.open {
    max-height: 5000px;
}

/* ── Category Header ── */
.category-header {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 32px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.3px;
    color: rgba(224, 230, 237, 0.55);
    transition: all 0.2s;
    min-width: 0;
}

.category-header > span {
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    line-height: 1.2;
    font-size: 1.1em;
}

.category-header .category-actions{
    opacity: 0;
    transition: opacity 0.2s;
}

.category-header:hover .category-actions {
    opacity: 1;
}

.category-header:hover {
    background: rgba(102, 126, 234, 0.05);
    color: rgba(224, 230, 237, 0.9);
}

.category-header.open {
    color: #667eea;
}

.category-count {
    font-size: 11px;
    opacity: 0.6;
    margin-left: 5px;
}

.category-actions {
    display: flex;
    gap: 5px;
    align-items: center;
}


.category-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    margin-left: 5px;
    transform: rotate(-90deg);
}

.category-arrow.open {
    transform: rotate(0deg);
}

/* ── Category SOPs ── */
.category-sops {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.category-sops.open {
    max-height: 2000px;
    overflow: visible;
}

/* ── Hidden Department (edit mode) ── */
.department-header.department-hidden {
    opacity: 0.4;
}

.department-header.department-hidden > span {
    text-decoration: line-through;
    text-decoration-color: rgba(224, 230, 237, 0.3);
}

.department-categories.department-hidden {
    opacity: 0.35;
}

.btn-visibility {
    color: rgba(224, 230, 237, 0.5);
    transition: color 0.2s;
}

.btn-visibility:hover {
    color: rgba(224, 230, 237, 0.9);
}

.btn-visibility.hidden-active {
    color: rgba(245, 87, 108, 0.7);
}

.btn-visibility.hidden-active:hover {
    color: #f5576c;
}

/* ── SOP Item ── */
.sop-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 20px 12px 15px;
    margin: 5px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.sop-item:hover {
    background: rgba(102, 126, 234, 0.05);
    border-color: rgba(102, 126, 234, 0.2);
}

.sop-item.active {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.3);
}

.sop-item-bar {
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 0 4px 4px 0;
}

.sop-item-info {
    flex: 1;
    margin-left: 10px;
}

.sop-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #e0e6ed;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    /* white-space: nowrap; */
}

.sop-item-meta {
    font-size: 12px;
    color: rgba(224, 230, 237, 0.5);
    display: flex;
    align-items: center;
}

/* ── Steps Info Icon ── */
.steps-info-icon {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: rgba(102, 126, 234, 0.5);
    cursor: pointer;
    font-size: 11px;
    transition: color 0.2s;
}

.steps-info-icon:hover {
    color: #667eea;
}

.steps-toggle {
    cursor: pointer;
    transition: color 0.2s;
}

.steps-toggle:hover {
    color: #667eea;
}

/* ── Steps Inline Dropdown ── */
.steps-dropdown {
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin 0.3s ease, opacity 0.2s ease;
    opacity: 0;
    margin-top: 0;
    border-top: 0 solid rgba(102, 126, 234, 0.1);
}

.steps-dropdown.open {
    max-height: 500px;
    opacity: 1;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.steps-dropdown-item {
    padding: 5px 0;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color 0.2s;
}

.steps-dropdown-item:hover {
    color: #667eea;
}

.steps-dropdown .steps-dropdown-item.active {
    color: #fff;
    font-weight: 600;
}

.steps-dropdown .steps-dropdown-item.match {
    color: #4facfe;
}

.steps-dropdown-meta {
    padding: 6px 0 2px;
    margin-top: 6px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    font-size: 11px;
    color: rgba(224, 230, 237, 0.4);
    display: flex;
    align-items: center;
    gap: 5px;
}

.steps-dropdown-meta i {
    font-size: 10px;
}

/* ── Drag Handle for SOP items ── */
.sop-drag-handle {
    display: flex;
    align-items: center;
    padding: 0 2px 0 0;
    color: rgba(224, 230, 237, 0.25);
    cursor: grab;
    font-size: 11px;
    flex-shrink: 0;
}

.sop-drag-handle:hover {
    color: rgba(224, 230, 237, 0.6);
}

.sop-item[draggable="true"]:active .sop-drag-handle {
    cursor: grabbing;
}

.sop-item.dragging {
    opacity: 0.4;
}

.sop-item.drag-over {
    border-top: 2px solid #667eea;
    margin-top: -2px;
}

/* ── Timeline Action Menu ── */
.timeline-action-wrapper {
    position: relative;
    display: inline-flex;
}

.timeline-action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    background: #1e2a3a;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.timeline-action-menu.open {
    display: block;
}

.timeline-action-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    color: rgba(224, 230, 237, 0.85);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.timeline-action-menu button:hover {
    background: rgba(102, 126, 234, 0.15);
}

.timeline-action-menu button.danger {
    color: #e74c3c;
}

.timeline-action-menu button.danger:hover {
    background: rgba(231, 76, 60, 0.12);
}

.timeline-action-menu button i {
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.action-menu-details {
    padding: 10px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.action-menu-detail {
    display: grid;
    grid-template-columns: 16px 1fr;
    gap: 0 8px;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.7);
    padding: 5px 0;
    line-height: 1.4;
    text-align: left;
}

.action-menu-detail i {
    width: 16px;
    text-align: center;
    font-size: 11px;
    color: rgba(102, 126, 234, 0.7);
    grid-row: 1;
    padding-top: 2px;
}

.action-menu-detail strong {
    color: rgba(224, 230, 237, 0.95);
    font-weight: 600;
}

.action-menu-detail .detail-date {
    grid-column: 2;
    color: rgba(224, 230, 237, 0.4);
    font-size: 11px;
}

.action-menu-detail.muted {
    color: rgba(224, 230, 237, 0.35);
    font-style: italic;
}

.action-menu-divider {
    height: 1px;
    background: rgba(102, 126, 234, 0.15);
    margin: 6px 0;
}

/* ══════════════════════════════════════════════════════════════════════════════
   EDIT MODE TOGGLE (COOL SWITCH)
   ══════════════════════════════════════════════════════════════════════════════ */

/* Keep your existing hide logic */
html:not(.edit-mode) .edit-action,
html:not(.edit-mode) .department-actions,
html:not(.edit-mode) .category-actions {
    display: none !important;
}

.edit-action{
    text-align:center;
    margin-top:10px;
    position:relative;
    z-index:5;
}

/* ── SOP Prev/Next Navigation ── */
.sop-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    position: relative;
    z-index: 5;
    gap: 20px;
}

.sop-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9) 0%, rgba(15, 18, 41, 0.9) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    color: rgba(224, 230, 237, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 45%;
}

.sop-nav-link:hover {
    border-color: rgba(102, 126, 234, 0.5);
    color: #fff;
    background: linear-gradient(135deg, rgba(26, 31, 58, 1) 0%, rgba(20, 24, 50, 1) 100%);
}

.sop-nav-link.next {
    margin-left: auto;
    text-align: right;
}

.sop-nav-link i {
    font-size: 14px;
    flex-shrink: 0;
    color: #667eea;
}

.sop-nav-label {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sidebar Bottom Bar ── */
.sidebar-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
    flex-shrink: 0;
}

.sidebar-bottom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sidebar-bottom-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.06);
}

/* Logout icon hover — red tint */
a.sidebar-bottom-btn:hover {
    color: #f5576c;
    background: rgba(245, 87, 108, 0.1);
}

/* Settings dropdown container */
.sidebar-settings {
    position: relative;
}

.settings-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: #111938;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 200;
}

.settings-dropdown.open {
    display: block;
}

.settings-dropdown .btn-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.settings-dropdown .btn-toggle:hover {
    background: transparent;
}

.settings-dropdown .toggle-label {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.3px;
}

.settings-dropdown .toggle-switch {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 2px;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.settings-dropdown .toggle-knob {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(0);
    transition: all 0.25s ease;
}

/* Active state — edit mode ON */
html.edit-mode .settings-dropdown #editToggle .toggle-switch {
    background: rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.3);
}

html.edit-mode .settings-dropdown #editToggle .toggle-knob {
    background: #4facfe;
    transform: translateX(16px);
}

html.edit-mode .settings-dropdown #editToggle .toggle-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Active state — full-width timeline ON */
html.full-width-timeline .settings-dropdown #fullWidthToggle .toggle-switch {
    background: rgba(79, 172, 254, 0.3);
    border-color: rgba(79, 172, 254, 0.3);
}

html.full-width-timeline .settings-dropdown #fullWidthToggle .toggle-knob {
    background: #4facfe;
    transform: translateX(16px);
}

html.full-width-timeline .settings-dropdown #fullWidthToggle .toggle-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Cog spins slightly when dropdown is open */
.sidebar-bottom-btn .fa-gear {
    transition: transform 0.3s ease;
}

.settings-dropdown.open ~ #settingsCog .fa-gear,
.sidebar-settings:has(.settings-dropdown.open) > .sidebar-bottom-btn .fa-gear {
    transform: rotate(45deg);
    color: rgba(255, 255, 255, 0.85);
}


/* ══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT AREA
   ══════════════════════════════════════════════════════════════════════════════ */
.main {
    margin-left: 320px;
    padding: 40px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}


/* ── Main Wrapper ── */
.main-wrapper {
    position: relative;
    max-width: 1300px;
    margin: 0 auto;
}


/* ── Timeline Line ── */
.timeline-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 40px;
    width: 4px;
    height: calc(100% - 88px);
    border-radius: 2px;
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 100px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 100px), transparent 100%);
}

/* ── Timeline Header ── */
.timeline-header-area {
    text-align: center;
    margin-bottom: 72px;
    position: relative;
    padding-top: 8px;
}

/* ── Action Buttons (top-right) ── */
.timeline-header-actions {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

/* ── Tags Row (Under Review + Approve) ── */
.timeline-tags-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 32px;
}

.timeline-header-area h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #e0e6ed 0%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.15;
}

/* ── Stats Row (steps + views) ── */
.timeline-stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.timeline-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #8a94a6;
    letter-spacing: 0.2px;
}

.timeline-stat i {
    font-size: 13px;
    opacity: 0.7;
}

.timeline-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.timeline-stat-badge.old {
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.timeline-stat-badge.old i {
    font-size: 10px;
}

/* ── Controls Row (Expand/Collapse) ── */
.timeline-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.timeline-controls .btn {
    padding: 10px 22px;
    font-size: 13px;
}

/* ── SOP Status Badges ── */
.sop-status-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sop-status-badge.review {
    background: rgba(255, 183, 77, 0.15);
    color: #ffb74d;
    border: 1px solid rgba(255, 183, 77, 0.3);
}

.sop-status-badge-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sop-status-badge-lg.review {
    background: rgba(255, 183, 77, 0.12);
    color: #ffb74d;
    border: 1px solid rgba(255, 183, 77, 0.25);
}

.sop-status-badge-lg.old-sop {
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.sop-status-badge.expired {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.sop-status-badge.expired i {
    font-size: 8px;
    margin-right: 1px;
}

.sop-status-badge-lg.expired {
    background: rgba(239, 68, 68, 0.10);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.review-table-badge.badge-expired {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-approve {
    background: rgba(67, 233, 123, 0.12);
    color: #43e97b;
    border: 1px solid rgba(67, 233, 123, 0.3) !important;
    border-radius: 20px !important;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    padding: 5px 14px !important;
}

.btn-approve:hover {
    background: rgba(67, 233, 123, 0.22);
    border-color: rgba(67, 233, 123, 0.5);
}

/* ── Step Wrapper ── */
.step-block{
    padding: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    margin: 20px 0px;
    transition: box-shadow 0.2s ease;
}

.step-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.step-block-header span,
.step-block-header h4 {
    font-weight: 600;
    font-size: 16px;
    color: #e0e6ed;
}

.step-block-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Drag Handle ── */
.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #5a6280;
    cursor: grab;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    font-size: 14px;
    user-select: none;
}

.drag-handle:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.12);
}

.drag-handle:active {
    cursor: grabbing;
    color: #4facfe;
}

/* ── Drag States ── */
.step-block.dragging,
.widget-block.dragging {
    opacity: 0;
}

.drag-placeholder {
    border: 2px dashed rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.05);
    margin: 10px 0;
    transition: height 0.2s ease;
}

.step-wrapper {
    position: relative;
    margin-bottom: 50px;
    transition: all 0.3s;
}

.step-wrapper.last .timeline-line {
    display: none;
}

/* ── Step Node ── */
.step-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: white;
    z-index: 10;
}

/* ── Step Card ── */
.step-card {
    background: linear-gradient(135deg, rgba(26, 31, 58, 0.9) 0%, rgba(15, 18, 41, 0.9) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    width: calc(50% - 40px);
}

/* ── Left/Right alternating layout ── */
.step-wrapper.step-left .step-card {
    margin-right: auto;
}

.step-wrapper.step-right .step-card {
    margin-left: auto;
}

.step-wrapper.step-left .step-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(-5px);
}

.step-wrapper.step-right .step-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(5px);
}

/* ── Full-Width Timeline Mode ── */
html.full-width-timeline .main-wrapper {
    padding-left: 40px;
    max-width: 100%;
}

html.full-width-timeline .timeline-line {
    left: 6px;
    transform: none;
}

html.full-width-timeline .step-node {
    left: -22px;
    transform: none;
    width: 40px;
    height: 40px;
    font-size: 16px;
}

html.full-width-timeline .step-wrapper::before {
    content: '';
    position: absolute;
    left: -34px;
    top: 39px;
    width: 64px;
    height: 3px;
    background: rgba(102, 126, 234, 0.5);
    border-radius: 2px;
    z-index: 5;
}

html.full-width-timeline .step-card {
    width: calc(100% - 30px);
    margin-left: 30px;
}

html.full-width-timeline .step-wrapper.step-left .step-card,
html.full-width-timeline .step-wrapper.step-right .step-card {
    margin-left: 30px;
    margin-right: 0;
}

html.full-width-timeline .step-wrapper.step-left .step-card:hover,
html.full-width-timeline .step-wrapper.step-right .step-card:hover {
    transform: translateY(-2px);
}

/* ── Step Header ── */
/* ── Step Checkbox ── */

.step-checkbox {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: 2px;
}

.step-checkbox input {
    display: none;
}

.step-checkbox-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--border-color, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 11px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
}

.step-checkbox input:checked + .step-checkbox-mark {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.step-checkbox:hover .step-checkbox-mark {
    border-color: #10b981;
}

.step-card.step-done {
    opacity: 0.55;
}

.step-card.step-done .step-header h3 {
    text-decoration: line-through;
    text-decoration-color: rgba(138, 148, 166, 0.4);
}

.step-header {
    padding: 25px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.step-header:hover {
    background: rgba(102, 126, 234, 0.05);
}

.step-header-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.step-header-text h3 {
    font-size: 20px;
    color: #ffffff;
    margin: 0 0 4px;
    line-height: 1.4;
}

.step-overview {
    font-size: 15px;
    color: rgba(224, 230, 237, 0.7);
    line-height: 1.6;
    margin: 0;
}

.step-input {
    background-color: transparent;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 4px;
}

.step-input:hover,
.step-input:focus {
    background-color: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.35);
    outline: none;
}

.step-overview-input {
    background-color: transparent;
    border: none;
    border-radius: 6px;
    color: rgba(224, 230, 237, 0.7);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.6;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow: hidden;
}

.step-overview-input:hover,
.step-overview-input:focus {
    background-color: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.35);
    outline: none;
    color: rgba(224, 230, 237, 0.9);
}

.step-overview-input::placeholder {
    color: rgba(224, 230, 237, 0.3);
}

/* ── Step Header Actions ── */
.step-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 4px;
}

.step-delete-btn {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.25);
    color: rgba(245, 87, 108, 0.6);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-delete-btn:hover {
    background: rgba(245, 87, 108, 0.2);
    border-color: rgba(245, 87, 108, 0.5);
    color: #f5576c;
}

.step-arrow {
    font-size: 20px;
    color: rgba(224, 230, 237, 0.4);
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.step-arrow.open {
    transform: rotate(180deg);
}

/* ── Step Content ── */
.step-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.step-content.open {
    max-height: 50000px;
    padding: 25px;
}

/* ── Step Feedback (Comments) ── */

.step-feedback {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

.step-feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.step-feedback-label {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-feedback-label i {
    font-size: 13px;
    color: var(--accent-primary, #6366f1);
}

.step-feedback-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: transparent;
    color: var(--border-color, #e2e8f0);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.step-feedback-add-btn:hover {
    border-color: var(--accent-primary, #6366f1);
    color: var(--accent-primary, #6366f1);
    background: rgba(99, 102, 241, 0.06);
}

.step-feedback-comments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-feedback-empty {
    font-size: 12px;
    color: var(--text-tertiary, #94a3b8);
    font-style: italic;
}

.step-comment {
    background: #1e293b; /* slate-800 */
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 10px 12px;
    border-left: 3px solid var(--accent-primary, #6366f1);
    color: #e2e8f0;
}

.step-comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-tertiary, #94a3b8);
}

.step-comment-author {
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    display: flex;
    align-items: center;
    gap: 4px;
}

.step-comment-date {
    flex: 1;
}

.step-comment-delete {
    background: none;
    border: none;
    color: var(--text-tertiary, #94a3b8);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.15s;
}

.step-comment-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.step-comment-body {
    font-size: 13px;
    line-height: 1.5;
}

/* ── Section ── */
.section {
    margin-bottom: 25px;
}

.section:last-child {
    margin-bottom: 0;
}

.section h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #667eea;
}

.section ul, .section ol {
    list-style: none;
    padding-left: 0;
    padding-bottom: 10px;
}

.section li {
    padding: 8px 0 2px 25px;
    position: relative;
    color: rgba(224, 230, 237, 0.8);
}


.section ol li {
    padding-left: 10px;
}

.section ul li {
    padding-left: 19px;
    list-style: none;
}

.section ul li:before {
    content: "▸";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}


.empty-section {
    padding: 20px;
    text-align: center;
    color: rgba(224, 230, 237, 0.4);
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════════════════════
   FORM STYLES
   ══════════════════════════════════════════════════════════════════════════════ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: #e0e6ed;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4facfe;
    background: #171d39;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
    color: rgba(224, 230, 237, 0.5);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════════════ */

.btn {
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: linear-gradient(135deg, #374792 0%, #4facfe 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
}


/* SECONDARY */
.btn-secondary {
    background: rgba(102, 126, 234, 0.12);
    color: #8fa2ff;
    border: 1px solid rgba(102, 126, 234, 0.35);
}

.btn-secondary:hover {
    background: rgba(102, 126, 234, 0.22);
    border-color: rgba(102, 126, 234, 0.55);
}

/* OUTLINE */
.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #d7d9e6;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.55);
}

/* SMALL BUTTON VARIANT */
.btn-sm {
    padding: 8px 18px !important;
    font-size: 13px;
    border-radius: 6px;
}

/* CANCEL */

.btn-cancel {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.3);
    color: #f5576c;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-cancel:hover {
    background: #f5576c;
    color: white;
    border-color: #f5576c;
    transform: scale(1.1);
}

.btn-cancel:active {
    transform: scale(0.95);
}

/* DANGER */
.btn-danger {
    background: linear-gradient(135deg, #d9534f 0%, #b52b27 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

/* GHOST */
.btn-ghost {
    background: transparent;
    color: #8f9bbd;
    border: none;
}

.btn-ghost:hover {
    color: white;
    background: rgba(255, 255, 255, 0.06);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Icon itself */
.btn-icon i {
    font-size: 10px;
    color: #ffffff;
    transition: color 0.25s ease;
}

/* Hover effect */
.btn-icon:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* Danger variant */
.btn-icon.danger {
    background: rgba(229, 57, 53, 0.12);
    border-color: rgba(229, 57, 53, 0.25);
}

.btn-icon.danger i {
    color: #ff6b6b;
}

.btn-icon.danger:hover {
    background: rgba(229, 57, 53, 0.18);
    border-color: rgba(229, 57, 53, 0.35);
}

/* ══════════════════════════════════════════════════════════════════════════════
   LIGHTBOX
   ══════════════════════════════════════════════════════════════════════════════ */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 30px;
    padding: 5px 15px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

.lightbox-caption {
    text-align: center;
    color: white;
    margin-top: 15px;
    font-size: 16px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 100px 40px;
}

.empty-state h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    color: rgba(224, 230, 237, 0.6);
}

.empty-state p {
    font-size: 16px;
    color: rgba(224, 230, 237, 0.4);
}

/* ================================================================
   WIDGET EDITOR STYLES - DARK MODE
   Modern, sleek design with smooth animations and visual hierarchy
   ================================================================ */

/* ──────────────────────────────────────────────────────────────
   WIDGET BLOCK BASE
   ────────────────────────────────────────────────────────────── */
.widget-block {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}


/* ──────────────────────────────────────────────────────────────
   WIDGET HEADER
   ────────────────────────────────────────────────────────────── */
.widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(26, 35, 56, 0.6);
    border-bottom: 1px solid #242b3d;
    backdrop-filter: blur(10px);
}

.widget-type-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #9aa1b4;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-transform: uppercase;
}

.widget-type-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: #4facfe;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.6);
}

.widget-style-select {
    background: #1a2338;
    border: 1px solid #2a3450;
    color: #e2e8f0;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.widget-style-select:hover {
    border-color: #4facfe;
    background: #1e2740;
}

.widget-style-select:focus {
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* ──────────────────────────────────────────────────────────────
   WIDGET BODY
   ────────────────────────────────────────────────────────────── */
.widget-body {
    padding: 18px;
}

/* ──────────────────────────────────────────────────────────────
   LIST WIDGET SPECIFIC
   ────────────────────────────────────────────────────────────── */
.widget-list .widget-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.widget-list .item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(26, 35, 56, 0.4);
    border-radius: 8px;
    transition: all 0.2s ease;
    animation: widgetSlideIn 0.3s ease;
}

.widget-list .item-row:hover {
    background: rgba(26, 35, 56, 0.7);
    transform: translateX(4px);
}

.widget-list .num {
    color: #4facfe;
    font-weight: 600;
    font-size: 14px;
    min-width: 24px;
    text-align: center;
}

.widget-list .item-row.indented {
    margin-left: 28px;
}

.btn-indent {
    background: none;
    border: 1px solid rgba(102, 126, 234, 0.2);
    color: rgba(224, 230, 237, 0.4);
    border-radius: 4px;
    cursor: pointer;
    padding: 3px 6px;
    font-size: 11px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-indent:hover {
    border-color: rgba(102, 126, 234, 0.5);
    color: rgba(224, 230, 237, 0.7);
}

.btn-indent.active {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #667eea;
}

/* ──────────────────────────────────────────────────────────────
   HIGHLIGHT WIDGET SPECIFIC (editor form context)
   ────────────────────────────────────────────────────────────── */
.widget-block.widget-highlight {
    border-left: 4px solid #f5576c;
    border-right: 1px solid rgba(245, 87, 108, 0.3);
    border-bottom: 1px solid rgba(245, 87, 108, 0.3);
    border-top: 1px solid rgba(245, 87, 108, 0.3);
    background: rgba(245, 87, 108, 0.1);
    margin: 10px 0px;
}

/* ──────────────────────────────────────────────────────────────
   CODE WIDGET SPECIFIC
   ────────────────────────────────────────────────────────────── */
.widget-code {
    border-left: 4px solid #43e97b;
}

.widget-code .widget-header {
    background: rgba(67, 233, 123, 0.08);
}

.widget-code .widget-type-label::before {
    background: #43e97b;
    box-shadow: 0 0 8px rgba(67, 233, 123, 0.6);
}

.widget-code .widget-body textarea {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    tab-size: 4;
    white-space: pre;
    background: rgba(10, 14, 23, 0.6);
    color: #e0e6ed;
}

/* Code snippet display (view mode) */
.code-snippet-block {
    position: relative;
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(67, 233, 123, 0.2);
    background: rgba(10, 14, 23, 0.7);
}

.code-snippet-block .code-lang-label {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #43e97b;
    background: rgba(67, 233, 123, 0.1);
    border-bottom-left-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-snippet-block pre {
    margin: 0;
    padding: 16px 18px;
    overflow-x: auto;
}

.code-snippet-block pre code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e0e6ed;
    white-space: pre;
    tab-size: 4;
}

/* ──────────────────────────────────────────────────────────────
   LINKS WIDGET SPECIFIC
   ────────────────────────────────────────────────────────────── */
.widget-links {
    border-left: 4px solid #4facfe;
}

.widget-links .widget-header {
    background: rgba(79, 172, 254, 0.1);
}

.widget-links .widget-type-label::before {
    background: #4facfe;
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.6);
}

.widget-links .widget-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.widget-links .item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(26, 35, 56, 0.4);
    border-radius: 8px;
    padding: 6px 10px;
    transition: all 0.2s ease;
}

.widget-links .item-row:hover {
    background: rgba(26, 35, 56, 0.7);
}

/* ── Links display (timeline view) ── */
.links-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.links-box .link-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(79, 172, 254, 0.08);
    border: 1px solid rgba(79, 172, 254, 0.2);
    border-radius: 8px;
    color: #4facfe;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
}

.links-box .link-item:hover {
    background: rgba(79, 172, 254, 0.15);
    border-color: rgba(79, 172, 254, 0.4);
    transform: translateX(4px);
}

.links-box .link-icon {
    font-size: 14px;
}

/* ── Highlight widget (Important Notes) ── */
.widget-highlight {
    display: flex;
    gap: 12px;
    background: rgba(234, 179, 8, 0.08);
    border-left: 3px solid rgba(234, 179, 8, 0.6);
    border-radius: 6px;
    padding: 14px 16px;
    margin-top: 10px;
    color: rgba(224, 230, 237, 0.85);
}

.edit-mode .widget-highlight {
    flex-direction: column;
}

.widget-highlight-icon {
    color: rgba(234, 179, 8, 0.7);
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────
   IMAGES WIDGET SPECIFIC
   ────────────────────────────────────────────────────────────── */
.widget-images .widget-header {
    background: rgba(79, 172, 254, 0.1);
}

.widget-images .widget-type-label::before {
    background: #4facfe;
    box-shadow: 0 0 8px rgba(79, 172, 254, 0.6);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 12px;
}

.image-preview-item {
    position: relative;
    border: 1px solid #2a3450;
    border-radius: 10px;
    padding: 12px;
    background: rgba(26, 35, 56, 0.6);
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease;
}

.image-preview-item:hover {
    border-color: #4facfe;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.image-preview-item img {
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin-bottom: 8px;
    display: block;
    transition: transform 0.3s ease;
}

.image-preview-item:hover img {
    transform: scale(1.02);
}

.images-empty {
    color: #5a6280;
    font-size: 13px;
    text-align: center;
    padding: 32px 20px;
    border: 2px dashed #2a3450;
    border-radius: 10px;
    margin-top: 12px;
    background: rgba(26, 35, 56, 0.3);
    transition: all 0.3s ease;
}

.images-empty:hover {
    border-color: #3d4a6b;
    background: rgba(26, 35, 56, 0.5);
}

/* ──────────────────────────────────────────────────────────────
   COPYABLE TEXT WIDGET SPECIFIC
   ────────────────────────────────────────────────────────────── */
.widget-copytext {
    border-left: 4px solid #43e97b;
}

.widget-copytext .widget-header {
    background: rgba(67, 233, 123, 0.1);
}

.widget-copytext .widget-type-label::before {
    background: #43e97b;
    box-shadow: 0 0 8px rgba(67, 233, 123, 0.6);
}

.widget-copytext-content {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    min-height: 140px;
}

/* ── Copytext Editor Tabs (Write / Preview) ── */
.copytext-editor-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 0;
    border-bottom: 1px solid #2a3450;
    padding-bottom: 0;
}

.copytext-tab {
    background: transparent;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: rgba(224, 230, 237, 0.5);
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copytext-tab:hover {
    color: rgba(224, 230, 237, 0.8);
    background: rgba(67, 233, 123, 0.05);
}

.copytext-tab.active {
    color: #43e97b;
    background: rgba(67, 233, 123, 0.08);
    border-color: #2a3450;
}

.copytext-tab-hint {
    margin-left: auto;
    font-size: 11px;
    color: rgba(224, 230, 237, 0.3);
    font-style: italic;
}

.copytext-write-area {
    border-radius: 0 0 8px 8px;
    border-top: none;
}

/* ── Copytext Preview Area (editor) ── */
.copytext-preview-area {
    background: rgba(10, 14, 39, 0.6);
    border: 1px solid #2a3450;
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 16px 20px;
    min-height: 140px;
    color: #e0e6ed;
    font-size: 14px;
    line-height: 1.7;
}

/* ── Copytext button (timeline view) ── */
.copytext-box {
    margin-top: 10px;
}

.btn-copytext {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(67, 233, 123, 0.08);
    border: 1px solid rgba(67, 233, 123, 0.25);
    border-radius: 8px;
    color: #43e97b;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copytext:hover {
    background: rgba(67, 233, 123, 0.18);
    border-color: rgba(67, 233, 123, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 233, 123, 0.15);
}

.btn-copytext i {
    font-size: 15px;
}

/* ── Copytext Viewer Modal ── */
.copytext-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.copytext-viewer-modal {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1229 100%);
    border: 1px solid rgba(67, 233, 123, 0.3);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease;
}

.copytext-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(67, 233, 123, 0.2);
}

.copytext-viewer-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #43e97b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.copytext-viewer-header h3 i {
    font-size: 16px;
}

.copytext-viewer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.copytext-viewer-body::-webkit-scrollbar {
    width: 6px;
}

.copytext-viewer-body::-webkit-scrollbar-track {
    background: transparent;
}

.copytext-viewer-body::-webkit-scrollbar-thumb {
    background: rgba(67, 233, 123, 0.3);
    border-radius: 3px;
}

.copytext-viewer-content {
    background: rgba(10, 14, 39, 0.6);
    border: 1px solid rgba(67, 233, 123, 0.15);
    border-radius: 10px;
    padding: 20px 24px;
    color: #e0e6ed;
    font-size: 14px;
    line-height: 1.7;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.copytext-viewer-content h1,
.copytext-viewer-content h2,
.copytext-viewer-content h3,
.copytext-viewer-content h4 {
    color: #e0e6ed;
    margin: 16px 0 8px 0;
    font-weight: 600;
}

.copytext-viewer-content h1:first-child,
.copytext-viewer-content h2:first-child,
.copytext-viewer-content h3:first-child {
    margin-top: 0;
}

.copytext-viewer-content h1 { font-size: 20px; }
.copytext-viewer-content h2 { font-size: 17px; }
.copytext-viewer-content h3 { font-size: 15px; }

.copytext-viewer-content ul,
.copytext-viewer-content ol {
    padding-left: 24px;
    margin: 8px 0;
}

.copytext-viewer-content li {
    margin-bottom: 4px;
}

.copytext-viewer-content p {
    margin: 8px 0;
}

.copytext-viewer-content strong {
    color: #fff;
    font-weight: 600;
}

.copytext-viewer-content em {
    color: rgba(224, 230, 237, 0.85);
}

.copytext-viewer-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid rgba(67, 233, 123, 0.2);
}

.btn-copy-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    border: none;
    border-radius: 8px;
    color: #0a0e27;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(67, 233, 123, 0.3);
}

.btn-copy-action.copied {
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
}

.copy-status {
    font-size: 13px;
    color: rgba(224, 230, 237, 0.5);
    font-weight: 500;
}

/* ──────────────────────────────────────────────────────────────
   FORM INPUTS INSIDE WIDGETS
   ────────────────────────────────────────────────────────────── */
.widget-list-item,
.widget-text-content,
.widget-link-label,
.widget-link-url,
.widget-textarea-content,
.widget-code-content,
.widget-image-alt,
.widget-image-caption {
    background: #1a2338;
    border: 1px solid #2a3450;
    color: #e2e8f0;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.widget-list-item:focus,
.widget-text-content:focus,
.widget-link-label:focus,
.widget-link-url:focus,
.widget-textarea-content:focus,
.widget-image-alt:focus,
.widget-image-caption:focus {
    border-color: #4facfe;
    background: #1e2740;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

.widget-list-item::placeholder,
.widget-text-content::placeholder,
.widget-link-label::placeholder,
.widget-link-url::placeholder,
.widget-textarea-content::placeholder,
.widget-image-alt::placeholder,
.widget-image-caption::placeholder {
    color: #5a6280;
}

.widget-textarea-content {
    min-height: 80px;
    resize: vertical;
}

/* Widget drag handle inherits from .drag-handle above */

/* ──────────────────────────────────────────────────────────────
   WIDGET SELECTOR TOOLBAR
   ────────────────────────────────────────────────────────────── */
.widget-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 20px 0px;
    padding-top: 12px;
    border-top: 1px solid #242b3d;
}

/* ──────────────────────────────────────────────────────────────
   UPLOAD STATUS
   ────────────────────────────────────────────────────────────── */
.upload-status {
    font-size: 12px;
    font-weight: 500;
    margin-left: 12px;
    animation: fadeIn 0.3s ease;
}

/* ──────────────────────────────────────────────────────────────
   IMAGE REMOVE BUTTON (OVERLAY)
   ────────────────────────────────────────────────────────────── */
.image-preview-item button[onclick^="removeImageItem"] {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(245, 87, 108, 0.9);
    border: none;
    color: white;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.image-preview-item button[onclick^="removeImageItem"]:hover {
    background: #f5576c;
    transform: scale(1.1);
}

/* ──────────────────────────────────────────────────────────────
   ANIMATIONS
   ────────────────────────────────────────────────────────────── */
@keyframes widgetSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ──────────────────────────────────────────────────────────────
   RESPONSIVE DESIGN
   ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .widget-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .image-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .widget-selector {
        gap: 6px;
    }
    
}

/* ──────────────────────────────────────────────────────────────
   ACCESSIBILITY
   ────────────────────────────────────────────────────────────── */
.widget-block:focus-within {
    outline: 2px solid rgba(79, 172, 254, 0.5);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

/* ──────────────────────────────────────────────────────────────
   CUSTOM SCROLLBAR FOR TEXTAREAS
   ────────────────────────────────────────────────────────────── */
.widget-textarea-content::-webkit-scrollbar {
    width: 8px;
}

.widget-textarea-content::-webkit-scrollbar-track {
    background: #1a2338;
    border-radius: 4px;
}

.widget-textarea-content::-webkit-scrollbar-thumb {
    background: #2a3450;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.widget-textarea-content::-webkit-scrollbar-thumb:hover {
    background: #3d4a6b;
}






/* ══════════════════════════════════════════════════════════════════════════════
   INLINE STEP EDITOR
   ══════════════════════════════════════════════════════════════════════════════ */

/* Keep step-editor-close for copytext viewer modal which reuses it */
.step-editor-close {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.3);
    color: #f5576c;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.step-editor-close:hover {
    background: #f5576c;
    color: white;
}

/* .inline-editor-form {
    padding: 5px 0 0;
} */

.inline-editor-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.inline-editor-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 0 0;
    margin-top: 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

.step-card.inline-editing {
    border-color: rgba(102, 126, 234, 0.4);
}

.step-card.inline-editing .step-content.open {
    max-height: none;
    overflow: visible;
    /* transform: translateY(-20%) scale(1.1); */
}

/* ── Section Block Styling ── */
.section-block {
    background: rgba(102, 126, 234, 0.03);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.section-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 14px;
    color: #9aa1b4;
}

.red-tiny {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.3);
    color: #f5576c;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.red-tiny:hover {
    background: #f5576c;
    color: white;
}

/* ══════════════════════════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════════════════════════ */
.sonic-auth__container{
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    height: 100vh;
    position: relative;
    z-index: 1;
}


/* Card */
.sonic-auth__card {
  width: min(520px, 92vw);
  background: #0d1333;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.05);
  padding: 28px;
  animation: authZoomIn 0.35s ease-out forwards;
  will-change: transform, opacity;
}

/* Zoom-in animation */
@keyframes authZoomIn {
  0% {
    transform: scale(0.75);
    opacity: 0;
  }
  60% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}


/* Header */
.sonic-auth__header {
  margin-bottom: 18px;
}

.sonic-auth__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.80);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sonic-auth__logo {
  width: 160px;
  height: 42px;
  visibility: hidden;
}
.sonic-auth__logo.ready {
  visibility: visible;
}

.sonic-auth__title {
  margin: 14px 0 6px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,0.94);
}

.sonic-auth__sub {
  margin: 0;
  color: rgba(255,255,255,0.62);
  font-size: 14px;
}

/* Alerts */
.sonic-auth__alert {
  border-radius: 14px;
  padding: 12px 12px;
  margin: 14px 0 10px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.86);
}

.sonic-auth__alert--danger {
  border-color: rgba(255, 77, 109, 0.35);
  background: rgba(255, 77, 109, 0.08);
}

.sonic-auth__alert--success {
  border-color: rgba(67, 233, 123, 0.35);
  background: rgba(67, 233, 123, 0.08);
}

/* Form */
.sonic-auth__form {
  margin-top: 14px;
}

.sonic-auth__field {
  margin-bottom: 14px;
}

.sonic-auth__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.72);
}

.sonic-auth__input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  background: #0a0f2a;
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.92);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .12s ease;
}

.sonic-auth__input::placeholder {
  color: rgba(255,255,255,0.38);
}

.sonic-auth__input:focus {
  border-color: rgba(56,249,215,0.55);
  box-shadow: 0 0 0 4px rgba(56,249,215,0.10);
  transform: translateY(-1px);
}

/* Button (not neon, just crisp) */
.sonic-auth__btn {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: #151c44;
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
}

.sonic-auth__btn:hover {
  transform: translateY(-1px);
  background: #1a2356;
  border-color: rgba(56,249,215,0.30);
}

.sonic-auth__btn:active {
  transform: translateY(0);
}

/* Footer */
.sonic-auth__footer {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.55);
}

.sonic-auth__link {
  color: rgba(56,249,215,0.88);
  text-decoration: none;
  font-weight: 700;
}

.sonic-auth__link:hover {
  text-decoration: underline;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .sonic-auth__card {
    padding: 22px;
    border-radius: 16px;
  }
  .sonic-auth__title {
    font-size: 22px;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE MENU BUTTON
   ══════════════════════════════════════════════════════════════════════════════ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1100;
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1229 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.05);
}

/* ── Sidebar Overlay (mobile backdrop) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE - TABLET (max-width: 1024px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }

    .main {
        margin-left: 280px;
        padding: 30px;
    }

    .sidebar.collapsed ~ .main {
        margin-left: 56px;
    }

    .timeline-header-area h1 {
        font-size: 34px;
    }

    .step-card {
        width: calc(50% - 30px);
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE - MOBILE (max-width: 768px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── Show mobile menu button ── */
    .mobile-menu-btn {
        display: flex;
    }

    /* ── Sidebar: off-screen overlay ── */
    .sidebar {
        width: 300px;
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1050;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
    }

    /* Hide desktop sidebar toggle on mobile */
    .sidebar-toggle {
        display: none;
    }

    /* Hide desktop collapse behavior on mobile */
    .sidebar.collapsed {
        width: 300px;
        transform: translateX(-100%);
    }

    .sidebar.collapsed.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed .sidebar-header h2,
    .sidebar.collapsed .sidebar-search,
    .sidebar.collapsed .sidebar-add,
    .sidebar.collapsed .sop-list,
    .sidebar.collapsed .sidebar-footer {
        display: block;
    }

    .sidebar.collapsed .sop-list {
        display: block;
    }

    /* ── Main content: full width ── */
    .main {
        margin-left: 0 !important;
        padding: 70px 16px 24px;
    }

    /* ── Timeline header ── */
    .timeline-header-area {
        margin-bottom: 35px;
    }

    .timeline-header-actions {
        position: static;
        justify-content: center;
        margin-bottom: 12px;
    }

    .timeline-header-area h1 {
        font-size: 26px;
        line-height: 1.2;
    }

    .timeline-stats-row {
        gap: 16px;
        margin-bottom: 18px;
    }

    .timeline-stat {
        font-size: 13px;
    }

    .timeline-controls {
        gap: 10px;
    }

    .timeline-controls .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    /* ── Timeline: single-column layout ── */
    .main-wrapper {
        padding-left: 28px;
        max-width: 100%;
    }

    .timeline-line {
        left: 6px;
        transform: none;
    }

    .step-node {
        left: -22px;
        transform: none;
        width: 34px;
        height: 34px;
        font-size: 15px;
    }

    .step-card {
        width: 100%;
    }

    .step-wrapper.step-left .step-card,
    .step-wrapper.step-right .step-card {
        margin-left: 0;
        margin-right: 0;
    }

    .step-wrapper.step-left .step-card:hover,
    .step-wrapper.step-right .step-card:hover {
        transform: translateY(-2px);
    }

    .step-wrapper {
        margin-bottom: 30px;
    }

    /* ── Step cards ── */
    .step-header {
        padding: 18px;
        gap: 10px;
    }

    .step-header-text h3 {
        font-size: 18px;
    }

    .step-input {
        font-size: 17px;
    }

    .step-overview {
        font-size: 14px;
    }

    .step-overview-input {
        font-size: 14px;
    }

    .step-delete-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }

    .step-content.open {
        padding: 18px;
    }

    .department-header .department-actions {
        opacity: 1;
    }

    .category-header .category-actions {
        opacity: 1;
    }

    /* ── Inline editor footer on mobile ── */
    .inline-editor-footer {
        flex-wrap: wrap;
        gap: 8px;
    }

    .inline-editor-footer .btn {
        font-size: 13px;
    }

    /* ── Forms ── */
    .form-container {
        padding: 20px;
        border-radius: 8px;
    }

    .form-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .form-header h1 {
        font-size: 22px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* ── Buttons: touch-friendly ── */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 8px 14px !important;
    }

    /* ── Sidebar add button ── */
    .sidebar-add {
        padding: 10px 12px;
    }

    /* ── Notifications ── */
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        padding: 12px 18px;
        font-size: 14px;
    }

    /* ── Empty state ── */
    .empty-state {
        padding: 60px 20px;
    }

    .empty-state h2 {
        font-size: 24px;
    }

    .empty-state p {
        font-size: 14px;
    }

    /* ── Lightbox ── */
    .lightbox-content {
        max-width: 95%;
    }

    .lightbox img {
        max-height: 70vh;
    }

    /* ── Widget editor ── */
    .widget-header {
        padding: 10px 14px;
    }

    .widget-body {
        padding: 14px;
    }

    .widget-selector {
        gap: 6px;
    }

    .widget-selector .btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* ── Section blocks ── */
    .section-block {
        padding: 12px;
    }

    .section-block-header {
        font-size: 13px;
    }

    /* ── Step block (edit page) ── */
    .step-block {
        padding: 14px;
        margin: 14px 0;
    }

    /* ── Image grid on mobile ── */
    .image-preview-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Edit page header ── */
    .edit-page .form-container > div:first-child {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE - SMALL MOBILE (max-width: 480px)
   ══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .main {
        padding: 65px 12px 20px;
    }

    .timeline-header-area h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 13px;
    }

    .step-header-text h3 {
        font-size: 16px;
    }

    .step-input {
        font-size: 15px;
    }

    .step-overview {
        font-size: 13px;
    }

    .step-overview-input {
        font-size: 13px;
    }

    .step-header {
        padding: 14px;
        gap: 8px;
    }

    .step-delete-btn {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .step-content.open {
        padding: 14px;
    }

    .section h4 {
        font-size: 16px;
    }

    .section li {
        font-size: 14px;
        padding: 6px 0 6px 20px;
    }

    .sidebar {
        width: 85vw;
        max-width: 300px;
    }

    .sidebar.collapsed {
        width: 85vw;
        max-width: 300px;
    }

    .form-container {
        padding: 16px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .sidebar-search input {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .timeline-header-area h1 {
        font-size: 22px;
    }

    .timeline-tags-row {
        gap: 8px;
        margin-bottom: 12px;
    }

    .timeline-stats-row {
        gap: 12px;
        margin-bottom: 16px;
    }

    .timeline-stat {
        font-size: 12px;
    }

    .timeline-controls {
        flex-direction: column;
        align-items: center;
    }

    .timeline-controls .btn {
        width: 100%;
        max-width: 200px;
    }

}

/* ── Form Validation Errors ── */
.form-error {
    display: block;
    color: #f5576c;
    font-size: 12px;
    margin-top: 6px;
}

/* ── Widget separation in timeline view ── */
.widget-rendered + .widget-rendered {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
}

.widget-rendered ol {
    margin-left: 20px;
    padding-left: 20px;
    list-style-type: decimal;
}

.widget-rendered ol li {
    list-style-type: decimal;
    padding-left: 4px;
}

.widget-rendered ol li::marker {
    color: #fff;
    font-weight: 600;
}

.widget-rendered ul {
    margin-left: 10px;
    padding-left: 20px;
    list-style-type: disc;
}

.widget-rendered ul li {
    list-style-type: disc;
    padding-left: 4px;
}

.widget-rendered ul li::before {
    content: none;
}

.widget-rendered ul li::marker {
    color: rgba(224, 230, 237, 0.5);
}

.widget-rendered li.indent {
    margin-left: 28px;
}

/* ── Copy SOP Link ── */
.btn-copy-link {
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: rgba(224, 230, 237, 0.7);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-copy-link:hover {
    background: rgba(102, 126, 234, 0.3);
    color: #667eea;
    border-color: rgba(102, 126, 234, 0.5);
}


/* ── Copy Toast ── */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 20, 45, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #43e97b;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── App Toast (save notifications, etc.) ── */
.app-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 20, 45, 0.95);
    border: 1px solid rgba(67, 233, 123, 0.4);
    color: #43e97b;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.app-toast-error {
    border-color: rgba(245, 87, 108, 0.4);
    color: #f5576c;
}
.app-toast-info {
    border-color: rgba(102, 126, 234, 0.4);
    color: #667eea;
}

/* ── INLINE LINKS IN WIDGETS ── */
.section a[target="_blank"] {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    transition: color 0.2s, border-color 0.2s;
}
.section a[target="_blank"]:hover {
    color: #8ba0ff;
    border-bottom-color: #8ba0ff;
}

/* ── INSERT LINK BUTTON (edit modal) ── */
.btn-insert-link {
    background: none;
    border: 1px solid #2a3450;
    color: #667eea;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}
.btn-insert-link:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #8ba0ff;
}
.widget-toolbar {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   WELCOME PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════════════
   DASHBOARD / WELCOME PAGE
   ══════════════════════════════════════════════════════════════════════ */

.welcome-page {
    padding: 50px 40px 80px;
    max-width: 1240px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.welcome-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 36px;
    opacity: 0;
    animation: welcomeFadeUp 0.6s ease 0.2s forwards;
}

.welcome-comet {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.welcome-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.welcome-subtitle {
    font-size: 0.95rem;
    color: rgba(224, 230, 237, 0.45);
    margin: 0;
    font-weight: 400;
}

/* ── Stats Grid (4 cards) ── */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
    opacity: 0;
    animation: welcomeFadeUp 0.6s ease 0.35s forwards;
}

.dashboard-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.dashboard-stat-card:hover {
    border-color: rgba(102, 126, 234, 0.25);
    background: rgba(102, 126, 234, 0.08);
}

.dashboard-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.dashboard-stat-icon.icon-sops {
    background: rgba(102, 126, 234, 0.12);
    color: #667eea;
}
.dashboard-stat-icon.icon-depts {
    background: rgba(79, 172, 254, 0.12);
    color: #4facfe;
}
.dashboard-stat-icon.icon-cats {
    background: rgba(250, 112, 154, 0.12);
    color: #fa709a;
}
.dashboard-stat-icon.icon-steps {
    background: rgba(67, 233, 123, 0.12);
    color: #43e97b;
}

.dashboard-stat-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.dashboard-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e6ed;
    line-height: 1.1;
}

.dashboard-stat-label {
    font-size: 0.75rem;
    color: rgba(224, 230, 237, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
}

/* ── Dashboard Sections (shared) ── */
.dashboard-section {
    background: rgba(102, 126, 234, 0.04);
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 14px;
    margin-bottom: 20px;
    overflow: hidden;
    opacity: 0;
    animation: welcomeFadeUp 0.6s ease forwards;
}

.dashboard-columns .dashboard-section:nth-child(1) { animation-delay: 0.5s; }
.dashboard-columns .dashboard-section:nth-child(2) { animation-delay: 0.6s; }
.dashboard-sections .dashboard-section:nth-child(1) { animation-delay: 0.7s; }
.dashboard-sections .dashboard-section:nth-child(2) { animation-delay: 0.8s; }

.dashboard-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(224, 230, 237, 0.5);
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.dashboard-section-header i {
    font-size: 13px;
}

.dashboard-section-header .header-count {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(102, 126, 234, 0.12);
    color: rgba(102, 126, 234, 0.7);
}

/* ── Under Review Section ── */
.dashboard-section.section-review .dashboard-section-header {
    color: rgba(234, 179, 8, 0.7);
}
.dashboard-section.section-review .dashboard-section-header i {
    color: rgba(234, 179, 8, 0.6);
}
.dashboard-section.section-review .header-count {
    background: rgba(234, 179, 8, 0.12);
    color: rgba(234, 179, 8, 0.7);
}

/* ── Review & Approval Table ── */
.review-table {
    width: 100%;
    border-collapse: collapse;
}

.review-table thead th {
    padding: 8px 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(224, 230, 237, 0.35);
    text-align: left;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.review-table thead th:last-child {
    text-align: right;
}

.review-table-row {
    cursor: pointer;
    transition: background 0.15s;
}

.review-table-row:hover {
    background: rgba(234, 179, 8, 0.04);
}

.review-table-row:not(:last-child) td {
    border-bottom: 1px solid rgba(102, 126, 234, 0.05);
}

.review-table-row td {
    padding: 15px 20px;
    vertical-align: middle;
}

.review-table-row td:last-child {
    text-align: right;
}

.review-table-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.review-table-dept {
    font-size: 0.78rem;
    color: rgba(224, 230, 237, 0.4);
    white-space: nowrap;
}

.review-table-dept i {
    font-size: 7px;
    margin: 0 5px;
    vertical-align: middle;
    opacity: 0.5;
}

.review-table-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.review-table-badge i {
    font-size: 9px;
}

.review-table-badge.badge-review {
    background: rgba(234, 179, 8, 0.1);
    color: rgba(234, 179, 8, 0.8);
}

.review-table-badge.badge-approval {
    background: rgba(168, 132, 252, 0.1);
    color: rgba(168, 132, 252, 0.8);
}

@media (max-width: 768px) {
    .review-table-dept {
        display: none;
    }
    .review-table-title {
        max-width: 160px;
    }
    .review-table thead th:nth-child(2) {
        display: none;
    }
}

/* ── View More Button ── */
.dashboard-view-more-wrap {
    position: relative;
}

.btn-view-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 8px;
    color: #8a94a6;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-view-more:hover {
    background: rgba(102, 126, 234, 0.12);
    color: #b0bcd4;
}

.btn-view-more i {
    font-size: 11px;
    transition: transform 0.2s;
}

/* ── All Approved Empty State ── */
.dashboard-approved-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: rgba(67, 233, 123, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
}

.dashboard-approved-empty i {
    font-size: 14px;
}

/* ── Recently Updated Section ── */
.dashboard-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.dashboard-recent-item:hover {
    background: rgba(102, 126, 234, 0.04);
}

.dashboard-recent-item:not(:last-child) {
    border-bottom: 1px solid rgba(102, 126, 234, 0.05);
}

.dashboard-recent-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.dashboard-recent-info {
    flex: 1;
    min-width: 0;
}

.dashboard-recent-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-recent-detail {
    font-size: 0.73rem;
    color: rgba(224, 230, 237, 0.3);
    margin-top: 2px;
}

.dashboard-recent-detail i {
    font-size: 6px;
    margin: 0 5px;
    vertical-align: middle;
}

.dashboard-recent-time {
    font-size: 0.72rem;
    color: rgba(224, 230, 237, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}

.dashboard-old-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.dashboard-old-badge i {
    font-size: 8px;
}

/* ── SOPs by Department Section ── */
.dashboard-dept-bars {
    padding: 10px 20px 16px;
}

.dashboard-dept-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 0;
}

.dashboard-dept-name {
    font-size: 0.8rem;
    color: rgba(224, 230, 237, 0.65);
    font-weight: 500;
    min-width: 120px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}

.dashboard-dept-name:hover {
    color: #4facfe;
}

.dashboard-dept-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(102, 126, 234, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.dashboard-dept-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px;
}

.dashboard-dept-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.5);
    min-width: 24px;
    text-align: right;
}

/* ── Empty Categories (collapsible) ── */
.welcome-empty-categories {
    margin-top: 0;
    cursor: pointer;
}

.dashboard-section.section-empty .dashboard-section-header {
    color: rgba(234, 179, 8, 0.6);
    cursor: pointer;
}

.dashboard-section.section-empty .header-count {
    background: rgba(234, 179, 8, 0.1);
    color: rgba(234, 179, 8, 0.6);
}

.welcome-empty-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0 20px;
}

.dashboard-section.section-empty.open .welcome-empty-list {
    max-height: 500px;
    padding: 8px 20px 14px;
}

.welcome-empty-arrow {
    font-size: 0.65rem;
    color: rgba(234, 179, 8, 0.35);
    transition: transform 0.3s ease;
    margin-left: auto;
}

.dashboard-section.section-empty.open .welcome-empty-arrow {
    transform: rotate(180deg);
}

.welcome-empty-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: rgba(234, 179, 8, 0.03);
    border: 1px solid rgba(234, 179, 8, 0.08);
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.welcome-empty-dept {
    color: rgba(224, 230, 237, 0.5);
    font-weight: 500;
}

.welcome-empty-sep {
    font-size: 0.55rem;
    color: rgba(224, 230, 237, 0.2);
}

.welcome-empty-cat {
    color: rgba(234, 179, 8, 0.65);
    font-weight: 500;
}

/* ── Dashboard Sections Container ── */
.dashboard-sections {
    display: flex;
    flex-direction: column;
}

/* ── Two-column layout for review + recent ── */
.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-columns .dashboard-section {
    margin-bottom: 0;
}

/* ── Keyframes ── */
@keyframes welcomeFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes welcomeFadeUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .welcome-page {
        padding: 30px 16px 60px;
    }
    .welcome-comet {
        width: 60px;
        height: 60px;
    }
    .welcome-title {
        font-size: 1.4rem;
    }
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .dashboard-stat-card {
        padding: 14px 16px;
        gap: 10px;
    }
    .dashboard-stat-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    .dashboard-stat-number {
        font-size: 1.2rem;
    }
    .dashboard-dept-name {
        min-width: 90px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   PIN BUTTON
   ══════════════════════════════════════════════════════════════════════ */

.btn-pin.pinned {
    background: rgba(250, 112, 154, 0.2);
    border-color: rgba(250, 112, 154, 0.4);
    color: #fa709a;
}

.btn-pin.pinned:hover {
    background: rgba(250, 112, 154, 0.35);
    border-color: rgba(250, 112, 154, 0.6);
    color: #fa709a;
}

/* ══════════════════════════════════════════════════════════════════════
   WELCOME PINNED SOPS
   ══════════════════════════════════════════════════════════════════════ */

.welcome-pinned {
    margin-bottom: 32px;
    animation: welcomeFadeUp 0.6s ease-out both;
    animation-delay: 0.85s;
}

.welcome-pinned-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fa709a;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-pinned-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.welcome-pinned-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(250, 112, 154, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    flex: 0 1 calc((100% - 40px) / 5);
    min-width: 150px;
}

.welcome-pinned-card:hover {
    transform: translateY(-1px);
    border-color: rgba(250, 112, 154, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.welcome-pinned-card-accent {
    height: 3px;
    flex-shrink: 0;
}

.welcome-pinned-card-body {
    padding: 10px 12px;
    min-width: 0;
}

.welcome-pinned-card-title {
    font-weight: 600;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.95);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-pinned-card-meta {
    font-size: 10px;
    color: rgba(224, 230, 237, 0.4);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-pinned-card-meta i {
    font-size: 7px;
    margin: 0 3px;
    vertical-align: middle;
}

.welcome-pinned-card-steps {
    margin-left: 6px;
    opacity: 0.7;
}

.welcome-pinned-unpin {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: none;
    background: rgba(250, 112, 154, 0.15);
    color: #fa709a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.welcome-pinned-card:hover .welcome-pinned-unpin {
    opacity: 1;
}

.welcome-pinned-unpin:hover {
    background: rgba(250, 112, 154, 0.35);
}

@media (max-width: 768px) {
    .welcome-pinned-grid {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   DEPARTMENT PAGE
   ══════════════════════════════════════════════════════════════════════ */

.dept-page {
    padding: 60px 40px 80px;
    max-width: 900px;
    margin: 0 auto;
}

/* Active department highlight in sidebar */
.department-header.active {
    color: #4facfe;
    background: rgba(79, 172, 254, 0.08);
    border-left: 3px solid #4facfe;
}

/* Stats */
.dept-toolbar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.dept-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dept-stats {
    display: flex;
    gap: 10px;
}

.dept-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 5px 14px;
    background: rgba(102, 126, 234, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 8px;
}

.dept-stat-number {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #4facfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dept-stat-label {
    font-size: 0.7rem;
    color: rgba(224, 230, 237, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Category cards list */
.dept-categories-list {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Category card */
.dept-category-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.dept-category-card:hover {
    border-color: rgba(102, 126, 234, 0.25);
}

.dept-category-card.open {
    border-color: rgba(102, 126, 234, 0.3);
}

/* Category header */
.dept-category-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.dept-category-header:hover {
    background: rgba(102, 126, 234, 0.06);
}

.dept-category-bar {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

.dept-category-info {
    flex: 1;
    min-width: 0;
}

.dept-category-info h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e0e6ed;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-category-count {
    font-size: 13px;
    color: rgba(224, 230, 237, 0.4);
    margin-top: 2px;
}

.dept-category-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dept-category-add {
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 13px;
}

.dept-category-header:hover .dept-category-add {
    opacity: 1;
}

.dept-category-action {
    opacity: 0;
    transition: opacity 0.2s;
}

.dept-category-header:hover .dept-category-action {
    opacity: 1;
}

.dept-category-arrow {
    font-size: 14px;
    color: rgba(224, 230, 237, 0.4);
    transition: transform 0.25s;
}

.dept-category-arrow.open {
    transform: rotate(180deg);
}

/* Category body (accordion) */
.dept-category-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.dept-category-body.open {
    max-height: 2000px;
}

/* Subcategory cards (nested inside category body) */
.dept-subcategory-card {
    margin: 4px 12px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.08);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.dept-subcategory-card:first-child {
    margin-top: 8px;
}

.dept-subcategory-card:last-child {
    margin-bottom: 8px;
}

.dept-subcategory-card:hover {
    border-color: rgba(102, 126, 234, 0.2);
}

.dept-subcategory-card.open {
    border-color: rgba(102, 126, 234, 0.25);
}

.dept-subcategory-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 10px;
}

.dept-subcategory-header:hover {
    background: rgba(102, 126, 234, 0.06);
}

.dept-subcategory-bar {
    width: 3px;
    height: 24px;
    border-radius: 2px;
    flex-shrink: 0;
}

.dept-subcategory-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dept-subcategory-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-subcategory-title i {
    font-size: 12px;
    color: rgba(102, 126, 234, 0.5);
    margin-right: 2px;
}

.dept-subcategory-count {
    font-size: 11px;
    color: rgba(224, 230, 237, 0.35);
    background: rgba(102, 126, 234, 0.1);
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.dept-subcategory-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dept-subcategory-header:hover .dept-category-add,
.dept-subcategory-header:hover .dept-category-action {
    opacity: 1;
}

.dept-subcategory-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.dept-subcategory-body.open {
    max-height: 2000px;
}

.dept-subcategory-body .dept-sop-item {
    padding-left: 28px;
}

/* SOP items */
.dept-sop-item {
    display: flex;
    align-items: center;
    padding: 14px 20px 14px 36px;
    cursor: pointer;
    transition: background 0.15s;
    gap: 12px;
    border-top: 1px solid rgba(102, 126, 234, 0.06);
    text-decoration: none;
    color: inherit;
}

.dept-sop-item:hover {
    background: rgba(102, 126, 234, 0.06);
}

.dept-sop-bar {
    width: 3px;
    height: 28px;
    border-radius: 2px;
    flex-shrink: 0;
}

.dept-sop-info {
    flex: 1;
    min-width: 0;
}

.dept-sop-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dept-sop-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.35);
    margin-top: 3px;
}

.dept-sop-meta i {
    margin-right: 3px;
}

.dept-sop-arrow {
    color: rgba(224, 230, 237, 0.2);
    font-size: 12px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.dept-sop-item:hover .dept-sop-arrow {
    color: rgba(224, 230, 237, 0.5);
}

.dept-sop-empty {
    padding: 20px 36px;
    color: rgba(224, 230, 237, 0.3);
    font-size: 13px;
    font-style: italic;
}

/* Hide category actions when not in edit mode */
html:not(.edit-mode) .dept-category-action {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .dept-page {
        padding: 30px 16px 60px;
    }
    .dept-toolbar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .dept-stats {
        gap: 8px;
    }
    .dept-stat {
        padding: 6px 12px;
    }
    .dept-category-info h3 {
        font-size: 14px;
    }
    .dept-sop-item {
        padding-left: 24px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   FLOWCHART / DECISION TREE WIDGET
   ══════════════════════════════════════════════════════════════════════ */

/* Container */
.fc-container {
    background: rgba(15, 18, 41, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 24px 20px;
    margin: 10px 0;
}

/* Decision Node */
.fc-decision {
    background: rgba(102, 126, 234, 0.08);
    border: 1.5px solid rgba(102, 126, 234, 0.45);
    border-radius: 10px;
    padding: 14px 16px;
    text-align: center;
    box-shadow: 0 0 16px rgba(102, 126, 234, 0.1);
}

.fc-decision-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    transform: rotate(45deg);
    margin-bottom: 10px;
}

.fc-decision-icon i {
    transform: rotate(-45deg);
    font-size: 12px;
    color: #667eea;
}

.fc-decision-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.9);
    line-height: 1.4;
}

/* Connector Lines */
.fc-connector-down {
    width: 2px;
    height: 24px;
    background: rgba(102, 126, 234, 0.35);
    margin: 0 auto;
}

/* Branch Container — stacked vertically */
.fc-branches {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fc-branch {
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(10, 14, 39, 0.4);
}

.fc-branch-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.fc-branch-connector {
    width: 16px;
    height: 2px;
    background: rgba(102, 126, 234, 0.3);
}

.fc-branch-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 12px;
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.fc-branch-label.yes {
    background: rgba(67, 233, 123, 0.15);
    color: #43e97b;
    border-color: rgba(67, 233, 123, 0.3);
}

.fc-branch-label.no {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.fc-branch-body {
    padding: 8px 12px;
}

/* Action Node */
.fc-action {
    background: rgba(26, 35, 56, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 6px;
    padding: 10px 12px 10px 32px;
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(224, 230, 237, 0.8);
    position: relative;
}

.fc-action::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 11px;
    top: 12px;
    font-size: 10px;
    color: rgba(102, 126, 234, 0.45);
}

/* Warning Node */
.fc-warning {
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.2);
    border-left: 3px solid rgba(234, 179, 8, 0.6);
    border-radius: 6px;
    padding: 10px 12px 10px 32px;
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(234, 179, 8, 0.85);
    position: relative;
}

.fc-warning::before {
    content: '\f071';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 10px;
    top: 11px;
    font-size: 10px;
    color: rgba(234, 179, 8, 0.6);
}

/* Editor: Flowchart widget block */
.widget-flowchart {
    border-left: 4px solid #667eea !important;
}

.widget-flowchart .widget-header {
    background: rgba(102, 126, 234, 0.08);
}

/* Editor: Tabs */
.flowchart-editor-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.flowchart-tab {
    background: transparent;
    border: none;
    color: rgba(224, 230, 237, 0.4);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.flowchart-tab.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.08);
}

.flowchart-tab-hint {
    margin-left: auto;
    font-size: 11px;
    color: rgba(224, 230, 237, 0.25);
}

/* Editor: Preview area */
.flowchart-preview-area {
    background: rgba(10, 14, 39, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 16px;
    min-height: 140px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   CREATE SOP MODAL
   ══════════════════════════════════════════════════════════════════════════════ */

.create-sop-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.create-sop-modal {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1229 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease;
}

#createSopImportView,
#createSopReviewView {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 85vh;
}

.create-sop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

.create-sop-header h2 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.create-sop-header h2 i {
    -webkit-text-fill-color: #667eea;
}

/* Format Guide Button */
.create-sop-format-guide-btn {
    background: none;
    border: none;
    color: #667eea;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    margin-left: auto;
    margin-right: 8px;
    opacity: 0.7;
}
.create-sop-format-guide-btn:hover {
    opacity: 1;
    background: rgba(102, 126, 234, 0.1);
}

/* Format Guide Panel */
.create-sop-format-guide {
    background: rgba(102, 126, 234, 0.06);
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    max-height: 400px;
    overflow-y: auto;
}
.create-sop-format-guide::-webkit-scrollbar { width: 6px; }
.create-sop-format-guide::-webkit-scrollbar-track { background: transparent; }
.create-sop-format-guide::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 3px;
}
.format-guide-content {
    padding: 20px 25px;
}
.format-guide-content h3 {
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.format-guide-intro {
    color: #8899a6;
    font-size: 13px;
    margin: 0 0 16px 0;
    line-height: 1.5;
}
.format-guide-section {
    margin-bottom: 16px;
}
.format-guide-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #e0e6ed;
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.format-guide-section ul {
    margin: 0;
    padding-left: 18px;
}
.format-guide-section li {
    color: #b0bec5;
    font-size: 13px;
    line-height: 1.7;
}
.format-guide-section li code,
.format-guide-section p code {
    background: rgba(102, 126, 234, 0.15);
    color: #4facfe;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.format-guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.format-guide-table th {
    text-align: left;
    color: #8899a6;
    font-weight: 600;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}
.format-guide-table td {
    color: #b0bec5;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.format-guide-table code {
    background: rgba(102, 126, 234, 0.15);
    color: #4facfe;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}
.format-guide-example {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 8px;
    padding: 14px;
    overflow-x: auto;
    margin: 0;
}
.format-guide-example code {
    color: #b0bec5;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre;
}

.create-sop-body {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.create-sop-body::-webkit-scrollbar { width: 6px; }
.create-sop-body::-webkit-scrollbar-track {
    background: rgba(102, 126, 234, 0.04);
    border-radius: 3px;
}
.create-sop-body::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 3px;
    transition: background 0.2s;
}
.create-sop-body::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.45);
}
/* Firefox scrollbar */
.create-sop-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.25) rgba(102, 126, 234, 0.04);
}

.create-sop-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    flex-shrink: 0;
}

/* -- Sections -- */
.create-sop-section { margin-bottom: 8px; }

.create-sop-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #e0e6ed;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.create-sop-section-title i { color: #667eea; }

.create-sop-section-desc {
    font-size: 13px;
    color: rgba(224, 230, 237, 0.5);
    margin-bottom: 12px;
}

/* -- Divider -- */
.create-sop-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0;
    color: rgba(224, 230, 237, 0.3);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.create-sop-divider::before,
.create-sop-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
}

/* -- Dropzone -- */
.create-sop-dropzone {
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(224, 230, 237, 0.6);
}

.create-sop-dropzone:hover,
.create-sop-dropzone.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.create-sop-drop-icon {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 8px;
    display: block;
}

.create-sop-dropzone p { margin: 4px 0; }
.create-sop-dropzone a { color: #4facfe; text-decoration: none; }
.create-sop-dropzone a:hover { text-decoration: underline; }

.create-sop-formats {
    display: block;
    font-size: 12px;
    margin-top: 6px;
    opacity: 0.5;
}

/* -- File List -- */
.create-sop-file-list { margin-top: 10px; }

.create-sop-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.12);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.create-sop-file-item > i { color: #667eea; }
.create-sop-file-name { flex: 1; color: #e0e6ed; }
.create-sop-file-status { display: flex; align-items: center; }

.create-sop-file-remove {
    background: none;
    border: none;
    color: #f5576c;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.create-sop-file-remove:hover {
    background: rgba(245, 87, 108, 0.1);
}

/* -- Paste Area -- */
.create-sop-paste-area {
    width: 100%;
    background: rgba(10, 14, 39, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    color: #e0e6ed;
    padding: 14px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.create-sop-paste-area:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

/* -- Toggle (Manual Entry) -- */
.create-sop-toggle {
    cursor: pointer;
    user-select: none;
}

.create-sop-toggle:hover { color: #4facfe; }

.create-sop-toggle-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.2s;
}

.create-sop-manual {
    padding-top: 12px;
}

.create-sop-manual .form-group {
    margin-bottom: 14px;
}

.create-sop-manual label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #e0e6ed;
    margin-bottom: 6px;
}

.create-sop-manual input,
.create-sop-manual select,
.create-sop-manual textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.create-sop-manual input:focus,
.create-sop-manual select:focus,
.create-sop-manual textarea:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: #171d39;
}

/* -- Review Cards -- */
.create-sop-review-card {
    background: rgba(102, 126, 234, 0.03);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.3s;
}

.create-sop-review-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.create-sop-review-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #e0e6ed;
}

.create-sop-review-card .form-group {
    margin-bottom: 14px;
}

.create-sop-review-card label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: rgba(224, 230, 237, 0.7);
    margin-bottom: 6px;
}

.create-sop-review-card input,
.create-sop-review-card select,
.create-sop-review-card textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.create-sop-review-card input:focus,
.create-sop-review-card select:focus,
.create-sop-review-card textarea:focus {
    outline: none;
    border-color: rgba(102, 126, 234, 0.5);
    background: #171d39;
}

.create-sop-review-row {
    display: flex;
    gap: 12px;
}

/* -- Uncertain Fields -- */
.create-sop-uncertain select,
.create-sop-uncertain input {
    border-color: rgba(245, 87, 108, 0.4) !important;
}

.create-sop-uncertain-badge {
    font-size: 10px;
    background: rgba(245, 87, 108, 0.15);
    color: #f5576c;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 400;
}

/* -- Review Steps List -- */
.create-sop-review-steps {
    max-height: 150px;
    overflow-y: auto;
}

.create-sop-review-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    font-size: 13px;
    color: rgba(224, 230, 237, 0.7);
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.create-sop-review-step-item:last-child { border-bottom: none; }

.create-sop-review-step-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* -- Responsive -- */
@media (max-width: 768px) {
    .create-sop-modal {
        width: 95%;
        max-height: 90vh;
    }
    .create-sop-review-row {
        flex-direction: column;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Generic Modal
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1a1f3a 0%, #0f1229 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 16px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal-body .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 6px;
}

.modal-body .form-group select,
.modal-body .form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.modal-body .form-group select:focus,
.modal-body .form-group input[type="text"]:focus {
    border-color: #667eea;
}

.modal-body .form-group select option {
    background: #1a1f3a;
    color: #e0e6ed;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
}

/* App Modal (alert/confirm replacement) */
.app-modal-overlay { z-index: 10000; }
.app-modal { max-width: 440px; }
.app-modal-icon { margin-right: 4px; font-size: 18px; color: #4facfe; }
.app-modal-icon.danger { color: #ff6b6b; }
.app-modal-message {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    word-break: break-word;
}
.app-modal-input {
    width: 100%;
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.app-modal-input:focus { border-color: #667eea; }
.btn-modal {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-modal-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}
.btn-modal-cancel:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.btn-modal-confirm {
    background: linear-gradient(135deg, #667eea 0%, #4facfe 100%);
    color: #fff;
}
.btn-modal-confirm:hover { filter: brightness(1.1); }
.btn-modal-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}
.btn-modal-danger:hover { filter: brightness(1.1); }

/* ═══════════════════════════════════════════════════════════════════════════
   WYSIWYG Editor
   ═══════════════════════════════════════════════════════════════════════════ */

.sop-editor-container {
    /* border: 1px solid rgba(102, 126, 234, 0.2); */
    border-radius: 10px;
    overflow: hidden;
    /* background: rgba(26, 35, 56, 0.4); */
    /* margin: 10px 0; */
}

/* ── Toolbar ── */

.sop-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(26, 35, 56, 0.8);
    border-top: 1px solid rgba(102, 126, 234, 0.15);
    flex-wrap: wrap;
}

.sop-editor-toolbar .toolbar-group {
    display: flex;
    gap: 2px;
}

.sop-editor-toolbar .toolbar-sep {
    width: 1px;
    height: 24px;
    background: rgba(102, 126, 234, 0.15);
    margin: 0 6px;
}

.sop-editor-toolbar button {
    min-width: 36px;
    height: auto;
    padding: 4px 6px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9aa1b4;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    font-size: 13px;
    transition: all 0.15s;
}

.sop-editor-toolbar button .tb-label {
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1;
    opacity: 0.6;
    font-weight: 600;
}

.sop-editor-toolbar button:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #e0e6ed;
}

.sop-editor-toolbar button:hover .tb-label {
    opacity: 1;
}

.sop-editor-toolbar button.active {
    background: rgba(102, 126, 234, 0.25);
    color: #667eea;
}

.sop-editor-toolbar button.active .tb-label {
    opacity: 1;
}

/* ── Editor Content Area ── */

.sop-editor-content {
    min-height: 200px;
    max-height: 600px;
    padding-right: 20px;
    overflow-y: auto;
    color: rgba(224, 230, 237, 0.9);
    font-size: 14px;
    outline: none;
    padding: 10px;
}

.sop-editor-content:empty::before {
    content: attr(data-placeholder);
    color: rgba(154, 161, 180, 0.4);
    pointer-events: none;
}

.sop-editor-content:focus {
    background: rgba(26, 35, 56, 0.3);
}

/* Target a specific container */
.sop-editor-content::-webkit-scrollbar {
  width: 12px;
}

.sop-editor-content::-webkit-scrollbar-track {
  background: #0b1020;
}

.sop-editor-content::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 10px;
  border: 3px solid #0b1020;
}

.sop-editor-content::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}

/* ── Editor Typography (matches view-mode .section styles) ── */

.sop-editor-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: #667eea;
    margin: 25px 0 12px;
}

.sop-editor-content h2:first-child {
    margin-top: 0;
}

.sop-editor-content h3 {
    font-size: 16px;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.9);
    margin: 20px 0 10px;
}

.sop-editor-content p {
    margin: 6px 0;
    color: rgba(224, 230, 237, 0.8);
    line-height: 1.7;
}

.sop-editor-content ul {
    list-style: none;
    padding-left: 0;
    padding-bottom: 10px;
    margin: 8px 0;
}

.sop-editor-content ol {
    margin-left: 20px;
    list-style-type: decimal;
    padding-bottom: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.sop-editor-content ol li::marker {
    color: #fff;
    font-weight: 600;
}

.sop-editor-content li {
    padding: 8px 0 2px 19px;
    position: relative;
    line-height: 1.6;
    color: rgba(224, 230, 237, 0.8);
}

.sop-editor-content ul li::before {
    content: "\25B8";
    position: absolute;
    left: 0;
    color: #667eea;
    font-weight: bold;
}

.sop-editor-content ol li {
    padding-left: 10px;
}

.sop-editor-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid rgba(102, 126, 234, 0.3);
    transition: color 0.2s, border-color 0.2s;
}

.sop-editor-content a:hover {
    color: #8ba0ff;
    border-bottom-color: #8ba0ff;
}

.sop-editor-content img {
    max-width: 100%;
    border-radius: 6px;
    margin: 10px 0;
    border: 1px solid rgba(102, 126, 234, 0.2);
    display: block;
}

/* Code blocks — matches view-mode .code-snippet-block */
.sop-editor-content pre {
    position: relative;
    background: rgba(10, 14, 23, 0.7);
    border: 1px solid rgba(67, 233, 123, 0.2);
    border-radius: 8px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 10px 0;
}

.sop-editor-content pre code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e0e6ed;
    white-space: pre;
    tab-size: 4;
    background: none;
    padding: 0;
}

.sop-editor-content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    background: rgba(102, 126, 234, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Blockquote / Highlight — matches view-mode .widget-highlight */
.sop-editor-content blockquote {
    display: flex;
    gap: 12px;
    border-left: 3px solid rgba(234, 179, 8, 0.6);
    border-radius: 6px;
    margin: 10px 0;
    padding: 14px 16px;
    background: rgba(234, 179, 8, 0.08);
    color: rgba(224, 230, 237, 0.85);
}

.editor-image-loading {
    padding: 20px;
    text-align: center;
    color: #667eea;
    font-size: 13px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 8px;
    margin: 10px 0;
}

/* ── Special Block Cards ── */

.sop-editor-block {
    margin: 14px 0;
    user-select: none;
    border-radius: 8px;
    overflow: hidden;
}

.block-card {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.2);
    background: rgba(26, 35, 56, 0.6);
}

.block-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #9aa1b4;
}

.block-card-header i:first-child {
    font-size: 13px;
}

.block-type-label {
    font-weight: 600;
}

.block-sublabel {
    font-weight: 400;
    opacity: 0.6;
    font-size: 11px;
}

.block-card-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.block-card-header .block-edit-btn,
.block-card-header .block-delete-btn {
    background: none;
    border: none;
    color: #5a6280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    transition: all 0.15s;
}

.block-card-header .block-edit-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.block-card-header .block-delete-btn:hover {
    color: #f5576c;
    background: rgba(245, 87, 108, 0.1);
}

.block-preview {
    padding: 10px 12px;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.5);
    max-height: 100px;
    overflow: hidden;
}

.block-preview pre {
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    font-size: 12px;
    color: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Code Card */
.code-card { border-color: rgba(102, 126, 234, 0.2); }
.code-card .block-card-header { background: rgba(13, 17, 23, 0.6); }
.code-card .block-preview { background: rgba(13, 17, 23, 0.4); font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace; }

/* Highlight Card */
.highlight-card { border-color: rgba(234, 179, 8, 0.3); }
.highlight-card .block-card-header { background: rgba(234, 179, 8, 0.08); color: rgba(234, 179, 8, 0.8); }
.highlight-card .block-preview { background: rgba(234, 179, 8, 0.04); }

/* Copytext Card */
.copytext-card { border-color: rgba(67, 233, 123, 0.3); }
.copytext-card .block-card-header { background: rgba(67, 233, 123, 0.08); color: rgba(67, 233, 123, 0.8); }
.copytext-card .block-preview { background: rgba(67, 233, 123, 0.04); }

/* Flowchart Card */
.flowchart-card { border-color: rgba(161, 140, 209, 0.3); }
.flowchart-card .block-card-header { background: rgba(161, 140, 209, 0.08); color: rgba(161, 140, 209, 0.8); }
.flowchart-card .block-preview { background: rgba(161, 140, 209, 0.04); }

/* ── Block Edit Modal ── */

.block-edit-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.block-edit-modal {
    background: #1a2338;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.block-edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.block-edit-modal-header h3 {
    margin: 0;
    font-size: 15px;
    color: #e0e6ed;
    font-weight: 600;
}

.block-modal-close {
    background: none;
    border: none;
    color: #5a6280;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.block-modal-close:hover {
    color: #f5576c;
}

.block-edit-modal-body {
    padding: 20px;
}

.block-modal-field {
    margin-bottom: 16px;
}

.block-modal-field:last-child {
    margin-bottom: 0;
}

.block-modal-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9aa1b4;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.block-modal-hint {
    font-size: 11px;
    color: rgba(154, 161, 180, 0.6);
    margin-bottom: 8px;
}

.block-modal-hint code {
    background: rgba(102, 126, 234, 0.1);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 11px;
    color: #667eea;
}

.block-modal-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(13, 17, 23, 0.5);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.block-modal-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.block-modal-textarea {
    width: 100%;
    padding: 12px;
    background: rgba(13, 17, 23, 0.5);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.block-modal-textarea:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.block-modal-textarea.mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
}

.block-edit-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(102, 126, 234, 0.15);
}

/* ── Responsive Editor ── */

@media (max-width: 768px) {
    .sop-editor-toolbar {
        padding: 6px 8px;
    }

    .sop-editor-toolbar button {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .sop-editor-toolbar .toolbar-sep {
        height: 20px;
        margin: 0 4px;
    }

    .sop-editor-content {
        padding: 14px;
        min-height: 150px;
        max-height: 400px;
    }

    .block-edit-modal {
        width: 95%;
        max-height: 85vh;
    }
}

/* ── Dashboard Filter Tabs ── */
.dashboard-filter-tabs {
    display: flex;
    gap: 4px;
}

.dashboard-filter-tab {
    background: none;
    border: none;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashboard-filter-tab:hover {
    color: #ccc;
    background: rgba(255,255,255,0.05);
}

.dashboard-filter-tab.active {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.dashboard-sort-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(224, 230, 237, 0.4);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: auto;
}

.dashboard-sort-btn:hover {
    color: #e0e6ed;
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
}

/* ── Sidebar Department Items (flat list) ── */
.department-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin-bottom: 2px;
    text-decoration: none;
    color: inherit;
}

.department-item:hover {
    background: rgba(102, 126, 234, 0.08);
}

.department-item.active {
    background: rgba(102, 126, 234, 0.12);
    border-left-color: #667eea;
}

.department-item.department-hidden {
    opacity: 0.4;
}

.department-item-title {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.department-item.active .department-item-title {
    color: #4facfe;
}

/* ── Floating Action Bar ── */
.floating-action-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(10, 15, 38, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 50px;
    padding: 8px 12px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.fab-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(102, 126, 234, 0.15);
    color: rgba(224, 230, 237, 0.8);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    color: #fff;
    transform: scale(1.08);
}

.floating-add-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: rgba(15, 20, 45, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 12px;
    padding: 6px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.floating-add-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-add-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: rgba(224, 230, 237, 0.85);
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
    white-space: nowrap;
}

.floating-add-menu button:hover {
    background: rgba(102, 126, 234, 0.15);
}

.floating-add-menu button i {
    width: 18px;
    text-align: center;
    color: #667eea;
}

/* ── Search Modal ── */
.search-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    padding-top: min(20vh, 140px);
    animation: searchFadeIn 0.15s ease;
}

.search-modal-overlay.search-modal-closing {
    opacity: 0;
    transition: opacity 0.15s ease;
}

@keyframes searchFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-modal {
    width: 580px;
    max-width: 92vw;
    max-height: 70vh;
    background: #1a1d2e;
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(102, 126, 234, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: searchSlideIn 0.15s ease;
}

@keyframes searchSlideIn {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.search-modal-header {
    padding: 4px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.12);
    flex-shrink: 0;
}

.search-modal-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
}

.search-modal-icon {
    color: #667eea;
    font-size: 16px;
    flex-shrink: 0;
}

.search-modal-input {
    flex: 1;
    padding: 0;
    font-size: 16px;
    background: transparent;
    border: none;
    color: #e0e6ed;
    outline: none;
}

.search-modal-input::placeholder {
    color: rgba(224, 230, 237, 0.3);
}

.search-modal-kbd {
    font-size: 11px;
    font-family: inherit;
    color: rgba(224, 230, 237, 0.35);
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 5px;
    padding: 2px 7px;
    flex-shrink: 0;
}

.search-modal-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-modal-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(224, 230, 237, 0.3);
    font-size: 14px;
}

.search-modal-empty i {
    display: block;
    font-size: 28px;
    margin-bottom: 10px;
    opacity: 0.4;
}

.search-results-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-results-dept {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(224, 230, 237, 0.4);
    padding: 4px 10px 6px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.search-result-bar {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(224, 230, 237, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 12px;
    color: rgba(224, 230, 237, 0.45);
    margin-top: 2px;
}

.search-result-steps {
    margin-left: 8px;
    opacity: 0.7;
}

.search-result-step-matches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.search-result-step-tag {
    font-size: 11px;
    color: #4facfe;
    background: rgba(79, 172, 254, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.search-result-step-tag i {
    font-size: 9px;
    margin-right: 3px;
}

/* ── Floating Action Bar Mobile ── */
@media (max-width: 768px) {
    .floating-action-bar {
        bottom: 16px;
    }
}

/* ══════════════════════════════════════════
   Sidebar Avatar & Notification Bell
   ══════════════════════════════════════════ */

.sidebar-avatar-btn {
    padding: 0 !important;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar-notif-wrapper {
    position: relative;
}

#notifBell {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #f5576c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

/* ── Notification Dropdown ── */

.notif-dropdown {
    position: fixed;
    bottom: 60px;
    left: 70px;
    width: 360px;
    max-height: 460px;
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.notif-dropdown-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e0e6ed;
}

.notif-mark-all {
    background: none;
    border: none;
    color: #667eea;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.notif-mark-all:hover {
    background: rgba(102, 126, 234, 0.1);
}

.notif-list {
    overflow-y: auto;
    max-height: 400px;
    flex: 1;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.notif-item.notif-unread {
    background: rgba(102, 126, 234, 0.06);
}

.notif-item.notif-unread::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
}

.notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.notif-icon.comment {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.notif-icon.expiry {
    background: rgba(245, 166, 35, 0.15);
    color: #f5a623;
}

.notif-icon.approval {
    background: rgba(67, 233, 123, 0.15);
    color: #43e97b;
}

.notif-icon.mention {
    background: rgba(118, 75, 162, 0.15);
    color: #a78bfa;
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: #e0e6ed;
    line-height: 1.3;
    margin-bottom: 2px;
}

.notif-message {
    font-size: 12px;
    color: #8a94a6;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-time {
    font-size: 11px;
    color: #5a6478;
    margin-top: 4px;
}

.notif-dismiss {
    background: none;
    border: none;
    color: #5a6478;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    flex-shrink: 0;
}

.notif-item:hover .notif-dismiss {
    opacity: 1;
}

.notif-dismiss:hover {
    color: #f5576c;
}

.notif-loading,
.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: #5a6478;
    font-size: 13px;
}

.notif-empty i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

.notif-empty p {
    margin: 0;
}

/* ══════════════════════════════════════════
   Profile Page
   ══════════════════════════════════════════ */

.profile-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.profile-container {
    width: 100%;
    max-width: 680px;
}

.profile-back {
    margin-bottom: 24px;
}

.profile-back-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
}

.profile-back-link:hover {
    color: #8b9cf7;
}

.profile-header-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px;
    background: rgba(26, 31, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.profile-avatar-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    color: #fff;
    font-size: 20px;
}

.profile-avatar-wrapper:hover .profile-avatar-overlay {
    opacity: 1;
}

.profile-remove-avatar {
    background: none;
    border: none;
    color: #f5576c;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0;
}

.profile-remove-avatar:hover {
    text-decoration: underline;
}

.profile-header-info h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: #e0e6ed;
}

.profile-role {
    margin: 0;
    font-size: 13px;
    color: #667eea;
    font-weight: 500;
}

.profile-job-title {
    margin: 4px 0 0;
    font-size: 13px;
    color: #8a94a6;
}

.profile-member-since {
    margin: 6px 0 0;
    font-size: 12px;
    color: #5a6478;
}

.profile-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 20px;
    font-weight: 500;
}

.profile-alert-success {
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.2);
    color: #43e97b;
}

.profile-alert-error {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.2);
    color: #f5576c;
}

.profile-section {
    background: rgba(26, 31, 46, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
}

.profile-section h2 {
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 600;
    color: #e0e6ed;
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-section h2 i {
    color: #667eea;
    font-size: 14px;
}

.profile-form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.profile-form-row .profile-field {
    flex: 1;
    margin-bottom: 0;
}

.profile-field {
    margin-bottom: 16px;
}

.profile-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #8a94a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.profile-field input,
.profile-field textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(15, 18, 27, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #e0e6ed;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.profile-field input:focus,
.profile-field textarea:focus {
    outline: none;
    border-color: #667eea;
}

.profile-field textarea {
    resize: vertical;
    min-height: 80px;
}

.profile-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* ── Profile Page Mobile ── */
@media (max-width: 768px) {
    .profile-page {
        padding: 20px 12px;
    }

    .profile-header-card {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }

    .profile-form-row {
        flex-direction: column;
        gap: 0;
    }

    .profile-form-row .profile-field {
        margin-bottom: 16px;
    }

    .profile-section {
        padding: 20px 16px;
    }

    .notif-dropdown {
        width: 300px;
        left: -60px;
    }
}