:root {
    --win-bg: #C0C0C0;
    --win-white: #FFFFFF;
    --win-gray: #808080;
    --win-dark-gray: #404040;
    --win-blue: #000080;
    --win-border-light: #dfdfdf;
    --win-border-dark: #808080;
    --win-text: #000000;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-drag: none;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background-color: #008080;
    /* Classic Teal Desktop */
    font-family: "MS Sans Serif", Tahoma, Verdana, Arial, sans-serif;
    font-size: 11px;
}

/* Bevel Utils */
.outset {
    border: 2px solid;
    border-top-color: var(--win-white);
    border-left-color: var(--win-white);
    border-right-color: var(--win-gray);
    border-bottom-color: var(--win-gray);
}

.inset {
    border: 2px solid;
    border-top-color: var(--win-gray);
    border-left-color: var(--win-gray);
    border-right-color: var(--win-white);
    border-bottom-color: var(--win-white);
    background-color: var(--win-white);
}

.button-active {
    border-top-color: var(--win-gray) !important;
    border-left-color: var(--win-gray) !important;
    border-right-color: var(--win-white) !important;
    border-bottom-color: var(--win-white) !important;
}

/* Desktop Environment */
#desktop {
    width: 100vw;
    height: calc(100vh - 32px);
    position: relative;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 20px;
}

.desktop-icon {
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    color: white;
    text-shadow: 1px 1px 0px #000;
}

.desktop-icon:active .icon-label {
    background-color: var(--win-blue);
    outline: 1px dotted white;
}

.icon-graphic {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
    image-rendering: pixelated;
}

.icon-label {
    padding: 2px 4px;
    word-wrap: break-word;
}

/* Taskbar */
#taskbar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 32px;
    background: var(--win-bg);
    border-top: 2px solid var(--win-white);
    display: flex;
    align-items: center;
    padding: 2px;
    z-index: 9999;
}

.task-item {
    height: 24px;
    min-width: 100px;
    margin-right: 4px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    font-weight: bold;
    background: var(--win-bg);
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.task-item.active {
    background: #e0e0e0;
    border-top-color: var(--win-gray);
    border-left-color: var(--win-gray);
    border-right-color: var(--win-white);
    border-bottom-color: var(--win-white);
}

/* Window System */
.window {
    position: absolute;
    background: var(--win-bg);
    min-width: 200px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}

.title-bar {
    height: 20px;
    background: var(--win-blue);
    color: white;
    display: flex;
    align-items: center;
    padding: 2px;
    cursor: default;
}

.window.inactive .title-bar {
    background: var(--win-gray);
}

.title-text {
    flex-grow: 1;
    font-weight: bold;
    padding-left: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-controls {
    display: flex;
    gap: 2px;
}

.win-btn {
    width: 16px;
    height: 14px;
    background: var(--win-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: black;
    font-weight: bold;
    font-size: 10px;
    cursor: pointer;
}

.win-btn svg {
    width: 10px;
    height: 10px;
}

.menu-bar {
    display: flex;
    padding: 2px 4px;
    border-bottom: 1px solid var(--win-gray);
}

.menu-item {
    padding: 2px 6px;
    cursor: default;
}

.menu-item:first-letter {
    text-decoration: underline;
}

.window-content {
    flex-grow: 1;
    padding: 8px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

/* Small Biz Manager Layout */
.biz-container {
    display: flex;
    flex-grow: 1;
    gap: 8px;
    height: 100%;
    overflow: hidden;
}

.tree-view {
    width: 160px;
    height: 100%;
    overflow-y: auto;
}

.list-view-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-box {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-box input {
    flex-grow: 1;
    height: 20px;
    border: 2px solid;
    border-top-color: var(--win-gray);
    border-left-color: var(--win-gray);
    border-right-color: var(--win-white);
    border-bottom-color: var(--win-white);
    padding: 0 4px;
    font-family: inherit;
}

.list-view {
    flex-grow: 1;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    position: sticky;
    top: 0;
    background: var(--win-bg);
    z-index: 10;
}

th {
    text-align: left;
    padding: 6px 8px;
    border: 1px solid var(--win-gray);
    background: var(--win-bg);
    font-weight: bold;
    font-size: 13px;
}

td {
    padding: 6px 6px;
    border-right: 1px solid #eee;
    cursor: pointer;
    white-space: nowrap;
    font-size: 14px;
}

td strong {
    font-size: 15px;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr.selected {
    background-color: var(--win-blue) !important;
    color: white;
}

.tree-item {
    padding: 2px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tree-item.selected {
    background: var(--win-blue);
    color: white;
}

/* Details Window Specifics */
.details-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
}

.label {
    font-weight: bold;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABZJREFUeNpiYGBgYHBxcfEHYmYgYAAAMwAByU99vQAAAABJRU5ErkJggg==");
}

::-webkit-scrollbar-thumb {
    background: var(--win-bg);
    border: 2px solid;
    border-top-color: var(--win-white);
    border-left-color: var(--win-white);
    border-right-color: var(--win-gray);
    border-bottom-color: var(--win-gray);
}

.hidden {
    display: none !important;
}

.resize-handle {
    width: 16px;
    height: 16px;
    position: absolute;
    bottom: 0;
    right: 0;
    cursor: se-resize;
    background: transparent;
    z-index: 100;
}

.resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 10px 10px;
    border-color: transparent transparent #808080 transparent;
}

/* Mobile Responsiveness */
/* Mobile Responsiveness - Card Layout Transformation */
@media (max-width: 768px) {
    #desktop {
        padding: 10px;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 20px;
        align-items: stretch;
    }

    /* Windows become stacked blocks */
    .window {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        max-height: none !important;
        left: auto !important;
        top: auto !important;
        margin-bottom: 20px;
        transform: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    }

    .window-content {
        overflow: visible;
        /* Let content flow */
        height: auto;
    }

    /* Ensure Program Manager stays at top if possible, or just natural flow */
    /* We can use order flex property if we knew the ID, but default stacking is fine. */

    /* Layout Adjustments */
    .biz-container {
        flex-direction: column;
        height: auto;
    }

    .tree-view {
        width: 100%;
        height: auto;
        max-height: 150px;
        border-right: none;
        border-bottom: 2px solid var(--win-white);
        margin-bottom: 15px;
        background: #f0f0f0;
        padding: 5px;
        border-radius: 4px;
    }

    .list-view-container {
        height: auto;
        overflow: visible;
    }

    .list-view {
        overflow: visible;
        height: auto;
    }

    /* --- TABLE TO CARD TRANSFORMATION --- */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    /* Hide headers */

    tr {
        background: white;
        margin-bottom: 16px;
        border: 2px solid var(--win-gray);
        box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
        padding: 16px;
        position: relative;
        border-radius: 2px;
    }

    tr:active {
        box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
        transform: translate(2px, 2px);
    }

    td {
        padding: 4px 0;
        border: none;
        white-space: normal;
        text-align: left;
    }

    /* Name (Col 1) */
    td:nth-child(1) {
        font-size: 18px;
        margin-bottom: 12px;
        border-bottom: 1px solid #eee;
        padding-bottom: 8px;
        display: flex;
        align-items: center;
        color: #000;
    }

    td:nth-child(1) strong {
        font-size: 18px;
    }

    /* Revenue (Col 2) */
    td:nth-child(2) {
        position: absolute;
        top: 16px;
        right: 16px;
        font-weight: bold;
        color: #fff;
        background: #008000;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 14px;
        box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    }

    /* Category (Col 3) */
    td:nth-child(3) {
        display: inline-block;
        margin-right: 12px;
        font-size: 14px;
        color: #555;
        background: #eee;
        padding: 2px 8px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    /* Year (Col 4) */
    td:nth-child(4) {
        display: inline-block;
        font-size: 14px;
        color: #555;
        background: #eee;
        padding: 2px 8px;
        border-radius: 10px;
    }

    /* Description (Col 5) */
    td:nth-child(5) {
        margin-top: 10px;
        display: block;
        color: #333;
        line-height: 1.5;
        font-size: 15px;
    }

    /* Hide resize handles */
    .resize-handle {
        display: none;
    }
}

@media (max-width: 768px) {
    .details-window {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        height: auto !important;
        max-height: 85vh !important;
        z-index: 10000 !important;
        margin: 0 !important;
        box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    }

    .details-window .window-content {
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* Read Me / Help Docs Styling */
.section-title {
    font-size: 14px;
    /* Win 3.1 used smaller, crisp fonts */
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 8px;
    color: #000;
    /* Black usually, blue is for links */
    font-family: "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0;
}

.section-body p {
    margin-bottom: 10px;
    line-height: 1.4;
    font-family: "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
    font-size: 13px;
    /* 13px is closer to non-aliased 8pt/10pt look */
}

.custom-list {
    list-style: none;
    padding-left: 5px;
    font-family: "MS Sans Serif", "Microsoft Sans Serif", sans-serif;
    font-size: 13px;
}

.custom-list li {
    margin-bottom: 8px;
    padding-left: 16px;
    position: relative;
    line-height: 1.4;
}

.custom-list li::before {
    content: "■";
    font-size: 8px;
    position: absolute;
    left: 0;
    /* Align bullet */
    top: 3px;
    color: #000;
}

.win-hr {
    border: 0;
    border-bottom: 1px solid #808080;
    /* Shadow */
    border-top: 1px solid #fff;
    /* Highlight - 3D line */
    margin: 10px 0;
}

.help-content-wrapper {
    padding: 15px;
    background: white;
    min-height: 100%;
}