/* NAS Home – ADM-style desktop: ADM wallpaper, translucent bars and widgets, big app icons.
   One accent colour, no gradients or glows, no animation. */

:root {
    /* Dark (ADM dark mode) is the default over the wallpaper. */
    --glass: rgb(22 24 29 / 72%);
    --glass-strong: rgb(22 24 29 / 88%);
    --glass-border: rgb(255 255 255 / 10%);
    --glass-hover: rgb(255 255 255 / 10%);
    --text: #f3f4f6;
    --muted: #b6bcc7;
    --dim: #8c93a0;
    --field: rgb(255 255 255 / 8%);
    --field-border: rgb(255 255 255 / 16%);
    --accent: #3b8bff;
    --accent-text: #ffffff;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    --track: rgb(255 255 255 / 14%);
    --label-shadow: 0 1px 3px rgb(0 0 0 / 85%);
    --radius: 14px;
    --radius-sm: 9px;
    --z-bar: 10;
    --z-flash: 30;
    --z-dialog: 40;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --glass: rgb(255 255 255 / 80%);
    --glass-strong: rgb(255 255 255 / 92%);
    --glass-border: rgb(0 0 0 / 8%);
    --glass-hover: rgb(0 0 0 / 6%);
    --text: #15181d;
    --muted: #4d5562;
    --dim: #6b7280;
    --field: rgb(255 255 255 / 90%);
    --field-border: rgb(0 0 0 / 14%);
    --accent: #1d6fe0;
    --ok: #15803d;
    --warn: #b45309;
    --bad: #b91c1c;
    --track: rgb(0 0 0 / 10%);
    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme]) {
        --glass: rgb(255 255 255 / 80%);
        --glass-strong: rgb(255 255 255 / 92%);
        --glass-border: rgb(0 0 0 / 8%);
        --glass-hover: rgb(0 0 0 / 6%);
        --text: #15181d;
        --muted: #4d5562;
        --dim: #6b7280;
        --field: rgb(255 255 255 / 90%);
        --field-border: rgb(0 0 0 / 14%);
        --accent: #1d6fe0;
        --ok: #15803d;
        --warn: #b45309;
        --bad: #b91c1c;
        --track: rgb(0 0 0 / 10%);
        color-scheme: light;
    }
    :root:not([data-theme]) select option, :root:not([data-theme]) select optgroup { background: #fff; color: #15181d; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #0c0d10 center / cover no-repeat fixed;
}
body[data-wallpaper="extra1"] { background-image: url("/asset/wallpaper/extra1.jpg"); }
body[data-wallpaper="extra2"] { background-image: url("/asset/wallpaper/extra2.jpg"); }
body[data-wallpaper="extra3"] { background-image: url("/asset/wallpaper/extra3.jpg"); }
body[data-wallpaper="01"] { background-image: url("/asset/wallpaper/01.jpg"); }
body[data-wallpaper="02"] { background-image: url("/asset/wallpaper/02.jpg"); }
body[data-wallpaper="03"] { background-image: url("/asset/wallpaper/03.jpg"); }
body[data-wallpaper="04"] { background-image: url("/asset/wallpaper/04.jpg"); }
body[data-wallpaper="05"] { background-image: url("/asset/wallpaper/05.jpg"); }
body[data-wallpaper="dark"] { background-image: url("/asset/wallpaper/dark.jpg"); }
body[data-wallpaper="light"] { background-image: url("/asset/wallpaper/light.jpg"); }
@media (max-width: 48rem) { body { background-attachment: scroll; } }

h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h2 { font-size: 0.95rem; font-weight: 600; }
h3 { font-size: 0.95rem; margin: 1.5rem 0 0.75rem; }
p { margin: 0; text-wrap: pretty; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--accent); text-decoration: none; font-weight: 550; }
.link:hover { text-decoration: underline; }

.icon { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--xs { width: 0.95rem; height: 0.95rem; }

/* Translucent ADM surface (static blur on small surfaces only) */
.glass, .card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

/* Buttons and fields */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    min-height: 2.5rem; padding: 0 1rem;
    border: 1px solid var(--field-border); border-radius: var(--radius-sm);
    background: var(--field); color: var(--text);
    font: inherit; font-weight: 550; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--glass-hover); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn--danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--icon { width: 2.5rem; padding: 0; }
.btn--block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field--grow { flex: 1; }
.field__label { font-size: 0.85rem; font-weight: 550; }
.field__hint { font-size: 0.8rem; color: var(--muted); }
.field__error { color: var(--bad); font-size: 0.875rem; }
input, select {
    width: 100%; min-height: 2.5rem; padding: 0 0.75rem;
    border: 1px solid var(--field-border); border-radius: var(--radius-sm);
    background: var(--field); color: var(--text); font: inherit;
}
select option, select optgroup { background: #1c1f25; color: #f3f4f6; }
:root[data-theme="light"] select option, :root[data-theme="light"] select optgroup { background: #fff; color: #15181d; }
input::placeholder { color: var(--dim); }
input[aria-invalid="true"] { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.5rem; }
.check input { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--accent); }
.checks { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.25rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); margin-bottom: 1rem; align-items: end; }
.inline-form { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; margin-top: 1rem; }

.flash {
    position: fixed; z-index: var(--z-flash);
    top: calc(env(safe-area-inset-top) + 4.5rem); left: 50%; transform: translateX(-50%);
    padding: 0.6rem 1rem; border-radius: var(--radius-sm);
    background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--text); font-weight: 550;
    max-width: calc(100% - 2rem);
}
.flash--error { background: var(--bad); color: #fff; }

/* ── Desktop ──────────────────────────────────────────────────────────── */
.desk { min-height: 100dvh; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

.deskbar {
    position: sticky; top: 0; z-index: var(--z-bar);
    display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
    padding: 0 1rem;
}
.deskbar__group {
    display: flex; align-items: center; gap: 0.25rem;
    min-height: 2.75rem; padding: 0 0.5rem;
    background: var(--glass); border: 1px solid var(--glass-border); border-top: 0;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.deskbar__search { width: min(20rem, 50vw); padding-left: 0.75rem; }
.deskbar__search-icon { color: var(--muted); }
.deskbar__search input { border: 0; background: transparent; min-height: 2.5rem; padding: 0 0.5rem; }
.deskbar__search input:focus-visible { outline: 0; }
.deskbar__search:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
.deskbar__status { gap: 0.15rem; }
.deskbar__weather { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0 0.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.deskbar__time { padding: 0 0.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.deskbar__sep { width: 1px; height: 1.25rem; background: var(--glass-border); margin: 0 0.25rem; }
.deskbar__btn {
    display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
    border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer;
}
.deskbar__btn:hover { background: var(--glass-hover); }
.deskbar form { margin: 0; display: flex; }

.desk__body {
    flex: 1; width: 100%; max-width: 92rem; margin: 0 auto;
    display: grid; gap: 2rem; align-items: start;
    grid-template-columns: minmax(0, 1fr) 21rem;
    padding: 2.5rem 1.5rem 3rem;
}
.desk__body--wide { grid-template-columns: minmax(0, 1fr); }

/* App icons, ADM desktop style */
.desk__apps { display: grid; gap: 1rem; justify-items: center; }
.apps {
    list-style: none; margin: 0; padding: 0; width: 100%; max-width: 62rem;
    display: grid; gap: 2rem 1.5rem; justify-content: center;
    grid-template-columns: repeat(auto-fill, 8.5rem);
}
.apps > li { display: flex; justify-content: center; }
.app {
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
    width: 8.5rem; padding: 0.75rem 0.5rem; border-radius: var(--radius);
    color: #fff; text-decoration: none; text-align: center;
}
.app:hover, .app:focus-visible { background: rgb(255 255 255 / 12%); }
.app[data-home-only] { opacity: 0.65; }
.app__icon { position: relative; display: grid; place-items: center; width: 5.5rem; height: 5.5rem; }
.app__icon img { width: 5.5rem; height: 5.5rem; object-fit: contain; border-radius: 22%; filter: drop-shadow(0 2px 4px rgb(0 0 0 / 35%)); }
.app__glyph {
    display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 1.25rem;
    background: #f5f6f8; color: #1d6fe0; box-shadow: 0 2px 6px rgb(0 0 0 / 30%);
}
.app__glyph .icon { width: 2.6rem; height: 2.6rem; stroke-width: 1.6; }
.app__name {
    font-size: 0.9rem; font-weight: 550; line-height: 1.3;
    text-shadow: var(--label-shadow);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app__status {
    position: absolute; right: 0.15rem; bottom: 0.15rem;
    width: 0.85rem; height: 0.85rem; border-radius: 50%;
    background: #9aa3b1; border: 2px solid #15171b;
}
.app__status[data-status="up"] { background: #22c55e; }
.app__status[data-status="down"] { background: #ef4444; }
.desk__note, .desk__empty-search { display: flex; align-items: center; gap: 0.45rem; padding: 0.6rem 0.9rem; font-size: 0.875rem; color: var(--muted); max-width: 46rem; }
.empty { padding: 1.5rem; display: grid; justify-items: start; gap: 1rem; }

/* Widgets */
.desk__widgets { display: grid; gap: 1rem; position: sticky; top: 4rem; }
.widget { padding: 1.1rem 1.25rem; display: grid; gap: 0.9rem; }
.widget__head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.widget__head span { color: var(--muted); font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem; }

.clock { text-align: center; gap: 0.2rem; padding-block: 1.4rem; }
.clock__greeting { color: var(--muted); font-weight: 550; }
.clock__time { font-size: 3.75rem; font-weight: 650; line-height: 1.05; font-variant-numeric: tabular-nums; }
.clock__date { color: var(--muted); text-transform: capitalize; }

.weather__now { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 0.75rem; }
.weather__icon { width: 2.75rem; height: 2.75rem; color: var(--accent); stroke-width: 1.5; }
.weather__temp { font-size: 2.4rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.weather__facts { margin: 0; display: grid; gap: 0.1rem; justify-self: end; text-align: right; }
.weather__facts div { display: flex; justify-content: flex-end; gap: 0.4rem; font-size: 0.8rem; }
.weather__facts dt { color: var(--muted); }
.weather__facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.weather__days { list-style: none; margin: 0; padding: 0.8rem 0 0; border-top: 1px solid var(--glass-border); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.25rem; text-align: center; }
.weather__days li { display: grid; justify-items: center; align-content: start; gap: 0.3rem; font-variant-numeric: tabular-nums; }
.weather__day { font-size: 0.8rem; color: var(--muted); text-transform: capitalize; }
.weather__range { font-weight: 600; font-size: 0.8rem; white-space: nowrap; }

.metric { display: grid; gap: 0.4rem; }
.metric__head { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.875rem; }
.metric__head span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
meter { width: 100%; height: 0.45rem; border-radius: 99px; border: 0; background: var(--track); }
meter::-webkit-meter-bar { background: var(--track); border: 0; border-radius: 99px; height: 0.45rem; }
meter::-webkit-meter-optimum-value { background: var(--ok); border-radius: 99px; }
meter::-webkit-meter-suboptimum-value { background: var(--warn); border-radius: 99px; }
meter::-webkit-meter-even-less-good-value { background: var(--bad); border-radius: 99px; }
meter:-moz-meter-optimum::-moz-meter-bar { background: var(--ok); border-radius: 99px; }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); border-radius: 99px; }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--bad); border-radius: 99px; }
.system__facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--glass-border); }
.system__facts dt { font-size: 0.8rem; color: var(--muted); }
.system__facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block; }
.dot--up { background: var(--ok); }
.dot--down { background: var(--bad); }

/* ── Login (ADM login style) ───────────────────────────────────────────── */
.page-login, .page-not-found { background-color: #0c0d10; }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.login__card {
    width: min(100%, 24rem); padding: 2rem; display: grid; gap: 1rem;
    background: rgb(243 244 246 / 94%); color: #15181d; border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 0 0 / 35%);
}
.login__card input { background: #fff; color: #15181d; border-color: #cfd4dc; }
.login__card input::placeholder { color: #8a919c; }
.login__card .field__error { color: #b91c1c; }
.login__card .btn--primary { background: #1d6fe0; border-color: #1d6fe0; color: #fff; }
.login__head { display: grid; gap: 0.15rem; margin-bottom: 0.25rem; }
.login__brand { font-size: 0.85rem; font-weight: 650; color: #1d6fe0; }
.login__title { font-size: 1.5rem; }
.login__clock { position: fixed; left: calc(env(safe-area-inset-left) + 2rem); bottom: calc(env(safe-area-inset-bottom) + 1.5rem); color: #fff; text-shadow: var(--label-shadow); }
.login__model { font-weight: 700; font-size: 1.4rem; }
.login__clock time { font-size: 1.1rem; font-variant-numeric: tabular-nums; }

/* ── Settings ─────────────────────────────────────────────────────────── */
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; max-width: 52rem; margin: 0 auto; padding: 1.75rem 1rem 1rem; text-shadow: var(--label-shadow); color: #fff; }
.topbar__eyebrow { font-size: 0.875rem; font-weight: 550; }
.topbar__eyebrow .link { color: #fff; }
.topbar__greeting { font-size: 1.75rem; font-weight: 700; }
.settings { max-width: 52rem; margin: 0 auto; padding: 0 1rem 3rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.settings__nav { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.4rem; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.settings__nav a { text-decoration: none; font-weight: 550; padding: 0.45rem 0.8rem; border-radius: 8px; }
.settings__nav a:hover { background: var(--glass-hover); }
.panel { padding: 1.5rem; scroll-margin-top: 1rem; }
.panel > h2 { margin-bottom: 1rem; font-size: 1.05rem; }
.places { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.places form { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.75rem; border: 1px solid var(--glass-border); border-radius: var(--radius-sm); }
.wallpapers { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
.wallpaper-option { position: relative; display: block; cursor: pointer; }
.wallpaper-option input { position: absolute; opacity: 0; }
.wallpaper-option img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); border: 2px solid transparent; }
.wallpaper-option input:checked + img { border-color: var(--accent); }
.wallpaper-option input:focus-visible + img { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.tile-list > li { border: 1px solid var(--glass-border); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; scroll-margin-top: 1rem; }
.tile-list__row { display: flex; align-items: center; gap: 0.75rem; }
.tile__icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; }
.tile__icon img { width: 2.5rem; height: 2.5rem; object-fit: contain; }
.tile-list__text { display: grid; min-width: 0; flex: 1; }
.tile-list__text .muted { font-size: 0.85rem; }
.tile-list__actions { display: flex; gap: 0.15rem; }
.tile-list__actions form { margin: 0; }
.tile-list__edit summary { cursor: pointer; color: var(--accent); font-weight: 550; font-size: 0.9rem; padding: 0.4rem 0; width: fit-content; }
.tile-form { padding-top: 0.75rem; }

.dialog {
    z-index: var(--z-dialog); width: min(100% - 2rem, 26rem);
    border: 1px solid var(--glass-border); border-radius: var(--radius);
    background: var(--glass-strong); color: var(--text); padding: 1.5rem;
}
.dialog::backdrop { background: rgb(0 0 0 / 55%); }
.dialog form { display: grid; gap: 1rem; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 64rem) {
    .desk__body { grid-template-columns: minmax(0, 1fr); padding: 1.5rem 1rem 2.5rem; }
    .desk__widgets { position: static; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
}
@media (max-width: 40rem) {
    .deskbar { padding: 0 0.5rem; }
    .deskbar__search { width: auto; flex: 1; }
    .deskbar__time, .deskbar__sep { display: none; }
    .apps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem 0.25rem; justify-content: stretch; }
    .app { width: 100%; padding: 0.5rem 0.15rem; gap: 0.45rem; }
    .app__icon, .app__icon img { width: 3.75rem; height: 3.75rem; }
    .app__glyph { width: 3.4rem; height: 3.4rem; border-radius: 0.9rem; }
    .app__glyph .icon { width: 1.8rem; height: 1.8rem; }
    .app__name { font-size: 0.78rem; }
    .clock__time { font-size: 3rem; }
    .tile-list__row { flex-wrap: wrap; }
    .login__clock { display: none; }
}
@media (max-width: 22rem) {
    .apps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
