/*
   The application shell (sidebar and top bar) and the components of the redesigned pages.
   Loaded after site.css: it only adds to it and overrides where the shell needs it.
   The colors come from the variables of site.css; the variables below are added on top of them.
   As in site.css, the two dark blocks are the same on purpose.
*/
:root {
    --side-w: 236px;
    --radius: 12px;
    --c-app: #e3287f;
    --c-script: #2d7df6;
    --c-file: #1fb56a;
    --c-cert: #f0a20b;
    --panel-bg: var(--surface);
    --panel-line: var(--line);
    --panel-shadow: 0 1px 2px rgba(31, 41, 51, 0.06);
    --page-glow: none;
    --side-bg: var(--surface);
    --side-line: var(--line);
    --side-ink: var(--muted);
    --side-hover-bg: var(--surface-2);
    --side-hover-ink: var(--ink);
    --side-active-bg: var(--brand-soft);
    --side-active-ink: var(--accent);
    --side-active-bar: var(--accent);
    --row-hover: var(--surface-2);
}

:root[data-theme="dark"] {
    --panel-bg: rgba(13, 28, 47, 0.74);
    --panel-line: #22405f;
    --panel-shadow: 0 12px 32px rgba(0, 8, 20, 0.35);
    --page-glow: radial-gradient(900px 520px at 6% 108%, rgba(37, 99, 201, 0.32), transparent 62%), radial-gradient(760px 460px at 102% -4%, rgba(77, 163, 255, 0.12), transparent 58%);
    --side-bg: rgba(8, 22, 40, 0.82);
    --side-line: #1b3350;
    --side-ink: #9db0c8;
    --side-hover-bg: rgba(77, 163, 255, 0.08);
    --side-hover-ink: #eaf2ff;
    --side-active-bg: linear-gradient(90deg, rgba(37, 99, 201, 0.62), rgba(37, 99, 201, 0.16));
    --side-active-ink: #ffffff;
    --side-active-bar: #58b0ff;
    --row-hover: rgba(77, 163, 255, 0.07);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --panel-bg: rgba(13, 28, 47, 0.74);
        --panel-line: #22405f;
        --panel-shadow: 0 12px 32px rgba(0, 8, 20, 0.35);
        --page-glow: radial-gradient(900px 520px at 6% 108%, rgba(37, 99, 201, 0.32), transparent 62%), radial-gradient(760px 460px at 102% -4%, rgba(77, 163, 255, 0.12), transparent 58%);
        --side-bg: rgba(8, 22, 40, 0.82);
        --side-line: #1b3350;
        --side-ink: #9db0c8;
        --side-hover-bg: rgba(77, 163, 255, 0.08);
        --side-hover-ink: #eaf2ff;
        --side-active-bg: linear-gradient(90deg, rgba(37, 99, 201, 0.62), rgba(37, 99, 201, 0.16));
        --side-active-ink: #ffffff;
        --side-active-bar: #58b0ff;
        --row-hover: rgba(77, 163, 255, 0.07);
    }
}

body {
    background-image: var(--page-glow);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

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

.shell {
    display: grid;
    grid-template-columns: var(--side-w) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

.app-side {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--side-bg);
    border-right: 1px solid var(--side-line);
    overflow-y: auto;
}

.app-brand {
    display: flex;
    align-items: center;
    padding: 22px 22px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 4px 14px 24px; }

.side-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--side-ink);
    text-decoration: none;
    font-size: 15px;
}

.side-nav a:hover { background: var(--side-hover-bg); color: var(--side-hover-ink); }
.side-nav a.active { background: var(--side-active-bg); color: var(--side-active-ink); font-weight: 600; }

.side-nav a.active::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--side-active-bar);
}

/* The menu icons are white shapes on a transparent background. As a mask they take the color of the text, in both themes. */
.ico {
    flex: none;
    width: 22px;
    height: 22px;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.ico-devices { -webkit-mask-image: url("../images/Devices-Menu.png"); mask-image: url("../images/Devices-Menu.png"); }
.ico-groups { -webkit-mask-image: url("../images/Groups-Menu.png"); mask-image: url("../images/Groups-Menu.png"); }
.ico-repository { -webkit-mask-image: url("../images/Repository-Menu.png"); mask-image: url("../images/Repository-Menu.png"); }
.ico-policies { -webkit-mask-image: url("../images/Policies-Menu.png"); mask-image: url("../images/Policies-Menu.png"); }
.ico-jobs { -webkit-mask-image: url("../images/Jobs-Menu.png"); mask-image: url("../images/Jobs-Menu.png"); }
.ico-settings { -webkit-mask-image: url("../images/Settings-Menu.png"); mask-image: url("../images/Settings-Menu.png"); }

.app-top {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 16px 28px 0;
}

.app-top .app-brand { padding: 0; margin-right: auto; }
.app-top .who { gap: 14px; color: var(--ink); }
.app-top .who a, .app-top .who button.link { color: var(--link); }
.app-top .theme-toggle { color: var(--ink); }
.app-top .sep { color: var(--muted); }

.shell > main {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    max-width: 1560px;
    margin: 0;
    padding: 18px 28px 40px;
}

/* the pages without a signed-in user (sign in) have no sidebar */
.shell-bare { grid-template-columns: minmax(0, 1fr); }
.shell-bare .app-top { grid-column: 1; padding: 16px 28px 0; }
.shell-bare > main { grid-column: 1; max-width: 1400px; margin: 0 auto; }

@media (max-width: 900px) {
    .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
    .app-side { grid-column: 1; grid-row: 1; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--side-line); overflow: visible; }
    .app-side .app-brand { padding: 14px 16px 6px; }
    .side-nav { flex-direction: row; overflow-x: auto; padding: 4px 10px 10px; }
    .side-nav a { padding: 9px 12px; white-space: nowrap; }
    .side-nav a.active::before { display: none; }
    .app-top { grid-column: 1; grid-row: 2; justify-content: flex-start; flex-wrap: wrap; padding: 12px 16px 0; }
    .shell > main { grid-column: 1; grid-row: 3; padding: 14px 16px 32px; }
    .shell-bare { grid-template-rows: auto 1fr; }
    .shell-bare .app-top { grid-row: 1; }
    .shell-bare > main { grid-row: 2; }
}

/* ---------- page header ---------- */

.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 22px; }
.page-head-icon { flex: none; width: 52px; height: 52px; }
.page-head-text { flex: 1 1 360px; min-width: 0; }
.page-head-text h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.01em; }
.page-head-text .hint { margin: 0; max-width: 78ch; font-size: 14px; line-height: 1.45; }
.page-head-tools { flex: none; }
form.search { display: flex; gap: 8px; align-items: center; margin: 0; }
form.search input[type=search] { min-width: 300px; }

/* ---------- panels ---------- */

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    box-shadow: var(--panel-shadow);
    margin: 0 0 22px;
}

.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--panel-line); }
.panel-head h2 { margin: 0; font-size: 16px; }
.panel-head .spacer { flex: 1; }
.panel-title { padding: 16px 18px 6px; }
.panel-title h2 { margin: 0; font-size: 16px; }
.panel .pad { padding: 8px 18px 18px; margin: 0; }

.count-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--badge-muted-bg); color: var(--muted); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--info-soft); color: var(--info); font-size: 12px; text-decoration: none; }
.chip:hover { text-decoration: underline; }

a.button.add::before { content: "+"; margin-right: 8px; font-weight: 600; }

.panel-form { padding: 4px 20px 22px; max-width: 680px; }
.panel-form label:first-child { margin-top: 14px; }

/* ---------- the four cards under the header ---------- */

.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 0 0 22px; }

.type-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    color: var(--ink);
    text-decoration: none;
    background: var(--panel-bg);
    border: 1px solid var(--panel-line);
    border-radius: var(--radius);
    box-shadow: var(--panel-shadow);
}

.type-card:hover { border-color: var(--accent); }
.type-card.active { border-color: var(--accent); background: var(--brand-soft); }
.type-card img { flex: none; width: 48px; height: 48px; }
.type-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.type-text strong { font-size: 15px; }
.type-desc { color: var(--muted); font-size: 13px; line-height: 1.35; }

/* ---------- the repository layout ---------- */

.repo-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
@media (max-width: 1180px) {
    .repo-layout { grid-template-columns: minmax(0, 1fr); }
}

.panel table { background: transparent; border: 0; }
.panel th { background: transparent; color: var(--muted); font-weight: 500; font-size: 13px; padding: 12px 14px; border-bottom: 1px solid var(--panel-line); white-space: nowrap; }
.panel td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.panel td:not(:first-child) { white-space: nowrap; }
.panel tbody tr:hover { background: var(--row-hover); }
.panel tbody tr:last-child td { border-bottom: 0; }

.name-cell { display: flex; align-items: center; gap: 12px; min-width: 190px; }
.name-cell img { flex: none; width: 28px; height: 28px; }
.name-text { display: flex; flex-direction: column; min-width: 0; }
.name-text a { font-weight: 600; text-decoration: none; }
.name-text a:hover { text-decoration: underline; }
.sub { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.idle { background: var(--badge-muted-bg); color: var(--muted); }

td.col-menu, th.col-menu { width: 1%; text-align: right; padding-left: 4px; }

/* the row menu: a details element, so it works without scripts */
details.menu { position: relative; display: inline-block; }

details.menu > summary {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    list-style: none;
    cursor: pointer;
}

details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover, details.menu[open] > summary { background: var(--brand-soft); color: var(--ink); }

.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 30;
    min-width: 190px;
    padding: 6px;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.menu-list form.inline { display: block; }
.menu-list a, .menu-list button.link { display: block; width: 100%; padding: 8px 10px; border-radius: 6px; text-align: left; color: var(--ink); text-decoration: none; }
.menu-list a:hover, .menu-list button.link:hover { background: var(--brand-soft); text-decoration: none; }
.menu-list .note { display: block; padding: 8px 10px; color: var(--muted); font-size: 12px; }

@media (max-width: 1400px) {
    .col-type { display: none; }
}
@media (max-width: 760px) {
    .col-size { display: none; }
}
@media (max-width: 640px) {
    .col-status { display: none; }
}

/* ---------- the column on the right ---------- */

.action-list { list-style: none; margin: 0; padding: 6px 10px 12px; }

.action-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 8px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
}

.action-list a:hover { background: var(--row-hover); }
.action-list a::after { content: "\203A"; margin-left: auto; color: var(--muted); font-size: 20px; line-height: 1; }
.action-list img { flex: none; width: 40px; height: 40px; }
.action-list .type-text strong { font-size: 14px; }
.action-list .type-desc { font-size: 12.5px; }

.usage { display: flex; align-items: center; gap: 22px; padding: 8px 18px 20px; }
.donut { position: relative; flex: none; display: grid; place-items: center; width: 116px; height: 116px; }
.donut svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.donut .ring { fill: none; stroke: var(--line); stroke-width: 5; }
.donut .seg { fill: none; stroke-width: 5; }
.donut .seg.app { stroke: var(--c-app); }
.donut .seg.script { stroke: var(--c-script); }
.donut .seg.file { stroke: var(--c-file); }
.donut .seg.cert { stroke: var(--c-cert); }
.donut-total { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.donut-total strong { font-size: 26px; }
.donut-total span { color: var(--muted); font-size: 12px; }

.legend { flex: 1; list-style: none; margin: 0; padding: 0; }
.legend a { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.legend a:hover .label { text-decoration: underline; }
.legend .n { margin-left: auto; font-weight: 600; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.dot.app { background: var(--c-app); }
.dot.script { background: var(--c-script); }
.dot.file { background: var(--c-file); }
.dot.cert { background: var(--c-cert); }

.activity { list-style: none; margin: 0; padding: 4px 18px 12px; }
.activity li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.activity li:last-child { border-bottom: 0; }
.activity img { flex: none; width: 32px; height: 32px; }
.activity .what { flex: 1; min-width: 0; }
.activity .what a { font-weight: 600; text-decoration: none; }
.activity .what a:hover { text-decoration: underline; }
.activity time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

@media (max-width: 720px) {
    form.search { width: 100%; }
    form.search input[type=search] { min-width: 0; flex: 1; }
    .page-head-tools { flex: 1 1 100%; }
}
