/* Yggdrasil retro theme — Midnight Commander vibes.
 * Midnight-blue background, pixel frames, hard shadows, zero rounding.
 * MesloLGS NF (the Vim/terminal font), with a monospace fallback.
 */
:root {
    --mc-blue: #0000aa;
    --mc-deep: #000066;
    --mc-fg: #d7d7d7;
    --mc-dim: #a8a8a8;
    --mc-bright: #ffffff;
    --mc-cyan: #55ffff;
    --mc-cyan-dim: #00aaaa;
    --mc-yellow: #ffff55;
    --mc-red: #aa0000;
    --mc-red-bright: #ff5555;
    --mc-black: #000000;
}

@font-face {
    font-family: "Yggdrasil Icons";
    src: url("fonts/yggdrasil-icons.woff2") format("woff2");
    font-weight: normal;
    font-style: normal;
    font-display: block;
    unicode-range: U+F0F3, U+F08B;
}

* { box-sizing: border-box; border-radius: 0 !important; }

html { background: var(--mc-black); }

body {
    background: var(--mc-blue);
    color: var(--mc-fg);
    font-family: "MesloLGS NF", "DejaVu Sans Mono", "Courier New", Courier, monospace;
    font-size: 18px;
    line-height: 1.45;
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1rem 4rem;
    min-height: 100vh;
}

/* Subtle CRT effect — scanlines over the whole page. */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.10) 0 1px,
        transparent 1px 3px
    );
}

::selection { background: var(--mc-cyan); color: var(--mc-black); }

.hidden,
[hidden] { display: none !important; }

/* --- Headings --- */
h1 {
    color: var(--mc-yellow);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 2.2rem;
    text-shadow: 3px 3px 0 var(--mc-black);
    border-bottom: 3px double var(--mc-dim);
    padding-bottom: 0.3em;
}

h2 { color: var(--mc-bright); letter-spacing: 2px; }

/* Yggdrasil logo — pixel art, so keep it crisp when scaled down.
 * On the home page it spans the full width of the blue band. */
.logo {
    display: block;
    width: 100%;
    height: auto;
    margin: 1rem auto;
    image-rendering: pixelated;
    border: 3px double var(--mc-bright);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
}

@keyframes mcblink { 50% { opacity: 0; } }

/* --- Menu bar (navigation) --- */
.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--mc-black);
    border: 2px solid var(--mc-dim);
    padding: 0.25em 0.5em;
    margin-bottom: 1rem;
    position: relative;
    z-index: 50;
}
.topbar-brand {
    color: var(--mc-yellow);
    font-weight: bold;
    letter-spacing: 0.12em;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.35em 0.5em;
    border-right: 2px solid var(--mc-dim);
}
.topbar-links,
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}
.topbar-links { flex: 1; }
.topbar-actions { margin-left: auto; }
.topbar-link {
    display: inline-flex;
    align-items: center;
    color: var(--mc-cyan);
    text-decoration: none;
    padding: 0.35em 0.6em;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.topbar-link:hover,
.topbar-link.is-active,
.topbar-menu[open] > .topbar-link {
    background: var(--mc-cyan);
    color: var(--mc-black);
    border-bottom-color: var(--mc-yellow);
}
.topbar-menu {
    position: relative;
}
.topbar-menu > summary {
    list-style: none;
    cursor: pointer;
}
.topbar-menu > summary::-webkit-details-marker {
    display: none;
}
.topbar-menu-panel {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    flex-direction: column;
    background: var(--mc-black);
    border: 2px solid var(--mc-dim);
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.45);
    padding: 0.25em;
    z-index: 100;
}
.topbar-menu:not([open]) .topbar-menu-panel {
    display: none;
}
.topbar-menu[open] .topbar-menu-panel {
    display: flex;
}
.topbar-menu-link {
    color: var(--mc-cyan);
    text-decoration: none;
    padding: 0.3em 0.45em;
    font-size: 0.82rem;
    white-space: nowrap;
}
.topbar-menu-link:hover,
.topbar-menu-link.is-active {
    background: var(--mc-cyan);
    color: var(--mc-black);
}
.nav-badge {
    display: inline-block;
    background: var(--mc-yellow);
    color: var(--mc-black);
    border: 1px solid var(--mc-black);
    padding: 0 0.35em;
    margin-left: 0.25em;
    font-size: 0.8em;
    line-height: 1.2;
}
.topbar-icon-link {
    min-width: 2.4em;
    justify-content: center;
    gap: 0.2em;
    padding: 0.35em 0.5em;
    font-size: 1rem;
    letter-spacing: 0;
}
.topbar-glyph {
    font-family: "Yggdrasil Icons", "MesloLGS NF", monospace;
    font-size: 1em;
    line-height: 1;
}
.topbar-icon-link .nav-badge {
    margin-left: 0;
    font-size: 0.62em;
}
@media (max-width: 760px) {
    .topbar {
        flex-wrap: wrap;
        gap: 0.25rem 0.5rem;
    }
    .topbar-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.15em;
    }
    .topbar-actions {
        margin-left: 0;
    }
    .topbar-link,
    .topbar-menu-link {
        font-size: 0.75rem;
        padding: 0.3em 0.45em;
    }
    .topbar-icon-link {
        font-size: 0.95rem;
        padding: 0.3em 0.4em;
    }
}

/* --- Panels and dialogs --- */
.panel {
    background: var(--mc-deep);
    border: 3px double var(--mc-bright);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
    padding: 1rem 1.2rem;
    margin-top: 1rem;
}

.dialog {
    position: relative;
    max-width: 460px;
    margin: 10vh auto 0;
    background: var(--mc-blue);
    border: 3px double var(--mc-bright);
    box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
    padding: 1.5rem 1.5rem 1.2rem;
}
.device-call-dialog {
    max-width: 560px;
}
.device-call-dialog pre {
    max-height: 50vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 1rem 0;
}
.dialog-title {
    position: absolute;
    top: -0.75em;
    left: 50%;
    transform: translateX(-50%);
    background: var(--mc-blue);
    color: var(--mc-yellow);
    padding: 0 1em;
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
}

/* --- Forms --- */
form { display: flex; flex-direction: column; gap: 0.8rem; }
label { color: var(--mc-bright); letter-spacing: 1px; }

/* Terminal-style field wrapper for the block caret (see login.html).
 * The overlay block is positioned by JS; without JS it stays hidden. */
.term-field { position: relative; }
.caret-block {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 1ch;
    height: 1.15em;
    background: var(--mc-yellow);
    box-shadow: 0 0 6px rgba(255, 255, 85, 0.6);
    pointer-events: none;
    animation: mcblink 1.06s steps(1) infinite;
}
.term-field.active .caret-block { display: block; }
/* Hide the native thin caret only when the JS block takes over. */
input.js-caret { caret-color: transparent; }

input, select, textarea {
    font: inherit;
    background: var(--mc-black);
    color: var(--mc-bright);
    border: 2px solid var(--mc-dim);
    padding: 0.3em 0.5em;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--mc-yellow);
}
select { width: 100%; margin-top: 0.3rem; }
option { background: var(--mc-black); color: var(--mc-bright); }

button {
    font: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: var(--mc-dim);
    color: var(--mc-black);
    border: none;
    box-shadow: 4px 4px 0 var(--mc-black);
    padding: 0.4em 1.2em;
    cursor: pointer;
}
button:hover { background: var(--mc-cyan); }
button:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--mc-black); }
button:disabled { opacity: 0.5; cursor: default; }

#refresh-button { margin-top: 0.6rem; }

/* Sensors page: the "hourly average" checkbox must stay a small inline
 * box next to its text — the global `input { width: 100% }` would
 * otherwise stretch it full-width and break the row layout. */
#avg-label { display: flex; align-items: center; gap: 0.5em; margin-top: 0.6rem; }
#avg-label input { width: auto; margin: 0; }

.error {
    background: var(--mc-red);
    color: var(--mc-bright);
    border: 2px solid var(--mc-bright);
    box-shadow: 4px 4px 0 var(--mc-black);
    padding: 0.4em 0.6em;
}

/* --- Tables --- */
table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
th, td {
    border: 1px solid var(--mc-dim);
    padding: 0.3em 0.6em;
    text-align: left;
}
th { background: var(--mc-cyan-dim); color: var(--mc-black); text-transform: uppercase; letter-spacing: 1px; }
tbody tr:hover { background: var(--mc-cyan); color: var(--mc-black); }

/* --- Links inside content --- */
a { color: var(--mc-cyan); }
a:hover { background: var(--mc-cyan); color: var(--mc-black); text-decoration: none; }

/* --- MC-style menu (home page) --- */
.mc-menu { list-style: none; padding: 0; margin: 1rem 0; }
.mc-menu li { margin: 0.2em 0; }
.mc-menu a {
    display: block;
    text-decoration: none;
    padding: 0.2em 0.6em;
}
.mc-menu a::before { content: "[*] "; color: var(--mc-yellow); }
.mc-menu a:hover::before { color: var(--mc-black); }
.mc-key {
    display: inline-block;
    background: var(--mc-black);
    color: var(--mc-cyan);
    border: 1px solid var(--mc-cyan-dim);
    padding: 0 0.4em;
    margin-right: 0.5em;
}
a:hover .mc-key { background: var(--mc-black); color: var(--mc-bright); }

.hint { color: var(--mc-dim); }

/* Yellow highlight for usernames, roles and other key words. */
.hl { color: var(--mc-yellow); }

/* --- API docs --- */
.endpoint {
    background: var(--mc-deep);
    border: 3px double var(--mc-bright);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
}
.method {
    display: inline-block;
    padding: 0.1em 0.6em;
    margin-right: 0.5em;
    font-size: 0.9em;
    letter-spacing: 1px;
}
.get { background: var(--mc-cyan); color: var(--mc-black); }
.post { background: var(--mc-yellow); color: var(--mc-black); }
.path { font-size: 1.1rem; color: var(--mc-bright); }
.desc { margin: 0.5rem 0; }
.section-label {
    font-size: 0.85em;
    color: var(--mc-dim);
    margin: 0.75rem 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}
pre {
    background: var(--mc-black);
    color: var(--mc-cyan);
    border: 2px solid var(--mc-dim);
    padding: 0.7rem;
    overflow-x: auto;
    font-size: 0.9em;
}
code { font-family: inherit; }
.note {
    background: var(--mc-black);
    border-left: 6px solid var(--mc-yellow);
    padding: 0.5rem 0.75rem;
    margin: 1rem 0;
}

/* --- Bottom status bar --- */
.statusbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mc-black);
    color: var(--mc-dim);
    border-top: 2px solid var(--mc-dim);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25em 1em;
    font-size: 0.95em;
    z-index: 100;
}
.statusbar b {
    background: var(--mc-cyan-dim);
    color: var(--mc-bright);
    padding: 0 0.4em;
    margin-right: 0.3em;
}
.statusbar a { text-decoration: none; }

/* --- Chart --- */
.chart-box { margin-top: 1rem; }
canvas {
    background: var(--mc-black);
    border: 3px double var(--mc-bright);
    padding: 0.5rem;
}


/* --- Notes --- */
textarea {
    resize: vertical;
    min-height: 4.5em;
}
.note-card {
    background: var(--mc-deep);
    border: 3px double var(--mc-bright);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
    padding: 1rem 1.2rem;
    margin-top: 1rem;
}
.note-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.note-meta { color: var(--mc-dim); font-size: 0.8em; }
.checklist { list-style: none; padding: 0; margin: 1rem 0; }
.checklist li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    border-bottom: 1px dashed var(--mc-dim);
    padding: 0.15em 0;
}
.check-form {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 0.6em;
    margin: 0;
}
.check-form input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--mc-yellow);
}
.item-edit-form {
    flex: 1;
    flex-direction: row;
    align-items: center;
    gap: 0.4em;
    margin: 0;
}
.item-edit-form input { flex: 1; min-width: 0; }
.item-edit-form button {
    background: var(--mc-dim);
    color: var(--mc-black);
    box-shadow: none;
    padding: 0.1em 0.4em;
    font-size: 0.85em;
    letter-spacing: 0;
}
.item-edit-form button:hover { background: var(--mc-cyan); }
.checklist li.done .item-edit-form input {
    text-decoration: line-through;
    color: var(--mc-dim);
}
.item-delete-form { margin: 0; }
.item-delete-form button {
    background: transparent;
    color: var(--mc-red-bright);
    box-shadow: none;
    padding: 0.1em 0.4em;
    letter-spacing: 0;
}
.item-delete-form button:hover { background: var(--mc-red); color: var(--mc-bright); }
.add-item-form {
    flex-direction: row;
    align-items: center;
    gap: 0.5em;
}
.add-item-form input { flex: 1; }
.note-menu-btn {
    background: transparent;
    color: var(--mc-dim);
    border: 2px solid var(--mc-dim);
    box-shadow: none;
    padding: 0.1em 0.4em;
    font-size: 1em;
    line-height: 1;
    letter-spacing: 0;
}
.note-menu-btn:hover { color: var(--mc-bright); border-color: var(--mc-bright); }

.note-title-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}

.note-save-status {
    font-size: 0.8em;
    color: var(--mc-dim);
    white-space: nowrap;
}
.note-save-status.saved { color: var(--mc-yellow); }
.note-save-status.unsaved { color: var(--mc-red); }

.note-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--mc-deep);
    border: 3px double var(--mc-bright);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
    min-width: 140px;
    z-index: 10;
    margin-top: 0.2rem;
}
.note-menu-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0.4em 0.8em;
    color: var(--mc-bright);
    font: inherit;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.note-menu-dropdown button:hover { background: var(--mc-cyan); color: var(--mc-black); }


/* --- Notifications --- */
.notification-list { list-style: none; padding: 0; margin: 1rem 0; }
.notification-item {
    border: 2px solid var(--mc-dim);
    margin: 0.5rem 0;
    background: var(--mc-deep);
}
.notification-item.unread { border-left: 6px solid var(--mc-yellow); }
.notification-item.read { opacity: 0.78; }
.notification-item a {
    display: block;
    padding: 0.5rem 0.7rem;
    color: var(--mc-fg);
    text-decoration: none;
}
.notification-item a:hover {
    background: var(--mc-cyan);
    color: var(--mc-black);
}
.notification-message { display: block; margin-bottom: 0.25rem; }
.notification-meta {
    display: flex;
    align-items: center;
    gap: 0.75em;
    font-size: 0.8em;
    color: var(--mc-dim);
}
.notification-item a:hover .notification-meta { color: var(--mc-black); }
.notification-status {
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.45em;
    background: var(--mc-dim);
    color: var(--mc-black);
}
.notification-item.unread .notification-status {
    background: var(--mc-yellow);
    color: var(--mc-black);
}
.notification-delete-form { margin: 0; }
.notification-delete-form button {
    background: var(--mc-red);
    color: var(--mc-bright);
    box-shadow: none;
    padding: 0.1em 0.4em;
    font-size: 0.85em;
    letter-spacing: 0;
}
.notification-delete-form button:hover { background: var(--mc-red-bright); }

/* --- News --- */
.news-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8em;
    border: 3px double var(--mc-bright);
    background: var(--mc-deep);
    box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.45);
    padding: 1.4rem;
    margin-top: 1rem;
    color: var(--mc-yellow);
    letter-spacing: 1px;
}
.news-spinner {
    display: inline-block;
    width: 1.4em;
    height: 1.4em;
    border: 3px solid var(--mc-dim);
    border-top-color: var(--mc-cyan);
    border-radius: 50% !important;
    animation: news-spin 0.9s linear infinite;
}
@keyframes news-spin { to { transform: rotate(360deg); } }
.news-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8em;
    margin: 0.8rem 0 0.4rem;
}
.news-toolbar a { color: var(--mc-cyan); text-decoration: none; }
.news-toolbar a:hover { background: var(--mc-cyan); color: var(--mc-black); }
.news-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin: 0.8rem 0 0;
}
.news-controls label {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
    font-size: 0.85em;
    letter-spacing: 1px;
}
.news-controls select {
    width: auto;
    min-width: 5.5rem;
    margin-top: 0.2rem;
}
.news-warning {
    border: 2px solid var(--mc-bright);
    border-left: 6px solid var(--mc-red-bright);
    background: var(--mc-red);
    color: var(--mc-bright);
    box-shadow: 4px 4px 0 var(--mc-black);
    padding: 0.4em 0.8em;
}
.news-panel { margin-top: 1rem; }
.news-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.news-item {
    border: 2px solid var(--mc-dim);
    border-left: 6px solid var(--mc-cyan);
    background: var(--mc-deep);
    margin: 0.7rem 0;
    padding: 0.6em 0.8em;
}
.news-item.read { border-left-color: var(--mc-dim); opacity: 0.72; }
.news-item.read:hover { opacity: 1; }
.news-item.read .news-title { color: var(--mc-dim); }
.news-item-header { margin-bottom: 0.35em; }
.news-title {
    display: block;
    color: var(--mc-yellow);
    text-decoration: none;
    font-size: 1.1em;
    line-height: 1.2;
}
.news-title:hover { text-decoration: underline; }
.news-item.read .news-title:hover { color: var(--mc-black); }
.news-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6em;
    margin-top: 0.3em;
    font-size: 0.8em;
    color: var(--mc-dim);
}
.news-source { color: var(--mc-bright); }
.news-category {
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.45em;
    background: var(--mc-dim);
    color: var(--mc-black);
}
.news-read-flag {
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 0.45em;
    background: var(--mc-dim);
    color: var(--mc-black);
}
.news-description { margin: 0.4em 0; color: var(--mc-fg); }
.news-sources { font-size: 0.85em; color: var(--mc-dim); }
.news-sources-label { margin-right: 0.4em; }
.news-sources a { color: var(--mc-cyan); text-decoration: none; margin-right: 0.7em; }
.news-sources a:hover { color: var(--mc-black); text-decoration: underline; }

/* --- Flash messages --- */
.flash-messages { list-style: none; padding: 0; margin: 1rem 0; }
.flash {
    border: 2px solid var(--mc-bright);
    box-shadow: 4px 4px 0 var(--mc-black);
    padding: 0.4em 0.8em;
    margin-bottom: 0.6rem;
}
.flash-success { background: var(--mc-deep); border-left: 6px solid var(--mc-cyan); }
.flash-error { background: var(--mc-red); color: var(--mc-bright); border-left: 6px solid var(--mc-red-bright); }

/* --- Clipboard --- */
.clipboard-list { list-style: none; padding: 0; margin: 1rem 0; }
.clipboard-item {
    display: flex;
    align-items: center;
    gap: 0.6em;
    border: 2px solid var(--mc-dim);
    background: var(--mc-deep);
    margin: 0.5rem 0;
    padding: 0.4em 0.6em;
}
.clipboard-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}
.clipboard-name {
    display: block;
    max-width: 100%;
    color: var(--mc-cyan);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clipboard-name:hover { color: var(--mc-black); text-decoration: underline; }
.clipboard-meta {
    display: block;
    color: var(--mc-dim);
    font-size: 0.8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clipboard-actions {
    position: relative;
    flex: 0 0 auto;
}
.clipboard-menu-btn {
    background: transparent;
    color: var(--mc-dim);
    border: 2px solid var(--mc-dim);
    box-shadow: none;
    padding: 0.05em 0.5em 0.15em;
    font-size: 1.1em;
    line-height: 1;
    letter-spacing: 0;
}
.clipboard-menu-btn:hover {
    color: var(--mc-bright);
    border-color: var(--mc-bright);
}
.clipboard-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--mc-deep);
    border: 3px double var(--mc-bright);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
    min-width: 140px;
    z-index: 10;
    margin-top: 0.2rem;
}
.clipboard-menu-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0.4em 0.8em;
    color: var(--mc-bright);
    font: inherit;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.clipboard-menu-dropdown button:hover {
    background: var(--mc-cyan);
    color: var(--mc-black);
}
.clipboard-menu-dropdown .clipboard-delete-btn {
    color: var(--mc-red-bright);
}
.clipboard-menu-dropdown .clipboard-delete-btn:hover {
    background: var(--mc-red);
    color: var(--mc-bright);
}
.clipboard-settings-details {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4em 1em;
    margin: 1rem 0;
}
.clipboard-settings-details dt {
    color: var(--mc-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.8em;
}
.clipboard-settings-details dd {
    margin: 0;
    color: var(--mc-bright);
    overflow-wrap: anywhere;
}

/* --- Backups --- */
.backup-list { list-style: none; padding: 0; margin: 1rem 0; }
.backup-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.6em;
    border: 2px solid var(--mc-dim);
    background: var(--mc-deep);
    margin: 0.5rem 0;
    padding: 0.4em 0.6em;
}
.backup-name { color: var(--mc-cyan); text-decoration: none; }
.backup-name:hover { color: var(--mc-black); text-decoration: underline; }
.backup-meta { color: var(--mc-dim); font-size: 0.8em; }
.backup-restore-form { margin: 0 0 0 auto; flex-direction: row; }
.backup-restore-form button {
    background: var(--mc-red);
    color: var(--mc-bright);
    box-shadow: none;
    padding: 0.15em 0.6em;
    font-size: 0.8em;
    letter-spacing: 1px;
}
.backup-restore-form button:hover {
    background: var(--mc-red-bright);
    color: var(--mc-black);
}

/* --- Calendar --- */
.calendar-controls { display: flex; gap: 0.8em; align-items: center; margin-top: 0.5rem; }
.calendar-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8em; margin-top: 0.5rem; }
.calendar-grid { display: flex; flex-direction: column; gap: 0.4em; margin-top: 1rem; }
.calendar-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.4em; }
.calendar-weekdays { gap: 0.4em; }
.calendar-weekday {
    color: var(--mc-dim);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8em;
}
.calendar-day {
    border: 2px solid var(--mc-dim);
    background: var(--mc-deep);
    min-height: 6em;
    max-height: 18em;
    overflow-y: auto;
    padding: 0.3em;
    width: 100%;
    box-sizing: border-box;
}
.calendar-day-outside { opacity: 0.55; }
.calendar-day-header { color: var(--mc-yellow); text-transform: uppercase; letter-spacing: 1px; font-size: 0.8em; }
.calendar-events { list-style: none; padding: 0; margin: 0.3em 0 0; }
.calendar-event { border-bottom: 1px dashed var(--mc-dim); padding: 0.15em 0; font-size: 0.9em; }
.calendar-event:last-child { border-bottom: none; }
.calendar-event-time { color: var(--mc-cyan); margin-right: 0.4em; }
.calendar-event-title { color: var(--mc-bright); }
.calendar-event-calendar { color: var(--mc-dim); margin-left: 0.4em; font-size: 0.85em; }
.calendar-event-calendar::before { content: "["; }
.calendar-event-calendar::after { content: "]"; }
.calendar-event-recurring {
    color: var(--mc-yellow);
    margin-left: 0.4em;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.calendar-event-allday .calendar-event-time { color: var(--mc-yellow); }
.calendar-event-description {
    margin: 0.2em 0 0;
    color: var(--mc-dim);
    font-size: 0.9em;
    white-space: pre-wrap;
}
.calendar-filter { flex-direction: row; align-items: flex-end; gap: 0.8em; margin-top: 0.8em; }
.calendar-filter label { display: flex; flex-direction: column; gap: 0.2em; font-size: 0.85em; letter-spacing: 1px; }
.calendar-filter select { width: auto; min-width: 10rem; margin-top: 0.2rem; }
.calendar-list { list-style: none; padding: 0; margin: 1rem 0; }
.calendar-day-item { border: 2px solid var(--mc-dim); background: var(--mc-deep); margin: 0.5rem 0; padding: 0.4em 0.6em; min-height: 6em; width: 100%; box-sizing: border-box; }
.calendar-nav { display: flex; gap: 0.8em; margin-top: 0.8rem; }
.calendar-today {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: var(--mc-yellow);
    color: var(--mc-black);
    box-shadow: 4px 4px 0 var(--mc-black);
    padding: 0.4em 1.2em;
    text-decoration: none;
}
.calendar-today:hover { background: var(--mc-cyan); color: var(--mc-black); }
.calendar-day.calendar-today,
.calendar-day-item.calendar-today {
    background: var(--mc-deep);
    border: 3px solid var(--mc-yellow);
}
.calendar-day[data-date],
.calendar-day-item[data-date],
.calendar-event[data-event] { cursor: pointer; }
.calendar-day[data-date]:focus,
.calendar-day-item[data-date]:focus {
    outline: 2px solid var(--mc-cyan);
    outline-offset: 2px;
}
.calendar-event[data-event]:hover .calendar-event-title { color: var(--mc-yellow); }
.calendar-event[data-event]:focus {
    outline: 2px solid var(--mc-cyan);
    outline-offset: 1px;
}

/* --- Calendar event modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.72);
    overflow-y: auto;
    padding: 1rem;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay .dialog {
    margin: 6vh auto;
    width: min(92vw, 560px);
    max-width: 560px;
}
.calendar-event-dialog form { gap: 0.6rem; }
.calendar-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.calendar-form-row label {
    display: flex;
    flex: 1 1 10rem;
    min-width: 0;
    flex-direction: column;
    gap: 0.2rem;
}
.checkbox-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    accent-color: var(--mc-cyan);
}
.calendar-event-dialog textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.4rem;
}
.dialog-actions button { min-width: 8rem; }
.dialog-actions button.danger {
    background: var(--mc-red);
    color: var(--mc-bright);
    margin-right: auto;
}
.dialog-actions button.danger:hover {
    background: var(--mc-red-bright);
    color: var(--mc-black);
}
