/* ==========================================================================
   Medeland Retro-Futur
   70'er-hi-fi møder interfacet om 20 år. Fælles for login-porten og Tuneren.
   ========================================================================== */

:root {
    --night: #140B07;
    --night-2: #1E120C;
    --espresso: #2B1A12;
    --line: #3A2418;
    --line-2: #4A2E1F;
    --teak: #6B3E1F;
    --teak-hi: #8A5A35;
    --cream: #F4E7CF;
    --sand: #CDB79C;
    --dust: #8C6F5C;
    --rust: #A8361C;
    --orange: #D9631E;
    --mustard: #E2A72E;
    --avocado: #7A8B2E;
    --avocado-hi: #A4B83A;
    --petrol: #1F5E5B;
    --teal-hi: #4FB3AA;

    --c: var(--mustard);
    --display: 'Fraunces', 'Cooper Black', Georgia, serif;
    --body: 'Space Grotesk', 'Helvetica Neue', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
    --gutter: clamp(16px, 4vw, 40px);
    --spring: cubic-bezier(.3, 1.45, .5, 1);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.mt {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--night);
    color: var(--cream);
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.mt a { color: var(--mustard); }
.mt a:hover { color: var(--cream); }
.mt :focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; border-radius: 6px; }
.mt button { font: inherit; color: inherit; }

.mt-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.mt-skip {
    position: absolute;
    left: var(--gutter);
    top: -60px;
    z-index: 50;
    padding: 10px 16px;
    border-radius: 10px;
    background: var(--mustard);
    color: var(--night) !important;
    font-weight: 600;
    text-decoration: none;
}
.mt-skip:focus { top: 12px; }

.mt-kicker {
    margin: 0;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--mustard);
}

.mt-link {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* --- Himlen: stjerner og solopgang ------------------------------------- */

.mt-sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.mt-stars {
    position: absolute;
    inset: -10%;
    background-image:
        radial-gradient(1px 1px at 12% 18%, rgba(244,231,207,.8), transparent 60%),
        radial-gradient(1px 1px at 72% 12%, rgba(244,231,207,.6), transparent 60%),
        radial-gradient(1.5px 1.5px at 38% 32%, rgba(226,167,46,.7), transparent 60%),
        radial-gradient(1px 1px at 86% 40%, rgba(244,231,207,.5), transparent 60%),
        radial-gradient(1px 1px at 54% 8%, rgba(244,231,207,.7), transparent 60%),
        radial-gradient(1.5px 1.5px at 22% 46%, rgba(217,99,30,.6), transparent 60%),
        radial-gradient(1px 1px at 92% 22%, rgba(244,231,207,.6), transparent 60%),
        radial-gradient(1px 1px at 4% 30%, rgba(244,231,207,.5), transparent 60%);
    background-size: 520px 520px;
    animation: mt-drift 240s linear infinite;
    opacity: .85;
}

.mt-sun {
    --lit: 0;
    position: absolute;
    left: 50%;
    bottom: 0;
    width: min(150vw, 1500px);
    aspect-ratio: 2 / 1;
    transform: translate(calc(-50% + var(--pan, 0px)), calc((6 - var(--lit)) * 3.5%));
    transition: transform 1.1s var(--ease);
}

.mt-ring {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: calc(100% - var(--i) * 14%);
    aspect-ratio: 2 / 1;
    border-radius: 9999px 9999px 0 0;
    transform: translateX(-50%);
    opacity: .07;
    transition: opacity .8s var(--ease), filter .8s var(--ease);
}
.mt-ring:nth-child(1) { background: var(--rust); }
.mt-ring:nth-child(2) { background: var(--orange); }
.mt-ring:nth-child(3) { background: var(--mustard); }
.mt-ring:nth-child(4) { background: var(--avocado); }
.mt-ring:nth-child(5) { background: var(--petrol); }
.mt-ring:nth-child(6) { background: var(--night); opacity: 1; }
.mt-ring.is-on { opacity: .92; }

.mt-sun.is-locked .mt-ring:not(:nth-child(6)) { opacity: 1; filter: saturate(1.15); }

/* --- Topbar ----------------------------------------------------------- */

.mt-bar {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 20px;
    padding: 20px var(--gutter);
}

.mt-mark {
    font-family: var(--display);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
}
.mt-mark span { color: var(--orange); }
.mt a.mt-mark, .mt a.mt-mark:hover { color: var(--cream); text-decoration: none; }

.mt-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--line-2);
    border-radius: 9999px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--sand);
    background: rgba(20, 11, 7, .6);
    backdrop-filter: blur(8px);
}

.mt-lamp {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--line-2);
    transition: background .3s, box-shadow .3s;
}
.mt-lamp[data-state="search"] { background: var(--mustard); box-shadow: 0 0 12px var(--mustard); }
.mt-lamp[data-state="tuning"] { background: var(--orange); box-shadow: 0 0 14px var(--orange); animation: mt-pulse .6s ease-in-out infinite; }
.mt-lamp[data-state="locked"] { background: var(--avocado-hi); box-shadow: 0 0 14px var(--avocado-hi); }

.mt-bar-right { display: flex; align-items: center; gap: 18px; }
.mt-clock { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; color: var(--sand); }

/* --- Login-porten ----------------------------------------------------- */

.mt-gate { display: flex; flex-direction: column; }

.mt-gate-main {
    position: relative;
    z-index: 2;
    flex: 1;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: clamp(8px, 3vh, 40px) var(--gutter) clamp(32px, 8vh, 96px);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 440px);
    gap: clamp(32px, 6vw, 96px);
    align-items: center;
}

.mt-gate-copy { display: flex; flex-direction: column; gap: 20px; }

.mt-title {
    margin: 0;
    font-family: var(--display);
    font-weight: 900;
    font-size: clamp(60px, 9.5vw, 156px);
    line-height: .84;
    letter-spacing: -.045em;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
}
.mt-title em {
    display: block;
    font-style: italic;
    font-weight: 300;
    color: var(--orange);
}

.mt-lede {
    margin: 0;
    max-width: 30em;
    font-size: clamp(17px, 1.6vw, 20px);
    color: var(--sand);
}

.mt-console {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: clamp(20px, 3vw, 28px);
    border-radius: 28px;
    background: rgba(43, 26, 18, .88);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 0 0 1px var(--line-2), 0 0 0 7px rgba(58, 36, 24, .8), 0 0 0 8px var(--teak-hi), 0 40px 90px rgba(0, 0, 0, .55);
}

.mt-dial {
    position: relative;
    padding: 12px 14px 8px;
    border-radius: 14px;
    background: var(--night);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, .6);
}
.mt-dial-ticks {
    height: 26px;
    background:
        linear-gradient(90deg, var(--dust) 1px, transparent 1px) 0 100% / 2.5% 32% repeat-x,
        linear-gradient(90deg, var(--sand) 1px, transparent 1px) 0 100% / 20% 70% repeat-x;
}
.mt-dial-needle {
    --p: 0;
    position: absolute;
    top: 8px;
    height: 30px;
    left: calc(14px + (100% - 28px) * var(--p));
    width: 3px;
    border-radius: 2px;
    background: var(--orange);
    box-shadow: 0 0 10px var(--orange);
    transition: left .7s var(--spring);
}
.mt-dial-scale, .mt-scale-nums {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--dust);
}

.mt-field { display: flex; flex-direction: column; gap: 8px; }
.mt-field label {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--mustard);
}
.mt-field label small { color: var(--dust); letter-spacing: .08em; text-transform: none; font-weight: 400; }

.mt input[type="text"], .mt input[type="password"], .mt input[type="search"], .mt textarea {
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 2px solid var(--line-2);
    border-radius: 14px;
    background: var(--night-2);
    color: var(--cream);
    font-family: var(--body);
    font-size: 18px;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.mt input::placeholder, .mt textarea::placeholder { color: var(--dust); }
.mt input:focus, .mt textarea:focus {
    outline: none;
    border-color: var(--mustard);
    background: var(--night);
    box-shadow: 0 0 0 3px rgba(226, 167, 46, .3), 0 0 32px rgba(226, 167, 46, .2);
}
.mt input[aria-invalid="true"] { border-color: var(--orange); }
.mt input[data-pass] { font-family: var(--mono); letter-spacing: .1em; }

.mt-pass { display: flex; gap: 8px; }
.mt-pass input { flex: 1; min-width: 0; }

.mt-ghost {
    flex: 0 0 auto;
    min-width: 72px;
    min-height: 44px;
    padding: 0 14px;
    border: 2px solid var(--line-2);
    border-radius: 14px;
    background: transparent;
    color: var(--mustard) !important;
    font-family: var(--mono) !important;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.mt-ghost:hover { background: var(--line); color: var(--cream) !important; }

.mt-dymo-slot { min-height: 30px; display: flex; align-items: center; }
.mt-dymo {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 5px 12px 5px 14px;
    border-radius: 3px;
    background: var(--rust);
    color: var(--cream);
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .32em;
    text-transform: uppercase;
    box-shadow: 0 2px 0 #6B1F0F, inset 0 1px 0 rgba(244, 231, 207, .25);
    transform: rotate(-1.5deg) scale(.6);
    opacity: 0;
    transition: transform .4s var(--spring), opacity .25s;
}
.mt-dymo.is-on { opacity: 1; transform: rotate(-1.5deg) scale(1); }

.mt-vu { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.mt-vu i, .mt-meter i {
    height: 9px;
    border-radius: 2px;
    background: var(--line);
    transition: background .15s, box-shadow .15s;
}
.mt-vu i.is-on { background: var(--avocado-hi); box-shadow: 0 0 8px var(--avocado-hi); }
.mt-vu i.is-on:nth-child(n+7) { background: var(--mustard); box-shadow: 0 0 8px var(--mustard); }
.mt-vu i.is-on:nth-child(n+11) { background: var(--orange); box-shadow: 0 0 8px var(--orange); }

.mt-error, .mt-note {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.4;
    animation: mt-rise .5s var(--ease) both;
}
.mt-error { background: var(--rust); color: var(--cream); }
.mt-note { background: var(--petrol); color: var(--cream); }

.mt-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }

.mt-rocker {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    cursor: pointer;
    font-size: 15px;
}
.mt-rocker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mt-rocker-track {
    position: relative;
    width: 54px;
    height: 30px;
    border-radius: 9999px;
    background: var(--line);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5);
    transition: background .25s;
}
.mt-rocker-track span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cream);
    box-shadow: 0 2px 0 var(--dust);
    transition: transform .3s var(--spring);
}
.mt-rocker input:checked + .mt-rocker-track { background: var(--avocado); }
.mt-rocker input:checked + .mt-rocker-track span { transform: translateX(24px); }
.mt-rocker input:focus-visible + .mt-rocker-track { outline: 3px solid var(--mustard); outline-offset: 3px; }

.mt-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 64px;
    padding: 0 28px;
    border: 0;
    border-radius: 16px;
    background: var(--rust);
    color: var(--cream) !important;
    box-shadow: 0 4px 0 #000;
    font-family: var(--display) !important;
    font-size: 24px;
    font-weight: 800;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, filter .2s;
}
.mt-cta svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--spring); }
.mt-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #000; filter: brightness(1.1); }
.mt-cta:hover svg { transform: translateX(4px); }
.mt-cta:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.mt-cta[aria-busy="true"] { pointer-events: none; background: var(--orange); }
.mt-cta-sm { min-height: 52px; padding: 0 22px; font-size: 19px; border-radius: 9999px; background: var(--mustard); color: var(--night) !important; box-shadow: 0 3px 0 var(--teak); }
.mt-cta-sm:hover { box-shadow: 0 5px 0 var(--teak); }
.mt-console .mt-cta { width: 100%; }

.mt-foot {
    position: relative;
    z-index: 2;
    padding: 0 var(--gutter) 24px;
    text-align: center;
}
.mt-foot span {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 9999px;
    background: rgba(20, 11, 7, .82);
    backdrop-filter: blur(8px);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: .1em;
    color: var(--sand);
}

/* Solen holdes i den nederste del af skærmen, så den aldrig går ind over teksten. */
.mt-gate .mt-sun { width: min(150vw, 76vh, 1400px); }
.mt-gate .mt-sun::after {
    content: '';
    position: absolute;
    inset: -20% -30% 0;
    z-index: -1;
    background: radial-gradient(closest-side at 50% 100%, rgba(217, 99, 30, calc(var(--lit) * .06)), transparent);
    transition: background 1s;
}
.mt-gate .mt-lede { text-shadow: 0 1px 12px var(--night); }

@media (max-width: 900px) {
    .mt-gate-main { grid-template-columns: minmax(0, 1fr); align-items: start; }
    .mt-gate .mt-sun { width: min(170vw, 70vh); }
}

/* --- Tuneren ---------------------------------------------------------- */

.mt-tuner {
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    grid-template-columns: minmax(0, 1fr);
}
.mt-tuner > :is(.mt-bar, .mt-stage, .mt-cassette) { position: relative; z-index: 2; }
.mt-tuner .mt-sun { --lit: 6; opacity: .32; transform: translate(calc(-50% + var(--pan, 0px)), 34%); }
.mt-tuner .mt-ring:not(:nth-child(6)) { opacity: .9; }

.mt-stage {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: clamp(16px, 3vh, 32px) var(--gutter) 24px;
    display: grid;
    align-items: start;
    min-height: 50vh;
    outline: none;
}

.mt-station {
    --signal: 1;
    --blur: 0px;
    grid-area: 1 / 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .35s, transform .5s var(--ease), filter .35s, visibility 0s .35s;
}
.mt-station.is-active {
    opacity: calc(.1 + var(--signal) * .9);
    visibility: visible;
    transform: none;
    filter: blur(var(--blur));
    transition: opacity .35s, transform .5s var(--ease), filter .35s, visibility 0s;
}

.mt-st-freq { margin: 0; font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: .2em; color: var(--c); }
.mt-st-name {
    margin: 0;
    font-family: var(--display);
    font-style: italic;
    font-weight: 900;
    font-size: clamp(56px, 10.5vw, 172px);
    line-height: .84;
    letter-spacing: -.045em;
    font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
    color: var(--c);
    overflow-wrap: anywhere;
}
.mt-st-lede { margin: 0; max-width: 36em; font-size: clamp(18px, 1.8vw, 22px); color: var(--cream); }
.mt-hint { margin: 0; font-size: 15px; color: var(--sand); }
.mt-hint code { font-family: var(--mono); color: var(--mustard); }

.mt-cards {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 14px;
}
.mt-card {
    width: 100%;
    height: 100%;
    min-height: 128px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
    border: 1.5px solid var(--line);
    border-radius: 20px;
    background: rgba(30, 18, 12, .82);
    backdrop-filter: blur(10px);
    color: var(--cream) !important;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform .3s var(--spring), border-color .25s, background .25s;
}
.mt-card:hover { transform: translateY(-4px) rotate(-.5deg); border-color: var(--c); background: var(--espresso); }
.mt-card-meta { font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--dust); }
.mt-card-title { font-family: var(--display); font-size: 25px; font-weight: 700; line-height: 1.05; font-variation-settings: 'SOFT' 100; margin-top: auto; }
.mt-card-host { font-size: 14px; color: var(--sand); }
.mt-card-ai { border-style: dashed; border-color: var(--teal-hi); }
.mt-card-off:hover { border-color: var(--orange); }

.mt-filter { max-width: 420px; }
.mt-filter input { min-height: 48px !important; border-radius: 9999px !important; font-size: 16px !important; }

.mt-groups {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 28px 32px;
}
.mt-group h3 { margin-bottom: 8px; color: var(--c); }
.mt-group ul { list-style: none; margin: 0; padding: 0; }
.mt-group li a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    min-height: 48px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-2);
    color: var(--cream);
    text-decoration: none;
    font-size: 18px;
    transition: color .2s, padding .3s var(--spring);
}
.mt-group li a small { font-family: var(--mono); font-size: 12px; color: var(--dust); white-space: nowrap; }
.mt-group li a:hover { color: var(--mustard); padding-left: 8px; }
.mt-group li[hidden], .mt-group[hidden] { display: none; }

/* AI-legeplads */

.mt-chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 920px;
}
.mt-log {
    list-style: none;
    margin: 0;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: min(46vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: var(--line-2) transparent;
}
.mt-empty p { margin: 0 0 12px; color: var(--sand); }
.mt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-chip {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line-2);
    border-radius: 9999px;
    background: rgba(30, 18, 12, .7);
    font-size: 14px;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.mt-chip:hover { background: var(--cream); color: var(--night); border-color: var(--cream); }

.mt-msg { display: flex; flex-direction: column; gap: 6px; max-width: min(100%, 760px); animation: mt-rise .45s var(--ease) both; }
.mt-msg-who { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--dust); }
.mt-msg-body {
    padding: 14px 18px;
    border-radius: 20px 20px 20px 6px;
    background: rgba(30, 18, 12, .9);
    border: 1px solid var(--line);
    overflow-wrap: anywhere;
}
.mt-msg-body p { margin: 0 0 .7em; }
.mt-msg-body p:last-child { margin-bottom: 0; }
.mt-msg-body ul, .mt-msg-body ol { margin: 0 0 .7em; padding-left: 1.3em; }
.mt-msg-body code { font-family: var(--mono); font-size: .9em; padding: 1px 5px; border-radius: 5px; background: var(--night); color: var(--mustard); }
.mt-msg-body pre { margin: 0 0 .7em; padding: 14px; border-radius: 12px; background: #0D0704; overflow-x: auto; }
.mt-msg-body pre code { padding: 0; background: none; color: var(--cream); font-size: 14px; line-height: 1.55; }
.mt-msg-body h4 { margin: 0 0 .4em; font-family: var(--display); font-size: 21px; }
.mt-msg.is-user { align-self: flex-end; align-items: flex-end; }
.mt-msg.is-user .mt-msg-body { border-radius: 20px 20px 6px 20px; background: var(--cream); color: var(--night); border-color: var(--cream); white-space: pre-wrap; }
.mt-msg.is-error .mt-msg-body { background: var(--rust); border-color: var(--rust); }
.mt-msg-wait { display: inline-flex; gap: 4px; align-items: flex-end; height: 18px; }
.mt-msg-wait i { width: 4px; border-radius: 2px; background: var(--teal-hi); animation: mt-vu .9s ease-in-out infinite; }
.mt-msg-wait i:nth-child(2) { animation-delay: .15s; }
.mt-msg-wait i:nth-child(3) { animation-delay: .3s; }
.mt-msg-wait i:nth-child(4) { animation-delay: .45s; }

.mt-compose {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 22px;
    background: rgba(43, 26, 18, .9);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 0 1px var(--line-2);
}
.mt-compose textarea {
    min-height: 56px !important;
    max-height: 40vh;
    padding: 14px 16px !important;
    resize: none;
    line-height: 1.45;
    font-size: 17px !important;
}
.mt-compose-bar { display: flex; align-items: center; gap: 12px; }
.mt-compose-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--dust); }

/* Støj mellem stationer */

.mt-static {
    --static: 0;
    grid-area: 1 / 1;
    align-self: stretch;
    min-height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    opacity: var(--static);
    pointer-events: none;
    border-radius: 28px;
    background-image: repeating-linear-gradient(0deg, rgba(244, 231, 207, .06) 0 1px, transparent 1px 3px);
    animation: mt-noise .35s steps(5) infinite;
    transition: opacity .3s;
}
.mt-static-text { margin: 0; font-family: var(--display); font-style: italic; font-size: clamp(28px, 4vw, 52px); color: var(--cream); }

/* Kassetten */

.mt-cassette {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--gutter) 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.mt-cassette .mt-kicker { display: inline-flex; align-items: center; gap: 10px; color: var(--sand); }
.mt-cassette svg { fill: none; stroke: var(--mustard); stroke-width: 1.8; }
.mt-tape { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mt-tape :is(a, button) {
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line-2);
    border-radius: 8px;
    background: rgba(30, 18, 12, .8);
    font-family: var(--mono);
    font-size: 12px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.mt .mt-tape a, .mt .mt-tape a:hover { color: inherit; text-decoration: none; }
.mt-tape a[aria-current] { border-color: var(--c); }
.mt-tape :is(a, button)::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mt-tape :is(a, button):hover { border-color: var(--c); background: var(--espresso); }

/* Tuner-dækket */

.mt-deck {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 14px var(--gutter) calc(16px + env(safe-area-inset-bottom));
    background: var(--teak);
    border-top: 6px solid var(--line);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, .35);
}
.mt-deck-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 24px);
}

.mt-seek {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--espresso);
    color: var(--mustard) !important;
    box-shadow: 0 3px 0 var(--night);
    cursor: pointer;
    transition: transform .15s;
}
.mt-seek svg { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mt-seek:hover { transform: translateY(-2px); }
.mt-seek:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--night); }

.mt-knob {
    flex: 0 0 auto;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    padding: 8px;
    background: var(--espresso);
    box-shadow: 0 0 0 5px var(--line), 0 0 0 7px var(--teak-hi), 0 10px 20px rgba(0, 0, 0, .4);
}
.mt-knob-cap {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--line);
    transform: rotate(var(--deg, -150deg));
    transition: transform .55s var(--spring);
}
.mt-knob-cap i {
    position: absolute;
    top: 5px;
    left: 50%;
    width: 4px;
    height: 20px;
    margin-left: -2px;
    border-radius: 2px;
    background: var(--mustard);
    box-shadow: 0 0 8px var(--mustard);
}

.mt-band { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.mt-markers { position: relative; height: 40px; margin: 0 12px; }
.mt-marker {
    position: absolute;
    left: var(--left);
    bottom: 0;
    transform: translateX(-50%);
    min-height: 36px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--espresso);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .25s, color .25s;
}
.mt a.mt-marker, .mt a.mt-marker:hover { color: inherit; }
.mt-marker kbd { font: inherit; font-size: 10px; color: var(--dust); }
.mt-marker:hover { border-color: var(--c); }
.mt-marker.is-active { background: var(--c); color: var(--night) !important; }
.mt-marker.is-active kbd { color: var(--night); }

.mt-scale {
    position: relative;
    height: 60px;
    border-radius: 12px;
    background: var(--night);
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, .6);
}
.mt-scale-ticks {
    position: absolute;
    inset: 0 12px;
    background:
        linear-gradient(90deg, var(--dust) 1px, transparent 1px) 0 100% / 1% 22% repeat-x,
        linear-gradient(90deg, var(--dust) 1px, transparent 1px) 0 100% / 5% 40% repeat-x,
        linear-gradient(90deg, var(--sand) 1px, transparent 1px) 0 100% / 10% 62% repeat-x;
}
.mt-scale-mark {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(12px + (100% - 24px) * var(--n, 0));
    width: 3px;
    margin-left: -1px;
    background: var(--c);
    opacity: .45;
}
.mt-range {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0 8px;
    width: calc(100% - 16px);
    height: 100%;
    margin: 0;
    background: transparent;
    cursor: ew-resize;
    touch-action: pan-y;
}
.mt-range::-webkit-slider-runnable-track { height: 60px; background: transparent; }
.mt-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px;
    height: 60px;
    border-radius: 4px;
    background: var(--orange);
    box-shadow: 0 0 22px var(--orange), 0 0 3px var(--cream);
}
.mt-range::-moz-range-track { height: 60px; background: transparent; }
.mt-range::-moz-range-thumb { width: 8px; height: 60px; border: 0; border-radius: 4px; background: var(--orange); box-shadow: 0 0 22px var(--orange); }
.mt-range:focus { outline: none; }
.mt-range:focus-visible { outline: 3px solid var(--mustard); outline-offset: 4px; }
.mt-scale-nums { margin: 0 12px; color: var(--cream); opacity: .75; }

.mt-readout { flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; min-width: 128px; }
.mt-freq { font-family: var(--mono); font-size: 28px; font-weight: 600; line-height: 1; }
.mt-meter { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
.mt-meter i.is-on { background: var(--avocado-hi); }
.mt-meter i.is-on:nth-child(n+6) { background: var(--mustard); }
.mt-meter i.is-on:nth-child(8) { background: var(--orange); }
.mt-lock { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--cream); opacity: .85; }

@media (max-width: 860px) {
    .mt-knob { display: none; }
    .mt-deck-inner { flex-wrap: wrap; }
    .mt-band { order: -1; flex: 1 1 100%; }
    .mt-markers {
        height: auto;
        margin: 0;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 2px;
    }
    .mt-markers::-webkit-scrollbar { display: none; }
    .mt-marker { position: static; transform: none; flex: 0 0 auto; min-height: 40px; }
    .mt-scale { height: 48px; }
    .mt-range::-webkit-slider-runnable-track { height: 48px; }
    .mt-range::-webkit-slider-thumb { height: 48px; }
    .mt-range::-moz-range-thumb { height: 48px; }
    .mt-readout { flex: 1; flex-direction: row; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
    .mt-freq { font-size: 22px; }
    .mt-meter { width: 72px; }
    .mt-clock { display: none; }
    .mt-cassette { display: none; }
}

@media (max-width: 480px) {
    .mt-marker kbd { display: none; }
}

/* --- Bevægelse ------------------------------------------------------- */

@keyframes mt-drift { to { transform: translate3d(-520px, 260px, 0); } }
@keyframes mt-pulse { 50% { opacity: .3; } }
@keyframes mt-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes mt-noise { to { background-position: 0 30px; } }
@keyframes mt-vu { 0%, 100% { height: 4px; } 50% { height: 18px; } }

/* ==========================================================================
   v2: Dashboard, Home Assistant, nyheder og rigere links
   ========================================================================== */

.mt-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 14px;
    align-items: start;
}
.mt-widget {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    padding: 18px;
    border: 1.5px solid var(--line);
    border-radius: 22px;
    background: rgba(30, 18, 12, .84);
    backdrop-filter: blur(12px);
}
.mt-w-wide { grid-column: 1 / -1; }
.mt-station[data-station="dashboard"] { gap: 12px; }
.mt-station[data-station="dashboard"] .mt-st-name { font-size: clamp(48px, 6.5vw, 104px); }
.mt-station[data-station="dashboard"] .mt-st-lede { margin-bottom: 6px; }
.mt-widget > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mt-widget h3 { color: var(--c); }
.mt-w-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--dust); }
.mt-w-more { min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--mustard) !important; font-family: var(--mono) !important; font-size: 12px; cursor: pointer; }
.mt-w-more:hover { background: var(--line); }
a.mt-w-more { display: inline-flex; align-items: center; text-decoration: none; }
.mt-w-foot { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--sand); }

/* Målere */
.mt-gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mt-gauge { position: relative; display: flex; flex-direction: column; gap: 4px; padding-bottom: 10px; }
.mt-gauge span { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--dust); }
.mt-gauge b { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; font-variation-settings: 'SOFT' 100; }
.mt-bar-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.mt-bar-fill::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); border-radius: 3px; background: var(--avocado-hi); transition: width .8s var(--ease), background .3s; }
.mt-bar-fill.is-warn::after { background: var(--mustard); }
.mt-bar-fill.is-hot::after { background: var(--orange); }

/* Rækker (tjenester, Proxmox, Ollama, genveje) */
.mt-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mt-rows > li { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); font-size: 15px; }
.mt-rows > li:last-child { border-bottom: 0; }
.mt-rows small { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dust); white-space: nowrap; }
.mt-led { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--dust); }
.mt-led.is-up { background: var(--avocado-hi); box-shadow: 0 0 8px var(--avocado-hi); }
.mt-led.is-down { background: var(--orange); box-shadow: 0 0 8px var(--orange); animation: mt-pulse 1.2s ease-in-out infinite; }
.mt-led.is-idle { background: var(--line-2); }
.mt-row-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--cream) !important;
    text-align: left;
    text-decoration: none;
    font-size: 15px;
    cursor: pointer;
}
.mt-row-link:hover { color: var(--mustard) !important; }
.mt-row-link small { margin-left: auto; }
.mt-px-node { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px 12px; align-items: center; margin-bottom: 6px; font-family: var(--mono); font-size: 12px; }
.mt-px-node b { font-family: var(--body); font-size: 15px; }

/* Home Assistant-felter */
.mt-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr)); gap: 10px; }
.mt-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 118px;
    padding: 14px;
    border: 1.5px solid var(--line-2);
    border-radius: 18px;
    background: var(--night-2);
    color: var(--cream) !important;
    text-align: left;
    font: inherit;
    overflow: hidden;
    transition: background .3s, border-color .3s, transform .2s var(--spring), box-shadow .3s;
}
button.mt-tile { cursor: pointer; }
button.mt-tile:hover { transform: translateY(-2px); border-color: var(--mustard); }
button.mt-tile:active { transform: scale(.97); }
.mt-tile.is-on { background: var(--mustard); border-color: var(--mustard); color: var(--night) !important; box-shadow: 0 0 30px rgba(226, 167, 46, .35); }
.mt-tile.is-on .mt-tile-state { color: var(--espresso); }
.mt-tile.is-off-line { opacity: .45; }
.mt-tile.is-busy::after { content: ''; position: absolute; inset: auto 0 0; height: 3px; background: var(--orange); animation: mt-load 1s linear infinite; }
.mt-tile-icon { width: 28px; height: 28px; }
.mt-tile-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mt-tile-name { margin-top: auto; font-weight: 600; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.mt-tile-state { font-family: var(--mono); font-size: 12px; color: var(--sand); }
.mt-tile-value { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; font-variation-settings: 'SOFT' 100; }
.mt-tile-value small { font-family: var(--mono); font-size: 13px; font-weight: 400; margin-left: 2px; }
.mt-tile-ctrl { display: flex; align-items: center; gap: 6px; }
.mt-tile-ctrl button { min-width: 36px; min-height: 36px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--espresso); color: var(--cream); font-family: var(--mono); cursor: pointer; }
.mt-tile-ctrl button:hover { border-color: var(--mustard); }
.mt-tile input[type="range"] { width: 100%; accent-color: var(--orange); }
.mt-tile.is-on input[type="range"] { accent-color: var(--espresso); }

/* Nyheder */
.mt-news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.mt-news li a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line-2);
    color: var(--cream);
    text-decoration: none;
}
.mt-news li a:hover .mt-news-title { color: var(--mustard); }
.mt-news-title { font-size: 16px; line-height: 1.35; transition: color .2s; }
.mt-news-meta { grid-column: 1; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; color: var(--dust); }
.mt-news-age { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: var(--mono); font-size: 11px; color: var(--sand); white-space: nowrap; }
.mt-news-full .mt-news-title { font-family: var(--display); font-size: clamp(19px, 2vw, 24px); font-weight: 600; font-variation-settings: 'SOFT' 100; }
.mt-news-full li a { padding: 14px 0; }
.mt-news-day { margin: 18px 0 2px; font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--c); }

/* Links v2 */
.mt-li-icon { flex: 0 0 auto; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--lc, var(--line)); font-size: 15px; overflow: hidden; }
.mt-li-icon img { width: 18px; height: 18px; }
.mt-group li a { justify-content: flex-start; align-items: center; }
.mt-group li a small { margin-left: auto; }
.mt-li-text { display: flex; flex-direction: column; min-width: 0; }
.mt-li-text em { font-style: normal; font-size: 13px; color: var(--sand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* AI-udbyder */
.mt-provider {
    min-height: 40px;
    max-width: 260px;
    padding: 0 10px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: var(--night-2);
    color: var(--cream);
    font-family: var(--mono);
    font-size: 12px;
}
.mt-compose-bar { flex-wrap: wrap; }

@keyframes mt-load { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (max-width: 600px) {
    .mt-gauges { gap: 8px; }
    .mt-gauge b { font-size: 24px; }
    .mt-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mt-provider { max-width: 100%; flex: 1 1 100%; order: -1; }
    .mt-group li a small { display: none; }
}

/* ==========================================================================
   v2.1: Assistenten – knap, sidepanel, historik, værktøjer og bekræftelse
   ========================================================================== */

.mt-dock {
    position: fixed;
    right: var(--gutter);
    bottom: calc(var(--deck-h, 120px) + 16px);
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 9999px;
    background: var(--mustard);
    color: var(--night) !important;
    box-shadow: 0 4px 0 var(--teak), 0 16px 40px rgba(0, 0, 0, .45);
    font-family: var(--display) !important;
    font-size: 19px;
    font-weight: 800;
    font-variation-settings: 'SOFT' 100, 'WONK' 1;
    cursor: pointer;
    transition: transform .2s var(--spring), box-shadow .2s;
}
.mt-dock:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--teak), 0 20px 44px rgba(0, 0, 0, .5); }
.mt-dock kbd { padding: 1px 7px; border-radius: 6px; background: rgba(20, 11, 7, .15); font-family: var(--mono); font-size: 12px; }
.mt-dock[hidden], .has-drawer .mt-dock { display: none; }

.mt-drawer {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: calc(var(--deck-h, 120px) + 12px);
    z-index: 40;
    width: min(480px, calc(100vw - 24px));
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--line-2);
    border-radius: 24px;
    background: rgba(24, 14, 9, .96);
    backdrop-filter: blur(18px) saturate(1.2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 6px rgba(58, 36, 24, .55);
    overflow: hidden;
    transform: translateX(calc(100% + 24px));
    transition: transform .3s var(--ease);
}
.mt-drawer.is-open { transform: none; }
.mt-drawer-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.mt-drawer-title { flex: 1; font-family: var(--display); font-size: 21px; font-weight: 800; font-variation-settings: 'SOFT' 100, 'WONK' 1; color: var(--mustard); }
.mt-icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--sand) !important; cursor: pointer; }
.mt-icon-btn:hover, .mt-icon-btn[aria-expanded="true"] { background: var(--line); color: var(--cream) !important; }
.mt-icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mt-drawer-history { max-height: 50%; overflow: auto; padding: 12px; border-bottom: 1px solid var(--line); }
.mt-drawer-chat { flex: 1; min-height: 0; display: flex; padding: 12px; }

/* Fuld visning på AI-stationen */
.mt-ai-layout { display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 20px; align-items: start; }
.mt-ai-side { position: sticky; top: 12px; }
.mt-station[data-station="ai"] { gap: 12px; }
.mt-station[data-station="ai"] .mt-st-name { font-size: clamp(40px, 5vw, 80px); }
.mt-ai-main .mt-chat { height: calc(100dvh - var(--deck-h, 120px) - 290px); min-height: 380px; }
.mt-ai-main .mt-log { flex: 1; max-height: none; }
.mt-ai-side .mt-history-list { max-height: calc(100dvh - var(--deck-h, 120px) - 400px); min-height: 160px; }
.mt-compose textarea { overflow-y: hidden; }

/* Chatten */
.mt-chat { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: none; min-height: 0; }
.mt-drawer .mt-chat { height: 100%; }
.mt-drawer .mt-log { flex: 1; max-height: none; }
.mt-chat-head { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.mt-chat-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--sand); }
.mt-provider[hidden] { display: none; }
.mt-log { padding-right: 4px; }
.mt-empty .mt-chips { margin-top: 4px; }

.mt-msg.is-thinking .mt-msg-who::after { content: ' · tænker…'; color: var(--teal-hi); text-transform: none; letter-spacing: .04em; }
.mt-msg.is-live .mt-msg-body > :last-child::after { content: '▍'; margin-left: 2px; color: var(--mustard); animation: mt-pulse .9s steps(2) infinite; }
.mt-msg-body[hidden] { display: none; }

.mt-tools { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mt-tools:empty { display: none; }
.mt-tool {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--line-2);
    border-radius: 10px;
    background: rgba(20, 11, 7, .7);
    font-family: var(--mono);
    font-size: 12px;
}
.mt-tool::before { content: '⚙'; color: var(--dust); }
.mt-tool-label { font-weight: 600; color: var(--cream); white-space: nowrap; }
.mt-tool-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sand); }
.mt-tool-state { color: var(--dust); white-space: nowrap; }
.mt-tool[data-state="preparing"], .mt-tool[data-state="running"] { border-color: var(--mustard); }
.mt-tool[data-state="preparing"]::before, .mt-tool[data-state="running"]::before { color: var(--mustard); display: inline-block; animation: mt-spin 1.2s linear infinite; }
.mt-tool[data-state="done"] .mt-tool-state { color: var(--avocado-hi); }
.mt-tool[data-state="error"], .mt-tool[data-state="denied"] { border-color: var(--orange); }
.mt-tool[data-state="error"] .mt-tool-state, .mt-tool[data-state="denied"] .mt-tool-state { color: var(--orange); }
.mt-tool[data-state="confirm"] { border-color: var(--mustard); box-shadow: 0 0 16px rgba(226, 167, 46, .25); }
.mt-tool[data-state="confirm"] .mt-tool-state { color: var(--mustard); }

.mt-confirm { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 2px solid var(--mustard); border-radius: 16px; background: var(--espresso); animation: mt-rise .3s var(--ease) both; }
.mt-confirm[hidden] { display: none; }
.mt-confirm ul { margin: 0; padding-left: 18px; font-size: 15px; }
.mt-confirm-actions { display: flex; gap: 8px; }
.mt-confirm .mt-cta-sm { min-height: 44px; }

.mt-compose { flex-direction: row; align-items: flex-end; gap: 8px; padding: 8px; }
.mt-compose textarea { flex: 1; min-height: 52px !important; }
.mt-send {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--mustard);
    color: var(--night) !important;
    box-shadow: 0 3px 0 var(--teak);
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.mt-send:hover { transform: translateY(-2px); }
.mt-send svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.mt-send.is-stop { background: var(--orange); }
.mt-send.is-stop svg { fill: currentColor; }

/* Historik */
.mt-history { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mt-history-head { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-history-head .mt-new { flex: 1 1 auto; }
.mt-history-head input { flex: 1 1 100%; min-height: 44px !important; border-radius: 9999px !important; font-size: 15px !important; }
.mt-history-list { display: flex; flex-direction: column; gap: 14px; max-height: min(52vh, 560px); overflow: auto; padding-right: 2px; }
.mt-drawer .mt-history-list { max-height: none; }
.mt-hgroup h3 { margin-bottom: 4px; color: var(--sand); font-size: 11px; }
.mt-hgroup ul { list-style: none; margin: 0; padding: 0; }
.mt-hitem { position: relative; display: flex; align-items: center; border-radius: 10px; }
.mt-hitem:hover, .mt-hitem.is-active { background: var(--espresso); }
.mt-hitem.is-active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--c); }
.mt-hitem.is-offline { opacity: .55; }
.mt-hopen { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; background: none; color: var(--cream) !important; text-align: left; cursor: pointer; }
.mt-htitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mt-hopen small { font-family: var(--mono); font-size: 11px; color: var(--dust); white-space: nowrap; }
.mt-hact { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--dust) !important; cursor: pointer; opacity: 0; }
.mt-hitem:hover .mt-hact, .mt-hitem:focus-within .mt-hact { opacity: 1; }
.mt-hact:hover { background: var(--line); color: var(--cream) !important; }
@media (hover: none) { .mt-hact { opacity: 1; } }

@keyframes mt-spin { to { transform: rotate(360deg); } }

@media (max-width: 860px) {
    .mt-ai-layout { grid-template-columns: minmax(0, 1fr); }
    .mt-ai-side { position: static; }
    .mt-ai-side .mt-history-list { max-height: 28vh; }
}
@media (max-width: 600px) {
    .mt-drawer { top: 0; right: 0; left: 0; width: 100%; border-radius: 0; border-width: 0; bottom: var(--deck-h, 150px); }
    .mt-dock { padding: 0 16px; font-size: 17px; }
    .mt-dock kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* --- Stationssider ---------------------------------------------------- */

/* Hver station er sin egen side; browsere med sideovergange toner blødt mellem dem, mens dækket står stille. */
@view-transition { navigation: auto; }
.mt-deck { view-transition-name: mt-deck; }
@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* Sidens eget indhold fra WordPress-editoren, over stationens funktion. */
.mt-prose { max-width: 72ch; color: var(--sand); }
.mt-prose > :first-child { margin-top: 0; }
.mt-prose > :last-child { margin-bottom: 0; }
.mt-prose :is(h2, h3, h4) { margin: 1.2em 0 .4em; font-family: var(--display); font-weight: 700; line-height: 1.15; color: var(--cream); }
.mt-prose h2 { font-size: clamp(24px, 3vw, 34px); }
.mt-prose h3 { font-size: clamp(20px, 2.2vw, 26px); }
.mt-prose :is(p, ul, ol, blockquote, figure, pre, table) { margin: 0 0 1em; }
.mt-prose :is(img, video, iframe) { max-width: 100%; height: auto; border-radius: 12px; }
.mt-prose blockquote { padding-left: 16px; border-left: 3px solid var(--c, var(--mustard)); font-style: italic; }
.mt-prose :is(code, pre) { font-family: var(--mono); font-size: .9em; }
.mt-prose pre { padding: 14px 16px; overflow-x: auto; border: 1px solid var(--line-2); border-radius: 12px; background: var(--espresso); }

/* --- Indlejret i barbersalonens modalvindue (?indlejret=1) ----------- */

.mt-embed :is(.mt-sky, .mt-bar, .mt-cassette, .mt-dock, .mt-deck, .mt-skip, .mt-static, .nw-mark) { display: none !important; }
body.mt-embed { min-height: 100%; background: var(--night); }
.mt-embed.mt-tuner { display: block; }
.mt-embed .mt-stage { min-height: 0; padding-top: clamp(16px, 3vh, 28px); padding-bottom: 32px; }
.mt-embed .mt-drawer { top: 8px; right: 8px; bottom: 8px; }
.mt-focus-hjemmet .mt-widgets > :not(.mt-w-home), .mt-focus-hjemmet .mt-st-lede { display: none; }

/* --- Opslagstavlen: opslag og egne links ---------------------------------- */
.mt-board { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px 36px; align-items: start; margin-bottom: 36px; }
.mt-board .mt-kicker { margin: 0 0 10px; }
.mt-board-form { display: flex; flex-direction: column; gap: 10px; }
.mt-board-form label:not(.mt-sr) { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--sand); }
.mt-board-form textarea { min-height: 88px; resize: vertical; }
.mt-board-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-board-row input { flex: 1 1 200px; min-width: 0; }
.mt-board-row select, .mt-board-form select {
    flex: 0 1 180px;
    min-height: 48px;
    padding: 0 12px;
    border: 2px solid var(--line-2);
    border-radius: 14px;
    background: var(--night);
    color: var(--cream);
    font: inherit;
}
.mt-board-send {
    flex: 0 0 auto;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: var(--rust);
    color: var(--cream);
    box-shadow: 0 3px 0 #000;
    font-family: var(--display);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
}
.mt-board-send:hover { filter: brightness(1.1); }
.mt-board-send:disabled { opacity: .7; cursor: progress; }
.mt-board-links .mt-board-send { align-self: flex-start; }
.mt-board-form label.mt-board-check { flex-direction: row; align-items: center; gap: 10px; color: var(--cream); font-size: 14px; }
.mt-board-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--mustard); }
.mt-board-msg { margin: 0; font-size: 14px; color: var(--teal-hi); }
.mt-board-msg:empty { display: none; }
.mt-board-msg.is-error { color: var(--orange); }
.mt-notes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; }
.mt-note {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 44px 16px 16px;
    border-radius: 4px 4px 16px 4px;
    background: var(--cream);
    color: var(--night);
    box-shadow: 0 6px 0 rgba(0, 0, 0, .35);
    transform: rotate(-.6deg);
}
.mt-note:nth-child(3n + 2) { transform: rotate(.7deg); background: #F2D9A6; }
.mt-note:nth-child(3n) { transform: rotate(-.2deg); background: #E8E0C8; }
.mt-note::before { content: ''; position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--rust); box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.mt-note.is-direct::before { background: var(--petrol); }
.mt-note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; font-family: var(--mono); font-size: 12px; color: #5A3B28; }
.mt-note-head b { font-family: var(--body); font-size: 14px; color: var(--night); }
.mt-note-head time { margin-left: auto; }
.mt-note-new { padding: 1px 6px; border-radius: 6px; background: var(--orange); color: var(--night); font-weight: 700; }
.mt-note-body { margin: 0; font-size: 16px; line-height: 1.45; white-space: pre-line; overflow-wrap: anywhere; }
.mt .mt-note-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 6px 12px; border-radius: 10px; background: var(--night); color: var(--cream); font-family: var(--mono); font-size: 13px; text-decoration: none; max-width: 100%; }
.mt .mt-note-link:hover { color: var(--mustard); }
.mt-note-link span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-note-del { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: #5A3B28; cursor: pointer; }
.mt-note-del:hover { background: var(--rust); color: var(--cream); }
.mt-note-del svg, .mt-li-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
[data-mylinks] { display: contents; }
.mt-group-own li { display: flex; align-items: center; gap: 4px; }
.mt-group-own li > a { flex: 1; min-width: 0; }
.mt-li-tools { display: flex; gap: 4px; flex: 0 0 auto; }
.mt-li-tool { min-width: 32px; height: 32px; padding: 0 8px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 16px; background: var(--night); color: var(--sand); font-family: var(--mono); font-size: 11px; cursor: pointer; }
.mt-li-tool:hover { color: var(--cream); border-color: var(--cream); }
.mt-li-tool[aria-pressed="true"] { color: var(--teal-hi); border-color: var(--teal-hi); }
.mt-li-del { padding: 0; border: 0; background: transparent; }
.mt-li-del:hover { background: var(--rust); }
@media (max-width: 860px) {
    .mt-board { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    .mt-note, .mt-note:nth-child(n) { transform: none; }
}
.mt .mt-board-form textarea { padding: 14px 18px; font-size: 16px; line-height: 1.45; }
.mt .mt-board-form input[type="text"] { min-height: 48px; font-size: 16px; }
