*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    overflow: hidden;
    height: 100vh;
    background: #555;
}

/* ── Outer window shell ─────────────────────────── */
.fb-window {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* ── Title bar ──────────────────────────────────── */
.fb-titlebar {
    background: #2b2d31;
    color: #bbb;
    height: 26px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    user-select: none;
    flex-shrink: 0;
}
.fb-titlebar-title { flex: 1; }
.fb-win-btn {
    width: 18px; height: 18px;
    border: none; cursor: pointer; border-radius: 2px;
    font-size: 10px; color: #555;
    background: #aaa;
    display: flex; align-items: center; justify-content: center;
}
.fb-win-btn:hover { background: #ccc; }
.fb-win-btn.close { background: #e05; color: #fff; }
.fb-win-btn.close:hover { background: #c00; }

/* ── Menu bar ───────────────────────────────────── */
.fb-menubar {
    background: #2b2d31;
    color: #bbb;
    height: 22px;
    display: flex;
    align-items: stretch;
    padding: 0 4px;
    font-size: 12px;
    position: relative;
    user-select: none;
    flex-shrink: 0;
    border-top: 1px solid #222;
}
.fb-menu-item {
    padding: 0 9px;
    display: flex;
    align-items: center;
    cursor: pointer;
    border-radius: 2px;
    white-space: nowrap;
}
.fb-menu-item:hover, .fb-menu-item.open { background: #3a3d44; color: #fff; }
.fb-menu-item.highlight { color: #6ab0ff; }

.fb-dropdown {
    position: absolute;
    top: 100%;
    background: #fff;
    border: 1px solid #bbb;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
    min-width: 170px;
    z-index: 9000;
    display: none;
    border-radius: 3px;
    padding: 3px 0;
}
.fb-dropdown.show { display: block; }
.fb-dd-item {
    padding: 5px 14px;
    color: #222;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.fb-dd-item:hover { background: #e8f0fe; }
.fb-dd-item.active-nav { background: #1565c0; color: #fff; }
.fb-dd-sep { border-top: 1px solid #eee; margin: 3px 0; }

/* ── Toolbar ────────────────────────────────────── */
.fb-toolbar {
    background: #f4f4f4;
    border-bottom: 1px solid #d5d5d5;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    gap: 2px;
    flex-shrink: 0;
}
.tb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 4px 9px;
    border: none;
    background: transparent;
    cursor: default;
    border-radius: 3px;
    font-size: 10.5px;
    color: #333;
    min-width: 48px;
}
.tb-btn:hover { background: #ddd; }
.tb-btn.pages-btn { background: #e3f0ff; color: #1565c0; border: 1px solid #b3d1f5; }
.tb-btn.pages-btn:hover { background: #1565c0; color: #fff; }
.tb-btn.tb-highlight { cursor: pointer; background: #fff5e2; color: #8a5a12; border: 1px solid #FAB435; font-weight: 700; animation: tbpulse 1.8s ease-in-out infinite; }
.tb-btn.tb-highlight:hover { background: #FAB435; color: #1C2045; animation: none; }
@keyframes tbpulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(250,180,53,.55); }
    50%      { box-shadow: 0 0 0 5px rgba(250,180,53,0); }
}
@media (prefers-reduced-motion: reduce) { .tb-btn.tb-highlight { animation: none; } }
.tb-icon { font-size: 17px; }
.tb-sep { width: 1px; height: 34px; background: #d0d0d0; margin: 0 4px; }

/* ── Body ───────────────────────────────────────── */
.fb-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ── Sidebar ────────────────────────────────────── */
.fb-sidebar {
    width: 184px;
    background: #1d1f24;
    color: #aaa;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    border-right: 1px solid #111;
}
.fb-sidebar::-webkit-scrollbar { width: 4px; }
.fb-sidebar::-webkit-scrollbar-thumb { background: #444; }

.sb-modules-bar {
    background: #141619;
    border-bottom: 1px solid #111;
    padding: 5px 10px;
    font-size: 11px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.sb-group { border-bottom: 1px solid #111; }
.sb-group-title {
    padding: 7px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}
.sb-group-title:hover { background: #26292f; }
.sb-group-title .sb-arrow { font-size: 9px; color: #666; margin-left: auto; }
.sb-group-items { display: none; }
.sb-group.expanded .sb-group-items { display: block; }
.sb-item {
    padding: 5px 10px 5px 26px;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sb-item:hover { background: #26292f; color: #ddd; }
.sb-item.active { background: #1565c0; color: #fff; }

/* ── Main ───────────────────────────────────────── */
.fb-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
}

/* ── Tab bar ────────────────────────────────────── */
.fb-tabbar {
    background: #efefef;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: stretch;
    padding: 0 8px;
    height: 28px;
    flex-shrink: 0;
}
.fb-tab {
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.fb-tab:hover { color: #222; }
.fb-tab.active { color: #1565c0; border-bottom-color: #1565c0; font-weight: 500; }

/* ── Content area ───────────────────────────────── */
.fb-content {
    flex: 1;
    overflow: auto;
    padding: 20px 24px;
    background: #fff;
}
.fb-content.module-active { padding: 0; overflow: hidden; }
.fb-panel { display: none; }
.fb-panel.active { display: block; }
.fb-panel.active.fill { display: flex; height: 100%; }

/* ── Dashboard ──────────────────────────────────── */
.dash-title {
    font-size: 22px;
    color: #1565c0;
    margin-bottom: 16px;
    font-weight: 400;
}
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 260px;
    grid-template-rows: auto auto;
    gap: 12px;
}
.dash-gadget {
    border: 1px solid #ccc;
    border-radius: 3px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.dash-gadget-head {
    background: #1565c0;
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}
.dash-gadget-body { overflow: auto; flex: 1; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 4px 8px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.dash-table td { padding: 3px 8px; border-bottom: 1px solid #f5f5f5; }
.dash-table tr:hover td { background: #f0f7ff; }
.dash-table a { color: #1565c0; text-decoration: none; }
.dash-table a:hover { text-decoration: underline; }
.dash-foot { padding: 4px 8px; font-size: 11px; color: #777; text-align: center; border-top: 1px solid #eee; background: #fafafa; }
.quick-links { padding: 10px 12px; font-size: 12px; line-height: 1.9; }
.quick-links h4 { font-size: 12px; color: #333; margin-bottom: 2px; margin-top: 8px; }
.quick-links h4:first-child { margin-top: 0; }
.quick-links a { color: #1565c0; text-decoration: none; display: block; }
.quick-links a:hover { text-decoration: underline; }

/* ── Available Pages ────────────────────────────── */
.pages-title { font-size: 20px; font-weight: 400; color: #222; margin-bottom: 16px; }
.pages-search {
    display: block; width: 300px;
    padding: 6px 12px; border: 1px solid #ccc;
    border-radius: 4px; font-size: 13px;
    margin-bottom: 16px; outline: none;
}
.pages-search:focus { border-color: #1565c0; box-shadow: 0 0 0 2px #1565c033; }
.pages-group { border: 1px solid #ddd; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.pages-group-head {
    background: #f5f5f5; padding: 8px 12px;
    font-size: 13px; font-weight: 600; color: #333;
    display: flex; align-items: center; gap: 6px;
    cursor: pointer; user-select: none;
}
.pages-group-head:hover { background: #eee; }
.pages-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.pages-table th { background: #fafafa; border-bottom: 1px solid #eee; padding: 6px 12px; text-align: left; color: #666; font-weight: 600; }
.pages-table td { padding: 7px 12px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.pages-table tr:last-child td { border-bottom: none; }
.pages-table tr:hover td { background: #f8f8f8; }
.open-btn { padding: 3px 14px; background: #fff; border: 1px solid #bbb; border-radius: 3px; cursor: pointer; font-size: 12px; color: #333; }
.open-btn:hover { background: #e8f0fe; border-color: #1565c0; color: #1565c0; }

/* ── Module split layout ────────────────────────── */
.module-layout { display: flex; height: 100%; }
.module-left {
    width: 310px;
    flex-shrink: 0;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}
.module-list-search { padding: 6px 8px; border-bottom: 1px solid #eee; }
.module-list-search input {
    width: 100%; padding: 5px 8px;
    border: 1px solid #ccc; border-radius: 3px;
    font-size: 12px; outline: none;
}
.module-list-search input:focus { border-color: #1565c0; }
.module-list { flex: 1; overflow-y: auto; }
.ml-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ml-table th {
    position: sticky; top: 0;
    background: #f0f0f0; border-bottom: 2px solid #ddd;
    padding: 5px 8px; text-align: left; font-weight: 600; white-space: nowrap;
}
.ml-table td { padding: 4px 8px; border-bottom: 1px solid #ebebeb; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.ml-table tr:hover td { background: #f0f7ff; }
.ml-table tr.selected td { background: #1565c0; color: #fff; }
.module-list-foot { padding: 5px 8px; font-size: 11px; color: #777; border-top: 1px solid #eee; text-align: center; background: #f5f5f5; }
.module-right { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.module-detail-header { background: #1565c0; color: #fff; padding: 10px 16px; flex-shrink: 0; }
.mdh-top { display: flex; align-items: baseline; gap: 12px; }
.mdh-title { font-size: 17px; font-weight: 500; }
.mdh-subtitle { font-size: 12px; opacity: 0.85; }
.mdh-status { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); }
.mdh-fields { display: flex; gap: 20px; margin-top: 8px; flex-wrap: wrap; }
.mdh-field label { display: block; font-size: 10px; opacity: 0.65; text-transform: uppercase; margin-bottom: 1px; }
.mdh-field span { font-size: 12px; }
.module-detail-tabs {
    background: #f5f5f5; border-bottom: 1px solid #ddd;
    display: flex; padding: 0 8px; flex-shrink: 0;
}
.module-detail-tab {
    padding: 7px 16px; font-size: 12px; color: #555;
    cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.module-detail-tab:hover { color: #222; }
.module-detail-tab.active { color: #1565c0; border-bottom-color: #1565c0; font-weight: 500; }
.module-detail-body { flex: 1; overflow: auto; padding: 12px 16px; }
.detail-section { margin-bottom: 16px; }
.detail-section-title { font-size: 11px; font-weight: 600; color: #888; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.detail-fields-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 16px; margin-bottom: 12px; }
.df-field label { font-size: 10px; color: #999; text-transform: uppercase; display: block; }
.df-field span { font-size: 12px; color: #222; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.detail-table th { background: #f5f5f5; border-bottom: 1px solid #ddd; padding: 5px 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.detail-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }
.detail-table tfoot td { background: #f9f9f9; font-weight: 600; border-top: 2px solid #ddd; }
.detail-table tr:hover td { background: #f8fbff; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-warning  { background: #fff3cd; color: #856404; }
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-secondary{ background: #e9ecef; color: #495057; }

/* ── CloudPages popup window ────────────────────── */
.cp-popup {
    position: absolute;
    background: #fff;
    border: 1px solid #aaa;
    box-shadow: 0 6px 28px rgba(0,0,0,0.28);
    display: flex;
    flex-direction: column;
    border-radius: 2px;
    transition: box-shadow 0.1s;
}
.cp-popup.focused { box-shadow: 0 8px 36px rgba(0,0,0,0.38); }
/* Maximize fills the whole simulated desktop (over the Fishbowl client chrome),
   leaving only the desktop taskbar visible — not just the fb-body content area. */
.cp-popup.maximized {
    position: fixed;
    top: 0 !important; left: 0 !important; right: 0 !important;
    bottom: 46px !important;            /* height of .win-taskbar */
    width: auto !important; height: auto !important;
    border-radius: 0; border: none;
    z-index: 8000;
}
.cp-popup.minimized { display: none; }
.cp-popup-titlebar {
    background: #ececec;
    border-bottom: 1px solid #d0d0d0;
    height: 26px;
    display: flex; align-items: center;
    padding: 0 8px; gap: 6px;
    font-size: 12px; color: #333;
    cursor: move; user-select: none; flex-shrink: 0;
}
.cp-popup-title { flex: 1; font-weight: 500; }
.cp-win-btn {
    width: 20px; height: 20px;
    border: 1px solid #bbb; background: #f0f0f0;
    border-radius: 2px; cursor: pointer;
    font-size: 10px; color: #555;
    display: flex; align-items: center; justify-content: center;
}
.cp-win-btn:hover { background: #ddd; }
.cp-win-btn.close:hover { background: #c00; color: #fff; border-color: #c00; }
.cp-popup-toolbar {
    background: #fafafa; border-bottom: 1px solid #eee;
    height: 42px; display: flex; align-items: center;
    padding: 0 8px; gap: 2px; flex-shrink: 0;
}
.cp-tb-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 1px; padding: 3px 8px; border: none;
    background: transparent; cursor: default; border-radius: 3px;
    font-size: 10px; color: #444; min-width: 44px;
}
.cp-tb-btn:hover { background: #e4e4e4; }
.cp-tb-icon { font-size: 15px; }
.cp-popup-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.cp-popup-iframe { flex: 1; border: none; width: 100%; }
.cp-popup-shield { display: none; position: absolute; inset: 0; z-index: 20; cursor: inherit; }
.cp-popup-shield.active { display: block; }
.cp-resize-e  { position: absolute; right: -4px; top: 20px; bottom: 20px; width: 8px; cursor: e-resize; z-index: 600; }
.cp-resize-s  { position: absolute; bottom: -4px; left: 20px; right: 20px; height: 8px; cursor: s-resize; z-index: 600; }
.cp-resize-se { position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; cursor: se-resize; z-index: 600; }
.cp-popup-statusbar { height: 20px; background: #f4f4f4; border-top: 1px solid #ddd; display: flex; align-items: center; padding: 0 8px; font-size: 11px; color: #666; flex-shrink: 0; }

/* minimal-window mode: page declares <meta name="window_style" content="minimal">.
   Just the browser view — no report toolbar, no status bar. */
.cp-popup.cp-minimal .cp-popup-toolbar,
.cp-popup.cp-minimal .cp-popup-statusbar { display: none; }

/* ── Pages dropdown ─────────────────────────────── */
.pages-dd {
    display: none;
    position: fixed;
    background: #fff;
    border: 1px solid #bbb;
    box-shadow: 0 4px 18px rgba(0,0,0,0.22);
    border-radius: 4px;
    min-width: 340px;
    max-width: 460px;
    z-index: 9500;
    overflow: hidden;
}
.pages-dd.show { display: block; }
.pages-dd-head {
    background: #1565c0;
    color: #fff;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pages-dd-head button { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 13px; padding: 0 2px; }
.pages-dd-head button:hover { color: #fff; }
.pages-dd-body { max-height: 260px; overflow-y: auto; }
.pages-dd-row { display: flex; align-items: center; padding: 8px 12px; border-bottom: 1px solid #f0f0f0; gap: 10px; }
.pages-dd-row:last-child { border-bottom: none; }
.pages-dd-row:hover { background: #f5f9ff; }
.pages-dd-info { flex: 1; min-width: 0; }
.pages-dd-title { font-size: 12px; font-weight: 500; color: #222; }
.pages-dd-desc { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pages-dd-empty { padding: 16px 12px; text-align: center; font-size: 12px; color: #999; font-style: italic; }

/* ── Hint banner ────────────────────────────────── */
.hint-bar {
    background: #fff3cd; border-bottom: 1px solid #ffc107;
    padding: 6px 16px; font-size: 12px; color: #664d03;
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.hint-bar.hidden { display: none; }

/* ── Windows 11-style taskbar ───────────────────── */
.win-taskbar {
    background: rgba(28, 28, 30, 0.92);
    backdrop-filter: blur(12px);
    height: 46px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.07);
    position: relative;
    z-index: 9000;
    gap: 6px;
}
.win-tb-start {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; border-radius: 6px; cursor: pointer;
    color: #ccc; flex-shrink: 0;
}
.win-tb-start:hover { background: rgba(255,255,255,0.1); }
.win-tb-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.1); margin: 0 4px; flex-shrink: 0; }
.win-tb-windows {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.win-tb-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px 4px 8px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #ddd;
    font-size: 11.5px;
    cursor: pointer;
    max-width: 190px;
    min-width: 130px;
    position: relative;
    user-select: none;
}
.win-tb-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.22); }
.win-tb-btn.focused { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.35); }
.win-tb-btn.minimized-btn { opacity: 0.55; }
.win-tb-btn::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 50%; transform: translateX(-50%);
    width: 16px; height: 2px;
    background: #60aaff;
    border-radius: 2px;
    display: none;
}
.win-tb-btn.focused::after { display: block; }
.win-tb-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win-tb-icon { font-size: 13px; flex-shrink: 0; }
.win-tb-x {
    font-size: 10px; color: rgba(255,255,255,0.4);
    padding: 1px 2px; border-radius: 3px;
    line-height: 1; flex-shrink: 0;
}
.win-tb-x:hover { background: rgba(220,60,60,0.8); color: #fff; }
.win-tb-clock {
    color: #bbb; font-size: 11px; text-align: right;
    line-height: 1.5; min-width: 58px; flex-shrink: 0; cursor: default;
}
