/* ============================================================================
   Roxyon AI — interface direction
   One token set, two first-class themes. Graphite rail, paper/ink stage, one
   green accent, brand red only in the wordmark. Hairlines, no heavy shadows.
   ========================================================================== */

/* ---------- tokens: light ---------- */
:root {
    color-scheme: light;

    --bg: #F4F4F5;
    --col: #FFFFFF;
    --panel: #FFFFFF;
    --card: #FFFFFF;
    --line: #E7E7EA;
    --line-soft: #EFEFF2;
    --ink: #232326;
    --ink-2: #5F5F66;
    --ink-3: #8C8C95;
    --bubble: #EEEFF1;
    --sel: #F1F1F4;

    --rail: #383838;
    --rail-2: #2F2F2F;
    --rail-ink: #ECECEF;
    --rail-ink-2: #B9B9BF;
    --rail-line: rgba(255, 255, 255, .10);
    --rail-hover: rgba(255, 255, 255, .07);
    --rail-on: rgba(255, 255, 255, .12);

    --accent: #17854B;          /* green that can carry text on a light surface */
    --accent-bg: #35C46A;       /* the brand green, fills */
    --accent-ink: #06240F;      /* ink on the brand green */
    --accent-soft: #E9F8EF;
    --brand: #D50C2D;           /* the wordmark's own red, never a UI colour */

    --warn: #A66A00;
    --warn-soft: #FBF1DD;
    --bad: #C0392B;
    --bad-soft: #FBEAE7;

    --sh-sm: 0 1px 2px rgba(20, 20, 22, .06);
    --sh-md: 0 18px 40px -26px rgba(20, 20, 22, .45);
    --sh-pal: 0 30px 80px -30px rgba(15, 15, 18, .5), 0 2px 8px rgba(15, 15, 18, .08);

    --r-xs: 7px;
    --r-sm: 9px;
    --r-md: 12px;
    --r-lg: 16px;
    --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- tokens: dark ---------- */
html[data-theme="dark"] {
    color-scheme: dark;

    --bg: #0E0E10;
    --col: #131316;
    --panel: #17171A;
    --card: #1C1C21;
    --line: #26262B;
    --line-soft: #202024;
    --ink: #ECECEF;
    --ink-2: #A2A2AB;
    --ink-3: #6F6F79;
    --bubble: #242429;
    --sel: rgba(255, 255, 255, .055);

    --rail: #121214;
    --rail-2: #17171A;
    --rail-ink: #F0F0F3;
    --rail-ink-2: #A6A6AF;
    --rail-line: rgba(255, 255, 255, .09);
    --rail-hover: rgba(255, 255, 255, .06);
    --rail-on: rgba(255, 255, 255, .10);

    --accent: #46CE7C;
    --accent-bg: #35C46A;
    --accent-ink: #05230F;
    --accent-soft: rgba(53, 196, 106, .14);

    --warn: #E0AE4C;
    --warn-soft: rgba(224, 174, 76, .13);
    --bad: #E06B60;
    --bad-soft: rgba(224, 107, 96, .13);

    --sh-sm: 0 1px 0 rgba(0, 0, 0, .35);
    --sh-md: 0 20px 44px -28px #000;
    --sh-pal: 0 40px 90px -30px #000, 0 2px 10px rgba(0, 0, 0, .5);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "IBM Plex Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

html[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", "Inter", sans-serif; }

h1, h2, h3, h4 { font-family: "Inter Tight", "IBM Plex Sans Arabic", sans-serif; letter-spacing: -.02em; margin: 0; font-weight: 600; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3 { font-family: "IBM Plex Sans Arabic", sans-serif; letter-spacing: 0; }

button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg.ic { display: block; flex: 0 0 auto; }
.num { font-variant-numeric: tabular-nums; }

::selection { background: var(--accent-soft); }

/* scrollbars: quiet */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border: 3px solid transparent; background-clip: content-box; border-radius: 10px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- the wordmark: the published lockup, unchanged ----------
   The file is roxyon.com/images/roxyon.cloud.svg (brand red #D50C2D). On the
   graphite rail it is white, exactly as on the published roxyon.ai panel.
   It is painted as a mask so it stays pixel-exact at any size and takes the
   colour of the surface it sits on. */
.lockup { display: flex; align-items: center; gap: 7px; }
.wordmark {
    display: block;
    height: 15px;
    width: 108px;
    background: currentColor;
    -webkit-mask: url(/images/roxyon-wordmark.svg) no-repeat left center / contain;
    mask: url(/images/roxyon-wordmark.svg) no-repeat left center / contain;
}
.lockup .ai {
    font-family: "Inter Tight", sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: lowercase;
    opacity: .62;
    line-height: 1;
    padding-bottom: 1px;
}

/* ---------- shell ---------- */
.app {
    display: grid;
    grid-template-columns: 258px 300px minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
}
.app.no-list { grid-template-columns: 258px minmax(0, 1fr); }

/* ---------- rail ---------- */
.rail {
    background: var(--rail);
    color: var(--rail-ink);
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-inline-end: 1px solid var(--rail-line);
}
.rail-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 14px 0 16px; flex: 0 0 auto; }
.rail-head .lockup { color: #fff; }
.rail-head .iconbtn { color: rgba(255, 255, 255, .55); }
.rail-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 10px 10px; }
.rail-foot { flex: 0 0 auto; padding: 10px; border-top: 1px solid var(--rail-line); }

.iconbtn {
    width: 30px; height: 30px; border-radius: 8px;
    display: grid; place-items: center; color: var(--ink-2);
    transition: background .15s var(--ease), color .15s var(--ease);
}
.iconbtn:hover { background: var(--sel); color: var(--ink); }
.rail .iconbtn:hover { background: var(--rail-hover); color: #fff; }

/* search / palette trigger */
.rail-search {
    display: flex; align-items: center; gap: 9px; width: 100%;
    height: 34px; padding: 0 9px; margin: 2px 0 12px;
    border-radius: var(--r-sm);
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    color: var(--rail-ink-2); font-size: 13px;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.rail-search:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .14); color: #fff; }
.rail-search .lbl { flex: 1; text-align: start; }
.kbd {
    font-family: "Inter", sans-serif; font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
    padding: 2px 5px; border-radius: 5px; line-height: 1.2;
    background: rgba(255, 255, 255, .09); color: rgba(255, 255, 255, .6);
    border: 1px solid rgba(255, 255, 255, .08);
}
.on-light .kbd, .pal .kbd { background: var(--sel); border-color: var(--line); color: var(--ink-3); }

/* the one strong action */
.btn-new {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 35px; border-radius: var(--r-sm);
    background: var(--accent-bg); color: var(--accent-ink);
    font-size: 13.5px; font-weight: 600; letter-spacing: -.01em;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset;
    transition: transform .12s var(--ease), filter .15s var(--ease);
}
.btn-new:hover { filter: brightness(1.06); }
.btn-new:active { transform: translateY(1px); }

/* nav */
.rail-label {
    font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: rgba(255, 255, 255, .38); padding: 0 8px; margin: 16px 0 6px;
}
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.navitem {
    display: flex; align-items: center; gap: 10px;
    height: 34px; padding: 0 9px; border-radius: var(--r-sm);
    color: var(--rail-ink-2); font-size: 13.5px; font-weight: 500;
    position: relative;
    transition: background .14s var(--ease), color .14s var(--ease);
}
.navitem .ic { opacity: .8; }
.navitem .ct { margin-inline-start: auto; font-size: 11.5px; color: rgba(255, 255, 255, .34); }
.navitem:hover { background: var(--rail-hover); color: #fff; }
.navitem.active { background: var(--rail-on); color: #fff; font-weight: 600; }
.navitem.active .ic { opacity: 1; }
.navitem.active::before {
    content: ""; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px;
    width: 2px; border-radius: 2px; background: var(--accent-bg);
}

/* mini chat rows in the rail */
.rail-chat {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 9px; border-radius: 8px; font-size: 12.5px; color: var(--rail-ink-2);
    transition: background .14s var(--ease), color .14s var(--ease);
}
.rail-chat:hover { background: var(--rail-hover); color: #fff; }
.rail-chat .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .3); flex: 0 0 auto; }
.rail-chat .dot.run { background: var(--accent-bg); box-shadow: 0 0 0 3px rgba(53, 196, 106, .18); }
.rail-chat .tt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* account row */
.me {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 8px; border-radius: var(--r-sm); text-align: start;
    transition: background .15s var(--ease);
}
.me:hover { background: var(--rail-hover); }
.avatar {
    width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: linear-gradient(150deg, #4BD782, #1E9C55);
    color: #06240F; font-size: 11px; font-weight: 700; letter-spacing: .02em;
}
.me-txt { min-width: 0; flex: 1; }
.me-name { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-plan { font-size: 11px; color: rgba(255, 255, 255, .42); line-height: 1.35; }

/* ---------- chats column ---------- */
.col {
    background: var(--col);
    border-inline-end: 1px solid var(--line);
    display: flex; flex-direction: column; min-height: 0;
}
.col-head {
    height: 56px; flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
    padding: 0 12px 0 16px; border-bottom: 1px solid var(--line-soft);
}
.col-title { font-size: 13.5px; font-weight: 600; flex: 1; }
.col-sub { font-size: 11.5px; color: var(--ink-3); }
.col-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 8px 8px 16px; }

.cgroup { margin-top: 10px; }
.cgroup:first-child { margin-top: 2px; }
.cgroup-h {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px 4px; font-size: 10px; font-weight: 600; letter-spacing: .09em;
    text-transform: uppercase; color: var(--ink-3);
}
.crow {
    display: block; padding: 8px 9px; border-radius: var(--r-sm); margin-bottom: 1px;
    border: 1px solid transparent;
    transition: background .14s var(--ease), border-color .14s var(--ease);
}
.crow:hover { background: var(--sel); }
.crow.active { background: var(--sel); border-color: var(--line); }
.crow-t { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; letter-spacing: -.01em; }
.crow-t .tt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-m { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); }
.crow-m .pr { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-m .sep { opacity: .5; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-bg); flex: 0 0 auto; animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(53, 196, 106, .5); } 50% { box-shadow: 0 0 0 4px rgba(53, 196, 106, 0); } }

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.stage-head {
    height: 56px; flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: 0 14px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.stage-head .t { min-width: 0; flex: 1; }
.stage-head h1 { font-size: 14.5px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-head .sub { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.stage-head .acts { display: flex; align-items: center; gap: 2px; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    height: 21px; padding: 0 7px; border-radius: 6px;
    font-size: 11px; font-weight: 500; letter-spacing: .01em;
    background: var(--sel); color: var(--ink-2); border: 1px solid var(--line);
    white-space: nowrap;
}
.chip.ok { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.plain { background: transparent; }
.chip .sw { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---------- thread ---------- */
.thread { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.thread-in { max-width: 760px; margin: 0 auto; padding: 26px 26px 8px; }

.dayline { display: flex; align-items: center; gap: 12px; margin: 6px 0 22px; color: var(--ink-3); font-size: 11px; font-weight: 500; }
.dayline::before, .dayline::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.msg { margin-bottom: 22px; }
.msg-user { display: flex; justify-content: flex-end; }
.bubble {
    max-width: 78%; padding: 11px 14px; border-radius: 16px 16px 6px 16px;
    background: var(--bubble); font-size: 14px; line-height: 1.6;
}
html[dir="rtl"] .bubble { border-radius: 16px 16px 16px 6px; }

.msg-ai { display: flex; gap: 11px; }
.ai-face {
    width: 26px; height: 26px; border-radius: 8px; flex: 0 0 auto; margin-top: 2px;
    display: grid; place-items: center; color: #06240F;
    background: linear-gradient(150deg, #4BD782, #1E9C55);
    box-shadow: 0 1px 2px rgba(20, 20, 22, .12);
}
.ai-face svg { width: 15px; height: 15px; }
.ai-body { min-width: 0; flex: 1; }
.ai-head { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.ai-name { font-size: 12.5px; font-weight: 600; letter-spacing: -.01em; }
.ai-tag { font-size: 10.5px; color: var(--ink-3); }
.ai-text { font-size: 14px; line-height: 1.66; }
.ai-text b, .msg b { font-weight: 600; }
.ai-text p { margin: 0 0 8px; }
.ai-text p:last-child { margin-bottom: 0; }

/* blocks inside a conversation */
.blk { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--sh-sm); overflow: hidden; }
.blk-h {
    display: flex; align-items: center; gap: 7px;
    padding: 9px 12px; border-bottom: 1px solid var(--line-soft);
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em; color: var(--ink-2);
}
.blk-h .ct { margin-inline-start: auto; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.blk-b { padding: 4px 0; }
.blk-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    font-size: 13px; border-top: 1px solid var(--line-soft);
}
.blk-row:first-child { border-top: 0; }
.blk-row .lb { flex: 1; min-width: 0; }
.blk-row .lb .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-row .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.blk-row .rt { margin-inline-start: auto; font-size: 11.5px; color: var(--ink-3); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: 12.5px; letter-spacing: -.01em; }

.st { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; }
.st-done { background: var(--accent-soft); color: var(--accent); }
.st-done svg { width: 11px; height: 11px; stroke-width: 2.4; }
.st-run { border: 2px solid var(--line); border-top-color: var(--accent-bg); animation: spin 1s linear infinite; }
.st-wait { border: 1.5px solid var(--line); }
.st-fail { background: var(--bad-soft); color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }

/* preview card */
.pv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.dots3 { display: flex; gap: 4px; }
.dots3 i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.pv-url {
    flex: 1; height: 22px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line-soft);
    display: flex; align-items: center; gap: 6px; padding: 0 8px;
    font-size: 11px; color: var(--ink-3);
}
.pv-shot {
    height: 148px; position: relative; overflow: hidden;
    background:
        radial-gradient(120% 90% at 12% 0%, rgba(53, 196, 106, .16), transparent 60%),
        linear-gradient(180deg, var(--bg), var(--panel));
    display: flex; align-items: center; justify-content: center;
}
.pv-shot .frame {
    width: 74%; height: 76%; border-radius: 10px 10px 0 0; background: var(--card);
    border: 1px solid var(--line); border-bottom: 0; box-shadow: var(--sh-md);
    padding: 12px; display: flex; flex-direction: column; gap: 7px;
}
.pv-shot .bar { height: 7px; border-radius: 4px; background: var(--line); }
.pv-shot .bar.w60 { width: 60%; }
.pv-shot .bar.w40 { width: 40%; }
.pv-shot .bar.acc { background: var(--accent-bg); width: 26%; height: 8px; border-radius: 5px; }
.pv-shot .grid2 { display: flex; gap: 7px; margin-top: auto; }
.pv-shot .grid2 i { flex: 1; height: 26px; border-radius: 6px; background: var(--bg); border: 1px solid var(--line-soft); }
.pv-foot { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--ink-3); }
.link { color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

/* a small table inside a conversation */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    text-align: start; font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
    color: var(--ink-3); padding: 8px 12px; border-bottom: 1px solid var(--line-soft);
}
.tbl td { padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n { text-align: end; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.note { padding: 8px 12px; font-size: 11px; color: var(--ink-3); background: var(--bg); border-top: 1px solid var(--line-soft); }

/* the live step */
.working { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding: 9px 12px; border: 1px dashed var(--line); border-radius: var(--r-md); background: var(--card); }
.working .ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent-bg); animation: spin 1s linear infinite; flex: 0 0 auto; }
.working .lb { font-size: 12.5px; color: var(--ink-2); flex: 1; }
.working .meta { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- composer ---------- */
.composer-wrap { flex: 0 0 auto; padding: 10px 26px 14px; background: linear-gradient(to top, var(--bg) 60%, transparent); }
.composer-in { max-width: 760px; margin: 0 auto; }
.composer {
    border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
    box-shadow: var(--sh-sm);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.composer:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px var(--sel), var(--sh-sm); }
.ta {
    display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent;
    padding: 13px 14px 4px; font-size: 14px; line-height: 1.6; min-height: 46px; max-height: 200px;
}
.ta::placeholder { color: var(--ink-3); }
.cbar { display: flex; align-items: center; gap: 6px; padding: 7px 8px 8px 10px; }
.pill {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px;
    border-radius: 7px; font-size: 11.5px; font-weight: 500; color: var(--ink-2);
    border: 1px solid transparent;
    transition: background .14s var(--ease), border-color .14s var(--ease);
}
.pill:hover { background: var(--sel); border-color: var(--line); }
.pill .ic { opacity: .75; }
.pill-sep { width: 1px; height: 16px; background: var(--line); margin: 0 3px; }
.send {
    margin-inline-start: auto; display: flex; align-items: center; gap: 7px;
    height: 30px; padding: 0 10px 0 12px; border-radius: 8px;
    background: var(--accent-bg); color: var(--accent-ink);
    font-size: 12.5px; font-weight: 600;
    transition: filter .15s var(--ease), transform .12s var(--ease);
}
.send:hover { filter: brightness(1.06); }
.send:active { transform: translateY(1px); }
.ring-usage { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto;
    background: conic-gradient(var(--accent-bg) 0 34%, var(--line) 34% 100%); }
.ring-usage i { width: 14px; height: 14px; border-radius: 50%; background: var(--panel); display: block; }
.hintline { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 8px; font-size: 11px; color: var(--ink-3); }
.hintline .k { font-size: 10.5px; }

/* empty state */
.hello { max-width: 760px; margin: 0 auto; padding: 8vh 26px 0; }
.hello h2 { font-size: 30px; letter-spacing: -.03em; line-height: 1.15; }
.hello p { color: var(--ink-2); font-size: 14px; margin: 8px 0 0; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 26px; }
.starter {
    display: flex; gap: 11px; align-items: flex-start; text-align: start;
    padding: 13px; border-radius: var(--r-md); border: 1px solid var(--line);
    background: var(--card); box-shadow: var(--sh-sm);
    transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease);
}
.starter:hover { border-color: var(--ink-3); transform: translateY(-1px); box-shadow: var(--sh-md); }
.starter .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.starter .t { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.starter .l { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; line-height: 1.45; }

/* ---------- context pane ---------- */
.ctx {
    width: 336px; flex: 0 0 auto; background: var(--col);
    border-inline-start: 1px solid var(--line);
    display: flex; flex-direction: column; min-height: 0;
}
.chatwrap { display: flex; min-height: 0; flex: 1 1 auto; }
.ctx-head { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--line-soft); }
.ctx-head .t { flex: 1; min-width: 0; }
.ctx-head .t .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-head .t .m { font-size: 11px; color: var(--ink-3); }
.seg { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.seg button { flex: 1; height: 27px; border-radius: 7px; font-size: 12px; font-weight: 500; color: var(--ink-2); transition: background .14s var(--ease), color .14s var(--ease); }
.seg button:hover { background: var(--sel); }
.seg button.on { background: var(--sel); color: var(--ink); font-weight: 600; }
.ctx-body { overflow-y: auto; min-height: 0; padding: 10px 10px 20px; }
.ctx-row { display: flex; align-items: center; gap: 9px; padding: 8px 8px; border-radius: 8px; font-size: 12.5px; }
.ctx-row:hover { background: var(--sel); }
.ctx-row .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-row .meta { font-size: 11px; color: var(--ink-3); }
.ctx-sec { font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 14px 8px 5px; }

/* ---------- pages: studio, work, connections ---------- */
.page { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.page-in { max-width: 1080px; margin: 0 auto; padding: 30px 30px 60px; }
.page-h { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-h .t { flex: 1; }
.page-h h2 { font-size: 27px; letter-spacing: -.035em; line-height: 1.1; }
.page-h p { margin: 7px 0 0; color: var(--ink-2); font-size: 13.5px; max-width: 60ch; }
.search {
    display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
    border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card);
    color: var(--ink-3); min-width: 230px;
}
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 13px; color: var(--ink); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.fbtn { height: 28px; padding: 0 11px; border-radius: 7px; border: 1px solid var(--line); background: var(--card);
    font-size: 12.5px; font-weight: 500; color: var(--ink-2); transition: all .14s var(--ease); }
.fbtn:hover { border-color: var(--ink-3); }
.fbtn.on { background: var(--ink); border-color: var(--ink); color: var(--panel); }

.gsec { margin-bottom: 26px; }
.gsec-h { display: flex; align-items: baseline; gap: 9px; margin-bottom: 11px; }
.gsec-h h3 { font-size: 15px; letter-spacing: -.02em; }
.gsec-h .n { font-size: 11.5px; color: var(--ink-3); }
.gsec-h .note { margin-inline-start: auto; font-size: 11.5px; color: var(--ink-3); background: none; border: 0; padding: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 10px; }
.cap {
    position: relative; text-align: start; padding: 14px; border-radius: var(--r-md);
    border: 1px solid var(--line); background: var(--card); box-shadow: var(--sh-sm);
    transition: border-color .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease);
}
.cap:hover { border-color: var(--accent-bg); transform: translateY(-1px); box-shadow: var(--sh-md); }
.cap .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.cap .t { font-size: 13.5px; font-weight: 600; letter-spacing: -.015em; }
.cap .l { font-size: 12px; color: var(--ink-2); margin-top: 3px; line-height: 1.5; }
.cap .tag { position: absolute; top: 12px; inset-inline-end: 12px; font-size: 10px; font-weight: 500; color: var(--ink-3); letter-spacing: .02em; }
.cap .go { display: flex; align-items: center; gap: 5px; margin-top: 11px; font-size: 11.5px; font-weight: 500; color: var(--accent); opacity: 0; transition: opacity .16s var(--ease); }
.cap:hover .go { opacity: 1; }

/* connections */
.con-group { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); overflow: hidden; margin-bottom: 16px; box-shadow: var(--sh-sm); }
.con-h { display: flex; align-items: baseline; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.con-h .t { font-size: 12.5px; font-weight: 600; }
.con-h .n { font-size: 11.5px; color: var(--ink-3); }
.con-h .note { margin-inline-start: auto; font-size: 11.5px; color: var(--ink-3); background: none; border: 0; padding: 0; }
.con {
    display: flex; align-items: center; gap: 11px; padding: 11px 14px; width: 100%; text-align: start;
    border-top: 1px solid var(--line-soft); transition: background .14s var(--ease);
}
.con:first-of-type { border-top: 0; }
.con:hover { background: var(--sel); }
.con .lb { flex: 1; min-width: 0; }
.con .n { font-size: 13px; font-weight: 500; }
.con .m { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.con .i-go { opacity: 0; color: var(--ink-3); display: grid; place-items: center; }
.con:hover .i-go { opacity: 1; }
.tile {
    width: 28px; height: 28px; border-radius: 8px; flex: 0 0 auto;
    display: grid; place-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: -.02em;
    color: var(--tint); background: color-mix(in srgb, var(--tint) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--tint) 18%, transparent);
}

/* work */
.work-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.proj { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--sh-sm); margin-bottom: 10px; text-align: start; width: 100%; transition: border-color .15s var(--ease), transform .15s var(--ease); }
.proj:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.proj .t { font-size: 13.5px; font-weight: 600; }
.proj .m { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.proj .next { font-size: 12px; color: var(--ink-2); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.proj .progress { height: 4px; border-radius: 3px; background: var(--line); margin-top: 9px; overflow: hidden; }
.proj .progress i { display: block; height: 100%; background: var(--accent-bg); border-radius: 3px; }
.pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.panel { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); box-shadow: var(--sh-sm); overflow: hidden; }
.panel-h { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* ---------- command palette ---------- */
.scrim { position: fixed; inset: 0; background: rgba(10, 10, 12, .42); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .18s var(--ease); z-index: 80; }
html.pal-open .scrim { opacity: 1; pointer-events: auto; }
.pal { position: fixed; z-index: 90; inset-inline: 0; top: 11vh; margin: 0 auto; width: min(620px, calc(100vw - 32px));
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-pal);
    opacity: 0; transform: translateY(-8px) scale(.99); pointer-events: none; transition: opacity .18s var(--ease), transform .18s var(--ease); overflow: hidden; }
html.pal-open .pal { opacity: 1; transform: none; pointer-events: auto; }
.pal-field { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line-soft); color: var(--ink-3); }
.pal-field input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 15px; color: var(--ink); }
.pal-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.pal-sec { font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); padding: 9px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--ink); }
.pal-item:hover { background: var(--sel); }
.pal-item .m { margin-inline-start: auto; font-size: 11px; color: var(--ink-3); }
.pal-item .ico { color: var(--ink-3); display: grid; place-items: center; }

/* the honesty line for a direction prototype */
.prevchip { position: fixed; inset-block-end: 10px; inset-inline-start: 12px; z-index: 40; font-size: 10.5px; letter-spacing: .02em;
    color: var(--ink-3); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; box-shadow: var(--sh-sm); }

/* ---------- phone ---------- */
.only-phone { display: none; }

@media (max-width: 1180px) {
    .ctx { display: none; }
}
@media (max-width: 940px) {
    .app, .app.no-list { grid-template-columns: minmax(0, 1fr); }
    .rail {
        position: fixed; inset-block: 0; inset-inline-start: 0; width: 274px; z-index: 70;
        transform: translateX(-102%); transition: transform .22s var(--ease);
        box-shadow: var(--sh-pal);
    }
    html[dir="rtl"] .rail { transform: translateX(102%); }
    html.rail-open .rail { transform: none; }
    .col { display: none; }
    .only-phone { display: inline-flex; }
    .thread-in, .composer-wrap { padding-inline: 14px; }
    .thread-in { padding-top: 14px; }
    .stage-head { height: 52px; padding-inline: 8px 10px; }
    .hello { padding-top: 4vh; }
    .hello h2 { font-size: 24px; }
    .starters { grid-template-columns: 1fr; }
    .page-in { padding: 20px 14px 90px; }
    .page-h { flex-direction: column; align-items: stretch; gap: 12px; }
    .page-h h2 { font-size: 22px; }
    .work-grid { grid-template-columns: 1fr; }
    .cards { grid-template-columns: 1fr; }
    .composer-wrap { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
    .bubble { max-width: 88%; }
    .prevchip { display: none; }
}

/* bottom bar on a phone */
.tabbar {
    display: none;
    position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 50;
    height: calc(58px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--panel) 92%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    align-items: center;
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 500; color: var(--ink-3); padding-top: 6px; }
.tabbar a.active { color: var(--ink); }
.tabbar a.active .ic { color: var(--accent); }
@media (max-width: 940px) { .tabbar { display: flex; } }

/* the drawer's scrim reuses .scrim through a class on <html> */
html.rail-open .scrim { opacity: 1; pointer-events: auto; }
