/* ── Google Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ── Design tokens ───────────────────────────────────────────── */
:root {
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'DM Mono', monospace;

    /* Surface */
    --bg:           #f4f5f8;
    --surface:      #ffffff;
    --surface-2:    #f0f1f5;
    --surface-3:    #e8eaf0;

    /* Sidebar */
    --sidebar-bg:   #1e2235;
    --sidebar-text: #c0c8e8;
    --sidebar-acc:  #ffffff;
    --sidebar-hover:#2d3350;
    --sidebar-div:  #3a4060;
    --sidebar-label:#8892b0;

    /* Accent */
    --acc:          #5b6cf9;
    --acc-hover:    #4558f7;
    --acc-light:    #eef0ff;
    --acc-text:     #ffffff;

    /* Status */
    --green:        #22c47a;
    --green-light:  #e6faf2;
    --yellow:       #f5c518;
    --yellow-light: #fffbe6;
    --red:          #ef4545;
    --red-light:    #fef0f0;

    /* Text */
    --text-primary:   #1a1d2e;
    --text-secondary: #6b7280;
    --text-muted:     #9ca3af;

    /* Borders */
    --border:       #e2e5ef;
    --border-focus: var(--acc);

    /* Shadows */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
    --shadow-lg:  0 8px 28px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
    --shadow-xl:  0 20px 48px rgba(0,0,0,0.14), 0 8px 16px rgba(0,0,0,0.08);

    /* Radius */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;
    --r-xl:  18px;
    --r-full: 9999px;

    /* Layout */
    --sidebar-w:       64px;
    --sidebar-w-exp:  220px;
    --header-h:        72px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* ── Page layout ─────────────────────────────────────────────── */
.pageWrapper {
    display: flex;
    min-height: 100vh;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════════════════════════ */
.sidebar {
    flex-shrink: 0;
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    overflow: hidden;
    transition: width 0.24s cubic-bezier(0.4, 0, 0.2, 1);
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar.expanded {
    width: var(--sidebar-w-exp);
}

.sidebarSection {
    padding: 8px 0 4px;
}

.sidebarLabel {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-label);
    padding: 4px 14px 8px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s;
}

.sidebar:not(.expanded) .sidebarLabel,
.sidebar:not(.expanded) .sidebarEmpty {
    opacity: 0;
}

.sidebarDivider {
    height: 1px;
    background: var(--sidebar-div);
    margin: 6px 14px;
    opacity: 0.6;
}

.sidebarEmpty {
    padding: 4px 18px;
    color: var(--sidebar-label);
    font-size: 12px;
    white-space: nowrap;
    font-style: italic;
}

.sidebarItem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    margin: 1px 6px;
    border-radius: var(--r-sm);
}

.sidebarItem:hover {
    background: var(--sidebar-hover);
}

.sidebarImg {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: var(--r-sm);
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

.sidebarItemLabel {
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.sidebarItemName {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--sidebar-acc);
    font-size: 13px;
}

.sidebarClicks {
    font-size: 10.5px;
    color: var(--sidebar-label);
    font-family: var(--font-mono);
}

/* ── Sidebar bottom / settings ───────────────────────────────── */
.sidebarBottom {
    margin-top: auto;
    border-top: 1px solid var(--sidebar-div);
    padding: 8px 0;
}

.sidebarSettingsBtn {
    color: var(--sidebar-text);
}

.sidebarSettingsIcon {
    font-size: 19px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--sidebar-text);
}

/* ════════════════════════════════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════════════════════════════ */
.mainContent {
    flex: 1;
    min-width: 0;
}

/* ════════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════════ */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 92%;
    margin: 0 auto;
    padding: 18px 0 16px;
    gap: 14px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.headerControls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Edit toggle ─────────────────────────────────────────────── */
.editToggle {
    height: 40px;
    padding: 0 16px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    font-family: var(--font-body);
}

.editToggle:hover {
    background: var(--surface-2);
    border-color: #c8cfe0;
    box-shadow: var(--shadow-md);
}

.editToggle.active {
    background: var(--yellow-light);
    border-color: var(--yellow);
    color: #7a5c00;
}

.editToggle.active:hover {
    background: #fff3b0;
}


/* ════════════════════════════════════════════════════════════════
   SEARCH BAR
════════════════════════════════════════════════════════════════ */
.searchWrapper {
    position: relative;
    flex: 1;
    min-width: 160px;
    max-width: 340px;
    display: flex;
    align-items: center;
}

.searchInput {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    font-size: 13.5px;
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
}

.searchInput::placeholder { color: var(--text-muted); }

.searchInput:focus {
    border-color: var(--acc);
    box-shadow: 0 0 0 3px rgba(91,108,249,0.15);
}

.searchShortcut {
    position: absolute;
    right: 12px;
    font-size: 12px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    pointer-events: none;
    font-family: var(--font-mono);
    background: var(--surface-2);
}

.searchClear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.12s;
}
.searchClear:hover { color: var(--text-primary); }

/* ── Shortcuts hint ──────────────────────────────────────────── */
.shortcutsHint {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: default;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.12s;
}

.shortcutsHint:hover { border-color: #c8cfe0; }
.shortcutsHint:hover .shortcutsTooltip { display: block; }

.shortcutsHintIcon { font-size: 16px; }

.shortcutsTooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 16px;
    white-space: nowrap;
    z-index: 200;
    box-shadow: var(--shadow-xl);
}

.shortcutRow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.shortcutRow:last-child { margin-bottom: 0; }

kbd {
    display: inline-block;
    padding: 2px 8px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    min-width: 30px;
    text-align: center;
    color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════════
   APP GRID
════════════════════════════════════════════════════════════════ */
.app-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    width: 92%;
    margin: 20px auto 32px;
}

.application {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.application.dragging { opacity: 0.35; }

/* ── App box (card) ──────────────────────────────────────────── */
.appBox {
    position: relative;
    width: 150px;
    height: 150px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.18s ease,
                border-color 0.15s;
}

.appBox:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: #c8cfe0;
}

.appBox img {
    border-radius: calc(var(--r-xl) - 4px);
    object-fit: cover;
}

/* ── Edit overlay ────────────────────────────────────────────── */
.editOverlay {
    position: absolute;
    inset: 0;
    background: rgba(20,24,40,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: var(--r-xl);
    backdrop-filter: blur(2px);
}

.dragHandle {
    color: rgba(255,255,255,0.85);
    font-size: 20px;
    cursor: grab;
    user-select: none;
}

.manageBtn {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.manageBtn:hover    { background: rgba(255,255,255,0.25); }

/* ── Category overlay ────────────────────────────────────────── */
.categoryOverlay {
    position: absolute;
    top: 0;
    left: 162px;
    width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 12px 14px;
    z-index: 30;
    box-shadow: var(--shadow-xl);
}

.categoryOverlay.flipped  { left: unset; right: 162px; }
.categoryOverlay.flippedUp { top: unset; bottom: 0; }

.categoryOverlayTitle {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.categoryCheck {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-primary);
    padding: 3px 4px;
    border-radius: var(--r-sm);
    transition: background 0.1s;
}
.categoryCheck:hover:not(.disabled) { background: var(--acc-light); }
.categoryCheck.disabled { opacity: 0.4; cursor: default; }

/* ── Popup box ───────────────────────────────────────────────── */
.popUpBox {
    position: absolute;
    top: -8px;
    left: 162px;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    z-index: 10;
    padding: 14px 16px;
    box-shadow: var(--shadow-xl);
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-primary);
}

.popupDocsLink {
    display: block;
    margin-top: 10px;
    color: var(--acc);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 5px 10px;
    background: var(--acc-light);
    border-radius: var(--r-sm);
    transition: background 0.15s;
}

.popupDocsLink:hover {
    background: var(--acc);
    color: var(--acc-text);
}

.popUpBox strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.popUpBox em {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    font-style: normal;
    background: var(--acc-light);
    color: var(--acc);
    border-radius: var(--r-full);
    padding: 2px 10px;
    font-weight: 600;
}

.popUpBox.flipped { left: unset; right: 162px; }

/* ── App name label ──────────────────────────────────────────── */
.appName {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 150px;
    color: var(--text-secondary);
}


/* ════════════════════════════════════════════════════════════════
   SETTINGS MODAL
════════════════════════════════════════════════════════════════ */
.settingsOverlay {
    position: fixed;
    inset: 0;
    background: rgba(10,12,24,0.5);
    backdrop-filter: blur(4px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settingsPanel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.settingsHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    z-index: 1;
}

.settingsHeader h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.settingsClose {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 14px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
    color: var(--text-secondary);
}
.settingsClose:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }

.settingsSection {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.settingsSection:last-child { border-bottom: none; }

.settingsSectionTitle {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.settingsRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}
.settingsRow:last-child { margin-bottom: 0; }

.settingsLabel {
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--text-primary);
}

.settingsOptions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.settingsOption {
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-body);
    transition: background 0.12s, border-color 0.12s;
    color: var(--text-primary);
}
.settingsOption:hover  { background: var(--surface-3); border-color: #c8cfe0; }
.settingsOption.active {
    background: var(--acc);
    color: #fff;
    border-color: var(--acc);
    box-shadow: 0 2px 8px rgba(91,108,249,0.3);
}

.settingsSelect {
    padding: 7px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    min-width: 160px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}
.settingsSelect:focus { border-color: var(--acc); }

/* ── Toggle switch ───────────────────────────────────────────── */
.settingsToggle {
    width: 44px;
    height: 24px;
    background: var(--surface-3);
    border: 1.5px solid var(--border);
    border-radius: var(--r-full);
    cursor: pointer;
    position: relative;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}
.settingsToggle.on { background: var(--acc); border-color: var(--acc); }

.settingsToggleKnob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: left 0.2s;
}
.settingsToggle.on .settingsToggleKnob { left: 22px; }


/* ════════════════════════════════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════════════════════════════ */
.emptyState {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 72px 20px;
    gap: 10px;
    text-align: center;
    animation: emptyFadeIn 0.3s ease both;
}

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

.emptyStateIcon {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 4px;
    opacity: 0.5;
}

.emptyStateTitle {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
}

.emptyStateHint {
    font-size: 13.5px;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.6;
}

.emptyStateAction {
    margin-top: 10px;
    padding: 9px 22px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.12s, box-shadow 0.12s;
    box-shadow: var(--shadow-sm);
}
.emptyStateAction:hover { background: var(--acc-light); border-color: var(--acc); color: var(--acc); box-shadow: var(--shadow-md); }

/* ════════════════════════════════════════════════════════════════
   GRID DENSITY
════════════════════════════════════════════════════════════════ */
body[data-density="compact"]     .app-list { gap: 12px; }
body[data-density="comfortable"] .app-list { gap: 20px; }
body[data-density="spacious"]    .app-list { gap: 32px; }

body[data-density="compact"]     .appBox { width: 100px; height: 100px; border-radius: var(--r-lg); }
body[data-density="compact"]     .appBox img { width: 100px; height: 100px; }
body[data-density="compact"]     .app-list { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
body[data-density="compact"]     .appName { width: 100px; }
body[data-density="compact"]     .popUpBox { left: 112px; }
body[data-density="compact"]     .popUpBox.flipped { left: unset; right: 112px; }
body[data-density="compact"]     .categoryOverlay { left: 112px; }
body[data-density="compact"]     .categoryOverlay.flipped { left: unset; right: 112px; }

body[data-density="spacious"]    .appBox { width: 190px; height: 190px; }
body[data-density="spacious"]    .appBox img { width: 190px; height: 190px; }
body[data-density="spacious"]    .app-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
body[data-density="spacious"]    .appName { width: 190px; }
body[data-density="spacious"]    .popUpBox { left: 202px; }
body[data-density="spacious"]    .popUpBox.flipped { left: unset; right: 202px; }
body[data-density="spacious"]    .categoryOverlay { left: 202px; }
body[data-density="spacious"]    .categoryOverlay.flipped { left: unset; right: 202px; }

/* ════════════════════════════════════════════════════════════════
   DARK THEME
════════════════════════════════════════════════════════════════ */
body[data-theme="dark"] {
    --bg:           #0d0f1a;
    --surface:      #161926;
    --surface-2:    #1e2235;
    --surface-3:    #252a40;
    --text-primary:   #e8eaf0;
    --text-secondary: #8b90aa;
    --text-muted:     #5a6080;
    --border:       #2a2f48;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.2);
    --shadow-lg:    0 8px 28px rgba(0,0,0,0.5), 0 4px 8px rgba(0,0,0,0.25);
    --shadow-xl:    0 20px 48px rgba(0,0,0,0.6), 0 8px 16px rgba(0,0,0,0.3);
    --sidebar-bg:   #0a0c18;
    --sidebar-text: #b0b8d8;
    --sidebar-hover:#141729;
    --sidebar-div:  #2a3050;
    --sidebar-label:#6870a0;
    --acc-light:    #1a1e3a;
    --green-light:  #0a2018;
    --yellow-light: #1e1800;
    --red-light:    #200a0a;
}

/* ════════════════════════════════════════════════════════════════
   BLUE THEME
════════════════════════════════════════════════════════════════ */
body[data-theme="blue"] {
    --bg:           #deeef9;
    --surface:      #f0f8ff;
    --surface-2:    #e0eef8;
    --surface-3:    #cce0f2;
    --text-primary:   #0e2a4a;
    --text-secondary: #3a6080;
    --border:       #a8cce8;
    --sidebar-bg:   #0e2a4a;
    --sidebar-text: #b8d4f0;
    --sidebar-acc:  #e8f4ff;
    --sidebar-hover:#173a62;
    --sidebar-div:  #2a5080;
    --sidebar-label:#7aaad0;
    --acc:          #1a6fc4;
    --acc-hover:    #1560b0;
    --acc-light:    #d0e8fa;
    --green-light:  #d0f0e0;
    --yellow-light: #fdf6d0;
}

/* ════════════════════════════════════════════════════════════════
   WIDGET SYSTEM
════════════════════════════════════════════════════════════════ */

/* ── Widget container ────────────────────────────────────────── */
.widgetContainer {
    width: 92%;
    margin: 24px auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.widgetContainer.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    align-items: start;
}

/* ── Individual widget ───────────────────────────────────────── */
.widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    transition: box-shadow 0.15s, opacity 0.15s;
}

.widget:hover {
    box-shadow: var(--shadow-md);
}

.widgetDragging {
    opacity: 0.45;
    box-shadow: var(--shadow-xl) !important;
}

/* ── Widget header ───────────────────────────────────────────── */
.widgetHeader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border);
}

.widgetDragHandle {
    font-size: 18px;
    color: var(--text-muted);
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
    line-height: 1;
}

.widgetDragHandle:active { cursor: grabbing; }

.widgetTitle {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    letter-spacing: -0.2px;
}

.widgetRemoveBtn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
    padding: 0;
}

.widgetRemoveBtn:hover {
    background: var(--red-light);
    color: var(--red);
}

/* Wrap app-list inside a widget */
.widget .app-list {
    padding: 16px 16px 8px;
}

/* Health sub-widget grid needs breathing room */
.widget .dashboardWidgets {
    padding: 16px;
    gap: 12px;
}

/* Health widget footer */
.widget .dashboardChecked {
    padding: 8px 20px 14px;
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Add Widget area ─────────────────────────────────────────── */
.addWidgetArea {
    display: flex;
    justify-content: center;
    padding: 8px 0 16px;
}

.addWidgetBtnRow {
    position: relative;
}

.addWidgetBtn {
    height: 38px;
    padding: 0 20px;
    background: var(--surface);
    border: 1.5px dashed var(--border);
    border-radius: var(--r-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-body);
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.addWidgetBtn:hover {
    border-color: var(--acc);
    color: var(--acc);
    background: var(--acc-light);
}

.addWidgetPanel {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    overflow: hidden;
    z-index: 100;
}

.addWidgetPanelTitle {
    padding: 10px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.addWidgetItem {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s;
}

.addWidgetItem:hover {
    background: var(--acc-light);
    color: var(--acc);
}

.addWidgetEmpty {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 0;
}

/* ── Search results wrapper ──────────────────────────────────── */
.widgetSearchResults {
    width: 92%;
    margin: 16px auto 0;
}

.widgetSearchHeader {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 4px 10px;
}

/* ── Favorite button ─────────────────────────────────────────── */
.favoriteBtn {
    display: block;
    margin: 2px auto 0;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--r-sm);
    transition: color 0.15s, background 0.15s;
    font-family: var(--font-body);
    line-height: 1;
}

.favoriteBtn:hover {
    color: var(--yellow);
    background: var(--yellow-light);
}

.favoriteBtn.favorited {
    color: var(--yellow);
}

/* ── Settings hint text ──────────────────────────────────────── */
.settingsHint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 0 2px;
    line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════════
   TRANSITIONS
════════════════════════════════════════════════════════════════ */
.grid-fade-enter-active { transition: opacity 0.18s ease, transform 0.18s ease; }
.grid-fade-leave-active { transition: opacity 0.12s ease, transform 0.12s ease; }
.grid-fade-enter-from   { opacity: 0; transform: translateY(8px); }
.grid-fade-leave-to     { opacity: 0; transform: translateY(-4px); }

.modal-fade-enter-active { transition: opacity 0.2s ease; }
.modal-fade-leave-active { transition: opacity 0.15s ease; }
.modal-fade-enter-from,
.modal-fade-leave-to     { opacity: 0; }

.modal-fade-enter-active .settingsPanel,
.modal-fade-enter-active .confirmPanel {
    animation: modalPop 0.24s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.modal-fade-leave-active .settingsPanel,
.modal-fade-leave-active .confirmPanel {
    animation: modalPop 0.15s ease reverse both;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.94) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}


/* ════════════════════════════════════════════════════════════════
   ANNOUNCEMENTS
════════════════════════════════════════════════════════════════ */

/* Sidebar button */
.sidebarAnnouncementsBtn {
    color: var(--sidebar-text);
    position: relative;
}

.sidebarAnnouncementsIcon {
    font-size: 18px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.announcementBadge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    font-family: var(--font-body);
    min-width: 16px;
    height: 16px;
    border-radius: var(--r-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--sidebar-bg);
    line-height: 1;
}

/* Modal panel */
.announcementsPanel {
    width: min(500px, calc(100vw - 32px));
}

.announcementsHeaderActions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.markAllReadBtn {
    padding: 5px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.12s, color 0.12s;
}
.markAllReadBtn:hover {
    background: var(--acc-light);
    color: var(--acc);
    border-color: var(--acc);
}

/* List */
.announcementsList {
    display: flex;
    flex-direction: column;
    padding: 12px 16px 20px;
    gap: 10px;
}

.announcementsEmpty {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    padding: 40px 0;
}

/* Individual item */
.announcementItem {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.announcementItem:hover {
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

/* Type-based left accent */
.announcement-warning {
    border-left: 4px solid var(--yellow);
    background: var(--yellow-light);
}
.announcement-warning:hover { background: #fffacc; }

.announcement-info {
    border-left: 4px solid var(--acc);
    background: var(--acc-light);
}
.announcement-info:hover { background: #e4e8ff; }

/* Unread dot */
.announcementDot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--acc);
    flex-shrink: 0;
    margin-top: 5px;
}

.announcementItem:not(.unread) .announcementDot {
    display: none;
}

/* Text */
.announcementContent {
    flex: 1;
    min-width: 0;
}

.announcementTitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.announcementItem:not(.unread) .announcementTitle {
    font-weight: 600;
    color: var(--text-secondary);
}

.announcementBody {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 8px;
}

.announcementDate {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ════════════════════════════════════════════════════════════════
   SYSTEM HEALTH DASHBOARD
════════════════════════════════════════════════════════════════ */
/* Widget grid — 2 cols on wide, stacks on narrow */
.dashboardWidgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}

/* Base widget card */
.dashWidget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}

.dashWidgetLabel {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Overall Status widget ─────────────────────────────────── */
.dashStatusBadge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin-bottom: 12px;
}

.dashStatusDot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dashStatusBadge.status-healthy  { color: var(--green); }
.dashStatusBadge.status-degraded { color: var(--yellow); }
.dashStatusBadge.status-outage   { color: var(--red); }

.dashStatusBadge.status-healthy  .dashStatusDot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dashStatusBadge.status-degraded .dashStatusDot { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.dashStatusBadge.status-outage   .dashStatusDot { background: var(--red); box-shadow: 0 0 6px var(--red); }

.dashStatusMeta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.dashStatusMeta strong { color: var(--text-primary); }

/* ── Resource metrics widget ───────────────────────────────── */
.dashMetricRow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dashMetricRow:last-child { margin-bottom: 0; }

.dashMetricName {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 52px;
    flex-shrink: 0;
}

.dashBar {
    flex: 1;
    height: 7px;
    background: var(--surface-3);
    border-radius: var(--r-full);
    overflow: hidden;
}

.dashBarFill {
    height: 100%;
    border-radius: var(--r-full);
    transition: width 0.4s ease;
}
.dashBarFill.ok     { background: var(--green); }
.dashBarFill.warn   { background: var(--yellow); }
.dashBarFill.danger { background: var(--red); }

.dashMetricValue {
    font-size: 11.5px;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    width: 90px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Services widget ───────────────────────────────────────── */
.dashServicesCount {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
}

.dashServicesDot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dashServicesDot.ok     { background: var(--green); }
.dashServicesDot.warn   { background: var(--yellow); }
.dashServicesDot.danger { background: var(--red); }

.dashServiceList {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dashServiceRow {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
}

.dashServiceDot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dashServiceDot.up       { background: var(--green); }
.dashServiceDot.degraded { background: var(--yellow); }
.dashServiceDot.down     { background: var(--red); }

.dashServiceName {
    flex: 1;
    color: var(--text-primary);
    font-size: 13px;
}

.dashServiceLatency {
    font-size: 11.5px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ── Alerts widget ─────────────────────────────────────────── */
.dashAlertList {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.dashAlertRow {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 11px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    font-size: 12.5px;
}

.dashAlertRow.alert-error   { background: var(--red-light);    border-color: #fbc8c8; }
.dashAlertRow.alert-warning { background: var(--yellow-light); border-color: #f0dc80; }
.dashAlertRow.alert-info    { background: var(--acc-light);    border-color: #c8d0ff; }

.dashAlertIcon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 1px;
}
.alert-error   .dashAlertIcon { background: var(--red);    color: #fff; }
.alert-warning .dashAlertIcon { background: var(--yellow); color: #6a4c00; }
.alert-info    .dashAlertIcon { background: var(--acc);    color: #fff; }

.dashAlertMessage {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.45;
}

.dashAlertTime {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
}

