/* Dark is the default palette. --helm-border-light / --helm-font-light are
   set inline per-dashboard from the border_color / font_color settings —
   they only feed into the actual --helm-border / --helm-font custom
   properties in light mode (below), so an admin-configured color never
   fights with dark mode's built-in palette. */
.helm-dashboard {
    --helm-border: #2A2F3A;
    --helm-font: #E5E7EB;
    --helm-bg: #0B0D12;
    --helm-panel-bg: #151821;
    --helm-radius: 14px;

    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--helm-font);
    background: var(--helm-bg);
    padding: 2.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.helm-dashboard[data-helm-theme="light"] {
    --helm-border: var(--helm-border-light, #E5E7EB);
    --helm-font: var(--helm-font-light, #111827);
    --helm-bg: #F9FAFB;
    --helm-panel-bg: #FFFFFF;
}

.helm-dashboard *,
.helm-dashboard *::before,
.helm-dashboard *::after {
    box-sizing: inherit;
}

/* ── Topbar: clock, search, weather ─────────────────────────────────── */

.helm-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto 2.5rem;
}

.helm-clock {
    font-size: 1.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    min-width: 9ch;
    text-align: center;
}

.helm-clock__date {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.7;
    margin-top: 0.15rem;
}

.helm-search {
    flex: 1 1 360px;
    max-width: 480px;
    display: flex;
    border: 1px solid var(--helm-border);
    border-radius: 999px;
    background: var(--helm-panel-bg);
    overflow: hidden;
}

.helm-search__input {
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    outline: none;
    background-color: transparent;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    color: var(--helm-font);
}

.helm-search__input:focus,
.helm-search__input:focus-visible {
    background-color: transparent;
    color: var(--helm-font);
    outline: none;
    box-shadow: none;
}

.helm-search__input::placeholder {
    color: var(--helm-font);
    opacity: 0.5;
}

.helm-search__button {
    border: none;
    background: transparent;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--helm-font);
    border-left: 1px solid var(--helm-border);
}

.helm-search__button:hover {
    background: var(--helm-bg);
}

.helm-weather {
    font-size: 0.95rem;
    min-width: 8ch;
    text-align: center;
    opacity: 0.9;
}

.helm-weather:empty {
    display: none;
}

.helm-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--helm-border);
    border-radius: 999px;
    background: var(--helm-panel-bg);
    color: var(--helm-font);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.helm-theme-toggle:hover {
    background: var(--helm-bg);
}

/* ── Panels ──────────────────────────────────────────────────────────── */

.helm-panels {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.helm-top-panels {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.helm-top-panels > .helm-panel {
    flex: 1 1 320px;
}

.helm-panel {
    background: var(--helm-panel-bg);
    border: 1px solid var(--helm-border);
    border-radius: var(--helm-radius);
    padding: 1.25rem 1.5rem;
}

.helm-panel__title {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.6;
}

.helm-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.helm-post a {
    color: var(--helm-font);
    text-decoration: none;
    font-size: 0.95rem;
}

.helm-post a:hover {
    text-decoration: underline;
}

.helm-post {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

/* ── Link tiles (helm-links items) ──────────────────────────────────── */

.helm-panel__list--tiles {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.helm-link {
    width: 168px;
}

.helm-link a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--helm-font);
    text-decoration: none;
    padding: 0.4rem;
    border-radius: 10px;
}

.helm-link a:hover {
    background: var(--helm-bg);
}

.helm-link__tile {
    width: 104px;
    height: 104px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background-color: var(--helm-bg);
    border: 1px solid var(--helm-border);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    flex-shrink: 0;
}

.helm-link__tile--image {
    border: none;
}

.helm-link__emoji {
    font-size: 3rem;
    line-height: 1;
}

.helm-link__favicon {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.helm-link__title {
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.25;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helm-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--helm-border);
    opacity: 0.75;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .helm-dashboard {
        padding: 1.5rem;
    }

    .helm-topbar {
        flex-direction: column;
        gap: 1rem;
    }

    .helm-search {
        max-width: 100%;
        width: 100%;
    }
}
