/* dashboard.css — what the Kiosk Dashboard adds to the panel's look (libs/ui.css): sign-in, the
   kiosk cards, a kiosk's window with its tabs, facts, jobs with their progress, the enrollment
   command, confirmations. Colours come from ui.css's variables. */

.content-inner > * + *,
.stack > * + * {
    margin-top: var(--space-4);
}

.content-inner {
    gap: 0;
}

.page-title {
    margin-bottom: var(--space-2);
}

/* ----------------------------------------------------------------
   The top bar, and signing in
   ---------------------------------------------------------------- */

.topbar-actions {
    align-self: center;
    align-items: center;
}

.who {
    font-weight: 600;
    color: var(--text);
}

/* No pages before signing in */
body.signed-out .sidebar {
    display: none;
}

.login-page {
    min-height: calc(100vh - 180px);
    display: grid;
    place-items: center;
}

.login {
    display: grid;
    gap: var(--space-3);
    width: min(360px, 100%);
    padding: var(--space-6);
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: var(--rounded-2xl);
}

.login-title {
    font-size: var(--text-2xl);
    letter-spacing: -0.02em;
}

.login .muted {
    margin: 0 0 var(--space-2);
}

.login input,
.login .field-with-button {
    width: 100%;
}

/* ----------------------------------------------------------------
   Messages, states, buttons
   ---------------------------------------------------------------- */

.message {
    min-height: 1.2em;
    margin: var(--space-2) var(--space-5) var(--space-3);
    color: var(--muted);
}

.login .message {
    margin: 0;
}

.message:empty {
    display: none;
}

.message.ok {
    color: var(--ok);
}

.message.err {
    color: var(--err-text);
}

/* A pill with a word in it: centred in its border, wherever it is */
.state {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 9px;
    border-radius: var(--rounded-full);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: var(--text-xs);
    line-height: 1;
    white-space: nowrap;
}

.state.good {
    color: var(--ok);
    border-color: var(--ok);
}

.state.warn {
    color: var(--unsaved);
    border-color: var(--unsaved);
}

.state.bad {
    color: var(--err-text);
    border-color: var(--err);
}

.state.info {
    color: var(--accent-text);
    border-color: var(--accent-line);
}

button.danger {
    color: var(--err-text);
    border-color: var(--err);
    background: var(--err-bg);
}

button.danger:hover {
    color: var(--text);
    background: var(--err);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.page-head .page-title {
    margin-bottom: 0;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.search {
    position: relative;
    flex: 1 1 260px;
    display: flex;
    align-items: center;
}

.search .icon {
    position: absolute;
    left: 11px;
    width: 15px;
    height: 15px;
    color: var(--faint);
    pointer-events: none;
}

.search input {
    width: 100%;
    padding-left: 34px;
}

.empty {
    display: grid;
    justify-items: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-5);
    text-align: center;
}

.empty p {
    margin: 0;
}

.explain {
    padding: var(--space-2) var(--space-5) var(--space-3);
    color: var(--muted);
}

.explain p {
    margin: 0 0 var(--space-3);
    max-width: 720px;
}

/* ----------------------------------------------------------------
   The kiosk cards
   ---------------------------------------------------------------- */

.kiosk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-3);
}

.kiosk-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--accent-line);
    border-radius: var(--rounded-2xl);
    background: var(--accent-bg);
    color: var(--text);
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kiosk-card:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Not connected (yet, or any more): quieter */
.kiosk-card.waiting,
.kiosk-card.revoked,
.kiosk-card.uninstalled {
    border-style: dashed;
    opacity: 0.8;
}

.kiosk-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.kiosk-name {
    font-weight: 600;
    font-size: var(--text-lg);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kiosk-card-lines {
    display: grid;
    gap: 5px;
}

.info {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--muted);
    min-width: 0;
}

.info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info .icon {
    width: 14px;
    height: 14px;
    color: var(--accent-text);
}

.info.warn,
.info.warn .icon {
    color: var(--unsaved);
}

.info.bad,
.info.bad .icon {
    color: var(--err-text);
}

.flags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.flag {
    padding: 2px 8px;
    border-radius: var(--rounded-full);
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    font-size: var(--text-xs);
}

.flag.info {
    color: var(--accent-text);
    border-color: var(--accent-line);
}

.flag.warn {
    color: var(--unsaved);
    border-color: var(--unsaved);
}

.flag.bad {
    color: var(--err-text);
    border-color: var(--err);
}

/* ----------------------------------------------------------------
   A kiosk's window: its name, tabs, and the tab's content
   ---------------------------------------------------------------- */

.kiosk-dialog {
    width: min(920px, calc(100vw - 32px));
    height: min(860px, calc(100vh - 48px));
    padding: 0;
}

.kiosk-dialog[open] {
    display: flex;
    flex-direction: column;
}

.kiosk-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-4) 0 var(--space-5);
}

.kiosk-dialog-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.kiosk-dialog-title h2 {
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kiosk-dialog-tabs {
    display: flex;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--line-soft);
}

.kiosk-dialog-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-4) var(--space-5) var(--space-5);
}

.kiosk-dialog-body > * + * {
    margin-top: var(--space-4);
}

/* ui.css hides a dialog's card titles (its dialogs hold one card); a kiosk's window holds several */
.kiosk-dialog .card > .card-head {
    display: flex;
}

.kiosk-dialog .card-head + .card-description {
    padding-top: 0;
}

.confirm-dialog {
    width: min(460px, calc(100vw - 32px));
}

.confirm-text {
    margin: 0;
    color: var(--muted);
}

#add-dialog .card {
    margin-top: var(--space-3);
}

/* ----------------------------------------------------------------
   One kiosk: facts, actions, its screen, its settings
   ---------------------------------------------------------------- */

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-3) var(--space-5);
    padding: var(--space-4) var(--space-5);
}

.fact {
    display: grid;
    gap: 2px;
    font-size: var(--text-sm);
}

.fact-label {
    color: var(--faint);
    font-size: var(--text-xs);
}

.fact .state {
    justify-self: start;
}

.fact.good > :last-child {
    color: var(--ok);
}

.fact.warn > :last-child {
    color: var(--unsaved);
}

.fact.bad > :last-child {
    color: var(--err-text);
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
}

.card-actions button .icon,
.inline button .icon,
.job-actions button .icon {
    width: 14px;
    height: 14px;
}

.inline {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
}

.inline input[type=time],
.schedule > input[type=time] {
    width: 130px;
}

.inline select {
    width: auto;
}

/* Service mode's choices: a checkbox each for the touch screen, keyboard and mouse */
.input-kinds {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.input-kind {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.secrets {
    display: grid;
    gap: 4px;
    padding: 0 var(--space-5) var(--space-4);
    font-size: var(--text-sm);
}

.screenshot {
    margin: 0;
    padding: 0 var(--space-5) var(--space-4);
}

.screenshot img {
    display: block;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--rounded-lg);
}

.screenshot figcaption {
    margin-top: var(--space-2);
    font-size: var(--text-xs);
}

/* "Its own": a switch, then the kiosk's own control or what every kiosk has */
.own-setting,
.schedule {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.own-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--muted);
    cursor: pointer;
}

.own-body .muted {
    font-size: var(--text-sm);
}

.time-note {
    font-size: var(--text-xs);
    color: var(--faint);
    text-align: right;
}

.time-note:empty {
    display: none;
}

.code-box {
    margin: var(--space-3) 0;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--accent-line);
    border-radius: var(--rounded-xl);
    background: var(--accent-bg);
}

.card .code-box {
    margin: 0 var(--space-5) var(--space-3);
}

.command,
.job-log {
    margin: var(--space-2) 0;
    padding: var(--space-3);
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: var(--rounded-lg);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
}

.job-log {
    max-height: 360px;
    margin: var(--space-2) 0 0;
}

/* ----------------------------------------------------------------
   Jobs and their progress
   ---------------------------------------------------------------- */

.job {
    padding: 10px var(--space-5);
    border-top: 1px solid var(--line-soft);
}

.job:first-child {
    border-top: 0;
}

.job-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
}

.job-line {
    flex: 1 1 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-time {
    margin-top: 2px;
    font-size: var(--text-xs);
}

.job-actions {
    display: flex;
    gap: var(--space-2);
}

.progress {
    position: relative;
    height: 22px;
    margin-top: var(--space-2);
    border-radius: var(--rounded-full);
    background: var(--field);
    border: 1px solid var(--line);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 0.4s ease;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
}

/* ----------------------------------------------------------------
   Releases
   ---------------------------------------------------------------- */

.release {
    display: grid;
    grid-template-columns: 1.2fr 0.6fr 0.6fr 1fr;
    gap: var(--space-3);
    padding: 10px var(--space-5);
    border-top: 1px solid var(--line-soft);
    font-size: var(--text-sm);
}

/* ----------------------------------------------------------------
   Phones (ui.css makes the layout itself narrow): a release in two columns; a kiosk's window
   fills the screen, with less padding, and its facts two to a line
   ---------------------------------------------------------------- */

@media (max-width: 760px) {
    .release {
        grid-template-columns: 1fr auto;
    }

    /* A text field with its button (the time zone, "Use mine"): the field on a line of its own */
    .row-control:has(> .inline > input[type=text]) {
        flex: 1 1 100%;
    }

    .inline > input[type=text] {
        flex: 1 1 100%;
    }

    .kiosk-dialog {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border: 0;
        border-radius: 0;
    }

    .kiosk-dialog-head {
        padding: var(--space-3) var(--space-3) 0 var(--space-4);
    }

    .kiosk-dialog-tabs {
        padding: var(--space-2) var(--space-3);
        overflow-x: auto;
    }

    .kiosk-dialog-body {
        padding: var(--space-3) var(--space-3) var(--space-5);
    }

    .facts {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: var(--space-3) var(--space-4);
    }
}
