:root {
    --card-bg: #f9f9f9;
    --card-bg-hover: #eee;
    --label-bg: #ffffff;
    --label-fg: #666;
    --sps-green: #28a745;
    /* medical green */
}

body {
    font-family: Arial, sans-serif;
    background-color: #ffffff;
    color: #333;
    padding: 2rem;
    margin: 0;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

li.row {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.box {
    position: relative;
    /* for floating label */
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: var(--card-bg);
    transition: background-color 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.box:hover {
    background-color: var(--card-bg-hover);
}

.box.sds {
    padding: 1.25rem 1rem 0.75rem 1rem;
    /* extra top padding for label */
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
}

.box.sps {
    width: 70px;
    /* compact */
    padding: 1.25rem 0 0.75rem 0;
    flex: 0 0 auto;
}

/* Floating labels */
.label-sds,
.label-sps {
    position: absolute;
    top: 2px;
    left: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--label-fg);
    background: var(--label-bg);
    padding: 0 0.25rem;
    pointer-events: none;
    user-select: none;
}

.label-sps {
    left: 50%;
    transform: translateX(-50%);
    color: var(--sps-green);
    /* green label */
    background: transparent;
    font-weight: 700;
}

.doc-title {
    font-size: 1rem;
    line-height: 1.2;
    word-break: break-word;
}

.icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

/* ────────────────────────────────────────────── */
/* Logo Section - Clickable with hover feedback   */
/* ────────────────────────────────────────────── */

.logo-container {
    height: 10vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    max-height: 100%;
    max-width: 80%;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.logo:hover {
    transform: scale(1.03);
}

/* Dotted box style for empty documents */
.box.empty {
    border: 2px dotted #ccc;
    cursor: default;
}

/* Prevent hover effect for empty boxes */
.box.empty:hover {
    background-color: var(--card-bg);
}

/* ────────────────────────────────────────────── */
/* Light-mode friendly tree styles                */
/* ────────────────────────────────────────────── */

:root {
    --primary: #0b69ff;
    --muted: #666;
    --card-bg: #fff;
    --card-border: rgba(0, 0, 0, 0.06);
}

/* page spacing: keep some room on the sides but allow full-width content */
body {
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
}

#selectors {
    display: none;
    gap: 12px;
    /* padding: 12px; */
    width: 100%;
    box-sizing: border-box;
}

/* let the card take the whole available width */
.selector-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 12px;
    color: #222;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
    width: 100%;
}

/* full width rows; padding increased for more breathing room */
.tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px;
    border-radius: 10px;
    margin: 8px 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-sizing: border-box;
    width: 100%;
}

.tree-item .left {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    min-width: 0;
    /* important for truncation */
}

.tree-item .label {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    color: #222;
}

.tree-children {
    padding-left: 12px;
    margin-top: 6px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
    padding: 8px;
}

/* Outlined visit button (instead of filled) */
.visit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    /* white background */
    color: var(--primary);
    /* blue text/icon */
    border: 1.5px solid var(--primary);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: none;
    transition: transform .08s ease, box-shadow .12s ease, background .12s;
    min-width: 44px;
    justify-content: center;
}

.visit-btn:hover {
    background: rgba(11, 105, 255, 0.04);
    /* subtle hover */
    box-shadow: 0 6px 14px rgba(11, 105, 255, 0.06);
}

.visit-btn:active {
    transform: translateY(1px) scale(0.997);
}

.visit-btn .vis-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    color: var(--primary);
}

.expand-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none; /* remove the border */
    background: white;
    flex: 0 0 34px;
    cursor: pointer; /* ensure pointer for user feedback */
}

.expand-toggle:hover {
    background-color: rgba(0,0,0,0.03);
}

/* smaller paddings on very small screens */
@media (max-width:480px) {
    .tree-item {
        padding: 10px 10px;
    }

    .tree-item .label {
        font-size: 14px;
    }

    body {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* ────────────── TREE ITEMS SPACING ────────────── */

/* Base tree item spacing (locations) */
.tree > li > .tree-item {
    margin: 10px 0; /* a bit more space between locations */
    padding: 14px 14px; /* can stay the same for larger clickable area */
}

/* Rooms under locations */
.tree > li > .tree-children > ul > li > .tree-item {
    margin: 6px 0; /* less space than locations */
    padding: 10px 12px; /* slightly smaller padding */
}

/* Storage units under rooms */
.tree > li > .tree-children > ul > li > .tree-children > ul > li > .tree-item {
    margin: 3px 0; /* very tight spacing */
    padding: 6px 10px; /* compact padding */
}