﻿:root {
      --bg: #f4f5f7;
      --panel: #ffffff;
      --surface: #fafbfc;
      --line: #dfe1e6;
      --line-strong: #c1c7d0;
      --text: #172b4d;
      --muted: #5e6c84;
      --subtle: #6b778c;
      --blue: #0c66e4;
      --blue-dark: #0747a6;
      --teal: #008da6;
      --green: #00875a;
      --yellow: #ffab00;
      --red: #de350b;
      --shadow: 0 8px 20px rgba(9, 30, 66, .10);
      --radius: 8px;
      --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      background: var(--bg);
      color: var(--text);
      font-family: var(--font);
      font-size: 13px;
    }

    button,
    input,
    textarea,
    select { font: inherit; }

    button:disabled { opacity: .45; cursor: not-allowed; }

    .app-shell {
      display: grid;
      grid-template-rows: auto 1fr;
      min-height: 100vh;
    }

    .topbar {
      height: 48px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 0 16px;
      background: #ffffff;
      border-bottom: 1px solid var(--line);
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .brand-badge {
      width: 30px;
      height: 30px;
      border-radius: 6px;
      display: grid;
      place-items: center;
      background: var(--blue);
      color: #fff;
      font-weight: 800;
      letter-spacing: .02em;
    }

    .brand h1 {
      margin: 0;
      font-size: 14px;
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .brand p {
      margin: 1px 0 0;
      color: var(--muted);
      font-size: 11px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .scope-picker {
      flex: 1 1 720px;
      max-width: 820px;
      display: grid;
      grid-template-columns: repeat(3, minmax(150px, 1fr));
      align-items: end;
      gap: 8px;
      min-width: 360px;
    }

    .scope-field {
      min-width: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 4px;
    }

    .scope-field label {
      grid-column: 1 / -1;
      color: var(--muted);
      font-size: 9px;
      font-weight: 800;
      letter-spacing: .04em;
      text-transform: uppercase;
    }

    .scope-field select {
      min-width: 0;
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      background: #fff;
      color: var(--text);
      padding: 5px 7px;
      font-size: 12px;
    }

    .top-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .btn {
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      background: #fff;
      color: var(--text);
      min-height: 30px;
      padding: 5px 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      font-weight: 600;
      box-shadow: 0 1px 1px rgba(9, 30, 66, .07);
    }

    .btn:hover { background: #f4f5f7; }
    .btn.is-active { background: #deebff; border-color: #4c9aff; color: var(--blue-dark); }
    .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
    .btn.primary:hover { background: var(--blue-dark); }
    .btn.subtle { background: #f4f5f7; box-shadow: none; }
    .btn.danger { border-color: #ffbdad; color: #bf2600; background: #ffebe6; }
    .btn.icon { min-width: 28px; padding: 4px 7px; }
    .btn.small { min-height: 26px; padding: 3px 8px; font-size: 12px; }

    .main {
      display: grid;
      grid-template-columns: minmax(420px, 40%) minmax(760px, 60%);
      gap: 12px;
      padding: 12px 12px 224px;
      min-height: calc(100vh - 48px);
    }

    .pane {
      min-width: 0;
      display: flex;
      flex-direction: column;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: var(--shadow);
    }

    .pane-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }

    .pane-title {
      min-width: 0;
      display: grid;
      gap: 2px;
    }

    .pane-title h2 {
      margin: 0;
      font-size: 14px;
      line-height: 1.2;
    }

    .pane-title span {
      color: var(--muted);
      font-size: 11px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .pane-body {
      min-height: 0;
      flex: 1;
      overflow: auto;
      padding: 10px;
      background: #f7f8f9;
    }

    .status-pill,
    .chip,
    .type-pill,
    .temp-id-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      border: 1px solid var(--line);
      border-radius: 999px;
      padding: 3px 7px;
      font-size: 11px;
      line-height: 1;
      font-weight: 700;
      white-space: nowrap;
      background: #fff;
      color: #42526e;
    }

    .status-pill.new { background: #deebff; border-color: #b3d4ff; color: var(--blue-dark); }
    .status-pill.submitted { background: #e3fcef; border-color: #abf5d1; color: #006644; }
    .status-pill.sla { background: #e3fcef; border-color: #abf5d1; color: #006644; }
    .status-pill.closed { background: #e3fcef; border-color: #abf5d1; color: #006644; }
    .type-pill { background: #f4f5f7; }
    .temp-id-pill { background: #f4f5f7; color: #253858; font-size: 10px; }
    .temp-id-pill.mini { padding: 2px 5px; font-size: 9px; }

    .request-workspace {
      min-width: 0;
    }

    .designer-sidebar {
      position: fixed;
      left: 50%;
      bottom: 14px;
      z-index: 30;
      transform: translateX(-50%);
      display: grid;
      grid-template-columns: 64px minmax(0, 1fr);
      width: min(1320px, calc(100vw - 28px));
      max-height: 198px;
      min-width: 0;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      overflow: hidden;
      box-shadow: 0 14px 36px rgba(9, 30, 66, .22);
      transition: transform .18s ease, opacity .18s ease;
    }

    body.tools-collapsed .main { padding-bottom: 12px; }
    body.tools-collapsed .designer-sidebar {
      opacity: 0;
      pointer-events: none;
      transform: translate(-50%, calc(100% + 24px));
    }
    body.tools-collapsed .toast { bottom: 18px; }

    body.preview-mode .portal-shell .field-design-strip,
    body.preview-mode .portal-shell .options-editor,
    body.preview-mode .agent-shell .drag-handle,
    body.preview-mode .agent-shell .card-actions {
      display: none;
    }

    body.preview-mode .portal-field:hover {
      border-color: transparent;
      background: transparent;
    }

    .side-tab-buttons {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 6px 4px;
      background: #f4f5f7;
      border-right: 1px solid var(--line);
    }

    .side-tab {
      min-height: 34px;
      border: 1px solid transparent;
      border-radius: 4px;
      background: transparent;
      color: #42526e;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      font-size: 9px;
      font-weight: 700;
      line-height: 1.1;
      padding: 4px 2px;
    }

    .side-tab:hover { background: #ebecf0; }
    .side-tab.is-active {
      background: #deebff;
      border-color: #b3d4ff;
      color: var(--blue-dark);
      box-shadow: inset 3px 0 0 var(--blue);
    }

    .side-tab-icon { font-size: 14px; font-weight: 900; }
    .side-tab-panels { min-width: 0; }
    .side-tab-panel { display: none; padding: 10px; overflow: auto; max-height: 196px; }
    .side-tab-panel.is-active { display: block; }

    .builder-box { display: grid; gap: 8px; }
    .builder-box h3 { margin: 0; font-size: 13px; }

    .side-tab-panel[data-tab-panel="add"].is-active .builder-box {
      grid-template-columns: 150px 150px minmax(410px, 1.35fr) minmax(280px, .95fr) 150px;
      grid-template-rows: auto auto;
      align-items: end;
      column-gap: 8px;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .builder-box h3 {
      grid-column: 1;
      grid-row: 1;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .builder-box > .help-note {
      grid-column: 1;
      grid-row: 2;
      margin: 0;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .temp-id-preview {
      grid-column: 2;
      grid-row: 1 / 3;
      align-self: stretch;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .form-grid {
      grid-column: 3;
      grid-row: 1 / 3;
      grid-template-columns: minmax(150px, 1fr) 130px 132px auto;
      align-items: end;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .form-grid-2 {
      grid-column: 4;
      grid-row: 1 / 3;
      grid-template-columns: minmax(150px, 1fr) minmax(130px, .8fr);
      align-items: end;
    }

    .side-tab-panel[data-tab-panel="add"].is-active .builder-actions {
      grid-column: 5;
      grid-row: 1 / 3;
      align-self: end;
      flex-direction: column;
    }

    .help-note {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    .temp-id-preview {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 8px;
      border: 1px solid var(--line);
      border-radius: 4px;
      background: #fafbfc;
      color: var(--muted);
      font-size: 11px;
    }

    .form-grid,
    .form-grid-2 { display: grid; gap: 7px; }

    .form-control {
      display: grid;
      gap: 3px;
      min-width: 0;
    }

    .form-control label {
      color: var(--muted);
      font-size: 10px;
      font-weight: 750;
      text-transform: uppercase;
      letter-spacing: .02em;
    }

    .form-control input,
    .form-control textarea,
    .form-control select,
    .label-editor,
    .type-editor,
    .source-editor {
      width: 100%;
      min-width: 0;
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      background: #fff;
      color: var(--text);
      padding: 6px 7px;
      font-size: 12px;
    }

    .form-control input:focus,
    .form-control textarea:focus,
    .form-control select:focus,
    .label-editor:focus,
    .type-editor:focus,
    .source-editor:focus,
    .mock-input:focus,
    .mock-select:focus,
    .mock-textarea:focus {
      outline: 2px solid #4c9aff;
      border-color: #4c9aff;
    }

    .checkbox-line {
      min-height: 26px;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      color: #42526e;
      font-size: 12px;
      font-weight: 650;
    }

    .builder-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .builder-actions .btn { flex: 1 1 auto; }

    .side-info-card {
      display: grid;
      gap: 8px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.45;
    }

    .side-info-card h3 {
      color: var(--text);
      margin: 0;
      font-size: 13px;
    }

    .mini-rule {
      display: grid;
      gap: 2px;
      border: 1px solid var(--line);
      border-radius: 4px;
      background: #fafbfc;
      padding: 7px;
    }

    .mini-rule strong { color: var(--text); }

    .portal-shell {
      min-width: 0;
      overflow: hidden;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: var(--radius);
    }

    .preview-stack {
      min-width: 0;
      display: grid;
      gap: 10px;
    }

    .portal-cover {
      height: 44px;
      background:
        linear-gradient(90deg, rgba(17, 63, 61, .62), rgba(105, 130, 108, .34)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='960' height='160' viewBox='0 0 960 160'%3E%3Crect width='960' height='160' fill='%23aeb7a8'/%3E%3Cpath d='M0 92 C150 50 228 126 360 78 C520 22 650 124 960 42 L960 160 L0 160 Z' fill='%23788f80'/%3E%3Cpath d='M0 116 C166 76 262 140 430 102 C610 62 738 128 960 88 L960 160 L0 160 Z' fill='%235f786f'/%3E%3C/svg%3E");
      background-size: cover;
      background-position: center;
    }

    .portal-content {
      padding: 18px 24px 26px;
      max-width: 1000px;
      margin: 0 auto;
    }

    .breadcrumbs {
      color: var(--teal);
      font-size: 11px;
      font-weight: 700;
      margin-bottom: 12px;
    }

    .portal-heading {
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: start;
      gap: 14px;
      margin-bottom: 22px;
    }

    .portal-icon {
      width: 42px;
      height: 42px;
      border-radius: 6px;
      display: grid;
      place-items: center;
      background: #e9f2ff;
      color: var(--blue-dark);
      border: 1px solid #b3d4ff;
      font-size: 22px;
      font-weight: 900;
    }

    .portal-heading h3 {
      margin: 0;
      font-size: 22px;
      line-height: 1.2;
      color: #0c214a;
    }

    .portal-heading p {
      margin: 6px 0 0;
      color: var(--text);
      font-size: 13px;
    }

    .portal-question {
      margin: 0 0 14px;
      color: #42526e;
      font-size: 12px;
    }

    .request-type-bar {
      min-height: 64px;
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: center;
      gap: 12px;
      padding: 12px 18px;
      margin-bottom: 16px;
      background: #f1f2f4;
      border: 1px solid #f1f2f4;
      border-radius: 2px;
    }

    .request-type-icon {
      width: 30px;
      height: 30px;
      border-radius: 4px;
      background: #0052cc;
      color: white;
      display: grid;
      place-items: center;
      font-weight: 900;
    }

    .request-type-name {
      color: var(--teal);
      font-weight: 800;
    }

    .request-name-input {
      width: 100%;
      margin: 0;
      border: 1px solid transparent;
      border-radius: 4px;
      background: transparent;
      color: inherit;
      padding: 4px 6px;
      font-weight: 800;
    }

    .request-name-input:focus {
      background: #fff;
      outline: 2px solid #4c9aff;
      border-color: #4c9aff;
    }

    .required-note {
      margin: 0 0 14px;
      color: var(--text);
    }

    .required-note span { color: var(--blue); }

    .portal-form {
      display: grid;
      gap: 14px;
    }

    .portal-field {
      position: relative;
      border: 1px solid transparent;
      border-radius: 4px;
      padding: 0;
    }

    .portal-field:hover {
      border-color: #b3d4ff;
      background: #fbfdff;
    }

    .field-design-strip {
      min-height: 32px;
      display: grid;
      grid-template-columns: auto auto minmax(120px, 1fr) 112px 122px auto auto;
      gap: 6px;
      align-items: center;
      margin-bottom: 6px;
      padding: 5px;
      background: #f7f8f9;
      border: 1px solid var(--line);
      border-radius: 4px;
    }

    .drag-handle {
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      background: #fff;
      color: #42526e;
      min-height: 24px;
      padding: 3px 7px;
      cursor: grab;
      user-select: none;
      font-size: 11px;
      font-weight: 800;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      line-height: 1;
    }

    .drag-handle:active { cursor: grabbing; }

    .card-actions {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      gap: 4px;
      flex-wrap: wrap;
    }

    .field-preview-label {
      display: inline-flex;
      align-items: baseline;
      gap: 2px;
      margin-bottom: 5px;
      font-weight: 700;
      color: #172b4d;
    }

    .field-preview-label .asterisk { color: var(--blue); }

    .field-preview-help {
      margin: -1px 0 6px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }

    .mock-input,
    .mock-select,
    .mock-textarea {
      width: 100%;
      border: 1px solid #8590a2;
      border-radius: 2px;
      background: #fff;
      color: var(--text);
      padding: 8px;
      font-size: 13px;
    }

    .mock-textarea { min-height: 128px; resize: vertical; }

    .mock-editor {
      border: 1px solid #8590a2;
      border-radius: 2px;
      overflow: hidden;
      background: #fff;
    }

    .editor-toolbar {
      min-height: 35px;
      display: flex;
      align-items: center;
      gap: 4px;
      padding: 5px 8px;
      border-bottom: 1px solid var(--line);
      color: #42526e;
      flex-wrap: wrap;
    }

    .editor-toolbar span {
      min-width: 24px;
      height: 24px;
      display: inline-grid;
      place-items: center;
      border-radius: 3px;
      font-weight: 700;
    }

    .editor-toolbar .toolbar-select {
      min-width: 105px;
      justify-content: start;
      padding: 0 8px;
      border-right: 1px solid var(--line);
    }

    .mock-editor textarea {
      border: 0;
      border-radius: 0;
      min-height: 112px;
      outline: 0;
    }

    .choice-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
      gap: 7px 12px;
    }

    .choice-item {
      display: inline-flex;
      align-items: center;
      gap: 7px;
      color: #172b4d;
      line-height: 1.35;
    }

    .options-editor {
      margin-top: 7px;
      padding: 7px;
      border: 1px solid var(--line);
      border-radius: 4px;
      background: #fafbfc;
    }

    .options-editor small {
      display: block;
      margin-bottom: 5px;
      color: var(--muted);
      font-weight: 700;
    }

    .options-editor textarea {
      width: 100%;
      min-height: 48px;
      resize: vertical;
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      padding: 6px;
      font-size: 12px;
    }

    .field-catalog {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .catalog-panel {
      min-width: 0;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #fff;
      overflow: hidden;
    }

    .catalog-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 9px 10px;
      border-bottom: 1px solid var(--line);
      background: #fafbfc;
    }

    .catalog-head h3 {
      margin: 0;
      font-size: 13px;
      line-height: 1.2;
    }

    .catalog-head small {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-size: 10px;
      line-height: 1.35;
    }

    .catalog-body {
      display: grid;
      gap: 8px;
      padding: 10px;
      max-height: 128px;
      overflow: auto;
    }

    .source-field-card {
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 8px;
      background: #fff;
    }

    .source-field-card .field-design-strip {
      grid-template-columns: auto auto minmax(160px, 1fr) 130px 146px auto;
      margin-bottom: 7px;
    }

    .source-card-value {
      padding: 7px 8px;
      border-radius: 2px;
      background: #fafbfc;
      color: #42526e;
      line-height: 1.4;
      word-break: break-word;
    }

    .source-badge {
      border-color: #c1c7d0;
      background: #f4f5f7;
      color: #42526e;
    }

    .source-badge.automation {
      border-color: #abf5d1;
      background: #e3fcef;
      color: #006644;
    }

    .source-badge.workflow {
      border-color: #ffe380;
      background: #fff7d6;
      color: #7a4f01;
    }

    .dropzone {
      min-height: 64px;
      display: grid;
      gap: 10px;
      border: 1px dashed transparent;
      border-radius: 4px;
      transition: background .12s ease, border-color .12s ease;
    }

    .dropzone.is-drag-over {
      border-color: #4c9aff;
      background: #deebff;
    }

    .empty-state {
      border: 1px dashed var(--line-strong);
      border-radius: 4px;
      padding: 16px;
      color: var(--muted);
      text-align: center;
      background: #fafbfc;
      font-size: 12px;
      line-height: 1.5;
    }

    .agent-shell {
      overflow: hidden;
      min-height: 640px;
      background: #fff;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      display: grid;
      grid-template-rows: auto auto 1fr;
    }

    .agent-topbar {
      height: 42px;
      display: grid;
      grid-template-columns: auto minmax(180px, 1fr) auto;
      align-items: center;
      gap: 10px;
      padding: 0 14px;
      border-bottom: 1px solid var(--line);
      background: #ffffff;
    }

    .agent-nav {
      display: inline-flex;
      align-items: center;
      gap: 11px;
      min-width: 0;
      color: #42526e;
      font-weight: 700;
      white-space: nowrap;
    }

    .agent-logo {
      width: 24px;
      height: 24px;
      border-radius: 5px;
      display: grid;
      place-items: center;
      background: var(--blue);
      color: #fff;
      font-size: 12px;
      font-weight: 900;
    }

    .agent-search {
      width: 100%;
      max-width: 540px;
      justify-self: center;
      border: 1px solid var(--line-strong);
      border-radius: 4px;
      background: #fff;
      padding: 7px 9px;
      color: var(--muted);
      font-size: 12px;
    }

    .agent-actions {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
    }

    .avatar {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      display: inline-grid;
      place-items: center;
      background: #0747a6;
      color: #fff;
      font-size: 10px;
      font-weight: 800;
      flex: 0 0 auto;
    }

    .issue-header {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      align-items: start;
      gap: 12px;
      padding: 18px 20px 12px;
      border-bottom: 1px solid #f1f2f4;
      background: #fff;
    }

    .issue-title {
      min-width: 0;
      display: grid;
      gap: 8px;
    }

    .issue-title small {
      color: #42526e;
      font-size: 12px;
      font-weight: 600;
    }

    .issue-title h2 {
      margin: 0;
      color: #172b4d;
      font-size: 22px;
      line-height: 1.2;
      word-break: break-word;
    }

    .issue-actions {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-end;
      gap: 7px;
    }

    .agent-content {
      min-height: 0;
      display: grid;
      grid-template-columns: minmax(390px, 1fr) 340px;
    }

    .agent-main {
      min-width: 0;
      padding: 18px 20px 20px;
      border-right: 1px solid var(--line);
      background: #fff;
    }

    .agent-sidebar {
      min-width: 0;
      padding: 18px 16px;
      background: #fff;
    }

    .raised-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      border: 1px solid var(--line);
      border-radius: 4px;
      background: #fff;
      margin-bottom: 16px;
    }

    .raised-left {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .raised-card a {
      color: var(--blue);
      text-decoration: none;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }

    .section-box,
    .sidebar-box {
      border: 1px solid var(--line);
      border-radius: 4px;
      background: #fff;
      margin-bottom: 12px;
      overflow: hidden;
    }

    .section-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 11px 12px;
      border-bottom: 1px solid var(--line);
      background: #fff;
    }

    .section-title h3 {
      margin: 0;
      font-size: 15px;
      line-height: 1.2;
      font-weight: 700;
    }

    .section-title small {
      display: block;
      margin-top: 2px;
      color: var(--muted);
      font-size: 11px;
    }

    .section-body { padding: 12px; }

    .status-actions-preview {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
    }

    .status-button {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 32px;
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 0 10px;
      background: #fff;
      color: #253858;
      font: inherit;
      font-weight: 700;
      white-space: nowrap;
    }

    .status-button.closed {
      border-color: #9fd76a;
      background: #92d050;
      color: #172b4d;
    }

    .status-button.automation {
      color: #42526e;
    }

    .resolution-state {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-height: 32px;
      color: #42526e;
      font-weight: 700;
      white-space: nowrap;
    }

    .status-check {
      color: #36b37e;
      font-weight: 900;
    }

    .agent-card {
      border: 1px solid #ebecf0;
      border-radius: 4px;
      padding: 10px;
      background: #fff;
    }

    .agent-card-head {
      display: grid;
      grid-template-columns: auto minmax(0, 1fr) auto;
      gap: 8px;
      align-items: center;
      margin-bottom: 7px;
    }

    .agent-label {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 6px;
      color: #172b4d;
      font-size: 13px;
      font-weight: 750;
    }

    .agent-label span:last-child {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .agent-value {
      min-height: 34px;
      padding: 8px 10px;
      border-left: 3px solid var(--line);
      border-radius: 2px;
      background: #fafbfc;
      color: #172b4d;
      line-height: 1.45;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .sidebar-box.sla-box { margin-bottom: 10px; }

    .workflow-screen {
      border: 1px solid #c1c7d0;
      border-radius: 4px;
      background: #fff;
      overflow: hidden;
    }

    .workflow-screen-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--line);
      background: #fafbfc;
    }

    .workflow-screen-head strong {
      font-size: 14px;
    }

    .workflow-screen-body {
      display: grid;
      gap: 10px;
      padding: 12px;
    }

    .workflow-screen-footer {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      padding: 10px 12px;
      border-top: 1px solid var(--line);
      background: #fafbfc;
    }

    .sla-row {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 14px;
      align-items: start;
    }

    .sla-date {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      border-radius: 999px;
      background: #f1f2f4;
      color: #42526e;
      padding: 6px 9px;
      font-weight: 700;
      white-space: nowrap;
    }

    .sla-metric {
      display: grid;
      gap: 3px;
      color: var(--text);
      line-height: 1.35;
    }

    .sla-metric span { color: var(--muted); }

    .details-list {
      display: grid;
      gap: 12px;
    }

    .detail-row,
    .context-row {
      display: grid;
      grid-template-columns: minmax(100px, .76fr) minmax(0, 1fr) auto;
      gap: 10px;
      align-items: start;
      min-height: 27px;
    }

    .detail-label,
    .context-label {
      color: #42526e;
      font-weight: 650;
      line-height: 1.35;
    }

    .detail-value,
    .context-value {
      min-width: 0;
      color: #172b4d;
      line-height: 1.35;
      word-break: break-word;
    }

    .context-row {
      grid-template-columns: minmax(100px, .76fr) minmax(0, 1fr) auto;
      padding: 0;
      border: 0;
      background: transparent;
    }

    .context-label {
      display: grid;
      gap: 4px;
    }

    .context-tools {
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }

    .chip-stack {
      display: inline-flex;
      flex-wrap: wrap;
      gap: 4px;
    }

    .json-drawer {
      display: none;
      margin-top: 10px;
    }

    .json-drawer.open { display: block; }

    .json-drawer pre {
      max-height: 300px;
      overflow: auto;
      margin: 0;
      padding: 12px;
      border-radius: 4px;
      background: #091e42;
      color: #dfe1e6;
      white-space: pre-wrap;
      word-break: break-word;
      font-size: 12px;
    }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 226px;
      z-index: 20;
      max-width: min(420px, calc(100vw - 36px));
      padding: 10px 12px;
      border-radius: 4px;
      background: #172b4d;
      color: #fff;
      box-shadow: var(--shadow);
      opacity: 0;
      pointer-events: none;
      transform: translateY(8px);
      transition: opacity .16s ease, transform .16s ease;
    }

    .toast.show { opacity: 1; transform: translateY(0); }

    @media (max-width: 1240px) {
      .main { grid-template-columns: 1fr; }
      .agent-content { grid-template-columns: minmax(390px, 1fr) 320px; }
    }

    @media (max-width: 980px) {
      .agent-content { grid-template-columns: 1fr; }
      .agent-main { border-right: 0; border-bottom: 1px solid var(--line); }
      .agent-sidebar { background: #fafbfc; }
      .designer-sidebar {
        grid-template-columns: 1fr;
        max-height: 280px;
      }
      .side-tab-buttons {
        flex-direction: row;
        border-right: 0;
        border-bottom: 1px solid var(--line);
      }
      .side-tab { min-height: 40px; flex-direction: row; flex: 1 1 0; }
      .side-tab-panel { max-height: 228px; }
      .side-tab-panel[data-tab-panel="add"].is-active .builder-box {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
      }
      .side-tab-panel[data-tab-panel="add"].is-active .builder-box h3,
      .side-tab-panel[data-tab-panel="add"].is-active .builder-box > .help-note,
      .side-tab-panel[data-tab-panel="add"].is-active .temp-id-preview,
      .side-tab-panel[data-tab-panel="add"].is-active .form-grid,
      .side-tab-panel[data-tab-panel="add"].is-active .form-grid-2,
      .side-tab-panel[data-tab-panel="add"].is-active .builder-actions {
        grid-column: auto;
        grid-row: auto;
      }
      .side-tab-panel[data-tab-panel="add"].is-active .form-grid,
      .side-tab-panel[data-tab-panel="add"].is-active .form-grid-2 {
        grid-template-columns: 1fr;
      }
      .side-tab-panel[data-tab-panel="add"].is-active .builder-actions {
        flex-direction: row;
      }
    }

    @media (max-width: 660px) {
      .topbar { height: auto; min-height: 48px; align-items: flex-start; flex-direction: column; padding: 10px; }
      .scope-picker { width: 100%; max-width: none; min-width: 0; grid-template-columns: 1fr; }
      .main { padding: 8px 8px 288px; gap: 8px; }
      .toast { bottom: 292px; }
      .pane-title span { white-space: normal; }
      .designer-sidebar { width: calc(100vw - 16px); bottom: 8px; }
      .portal-content { padding: 14px; }
      .portal-heading { grid-template-columns: auto 1fr; }
      .portal-heading .btn { grid-column: 1 / -1; justify-self: start; }
      .field-design-strip { grid-template-columns: 1fr; }
      .field-catalog { grid-template-columns: 1fr; }
      .source-field-card .field-design-strip { grid-template-columns: 1fr; }
      .issue-header { grid-template-columns: 1fr; }
      .issue-actions { justify-content: flex-start; }
      .agent-topbar { grid-template-columns: 1fr; height: auto; padding: 10px; }
      .agent-search { justify-self: stretch; }
      .agent-actions { justify-content: flex-start; }
      .detail-row,
      .context-row { grid-template-columns: 1fr; gap: 3px; }
      .context-tools { justify-content: flex-start; }
    }
