:root {
    --bg: #ffffff;
    --bg-secondary: #f2f2f5;
    --text: #1c1c1e;
    --accent: #4a7fea;
    --border: #e2e2e6;
    --danger: #d9463f;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 100%;
    height: 100dvh;
    overflow: hidden;
}

/* ---------- utility classes (small subset actually used by script.js) ---------- */

.p-s { padding: 0.5rem; }
.p-sm { padding: 0.75rem; }
.py-xs { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-s { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-m { padding-top: 1rem; padding-bottom: 1rem; }
.px-s { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-sm { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-m { padding-left: 1rem; padding-right: 1rem; }
.mt-m { margin-top: 1rem; }
.my-m { margin-top: 1rem; margin-bottom: 1rem; }
.mb-s { margin-bottom: 0.5rem; }
.mb-m { margin-bottom: 1rem; }
.mb-l { margin-bottom: 1.5rem; }
.mb-xxl { margin-bottom: 3rem; }
.gap-s { gap: 0.5rem; }
.grid { display: grid; }
.grid > * { width: 100%; }
.ec-2 { grid-template-columns: repeat(2, 1fr); }
.ac-2 { grid-template-columns: repeat(2, auto); }
.col-12 { width: 100%; }
.br-xxs { border-radius: 0.1rem; }
.br-xs { border-radius: 0.25rem; }
.br-s { border-radius: 0.5rem; }
.fs-s { font-size: 0.8em; }
.fs-sm { font-size: 0.9em; }
.fs-m { font-size: 1em; }
.fs-ml { font-size: 1.1em; }
.fs-l { font-size: 1.3em; }
.fs-xl { font-size: 1.6em; }
.tc { text-align: center; }
.tr { text-align: right; }
.b { border: 1px solid var(--border); }
.field {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    font-size: 1em;
    width: 100%;
    font-family: inherit;
}
.btn {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    font-size: 1em;
    border-radius: 0.375rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    text-align: center;
}
.btn:hover { background-color: #e6ecfc; }

.perfect-center {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
}

.vertically-center {
    display: flex;
    align-items: center;
    height: 100%;
}

.vertically-center-right {
    display: flex;
    align-items: center;
    justify-content: right;
}

.d-md-none { display: block; }
@media only all and (min-width: 760px) {
    .d-md-none { display: none; }
}

/* ---------- icons (simple text glyphs, no external font needed) ---------- */

.ico { font-style: normal; }
.ico-folder::before { content: "\1F4C1"; }
.ico-file::before { content: "\1F4C4"; }
.ico-dots::before { content: "\22EE"; }
.ico-close::before { content: "\2715"; }
.ico-chevron::before { content: "\203A"; }
.ico-plus::before { content: "+"; }
.ico-save::before { content: "\1F4BE"; }
.ico-trash::before { content: "\1F5D1"; }
.ico-restore::before { content: "\21BA"; }
.ico-move::before { content: "\27A1"; }
.ico-tag::before { content: "\1F3F7"; }
.ico-comment::before { content: "\1F4AC"; }
.ico-info::before { content: "\2139"; }
.ico-check-square::before { content: "\2611"; }
.ico-square::before { content: "\2610"; }
.ico-house::before { content: "\1F3E0"; }
.ico-copy::before { content: "\29C9"; }
.ico-paste::before { content: "\1F4CB"; }
.ico-rename::before { content: "\270E"; }
.ico-list::before { content: "\2261"; }
.ico-empty::before { content: "\1F9F9"; }

/* ---------- layout shell ---------- */

aside {
    background: var(--bg-secondary);
    position: fixed;
    top: 0;
    left: -100%;
    width: 70%;
    max-width: 280px;
    transition: left 0.25s;
    height: 100%;
    z-index: 101;
    padding: 1rem;
}

.aside-active { left: 0; }

.menu-item {
    padding: 0.75rem;
    font-size: 1.1em;
    cursor: pointer;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.menu-item:hover { background: #e6ecfc; }
.menu-item.active { background: var(--accent); color: white; }

main {
    padding: 0.25em;
    min-height: 0;
    display: grid;
    grid-template-columns: 100%;
    height: 100dvh;
}

.browser-default { grid-template-rows: auto auto auto minmax(auto, 1fr); }
.browser-default > :last-child { display: none; }
.browser-selection { grid-template-rows: auto auto auto minmax(auto, 1fr) auto; }

.header {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.2);
    padding: 0.25em;
    align-items: center;
}

.nav-bar {
    box-shadow: 0px 5px 5px -5px rgba(0, 0, 0, 0.25);
    min-height: 42px;
}

.location-bar {
    display: block;
    overflow: auto;
    padding: 0.3em;
    scrollbar-width: none;
    width: 100%;
    white-space: nowrap;
}
.location-bar > * { display: inline-block; }

.folder-link {
    font-size: 1em;
    padding: 0.4em;
    cursor: pointer;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    user-select: none;
}
.folder-link:hover { background: var(--bg-secondary); }

.separator { font-size: 1em; padding: 0.25rem; color: #999; }

.content-list {
    position: relative;
    overflow-y: auto;
    padding: 0.25rem;
    scrollbar-width: none;
}

.content-list:empty:after {
    content: "No data";
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    height: 100%;
}

.item {
    box-shadow: rgba(17, 17, 26, 0.1) 0px 1px 0px;
    margin: 0.4em 0;
    padding: 0.1em;
    user-select: none;
    cursor: pointer;
    height: 3em;
    border-radius: 0.25rem;
}

.default {
    display: grid;
    grid-template-columns: 3.4em minmax(0, 1fr) minmax(32px, 10%);
}
.default > :first-child { display: none; }

.selection {
    display: grid;
    grid-template-columns: minmax(30px, 2em) minmax(3em, 3.5em) minmax(0, 1fr);
}
.selection > :last-child { display: none; }

.selected {
    border-radius: 0.25rem;
    background: #6494edb3;
    color: white;
}

input[type=checkbox] { transform: scale(1.4); }

.item-name {
    font-size: 1em;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.item-info {
    display: grid;
    grid-template-columns: auto auto;
    font-size: 0.65em;
    opacity: 0.75;
}
.item-info > :last-child { text-align: right; }

.bottom-bar { box-shadow: 0px -5px 5px -5px rgba(0, 0, 0, 0.25); }

.action-bar { display: flex; justify-content: space-between; gap: 0.5rem; }

.option {
    padding: 0.4em;
    display: flex;
    gap: 1rem;
    align-items: center;
    height: 100%;
    user-select: none;
    cursor: pointer;
}
.option:hover { background: var(--bg-secondary); }

.backdrop1, .backdrop2, .clear-backdrop {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #333333aa;
}
.backdrop1 { z-index: 100; }
.backdrop2 { z-index: 200; }
.clear-backdrop { z-index: 100; background: transparent; }

.meta-data { padding: 0.5em; }
fieldset { margin: 0; border: 1px solid var(--border); }

.tags-holder-v { height: 3em; overflow-y: auto; scrollbar-width: none; padding: 0.3rem; }
.tag-v {
    display: inline-block;
    border: 1px solid var(--accent);
    border-radius: 0.2em;
    padding: 0.25em 0.5em;
    margin: 0.1em;
    font-size: 0.85em;
}

.comment-holder { max-height: 5em; overflow-y: auto; scrollbar-width: none; }
.item-comment {
    font-family: inherit;
    width: 100%;
    height: 100%;
    min-height: 8em;
    padding: 0.4em;
    border-radius: 0.25rem;
    border: 1px solid var(--border);
}

.tags-holder { height: 8em; overflow-y: auto; scrollbar-width: none; padding: 0.3rem; }
.tag {
    display: grid;
    grid-template-columns: 1fr 40px;
    font-size: 1.05em;
    line-height: 1.5;
    border-radius: 0.4em;
    margin-bottom: 0.5rem;
    border: 1px solid #ddd;
}
.tag-text { padding: 0.3em 0.4em; border: 0; font-family: inherit; font-size: inherit; }
.tag-delete-btn {
    border: 0;
    background: #f2f2f5;
    border-top-right-radius: inherit;
    border-bottom-right-radius: inherit;
    cursor: pointer;
}

.item-action { padding: 0.5rem; }
.item-action > * {
    display: grid;
    grid-template-columns: 32px 1fr;
    padding-top: 1rem;
    padding-bottom: 1rem;
    cursor: pointer;
}
.item-action > *:hover { background: var(--bg-secondary); }

.item-options, .prompt-frame {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    max-height: 80%;
    min-width: 240px;
    width: 90%;
    max-width: 640px;
    z-index: 201;
    background-color: var(--bg);
    box-shadow: rgba(0, 0, 0, 0.12) 0px 2px 3px, rgba(0, 0, 0, 0.24) 0px 1px 2px;
    display: grid;
    grid-template-rows: auto 1fr;
    scrollbar-width: none;
    border-radius: 0.5rem;
    overflow: hidden;
}

.info-top, .info-top-simple {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    box-shadow: rgba(0, 0, 0, 0.12) 0px 9px 3px -11px, rgba(0, 0, 0, 0.24) 0px 1px 2px;
}

.menu-bottom { overflow-y: auto; scrollbar-width: none; }

.popup {
    position: absolute;
    z-index: 101;
    background-color: var(--bg);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    border-radius: 0.375rem;
    overflow: hidden;
}
.popup-item { padding: 1em 0.75em; cursor: pointer; }
.popup-item:hover { background: var(--bg-secondary); }

.move-ui { display: grid; grid-template-columns: auto auto; height: 100%; align-items: center; }
.move-action { display: block; }
.moving-item-info { display: flex; }

@media only all and (min-width: 760px) {
    body { grid-template-columns: 25% 75%; }
    aside { position: static; display: block; width: 100%; max-width: none; }
    .header { grid-template-columns: 1fr; }
    .default { grid-template-columns: 3em minmax(0, 1fr) minmax(32px, 10%); }
}

@media only all and (min-width: 980px) {
    body { grid-template-columns: 20% 80%; }
    main { padding: 1em; }
    .default { grid-template-columns: 3.5em minmax(0, 1fr) minmax(32px, 10%); }
}
