@layer reset, base, layout, components, responsive;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body, h1, h2, h3, h4, p { margin: 0; }
  button, input, textarea, select { font: inherit; }
  button { border: 0; }
  img { max-width: 100%; }
}

@layer base {
  :root {
    color-scheme: dark;
    --ink: #f2f5f2;
    --muted: #89928f;
    --muted-2: #626c68;
    --bg: #090d12;
    --panel: #0e141a;
    --panel-2: #121a21;
    --panel-3: #172129;
    --line: #263138;
    --line-soft: #1b252b;
    --green: #a6ef67;
    --green-deep: #0d2818;
    --cyan: #76d6d0;
    --blue: #87aefb;
    --amber: #f5c665;
    --red: #ff7b76;
    --violet: #b8a4ff;
    --shadow: 0 28px 80px rgba(0, 0, 0, .42);
    --radius: 14px;
    font-family: Aptos, "Segoe UI Variable Text", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
  }
  body {
    min-width: 320px;
    min-height: 100vh;
    overflow: hidden;
    background:
      radial-gradient(circle at 48% -20%, rgba(91, 139, 130, .12), transparent 34%),
      linear-gradient(180deg, #0b1015 0, var(--bg) 26%);
  }
  ::selection { color: #08110a; background: var(--green); }
  :focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
  a { color: inherit; }
  button { color: inherit; cursor: pointer; }
  button:disabled { cursor: not-allowed; opacity: .5; }
  input, textarea, select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #0a1015;
    color: var(--ink);
    outline: none;
    padding: .72rem .78rem;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
  }
  input:hover, textarea:hover, select:hover { border-color: #3a474d; }
  input:focus, textarea:focus, select:focus { border-color: rgba(166, 239, 103, .7); box-shadow: 0 0 0 3px rgba(166, 239, 103, .07); background: #0d1419; }
  textarea { resize: vertical; line-height: 1.45; }
  select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 11px) 50%; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat; padding-right: 2rem; }
  .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
  .skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: .65rem .9rem; border-radius: 8px; color: #071007; background: var(--green); transform: translateY(-150%); transition: transform .15s; }
  .skip-link:focus { transform: none; }
  .kicker { color: var(--green); font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: .63rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
  .mobile-only { display: none; }
}

@layer layout {
  .app-header {
    height: 66px;
    display: grid;
    grid-template-columns: 240px 1fr auto;
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 13, 18, .9);
    backdrop-filter: blur(18px);
    position: relative;
    z-index: 20;
  }
  .brand { height: 100%; display: flex; align-items: center; gap: 11px; padding: 0 17px; border-right: 1px solid var(--line); }
  .brand > span:last-child { display: flex; flex-direction: column; gap: 2px; }
  .brand strong { font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: .78rem; letter-spacing: .09em; }
  .brand small { color: var(--muted); font-size: .65rem; }
  .brand-mark { width: 31px; height: 31px; display: flex; align-items: end; justify-content: center; gap: 2px; padding: 7px; border: 1px solid rgba(166, 239, 103, .4); border-radius: 8px; background: rgba(166, 239, 103, .07); }
  .brand-mark i { display: block; width: 4px; border-radius: 2px 2px 0 0; background: var(--green); }
  .brand-mark i:nth-child(1) { height: 7px; opacity: .55; }
  .brand-mark i:nth-child(2) { height: 15px; }
  .brand-mark i:nth-child(3) { height: 10px; opacity: .75; }
  .header-center { justify-self: center; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .69rem; }
  .header-actions { height: 100%; display: flex; align-items: center; padding-right: 12px; }
  .app-shell { height: calc(100vh - 66px); display: grid; grid-template-columns: 160px minmax(510px, 1fr) 370px; }
  .side-nav { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 20px 12px 16px; border-right: 1px solid var(--line); background: rgba(11, 16, 21, .75); }
  .nav-group { display: flex; flex-direction: column; gap: 6px; }
  .nav-label { display: block; margin: 0 8px 8px; color: var(--muted-2); font-size: .59rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
  .main-workspace { min-width: 0; overflow: auto; scrollbar-color: var(--line) transparent; }
  .view { min-height: 100%; padding: 29px clamp(20px, 3vw, 38px) 42px; }
  .view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 25px; }
  .view-header h1 { margin-top: 5px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: clamp(1.55rem, 2.4vw, 2.2rem); font-weight: 550; letter-spacing: -.025em; }
  .view-header p { max-width: 590px; margin-top: 6px; color: var(--muted); font-size: .82rem; line-height: 1.5; }
  .view-actions { display: flex; gap: 8px; flex: none; }
  .orchestrator-panel { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows:auto auto minmax(0, 1fr) auto; border-left: 1px solid var(--line); background: rgba(13, 19, 25, .9); }
  .orchestrator-header { min-height: 79px; display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; border-bottom: 1px solid var(--line); }
  .orchestrator-header h2 { margin-top: 3px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: 1.04rem; font-weight: 520; }
  .conversation-controls { display: grid; gap: 9px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 13, 17, .38); }
  .control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .conversation-controls label { min-width: 0; }
  .conversation-controls label > span { display: block; margin: 0 0 5px 2px; color: var(--muted-2); font-size: .59rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .conversation-controls select { padding: .55rem 1.8rem .55rem .62rem; font-size: .7rem; }
  .messages { min-height: 0; max-height: 100%; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; display: flex; flex-direction: column; gap: 12px; padding: 17px 16px; scrollbar-color: var(--line) transparent; }
  .messages.assistant-anchored::after { content: ""; flex: 0 0 var(--conversation-tail-space, 0px); pointer-events: none; }
  .composer { padding: 13px 15px 15px; border-top: 1px solid var(--line); background: #0c1217; }
}

@layer components {
  .auth-gate {
    position: fixed;
    z-index: 500;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(circle at 50% 10%, rgba(166, 239, 103, .12), transparent 34%),
      rgba(6, 10, 14, .96);
    backdrop-filter: blur(14px);
  }
  .auth-gate[hidden] { display: none; }
  .auth-card { width: min(440px, 100%); padding: 31px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, rgba(19, 27, 34, .98), rgba(10, 15, 20, .98)); box-shadow: var(--shadow); }
  .auth-brand { display: flex; margin-bottom: 22px; }
  .auth-card h1 { margin-top: 8px; font-family: Bahnschrift, "Arial Narrow", sans-serif; font-size: clamp(1.65rem, 5vw, 2.2rem); letter-spacing: -.03em; }
  .auth-card > p { margin-top: 10px; color: var(--muted); font-size: .76rem; line-height: 1.6; }
  .auth-card form { display: grid; gap: 12px; margin-top: 23px; }
  .auth-card label { color: var(--muted); font-size: .66rem; font-weight: 700; }
  .auth-card input { margin-top: 7px; }
  .auth-card .button { width: 100%; min-height: 43px; justify-content: center; }
  .auth-error { min-height: 1.3em; color: var(--red) !important; }
  .auth-assurance { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; padding: 12px; border-left: 2px solid var(--green); background: rgba(166, 239, 103, .04); }
  .auth-assurance strong { font-size: .65rem; }
  .auth-assurance span { color: var(--muted); font-size: .61rem; line-height: 1.45; }
  body.auth-locked > :not(.auth-gate):not(.toast-region) { pointer-events: none; user-select: none; }
  .session-status { display: inline-flex; align-items: center; gap: 6px; margin-right: 7px; color: var(--muted); font-size: .61rem; white-space: nowrap; }
  .session-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
  .session-status.authenticated::before { background: var(--green); box-shadow: 0 0 8px rgba(166, 239, 103, .55); }
  .session-status.unauthenticated::before { background: var(--red); }
  .live-indicator { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
  .live-indicator i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px rgba(137, 146, 143, .08); }
  .live-indicator.live i { background: var(--green); box-shadow: 0 0 0 4px rgba(166, 239, 103, .1); }
  .live-indicator.degraded i { background: var(--amber); }
  .last-refresh { padding-left: 12px; border-left: 1px solid var(--line); }
  .header-button, .compact-button { position: relative; min-height: 35px; padding: 0 10px; border-left: 1px solid var(--line); background: transparent; color: var(--muted); font-size: .68rem; }
  .header-button:hover, .compact-button:hover { color: var(--ink); }
  .header-button b { position: absolute; top: 7px; right: 2px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px; border-radius: 99px; color: #11170a; background: var(--green); font-size: .55rem; }
  .nav-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-size: .74rem; text-align: left; }
  .nav-item:hover { color: var(--ink); background: var(--panel); }
  .nav-item.active { color: var(--ink); border-color: var(--line); background: linear-gradient(110deg, rgba(166, 239, 103, .1), rgba(166, 239, 103, .02)); }
  .nav-glyph { width: 26px; color: var(--muted-2); font-family: Bahnschrift, monospace; font-size: .58rem; letter-spacing: .08em; }
  .nav-item.active .nav-glyph { color: var(--green); }
  .nav-summary { margin: 0 4px; padding: 13px 8px; border-top: 1px solid var(--line); }
  .nav-summary .nav-label { margin-left: 0; }
  .nav-summary strong { display: block; font-family: Bahnschrift, sans-serif; font-size: 1.65rem; font-weight: 500; }
  .nav-summary > span:not(.nav-label) { color: var(--muted); font-size: .64rem; }
  .nav-summary small { color: var(--muted-2); font-size: .6rem; }
  .mini-meter { height: 3px; margin: 12px 0 8px; overflow: hidden; border-radius: 2px; background: var(--line); }
  .mini-meter i { display: block; width: 0; height: 100%; background: var(--green); transition: width .3s; }
  .button { min-height: 37px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: .65rem .86rem; border: 1px solid transparent; border-radius: 9px; font-size: .72rem; font-weight: 700; transition: transform .14s, border-color .14s, background .14s; }
  .button:hover:not(:disabled) { transform: translateY(-1px); }
  .button.primary { color: #0b1307; background: var(--green); }
  .button.primary:hover:not(:disabled) { background: #b8fb7d; }
  .button.ghost { border-color: var(--line); background: var(--panel); color: var(--ink); }
  .button.ghost:hover:not(:disabled) { border-color: #435159; background: var(--panel-2); }
  .button.danger { border-color: rgba(255, 123, 118, .28); background: rgba(255, 123, 118, .08); color: var(--red); }
  .button.small { min-height: 30px; padding: .42rem .58rem; border-radius: 7px; font-size: .64rem; }
  .square-button { width: 34px; height: 34px; display: grid; place-items: center; flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 1.05rem; }
  .square-button:hover { color: var(--ink); border-color: #455159; }
  .text-button { padding: 0; background: transparent; color: var(--cyan); font-size: .68rem; }
  .text-button[aria-pressed="true"] { color: var(--green); }
  .metrics { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 9px; margin-bottom: 17px; }
  .metric { position: relative; min-height: 88px; overflow: hidden; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(145deg, rgba(18, 26, 33, .94), rgba(11, 17, 22, .94)); }
  .metric::after { content: ""; position: absolute; right: -18px; bottom: -30px; width: 80px; height: 80px; border: 1px solid rgba(255, 255, 255, .04); border-radius: 50%; }
  .metric strong { display: block; font-family: Bahnschrift, sans-serif; font-size: 1.55rem; font-weight: 500; }
  .metric span { display: block; margin-top: 7px; color: var(--muted); font-size: .61rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
  .metric small { display: block; margin-top: 3px; color: var(--muted-2); font-size: .56rem; }
  .metric em { position: absolute; top: 15px; right: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
  .metric.active em { background: var(--green); }
  .metric.waiting em { background: var(--amber); }
  .metric.failed em { background: var(--red); }
  .board-toolbar { display: grid; grid-template-columns: minmax(180px, 1fr) 150px 140px auto; gap: 8px; align-items: end; margin-bottom: 19px; }
  .search-field input { min-height: 38px; padding-left: .85rem; }
  .select-field > span { display: block; margin: 0 0 4px 2px; color: var(--muted-2); font-size: .57rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .select-field select { min-height: 38px; padding-block: .5rem; font-size: .7rem; }
  .result-count { align-self: center; padding-left: 6px; color: var(--muted); font-size: .67rem; white-space: nowrap; }
  .board { display: grid; grid-template-columns: repeat(4, minmax(215px, 1fr)); gap: 10px; align-items: start; }
  .column { min-width: 0; }
  .column-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; padding: 0 3px; }
  .column-title { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .63rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .column-title i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
  .column[data-column="queue"] .column-title i { background: var(--blue); }
  .column[data-column="active"] .column-title i { background: var(--green); }
  .column[data-column="finished"] .column-title i { background: var(--violet); }
  .column-count { min-width: 23px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: .59rem; }
  .column-header small { display: block; margin: 3px 0 0 13px; color: var(--muted-2); font-size: .54rem; }
  .column-body { min-height: 240px; display: flex; flex-direction: column; gap: 8px; padding: 7px; border: 1px solid var(--line-soft); border-radius: 13px; background: rgba(7, 11, 15, .32); }
  .empty-column { display: grid; place-items: center; min-height: 130px; padding: 20px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted-2); font-size: .68rem; text-align: center; }
  .task-card { position: relative; overflow: hidden; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(150deg, rgba(21, 30, 37, .98), rgba(13, 19, 24, .98)); box-shadow: 0 9px 25px rgba(0, 0, 0, .13); transition: border-color .15s, transform .15s; }
  .task-card:hover { transform: translateY(-1px); border-color: #39464d; }
  .task-card.active { border-color: rgba(166, 239, 103, .34); box-shadow: inset 3px 0 var(--green), 0 12px 30px rgba(0, 0, 0, .18); }
  .task-card.stopped { border-color: rgba(184, 164, 255, .25); }
  .task-card.failed { border-color: rgba(255, 123, 118, .26); }
  .card-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .project-name { overflow: hidden; color: var(--cyan); font-size: .59rem; font-weight: 750; letter-spacing: .08em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
  .priority-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--muted); }
  .priority-dot.critical { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 123, 118, .08); }
  .priority-dot.high { background: var(--amber); }
  .priority-dot.normal { background: var(--blue); }
  .priority-dot.low { background: var(--muted-2); }
  .task-card h3 { margin: 7px 0 5px; font-size: .79rem; font-weight: 650; line-height: 1.32; }
  .task-open { width: 100%; display: block; padding: 8px 0 0; background: transparent; text-align: left; }
  .task-open strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: .79rem; line-height: 1.32; }
  .task-objective { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: .67rem; line-height: 1.44; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin: 11px 0; color: var(--muted-2); font-size: .59rem; }
  .status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(6, 10, 13, .32); font-weight: 700; text-transform: capitalize; }
  .status-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
  .status-chip.in-progress, .status-chip.review-validation { color: var(--green); border-color: rgba(166, 239, 103, .2); }
  .status-chip.waiting, .status-chip.queued { color: var(--amber); }
  .status-chip.failed { color: var(--red); }
  .status-chip.completed { color: var(--cyan); }
  .status-chip.stopped { color: var(--violet); }
  .activity-line { min-height: 35px; margin: 8px -3px 10px; padding: 8px 9px; border-radius: 7px; background: rgba(5, 9, 12, .45); color: var(--muted); font-size: .61rem; line-height: 1.4; }
  .activity-line strong { color: var(--green); font-weight: 650; }
  .task-card.stopped .activity-line strong { color: var(--violet); }
  .card-footer { display: flex; align-items: center; gap: 5px; padding-top: 9px; border-top: 1px solid var(--line-soft); }
  .card-footer .spacer { flex: 1; }
  .card-action { min-height: 27px; padding: .35rem .48rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: .59rem; font-weight: 700; }
  .card-action:hover { color: var(--ink); border-color: #45525a; }
  .card-action.primary-action { border-color: rgba(166, 239, 103, .27); color: var(--green); background: rgba(166, 239, 103, .06); }
  .card-action.stop-action { border-color: rgba(255, 123, 118, .25); color: var(--red); }
  .card-order { display: flex; gap: 3px; }
  .card-order button { width: 25px; height: 27px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted-2); font-size: .65rem; }
  .priority-select { position: relative; width: auto; min-width: 76px; min-height: 27px; display: flex; align-items: center; gap: 4px; font-size: .58rem; }
  .priority-select select { min-height: 27px; padding: .3rem 1.25rem .3rem .42rem; border-radius: 6px; font-size: .58rem; }
  .priority-select .priority-dot { position: absolute; z-index: 1; left: 7px; pointer-events: none; }
  .priority-select .priority-dot + select { padding-left: 18px; }
  .priority-select.critical .priority-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 123, 118, .08); }
  .priority-select.high .priority-dot { background: var(--amber); }
  .priority-select.normal .priority-dot { background: var(--blue); }
  .priority-select.low .priority-dot { background: var(--muted-2); }
  .project-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 18px; }
  .summary-strip { padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); }
  .summary-strip strong { display: block; font-family: Bahnschrift, sans-serif; font-size: 1.15rem; font-weight: 500; }
  .summary-strip span { color: var(--muted); font-size: .63rem; }
  .projects-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 12px; }
  .project-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, var(--panel-2), #0c1217); }
  .project-card-header { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
  .project-monogram { width: 39px; height: 39px; display: grid; place-items: center; flex: none; border: 1px solid rgba(118, 214, 208, .25); border-radius: 9px; color: var(--cyan); background: rgba(118, 214, 208, .06); font-family: Bahnschrift, sans-serif; font-size: .72rem; }
  .project-title { flex: 1; min-width: 0; }
  .project-title h3 { font-size: .9rem; }
  .project-title p { overflow: hidden; margin-top: 4px; color: var(--muted); font-family: Consolas, monospace; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
  .repository-state { color: var(--green); font-size: .61rem; font-weight: 700; text-transform: capitalize; }
  .repository-state { display: flex; flex-direction: column; gap: 3px; margin: 9px 0; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 7px; background: rgba(5, 9, 12, .38); text-transform: none; }
  .repository-state span { color: var(--muted); font-weight: 400; line-height: 1.4; overflow-wrap: anywhere; }
  .repository-state.live { color: var(--green); border-color: rgba(166, 239, 103, .18); }
  .repository-state.stopped { color: var(--violet); border-color: rgba(184, 164, 255, .18); }
  .repository-state.danger { color: var(--red); border-color: rgba(255, 123, 118, .18); }
  .repository-state.unknown { color: var(--amber); }
  .project-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 16px 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--line-soft); }
  .project-stat { padding: 10px; background: rgba(9, 14, 18, .86); }
  .project-stat strong { display: block; font-size: .82rem; }
  .project-stat span { color: var(--muted-2); font-size: .55rem; text-transform: uppercase; }
  .project-footer { display: flex; gap: 6px; }
  .project-footer .button:last-child { margin-left: auto; }
  .system-health { display: grid; grid-template-columns: auto 1fr repeat(3, minmax(90px, auto)); align-items: center; gap: 16px; min-height: 92px; margin-bottom: 14px; padding: 17px 20px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(110deg, rgba(166, 239, 103, .08), var(--panel) 45%); }
  .health-orb { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(166, 239, 103, .3); border-radius: 50%; color: var(--green); background: var(--green-deep); font-family: Bahnschrift, sans-serif; font-size: .62rem; }
  .health-copy h2 { font-size: .9rem; }
  .health-copy p { margin-top: 4px; color: var(--muted); font-size: .67rem; }
  .health-copy strong { display: block; margin-top: 3px; font-size: .9rem; }
  .health-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: .63rem; }
  .health-orb i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(166, 239, 103, .1); }
  .health-stat { padding-left: 15px; border-left: 1px solid var(--line); }
  .health-stat strong { display: block; font-family: Bahnschrift, sans-serif; font-size: 1rem; }
  .health-stat span { color: var(--muted); font-size: .58rem; }
  .operations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .operations-section { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: rgba(14, 20, 26, .75); }
  .section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 13px; }
  .section-heading h2 { margin-top: 3px; font-size: .91rem; }
  .provider-grid, .worker-grid, .notifications-list { display: flex; flex-direction: column; gap: 7px; }
  .provider-row, .worker-row, .notification-row { padding: 11px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(7, 11, 15, .35); }
  .provider-row-top, .worker-row-top { display: flex; justify-content: space-between; gap: 10px; }
  .provider-row h3, .worker-row h3 { font-size: .74rem; }
  .provider-row p, .worker-row p { margin-top: 4px; color: var(--muted); font-size: .61rem; line-height: 1.4; }
  .health-tag { align-self: start; padding: 3px 6px; border: 1px solid rgba(166, 239, 103, .2); border-radius: 99px; color: var(--green); font-size: .55rem; font-weight: 700; text-transform: uppercase; }
  .health-tag.offline, .health-tag.unhealthy { color: var(--red); border-color: rgba(255, 123, 118, .24); }
  .health-tag.unknown { color: var(--amber); border-color: rgba(245, 198, 101, .24); }
  .capability-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
  .capability-list span { padding: 2px 5px; border-radius: 4px; color: var(--muted); background: var(--panel-3); font-size: .53rem; }
  .usage-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .usage-card { padding: 12px; border: 1px solid var(--line-soft); border-radius: 9px; background: rgba(7, 11, 15, .35); }
  .usage-card strong { display: block; font-family: Bahnschrift, sans-serif; font-size: 1rem; font-weight: 500; }
  .usage-card span { color: var(--muted); font-size: .58rem; }
  .notification-row { display: grid; grid-template-columns: 7px 1fr auto; gap: 9px; align-items: start; }
  .notification-row.unread { border-color: rgba(166, 239, 103, .18); }
  .notification-dot { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--muted-2); }
  .notification-row.unread .notification-dot { background: var(--green); }
  .notification-copy h3 { font-size: .68rem; }
  .notification-copy p { margin-top: 3px; color: var(--muted); font-size: .59rem; line-height: 1.4; }
  .notification-copy time { display: block; margin-top: 5px; color: var(--muted-2); font-size: .53rem; }
  .notification-copy strong { display: block; font-size: .68rem; }
  .notification-copy small { display: block; margin-top: 5px; color: var(--muted-2); font-size: .53rem; }
  .empty-state { padding: 24px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: .69rem; text-align: center; }
  .empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; }
  .loading-block { color: var(--muted); font-size: .7rem; }
  .message { max-width: 92%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; font-size: .72rem; line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
  .message.user { align-self: flex-end; border-color: rgba(135, 174, 251, .24); border-bottom-right-radius: 3px; background: rgba(135, 174, 251, .08); }
  .message.assistant { align-self: flex-start; border-bottom-left-radius: 3px; background: var(--panel-2); }
  .message.tool { max-width: 100%; padding: 7px 9px; border-style: dashed; color: var(--muted); background: transparent; font-size: .61rem; }
  .message .meta { display: block; margin-top: 7px; color: var(--muted-2); font-size: .54rem; }
  .empty-chat { margin: auto; padding: 20px 4px; color: var(--muted); text-align: center; }
  .empty-chat .orb { width: 47px; height: 47px; display: block; margin: 0 auto 14px; border: 1px solid rgba(166, 239, 103, .35); border-radius: 50%; background: radial-gradient(circle at 37% 35%, rgba(166, 239, 103, .36), rgba(166, 239, 103, .05) 42%, transparent 44%), rgba(166, 239, 103, .04); box-shadow: 0 0 32px rgba(166, 239, 103, .08); }
  .empty-chat h3 { color: var(--ink); font-family: Bahnschrift, sans-serif; font-size: .86rem; font-weight: 500; }
  .empty-chat p { max-width: 265px; margin: 7px auto 0; font-size: .67rem; line-height: 1.5; }
  .prompt-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 14px; }
  .prompt-chips button { padding: 5px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: transparent; font-size: .55rem; }
  .prompt-chips button:hover { color: var(--ink); border-color: #435058; }
  .composer textarea { min-height: 73px; max-height: 180px; resize: none; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; }
  .composer-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }
  .composer-footer > span { color: var(--muted-2); font-size: .58rem; }
  .composer-actions { display: flex; align-items: center; gap: 7px; }
  .record-button { min-height: 33px; padding: .48rem .67rem; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: .64rem; font-weight: 700; }
  .record-button:hover:not(:disabled) { color: var(--ink); border-color: #455159; }
  .record-button[aria-pressed="true"] { border-color: rgba(255, 123, 118, .55); color: var(--red); background: rgba(255, 123, 118, .09); }
  .send-button { min-height: 33px; padding: .5rem .75rem; border-radius: 8px; color: #0a1107; background: var(--green); font-size: .66rem; font-weight: 750; }
  .completion-summary { font-size: .78rem; line-height: 1.6; }
  .speech-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
  .speech-controls audio { width: min(100%, 420px); height: 38px; }
  dialog { max-height: calc(100vh - 32px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); background: var(--panel); box-shadow: var(--shadow); }
  dialog::backdrop { background: rgba(3, 6, 9, .78); backdrop-filter: blur(6px); }
  .form-dialog { width: min(620px, calc(100vw - 26px)); }
  .compact-dialog { width: min(500px, calc(100vw - 26px)); }
  .form-dialog form { max-height: calc(100vh - 32px); overflow: auto; padding: 22px; }
  .dialog-heading, .detail-header { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
  .dialog-heading { margin-bottom: 19px; }
  .dialog-heading h2, .detail-header h2 { margin-top: 4px; font-family: Bahnschrift, sans-serif; font-size: 1.18rem; font-weight: 500; }
  .dialog-heading p { margin-top: 5px; color: var(--muted); font-size: .67rem; }
  .form-dialog label { display: block; margin: 12px 0 0; color: var(--muted); font-size: .66rem; font-weight: 650; }
  .form-dialog label small { color: var(--muted-2); font-weight: 400; }
  .form-dialog label > input, .form-dialog label > textarea, .form-dialog label > select { margin-top: 6px; color: var(--ink); font-weight: 400; }
  .form-grid { display: grid; gap: 11px; }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .check-field { display: flex !important; align-items: start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(7, 11, 15, .3); }
  .check-field input { width: auto; margin-top: 2px; accent-color: var(--green); }
  .check-field span { display: flex; flex-direction: column; gap: 3px; }
  .check-field strong { color: var(--ink); font-size: .68rem; }
  .check-field small { font-size: .59rem; }
  .dialog-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 20px; }
  .setting-note { display: flex; flex-direction: column; gap: 3px; margin-top: 15px; padding: 11px; border-left: 2px solid var(--green); color: var(--muted); background: rgba(166, 239, 103, .04); font-size: .62rem; }
  .setting-note strong { color: var(--ink); }
  .detail-dialog { width: min(880px, calc(100vw - 26px)); height: min(760px, calc(100vh - 28px)); }
  .project-detail-dialog { width: min(760px, calc(100vw - 26px)); height: min(650px, calc(100vh - 28px)); }
  .detail-shell { height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; }
  .project-detail-dialog .detail-shell { grid-template-rows: auto minmax(0, 1fr); }
  .detail-header { padding: 19px 21px 16px; border-bottom: 1px solid var(--line); }
  .detail-header .detail-subtitle { margin-top: 5px; color: var(--muted); font-size: .64rem; }
  .detail-header p { margin-top: 5px; color: var(--muted); font-size: .64rem; }
  .detail-actions { display: flex; flex-wrap: wrap; gap: 6px; min-height: 48px; padding: 8px 21px; border-bottom: 1px solid var(--line-soft); background: rgba(7, 11, 15, .28); }
  .detail-tabs { display: flex; gap: 2px; padding: 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .detail-tabs button { position: relative; padding: 12px 10px; background: transparent; color: var(--muted); font-size: .64rem; font-weight: 700; white-space: nowrap; }
  .detail-tabs button[aria-selected="true"] { color: var(--ink); }
  .detail-tabs button[aria-selected="true"]::after { content: ""; position: absolute; right: 8px; bottom: -1px; left: 8px; height: 2px; background: var(--green); }
  .detail-content { min-height: 0; overflow: auto; padding: 19px 21px 25px; scrollbar-color: var(--line) transparent; }
  .instruction-bar { display: grid; grid-template-columns: 1fr auto; gap: 7px; padding: 11px 17px; border-top: 1px solid var(--line); background: #0b1116; }
  .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .detail-panel { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 13, 17, .36); }
  .detail-panel.full { grid-column: 1 / -1; }
  .detail-panel h3 { margin-bottom: 9px; color: var(--muted); font-size: .58rem; letter-spacing: .1em; text-transform: uppercase; }
  .detail-panel p { color: var(--muted); font-size: .7rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
  .detail-panel ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .67rem; line-height: 1.6; }
  .detail-panel strong { color: var(--ink); }
  .key-values { display: grid; gap: 7px; }
  .key-value { display: grid; grid-template-columns: minmax(100px, .45fr) 1fr; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line-soft); font-size: .66rem; }
  .key-value:last-child { padding-bottom: 0; border: 0; }
  .key-value dt { color: var(--muted-2); }
  .key-value dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
  .tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
  .tag { padding: 4px 7px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: var(--panel-2); font-size: .58rem; }
  .timeline { display: flex; flex-direction: column; }
  .timeline-item { position: relative; display: grid; grid-template-columns: 13px 1fr auto; gap: 9px; padding: 0 0 15px; }
  .timeline-item:not(:last-child)::before { content: ""; position: absolute; top: 8px; bottom: 0; left: 4px; width: 1px; background: var(--line); }
  .timeline-dot { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 3px; border: 2px solid var(--panel); border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 1px var(--line); }
  .timeline-copy h4 { font-size: .67rem; font-weight: 650; }
  .timeline-copy p { margin-top: 3px; color: var(--muted); font-size: .61rem; line-height: 1.45; }
  .timeline-item time { color: var(--muted-2); font-size: .54rem; white-space: nowrap; }
  .timeline-copy { min-width: 0; }
  .timeline-copy .activity-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 5px; padding: 0; background: transparent; }
  .timeline-copy .activity-line span { color: var(--muted-2); font-size: .54rem; white-space: nowrap; }
  .timeline-copy details { margin-top: 6px; }
  .timeline-copy summary { color: var(--muted-2); cursor: pointer; font-size: .56rem; }
  .code-block { max-width: 100%; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; color: #c8d2ce; background: #070b0e; font: .61rem/1.55 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
  .toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; width: min(360px, calc(100vw - 36px)); display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
  .toast { display: grid; grid-template-columns: 4px 1fr; gap: 10px; padding: 11px 13px 11px 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--panel-2); box-shadow: var(--shadow); font-size: .68rem; line-height: 1.4; animation: toast-in .18s ease-out; }
  .toast::before { content: ""; border-radius: 4px; background: var(--green); }
  .toast.error::before { background: var(--red); }
  @keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
}

@layer responsive {
  @media (max-width: 1320px) {
    .app-shell { grid-template-columns: 70px minmax(500px, 1fr) 340px; }
    .app-header { grid-template-columns: 200px 1fr auto; }
    .side-nav { padding-inline: 8px; }
    .nav-label, .nav-item > span:last-child, .nav-summary > span:not(.nav-label), .nav-summary small, .mini-meter { display: none; }
    .nav-item { justify-content: center; }
    .nav-glyph { width: auto; }
    .nav-summary { text-align: center; }
    .board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  }
  @media (max-width: 1040px) {
    body { overflow: auto; }
    .app-shell { height: auto; min-height: calc(100vh - 66px); grid-template-columns: 70px minmax(0, 1fr); }
    .orchestrator-panel { position: fixed; z-index: 30; top: 66px; right: 0; bottom: 0; width: min(390px, 94vw); transform: translateX(102%); box-shadow: var(--shadow); transition: transform .22s ease; }
    .orchestrator-panel.open { transform: none; }
    .mobile-only { display: inline-flex; }
    .header-center { justify-self: end; }
    .last-refresh { display: none; }
    .operations-grid { grid-template-columns: 1fr; }
  }
  @media (max-width: 760px) {
    .app-header { grid-template-columns: 1fr auto; }
    .brand { border-right: 0; }
    .header-center { display: none; }
    .header-actions { padding-right: 5px; }
    .header-button { padding-inline: 8px; }
    .session-status { display: none; }
    .app-shell { display: block; }
    .side-nav { position: sticky; z-index: 10; top: 0; height: 51px; flex-direction: row; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(9, 13, 18, .96); }
    .nav-group { width: 100%; flex-direction: row; }
    .nav-item { flex: 1; padding: 7px; }
    .nav-item > span:last-child { display: inline; }
    .nav-glyph { display: none; }
    .nav-summary { display: none; }
    .view { padding: 22px 15px 34px; }
    .view-header { align-items: start; flex-direction: column; margin-bottom: 19px; }
    .view-actions { width: 100%; }
    .view-actions .button { flex: 1; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .board-toolbar { grid-template-columns: 1fr 1fr; }
    .search-field { grid-column: 1 / -1; }
    .result-count { display: none; }
    .board { grid-template-columns: 1fr; }
    .column-body { min-height: 110px; }
    .projects-grid, .project-summary { grid-template-columns: 1fr; }
    .system-health { grid-template-columns: auto 1fr; }
    .health-stat { padding: 8px 0 0; border-top: 1px solid var(--line); border-left: 0; }
    .operations-section { padding: 13px; }
    .form-grid.two, .detail-grid { grid-template-columns: 1fr; }
    .detail-panel.full { grid-column: auto; }
    .detail-dialog { width: 100vw; max-width: none; height: 100vh; max-height: none; border: 0; border-radius: 0; }
    .detail-header { padding-inline: 16px; }
    .detail-actions, .detail-content { padding-inline: 16px; }
    .instruction-bar { grid-template-columns: 1fr; }
  }
  @media (max-width: 430px) {
    .brand small { display: none; }
    .brand { padding-inline: 11px; }
    .header-button { font-size: .62rem; }
    .metrics { gap: 7px; }
    .metric { min-height: 76px; padding: 11px; }
    .metric strong { font-size: 1.3rem; }
    .board-toolbar { grid-template-columns: 1fr; }
    .search-field { grid-column: auto; }
    .form-dialog form { padding: 17px; }
    .auth-gate { padding: 12px; }
    .auth-card { padding: 24px 20px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  }
}
