/* ThinkMate synthetic shell. Loaded only for /thinkmate requests (see _Host.cshtml).
   Colours, Inter and patterns follow output/next-culture-cockpit-daily/daily.css. */

:root {
    --tm-primary: #1f5466;
    --tm-primaryfade: hsl(195, 33%, 45%);
    --tm-mercury: #f6f6fa;
    --tm-turquoise: #4ecdc4;
    --tm-gray: #6c6b72;
    --tm-line: #e0e2e8;
    --tm-ink: #263d48;
    --tm-nav-gradient: linear-gradient(180deg, #1f5465 0%, #0c3c4d 100%);
    --tm-focus: #278b84;
}

*, *::before, *::after { box-sizing: border-box; }

body.tm-host {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: var(--tm-mercury);
    color: var(--tm-ink);
    overflow-wrap: break-word;
}

.tm-host button, .tm-host textarea { font: inherit; }

.tm-host button {
    cursor: pointer;
    min-height: 44px;
    padding: 9px 14px;
    border: 1px solid var(--tm-line);
    border-radius: 8px;
    background: #fff;
    color: var(--tm-primary);
    font-weight: 600;
}

.tm-host button:hover { filter: brightness(.96); }

.tm-host button:focus-visible,
.tm-host a:focus-visible,
.tm-host textarea:focus-visible,
.tm-main:focus-visible {
    outline: 3px solid var(--tm-focus);
    outline-offset: 3px;
}

.tm-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.tm-skip {
    position: absolute;
    left: 8px;
    top: -100px;
    z-index: 100;
}

.tm-skip:focus { top: 8px; }

.tm-host .tm-primary {
    background: linear-gradient(to right, var(--tm-primary), var(--tm-primaryfade));
    color: #fff;
    border: 0;
}

/* Demo banner */
.tm-demo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    min-height: 32px;
    padding: 4px 12px;
    background: #e8eef0;
    color: #45616c;
    font-size: 11px;
    text-align: center;
}

.tm-host .tm-demo button {
    min-height: 28px;
    padding: 2px 8px;
    font-size: 11px;
    background: transparent;
    white-space: nowrap;
}

/* Frame */
.tm-frame {
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    min-height: calc(100dvh - 32px);
}

.tm-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 32px);
    padding: 28px 16px 16px;
    background: var(--tm-nav-gradient);
    color: #f0f0f2;
    overflow-y: auto;
}

.tm-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px 28px;
    color: #fff;
    font-size: 19px;
    line-height: 1.2;
}

.tm-brand img {
    width: 45px;
    height: 45px;
    padding: 5px;
    border-radius: 10px;
    background: #fff;
    flex-shrink: 0;
}

.tm-brand b { font-weight: 650; }
.tm-brand-word { display: block; white-space: nowrap; }
.tm-brand small { display: block; margin-top: 5px; font-size: 10px; color: #b6d1d9; }

.tm-space-label {
    padding: 12px 12px 15px;
    border-top: 1px solid #ffffff20;
    color: #b6d1d9;
    font-size: 9px;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.tm-nav { display: grid; gap: 5px; }

.tm-host .tm-nav-item {
    width: 100%;
    padding: 13px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #e1eaee;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
}

.tm-host .tm-nav-item:hover { background: #4ecdc426; filter: none; }

.tm-host .tm-nav-item[aria-current=page] {
    background: #4ecdc44d;
    color: #fff;
    box-shadow: inset 3px 0 0 var(--tm-turquoise);
    font-weight: 650;
}

.tm-sidebar .tm-nav-item:focus-visible,
.tm-mobile-nav .tm-nav-item:focus-visible { outline-color: var(--tm-turquoise); }

.tm-side-note {
    margin: 35px 10px 0;
    padding-top: 25px;
    border-top: 1px solid #ffffff20;
    color: #c4d9df;
    font-size: 11px;
}

.tm-side-note strong { display: block; color: #fff; font-size: 12px; }
.tm-side-note p { margin: 4px 0 0; }

/* Workspace */
.tm-workspace {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100dvh - 32px);
}

.tm-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 15px;
    min-height: 73px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--tm-line);
    background: #fff;
}

.tm-header > div { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tm-header-brand { font-size: 13px; font-weight: 650; }
.tm-crumb { color: var(--tm-gray); font-size: 12px; }

.tm-main {
    flex: 1;
    width: 100%;
    max-width: 1470px;
    min-width: 0;
    margin: 0 auto;
    padding: 30px 32px 24px;
}

.tm-main:focus:not(:focus-visible) { outline: none; }

.tm-main h1 {
    margin: 8px 0 12px;
    color: var(--tm-primary);
    font-size: 31px;
    font-weight: 650;
    line-height: 1.25;
    letter-spacing: -.04em;
}

.tm-main h2 {
    margin: 0 0 13px;
    font-size: 18px;
    font-weight: 650;
    line-height: 1.4;
    letter-spacing: -.02em;
}

.tm-main p { margin: 0 0 13px; }

.tm-eyebrow {
    color: var(--tm-primaryfade);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.tm-main .tm-eyebrow { margin: 0; }
.tm-sub { color: var(--tm-gray); font-size: 13px; }
.tm-muted { color: var(--tm-gray); font-size: 12px; }

.tm-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 22px;
    margin-top: 22px;
}

.tm-card {
    min-width: 0;
    padding: 21px;
    border: 1px solid var(--tm-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 14px #1f546604;
}

.tm-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tm-between h2 { margin: 0; }

.tm-pill {
    padding: 4px 8px;
    border-radius: 4px;
    background: #eef3f5;
    color: #3b6271;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.tm-pill-green { background: #e4f4ee; color: #27674b; }
.tm-pill-amber { background: #fff2df; color: #835f2c; }
.tm-pill-private { background: #f0edf6; color: #6d5a8d; }

.tm-notice {
    padding: 12px 15px;
    border-left: 3px solid #71aca7;
    border-radius: 7px;
    background: #eef4f4;
    color: #45616c;
    font-size: 12px;
}

/* Conversation */
.tm-messages { margin: 0; padding: 0; list-style: none; }

.tm-message {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 13px;
}

.tm-message > div { flex: 1; min-width: 0; }
.tm-message strong { font-size: 12px; }
.tm-main .tm-message p { margin: 7px 0 0; }

.tm-message-user {
    display: block;
    margin-left: 35px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #edf1f4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tm-coach-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 29px;
    height: 29px;
    border-radius: 8px;
    background: #e2f3f0;
    color: var(--tm-primary);
    font-size: 10px;
    font-weight: 700;
}

.tm-quick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 22px;
}

.tm-host .tm-quick button {
    min-height: 72px;
    font-size: 12px;
    font-weight: 650;
    text-align: left;
}

.tm-quick small {
    display: block;
    margin-top: 5px;
    color: var(--tm-gray);
    font-size: 11px;
    font-weight: 400;
}

/* Tasks */
.tm-task-list { margin: 13px 0; padding: 0; list-style: none; }

.tm-task-list li {
    display: grid;
    gap: 2px;
    padding: 10px 0;
    border-bottom: 1px solid #eeeef2;
    font-size: 12px;
}

.tm-task-list li:last-child { border-bottom: 0; }

.tm-host .tm-link-button {
    padding: 9px 0;
    border: 0;
    background: transparent;
    text-decoration: underline;
}

.tm-tasks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tm-main .tm-task h2 { margin: 12px 0 4px; font-size: 14px; }
.tm-main .tm-task p { margin: 0; }

/* Empty states */
.tm-empty { max-width: 640px; }
.tm-empty p { color: var(--tm-gray); }

/* Chat dock: composer and mobile navigation stick together, so the navigation never
   covers the chat. */
.tm-dock {
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.tm-composer {
    padding: 13px 32px 12px;
    border-top: 1px solid var(--tm-line);
    background: #fff;
}

.tm-contextline {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 9px;
    color: var(--tm-gray);
    font-size: 11px;
}

.tm-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #53a89a;
}

.tm-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 10px 10px 10px 15px;
    border: 1px solid #aebec5;
    border-radius: 10px;
    background: #fafafc;
}

.tm-chat-form:focus-within { border-color: var(--tm-focus); }

.tm-chat-form textarea {
    flex: 1;
    min-width: 0;
    min-height: 33px;
    max-height: 180px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--tm-ink);
    font-size: 14px;
    resize: vertical;
}

.tm-chat-form textarea:focus-visible { outline: none; }

.tm-host .tm-send {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 18px;
}

.tm-chat-hint {
    margin: 6px 0 0;
    color: var(--tm-gray);
    font-size: 10px;
    text-align: right;
}

.tm-mobile-nav { display: none; }

/* Not found and Blazor error UI */
.tm-notfound { padding: 40px 24px; }

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    padding: 12px 48px 12px 16px;
    background: #fff6e9;
    color: #775a35;
    font-size: 13px;
    box-shadow: 0 -1px 4px #0003;
}

#blazor-error-ui .reload { color: var(--tm-primary); font-weight: 600; }

#blazor-error-ui .dismiss {
    position: absolute;
    top: 6px;
    right: 8px;
    min-height: 36px;
    padding: 2px 10px;
}

@media (max-width: 1200px) {
    .tm-frame { grid-template-columns: 190px minmax(0, 1fr); }
    .tm-main { padding: 24px; }
    .tm-header { padding: 12px 24px; }
    .tm-composer { padding: 12px 24px; }
    .tm-grid { grid-template-columns: minmax(0, 1fr) 240px; }
    .tm-brand { font-size: 17px; }
}

@media (max-width: 980px) {
    .tm-grid { grid-template-columns: 1fr; }
    .tm-frame { grid-template-columns: 170px minmax(0, 1fr); }
    .tm-sidebar { padding: 24px 10px; }
    .tm-brand { gap: 8px; padding-left: 5px; font-size: 16px; }
    .tm-brand img { width: 38px; height: 38px; }
    .tm-host .tm-nav-item { padding: 11px 10px; font-size: 12px; }
}

@media (max-width: 720px) {
    .tm-frame { display: block; }
    .tm-sidebar { display: none; }
    .tm-workspace { min-height: calc(100dvh - 40px); }
    .tm-header { min-height: 56px; padding: 8px 16px; }
    .tm-header > div { gap: 10px; }
    .tm-main { padding: 20px 16px; }
    .tm-main h1 { font-size: 26px; }
    .tm-card { padding: 16px; }
    .tm-quick { grid-template-columns: 1fr; gap: 8px; }
    .tm-host .tm-quick button { min-height: 60px; padding: 10px 12px; }
    .tm-message-user { margin-left: 20px; }
    .tm-composer { padding: 8px 12px; }
    .tm-contextline { margin-bottom: 6px; font-size: 10px; }
    .tm-chat-form { padding: 6px 6px 6px 12px; }
    /* 16px avoids the automatic zoom of iOS Safari on focus. */
    .tm-chat-form textarea { font-size: 16px; max-height: 120px; }
    .tm-chat-hint { display: none; }

    .tm-mobile-nav {
        display: flex;
        gap: 2px;
        padding: 5px 6px max(6px, env(safe-area-inset-bottom));
        background: var(--tm-nav-gradient);
    }

    .tm-host .tm-mobile-nav .tm-nav-item {
        flex: 1 1 0;
        min-width: 0;
        min-height: 48px;
        padding: 6px 2px;
        font-size: 12px;
        text-align: center;
        overflow-wrap: anywhere;
    }

    .tm-host .tm-mobile-nav .tm-nav-item[aria-current=page] {
        background: #4ecdc430;
        box-shadow: inset 0 -3px 0 var(--tm-turquoise);
    }
}

@media (max-width: 360px) {
    .tm-demo { font-size: 10px; }
    .tm-header { padding: 8px 12px; }
    .tm-main { padding: 16px 12px; }
    .tm-host .tm-mobile-nav .tm-nav-item { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}

.tm-signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: #eaf3f2; }
.tm-signin-card { width: min(100%, 540px); padding: clamp(24px, 6vw, 48px); overflow-wrap: anywhere; }
.tm-signin-card .tm-brand { color: var(--tm-petrol, #123f43); margin-bottom: 32px; }
.tm-signin-actions { display: grid; gap: 12px; margin: 28px 0; }
.tm-signin-link { display: block; width: 100%; padding: 14px 18px; border: 0; border-radius: 12px; background: #123f43; color: white; text-align: center; text-decoration: none; font: inherit; cursor: pointer; }
.tm-signin-link:focus-visible { outline: 3px solid #4ecdc4; outline-offset: 3px; }
.tm-signin-link:disabled { opacity: .55; cursor: wait; }
.tm-signin-error { padding: 12px; border-left: 3px solid #a63d39; background: #fff3f2; }

/* Authenticated private workspace. */
.tm-authenticated .tm-frame, .tm-authenticated .tm-workspace { min-height: 100dvh; }
.tm-authenticated .tm-sidebar { height: 100dvh; }
.tm-authenticated .tm-header > div { flex-wrap: wrap; }
.tm-authenticated .tm-crumb { overflow-wrap: anywhere; }
.tm-ideas-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; border: 0; padding: 0; margin: 0; min-width: 0; }
.tm-ideas-grid > section { min-width: 0; }
.tm-authenticated input, .tm-authenticated textarea { display: block; width: 100%; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--tm-line); border-radius: 8px; color: var(--tm-ink); background: #fff; }
.tm-authenticated input { min-height: 44px; }
.tm-authenticated textarea { resize: vertical; white-space: pre-wrap; }
.tm-authenticated label { display: block; font-weight: 600; margin: 14px 0 5px; }
.tm-authenticated input:focus-visible { outline: 3px solid var(--tm-focus); outline-offset: 3px; }
.tm-authenticated button:disabled { opacity: .55; cursor: default; }
.tm-idea-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; margin: 12px 0 20px; }
.tm-idea-search label { grid-column: 1 / -1; margin: 0; }
.tm-idea-entries { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.tm-host .tm-idea-entries button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.tm-idea-entries span { display: block; color: var(--tm-gray); font-size: 11px; font-weight: 400; }
.tm-host .tm-idea-entries button[aria-current=true] { border-color: var(--tm-focus); background: #e8f5f3; }
.tm-live-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 8px; }
.tm-live-error { border-left: 4px solid #a33a3a; }
.tm-discard { margin-bottom: 20px; border: 2px solid var(--tm-primary); }
@media (max-width: 1100px) { .tm-ideas-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .tm-authenticated input, .tm-authenticated textarea { font-size: 16px; } .tm-authenticated .tm-header .tm-crumb { max-width: 45vw; } }

/* Private coach and confirmed tasks. */
.tm-pilot-panel[hidden] { display: none; }
.tm-coach-grid { display: grid; grid-template-columns: minmax(180px, 260px) minmax(0, 1fr); gap: 20px; align-items: start; }
.tm-conversation, .tm-conversation-list { min-width: 0; }
.tm-turns { list-style: none; padding: 0; margin: 20px 0; }
.tm-turns > li { margin-bottom: 24px; }
.tm-chat-user, .tm-chat-coach { padding: 16px; border-radius: 14px; margin-bottom: 10px; }
.tm-chat-user { background: #edf4f4; margin-left: 24px; }
.tm-chat-coach { border: 1px solid #d7e7e7; margin-right: 24px; }
.tm-plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tm-proposal { border-left: 3px solid #28b8b0; padding: 12px 16px; background: #f1fbfa; }
.tm-proposal h3 { font-size: 14px; margin-top: 0; }
.tm-coach-compose { display: grid; gap: 10px; margin-top: 18px; }
.tm-coach-compose textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: 12px; border: 1px solid #b7cccc; border-radius: 10px; font: inherit; }
.tm-task-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.tm-task-column { min-width: 0; }
.tm-task-column > h2 { font-size: 17px; }
.tm-task-column > h2 span { color: #607a7c; font-size: 14px; }
.tm-private-task { margin-bottom: 14px; overflow-wrap: anywhere; }
.tm-private-task h3 { font-size: 16px; margin-top: 0; }
.tm-private-task label { display: block; margin-bottom: 6px; }
.tm-private-task select { width: 100%; padding: 8px; font: inherit; border: 1px solid #b7cccc; border-radius: 8px; background: white; }
@media (max-width: 760px) {
  .tm-coach-grid, .tm-task-board { grid-template-columns: minmax(0, 1fr); }
  .tm-conversation-list .tm-idea-entries { max-height: 180px; overflow-y: auto; }
  .tm-chat-user { margin-left: 8px; } .tm-chat-coach { margin-right: 8px; }
}
