/* The office frame: header, sidebar, the scrolling page, footer.
   Base rules (phone first) come first, media queries last (scripts/check_cascade.py). */

.adm { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- Header ---------------------------------------------------------------------- */
.adm-top { position: sticky; top: 0; z-index: 40; flex: none; height: 4rem;
           display: flex; align-items: center; gap: .5rem; padding: 0 .75rem;
           background: var(--color-secondary); color: var(--color-secondary-content);
           box-shadow: 0 1px 0 rgb(255 255 255 / .06), 0 2px 8px rgb(0 0 0 / .18); }

.adm-brand { flex: none; display: flex; align-items: center; gap: .7rem; padding: .35rem .4rem;
             border-radius: .6rem; }
.adm-brand img { flex: none; }
.adm-brand:hover { background: rgb(255 255 255 / .08); }
.adm-brand-word { display: none; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em;
                  padding-left: .7rem; border-left: 1px solid rgb(255 255 255 / .25); }

.adm-crumb { display: none; align-items: center; gap: .4rem; min-width: 0; margin-left: .5rem;
             font-size: 1rem; color: rgb(255 255 255 / .7); white-space: nowrap; }
.adm-crumb-group { overflow: hidden; text-overflow: ellipsis; }
.adm-crumb .ti { font-size: .9rem; opacity: .6; }
.adm-crumb-page { color: var(--color-secondary-content); font-weight: 700;
                  overflow: hidden; text-overflow: ellipsis; }

.adm-tools { margin-left: auto; display: flex; align-items: center; gap: .1rem; min-width: 0; }
.adm-icon-btn.adm-wide-only { display: none; }

.adm-icon-btn { position: relative; display: inline-grid; place-items: center;
                width: 2.6rem; height: 2.6rem; border-radius: 999px; cursor: pointer;
                color: inherit; list-style: none; }
.adm-icon-btn::-webkit-details-marker { display: none; }
.adm-icon-btn:hover, .adm-icon-btn:focus-visible { background: rgb(255 255 255 / .12); }
.adm-icon-btn > .ti { font-size: 1.4rem; }
.adm-icon-badge { position: absolute; top: .1rem; right: .05rem; min-width: 1.25rem; height: 1.25rem;
                  padding: 0 .3rem; border-radius: 999px; font-size: .72rem; font-weight: 800;
                  line-height: 1.25rem; text-align: center;
                  background: var(--color-accent); color: var(--color-accent-content);
                  box-shadow: 0 0 0 2px var(--color-secondary); }

/* The one status light. Color plus a word, never color alone. */
.adm-light { display: inline-flex; align-items: center; gap: .5rem; height: 2.3rem;
             padding: 0 .75rem 0 .65rem; margin-right: .25rem; border-radius: 999px;
             font-size: .9rem; font-weight: 700; background: rgb(255 255 255 / .08);
             border: 1px solid rgb(255 255 255 / .16); max-width: 22rem; }
/* On a phone the light is just the dot, in a button-sized target. */
.adm-light { padding: 0; width: 2.6rem; height: 2.6rem; justify-content: center; margin-right: 0;
             background: transparent; border-color: transparent; }
.adm-light:hover { background: rgb(255 255 255 / .15); }
.adm-light-text { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-light-dot { flex: none; width: .7rem; height: .7rem; border-radius: 999px;
                 background: var(--color-success); box-shadow: 0 0 0 3px rgb(255 255 255 / .12); }
.adm-light.is-watch .adm-light-dot { background: var(--color-warning); }
.adm-light.is-bad .adm-light-dot, .adm-light.is-none .adm-light-dot { background: var(--color-error);
                  animation: adm-pulse 1.6s ease-in-out infinite; }
@keyframes adm-pulse { 50% { box-shadow: 0 0 0 6px rgb(255 255 255 / 0); opacity: .75; } }

/* Account menu */
.adm-user { position: relative; }
.adm-user > summary { display: flex; align-items: center; gap: .55rem; height: 2.6rem;
                      padding: 0 .35rem; border-radius: 999px; cursor: pointer; list-style: none; }
.adm-user > summary::-webkit-details-marker { display: none; }
.adm-user > summary:hover, .adm-user[open] > summary { background: rgb(255 255 255 / .12); }
.adm-avatar { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 999px;
              font-size: .85rem; font-weight: 800; letter-spacing: .02em;
              background: var(--color-primary); color: var(--color-primary-content);
              box-shadow: 0 0 0 2px rgb(255 255 255 / .35); }
.adm-user-name, .adm-user-caret { display: none; }
.adm-user-name { font-weight: 700; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-user-panel { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 60; min-width: 16rem;
                  padding: .4rem; border-radius: var(--radius-box);
                  background: var(--color-base-100); color: var(--color-base-content);
                  border: 1px solid var(--color-base-300); box-shadow: 0 12px 32px rgb(0 0 0 / .22); }
.adm-user-who { display: flex; flex-direction: column; padding: .5rem .7rem .7rem;
                border-bottom: 1px solid var(--color-base-300); margin-bottom: .3rem; }
.adm-user-who span { font-size: .85rem; opacity: .65; }
.adm-user-panel a, .adm-user-panel button { display: flex; width: 100%; align-items: center; gap: .6rem;
                  padding: .55rem .7rem; border-radius: .5rem; font-size: 1rem; text-align: left; cursor: pointer; }
.adm-user-panel a:hover, .adm-user-panel button:hover { background: var(--color-base-200); }
.adm-user-panel .ti { font-size: 1.2rem; opacity: .75; }
.adm-user-panel form { border-top: 1px solid var(--color-base-300); margin-top: .3rem; padding-top: .3rem; }

/* Phone drawer */
.adm-drawer > summary { list-style: none; }
.adm-drawer-panel { position: fixed; inset: 4rem 0 0 0; z-index: 50; overflow-y: auto;
                    padding: .5rem .75rem 2.5rem; background: var(--color-base-100);
                    color: var(--color-base-content); border-top: 1px solid var(--color-base-300); }

/* New-request toasts, bottom right, above the footer */
.adm-toasts { position: fixed; right: 1rem; bottom: 3.5rem; z-index: 70; display: grid; gap: .5rem; max-width: min(27rem, calc(100vw - 2rem)); }
.adm-toast { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem; border-radius: var(--radius-box);
             background: var(--color-base-100); color: var(--color-base-content); border: 2px solid var(--color-primary);
             box-shadow: 0 10px 30px rgb(0 0 0 / .2); transform: translateY(.5rem); opacity: 0; transition: all .2s ease; }
.adm-toast.is-in { transform: none; opacity: 1; }
.adm-toast > .ti { font-size: 1.4rem; color: var(--color-primary); }
.adm-toast span { flex: 1; }
.adm-toast a { font-weight: 800; text-decoration: underline; }
.adm-toast button { opacity: .6; cursor: pointer; }

/* The problem toast: something broken the person signed in can fix. It stays put. */
.adm-nag { order: 99; width: min(27rem, calc(100vw - 2rem)); justify-self: end;
           border-radius: var(--radius-box); background: var(--color-base-100); color: var(--color-base-content);
           border: 3px solid var(--color-error); box-shadow: 0 18px 50px -12px rgb(0 0 0 / .45); overflow: hidden;
           animation: adm-nag-in .35s ease-out; }
.adm-nag.is-warn { border-color: var(--color-warning); }
.adm-nag header { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; background: var(--color-error);
                  color: var(--color-error-content); }
.adm-nag.is-warn header { background: var(--color-warning); color: var(--color-warning-content); }
.adm-nag header .ti { font-size: 1.6rem; }
.adm-nag h2 { font-size: 1.1rem; font-weight: 800; }
.adm-nag ul { display: grid; gap: .8rem; padding: .9rem 1rem .4rem; max-height: 50vh; overflow-y: auto; }
.adm-nag li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7rem; }
.adm-nag li > .ti { font-size: 1.5rem; color: var(--color-error); }
.adm-nag.is-warn li > .ti { color: var(--color-warning); }
.adm-nag-t { font-weight: 800; font-size: 1.02rem; }
.adm-nag-s { font-size: .92rem; opacity: .85; margin-top: .15rem; }
.adm-nag-fix { display: flex; align-items: center; gap: .4rem; margin-top: .45rem; min-width: 0; }
.adm-nag-fix code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: .8rem; padding: .3rem .45rem;
                    border-radius: .4rem; background: var(--color-base-200); }
.adm-nag-go { margin-top: .5rem; background: var(--color-error); color: var(--color-error-content); border: 0; }
.adm-nag.is-warn .adm-nag-go { background: var(--color-warning); color: var(--color-warning-content); }
.adm-nag footer { display: flex; justify-content: flex-end; padding: .3rem .6rem .6rem; }
@keyframes adm-nag-in { from { transform: translateY(1rem); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Sidebar navigation ---------------------------------------------------------- */
.adm-side { display: none; background: var(--color-base-100); border-right: 1px solid var(--color-base-300); }
.adm-nav { padding-bottom: 1.5rem; }
.adm-nav-group { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none;
                  padding: 1rem .75rem .3rem; font-size: .78rem; font-weight: 800; letter-spacing: .08em;
                  text-transform: uppercase; color: color-mix(in oklab, var(--color-base-content) 62%, transparent);
                  border-radius: .4rem; user-select: none; }
.adm-nav-group::-webkit-details-marker { display: none; }
.adm-nav-group:hover { color: var(--color-base-content); }
.adm-nav-group .ti { font-size: 1rem; transition: transform .15s; }
.adm-nav-sec:not([open]) > .adm-nav-group .ti { transform: rotate(-90deg); }
.adm-nav-sec[data-nav-here] > .adm-nav-group { color: var(--color-primary); }
.adm-nav-find { display: flex; align-items: center; gap: .5rem; margin: .5rem .25rem .25rem; padding: .45rem .7rem;
                border: 2px solid var(--color-base-300); border-radius: .6rem; background: var(--color-base-100); }
.adm-nav-find:focus-within { border-color: var(--color-primary); }
.adm-nav-find .ti { opacity: .6; }
.adm-nav-find input { flex: 1; min-width: 0; background: transparent; outline: none; font-size: 1rem; }
.adm-nav-kbd { font-size: .75rem; padding: 0 .35rem; border: 1px solid var(--color-base-300); border-radius: .3rem; opacity: .6; }
.adm-nav.is-finding .adm-nav-group .ti { display: none; }
.adm-nav-empty { padding: .75rem; opacity: .7; }
.adm-nav-link { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem;
                margin: 1px 0; border-radius: .6rem; font-size: 1.02rem; }
.adm-nav-link .ti { font-size: 1.25rem; opacity: .7; }
.adm-nav-link:hover { background: var(--color-base-200); }
.adm-nav-link.is-active { background: var(--color-primary); color: var(--color-primary-content); font-weight: 700; }
.adm-nav-link.is-active .ti { opacity: 1; }
.adm-count { min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; text-align: center;
             font-size: .8rem; font-weight: 800; line-height: 1.4rem;
             background: var(--color-accent); color: var(--color-accent-content); }
.adm-count.is-warn { background: var(--color-warning); color: var(--color-warning-content); }
.is-active .adm-count { background: var(--color-primary-content); color: var(--color-primary); }

.adm-frame { flex: 1 0 auto; }

/* ---- Wider screens --------------------------------------------------------------- */
@media (min-width: 420px) {
    .adm-brand-word { display: inline; }
}

@media (min-width: 640px) {
    .adm-light-text { display: inline; }
    .adm-light { width: auto; height: 2.3rem; padding: 0 .75rem 0 .65rem; margin-right: .25rem; justify-content: flex-start;
                 background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .16); }
    .adm-icon-btn.adm-wide-only { display: inline-grid; }
    .adm-top { padding: 0 1rem; }
}

@media (min-width: 1024px) {
    .adm-crumb { display: flex; }
    .adm-user-name, .adm-user-caret { display: inline; }
    .adm-user > summary { padding: 0 .75rem 0 .3rem; }

    /* The fixed frame: nothing outside the page area ever scrolls away. */
    .adm-framed { height: 100dvh; overflow: hidden; }
    .adm-framed .adm-top { position: relative; }
    .adm-framed .adm-frame { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); }
    .adm-framed .adm-side { display: block; overflow-y: auto; overscroll-behavior: contain; padding: .25rem .6rem; }
    .adm-framed .adm-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain;
                              scrollbar-gutter: stable; --sticky-top: 0rem; --frame-h: calc(100dvh - 4rem - 2.5rem); }
    .adm-framed > footer { flex: none; }
}
