/*!*************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./app/globals.css ***!
  \*************************************************************************************************************************************************************************************************************************************************************/
:root {
  --bg: #070c16;
  --panel: rgba(12, 20, 34, 0.92);
  --panel-soft: rgba(17, 29, 48, 0.84);
  --line: rgba(88, 132, 166, 0.2);
  --line-bright: rgba(30, 211, 204, 0.42);
  --text: #e4f1fb;
  --muted: #8297ac;
  --accent: #21ddd0;
  --accent-blue: #2c8cff;
  --accent-dark: #092c33;
  --danger: #ff7e92;
  --radius: 16px;
  --shadow: 0 16px 46px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif; }
body {
  background-image:
    radial-gradient(circle at 42% -10%, rgba(32, 123, 145, 0.22), transparent 40%),
    radial-gradient(circle at 100% 0, rgba(40, 91, 173, 0.16), transparent 26%),
    linear-gradient(rgba(22, 45, 62, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22, 45, 62, 0.06) 1px, transparent 1px);
  background-size: auto, auto, 36px 36px, 36px 36px;
}
* { scrollbar-width: thin; scrollbar-color: rgba(33, 221, 208, .38) rgba(8, 16, 28, .36); }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: rgba(8, 16, 28, .36); }
*::-webkit-scrollbar-thumb { background: rgba(33, 221, 208, .34); border-radius: 999px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
input, textarea, select {
  border: 1px solid var(--line);
  background: rgba(6, 13, 24, 0.85);
  color: var(--text);
  outline: none;
  border-radius: 10px;
  padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { border-color: var(--line-bright); box-shadow: 0 0 0 2px rgba(33, 221, 208, 0.08); }
input::placeholder, textarea::placeholder { color: #657b90; }

.app-shell { width: 100vw; height: 100vh; min-height: 0; overflow: hidden; display: flex; flex-direction: column; background: #050b14; }
.app-topbar { height: 64px; flex-shrink: 0; border-bottom: 1px solid var(--line); background: rgba(6, 12, 22, .96); display: grid; grid-template-columns: auto minmax(230px, auto) minmax(260px, 1fr) auto; align-items: center; grid-gap: 18px; gap: 18px; padding: 0 22px; }
.mobile-menu-button { display: none; border: 1px solid var(--line); border-radius: 10px; background: rgba(15, 45, 53, .38); color: var(--accent); width: 40px; height: 40px; place-items: center; }
.mobile-tabbar { display: none; }
.topbar-title { display: flex; align-items: center; gap: 9px; color: var(--text); white-space: nowrap; }
.topbar-title svg { color: var(--accent); }
.topbar-center { display: flex; align-items: center; gap: 12px; min-width: 0; }
.global-search { height: 40px; flex: 1 1; max-width: 680px; display: flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; color: var(--muted); }
.global-search input { min-width: 0; flex: 1 1; padding: 0; border: 0; background: transparent; box-shadow: none; }
.quick-question { white-space: nowrap; border: 1px solid var(--line-bright); border-radius: 8px; color: var(--accent); background: var(--accent-dark); padding: 9px 12px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.topbar-model, .topbar-status, .topbar-user, .topbar-link { white-space: nowrap; color: var(--muted); font-size: 12px; }
.topbar-status { display: inline-flex; align-items: center; gap: 5px; color: #63dbb5; }
.topbar-link { border: 0; background: transparent; padding: 0; color: #8edbd5; text-decoration: none; }
.mobile-logout-button { display: none; }
.app-body {
  flex: 1 1;
  display: flex;
  width: 100vw;
  height: calc(100vh - 64px);
  min-height: 0;
  overflow: hidden;
}
.app-body.logs-mode .context-panel { width: 520px; }
.primary-nav { width: 72px; min-height: 0; flex: 0 0 72px; border-right: 1px solid var(--line); background: rgba(5, 11, 20, .95); padding: 18px 10px; display: flex; flex-direction: column; align-items: center; z-index: 30; }
.secondary-nav { width: 240px; min-height: 0; flex: 0 0 240px; overflow: hidden; border-right: 1px solid var(--line); background: rgba(8, 15, 27, .94); display: flex; flex-direction: column; }
.main-workspace { min-width: 0; min-height: 0; flex: 1 1 auto; overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: rgba(7, 13, 23, .35); }
.workspace-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
.context-panel { width: 420px; min-width: 420px; min-height: 0; flex: 0 0 auto; background: rgba(6, 12, 22, 0.78); overflow-y: auto; overflow-x: hidden; padding: 24px 22px; }
.context-drawer-header, .mobile-context-button { display: none; }
.secondary-scroll { min-height: 0; flex: 1 1 auto; overflow-y: auto; padding: 20px 16px; display: grid; align-content: start; grid-gap: 18px; gap: 18px; }
.secondary-header { display: grid; grid-gap: 7px; gap: 7px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.secondary-header span { color: var(--text); font-weight: 600; }
.secondary-header small { color: var(--muted); line-height: 1.5; }
.secondary-menu { display: grid; grid-gap: 8px; gap: 8px; }
.secondary-menu button { border: 1px solid transparent; border-radius: 10px; background: rgba(12, 22, 36, .55); color: #a3b4c5; text-align: left; padding: 10px 12px; font-size: 13px; }
.secondary-menu button:hover { border-color: rgba(33, 221, 208, .25); color: var(--accent); background: rgba(13, 57, 64, .35); }
.secondary-menu button.active { border-color: var(--line-bright); color: var(--accent); background: rgba(13, 57, 64, .58); }
.secondary-menu button:disabled { color: #64778a; background: rgba(12, 22, 36, .34); border-color: transparent; }
.secondary-menu button:disabled:hover { color: #64778a; background: rgba(12, 22, 36, .34); border-color: transparent; }
.module-nav { display: grid; grid-gap: 10px; gap: 10px; flex-shrink: 0; }
.module-group { display: grid; grid-gap: 4px; gap: 4px; }
.module { position: relative; width: 52px; height: 52px; border: 1px solid transparent; border-radius: 14px; display: grid; place-items: center; color: #8ca1b4; background: transparent; transition: .18s; }
.module:hover { background: rgba(23, 37, 56, 0.72); color: var(--text); }
.module.active { border-color: rgba(33, 221, 208, .25); background: rgba(13, 57, 64, .65); color: var(--accent); box-shadow: inset 0 0 26px rgba(33, 221, 208, .06); }
.nav-tooltip { position: absolute; left: 62px; top: 50%; transform: translateY(-50%); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; background: #0d1d2d; color: var(--text); font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none; transition: .16s; box-shadow: var(--shadow); }
.module:hover .nav-tooltip { opacity: 1; }
.new-session-button { flex-shrink: 0; border: 1px solid var(--line-bright); border-radius: 10px; padding: 10px 12px; color: var(--accent); background: rgba(13, 57, 64, .32); text-align: left; font-size: 13px; }
.history-panel { min-height: 0; flex: 1 1 auto; border-top: 1px solid var(--line); padding-top: 14px; display: grid; align-content: start; grid-gap: 10px; gap: 10px; overflow: hidden; }
.history-list { min-height: 0; max-height: 34vh; overflow-y: auto; display: grid; grid-gap: 7px; gap: 7px; }
.history-title { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.history-title strong { display: inline-flex; align-items: center; gap: 5px; }
.history-title button { border: 1px solid var(--line-bright); background: transparent; color: var(--accent); border-radius: 6px; font-size: 11px; padding: 3px 7px; }
.history-row { display: flex; align-items: center; border-radius: 7px; color: var(--muted); }
.history-row.active { background: rgba(13, 57, 64, .65); color: var(--accent); }
.history-row button:first-child { border: 0; background: transparent; flex: 1 1; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 7px; font-size: 12px; }
.history-row button:last-child { border: 0; background: transparent; padding: 6px; color: var(--muted); }
.sidebar-footer { flex-shrink: 0; margin-top: auto; border-top: 1px solid var(--line); padding: 16px; display: grid; grid-gap: 12px; gap: 12px; }
.status { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.status span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.language-toggle { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: transparent; color: var(--muted); }
.workspace-header { min-height: 86px; flex-shrink: 0; border-bottom: 1px solid var(--line); padding: 20px 28px; display: flex; justify-content: space-between; align-items: center; }
.workspace-header h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 550; margin: 0 0 6px; }
.workspace-header h2 svg { color: var(--accent); }
.workspace-header p { color: var(--muted); font-size: 12px; margin: 0; }
.tool-panel { margin: 20px 28px 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-soft); box-shadow: var(--shadow); }
.diagnostic-panel { min-height: calc(100% - 126px); display: flex; flex-direction: column; }
.tool-panel-hint { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.tool-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-bar { display: flex; gap: 9px; width: min(480px, 100%); }
.search-bar input { flex: 1 1; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-chips button { border: 1px solid rgba(33, 221, 208, .26); border-radius: 999px; background: rgba(13, 57, 64, .28); color: #9fe8e0; padding: 6px 10px; font-size: 11px; }
.quick-chips button:hover { border-color: var(--line-bright); background: rgba(20, 77, 80, .46); }
.knowledge-page { display: grid; grid-gap: 14px; gap: 14px; }
.knowledge-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.knowledge-tabs button { border: 1px solid var(--line); border-radius: 8px; background: rgba(6, 13, 24, .58); color: var(--muted); padding: 8px 11px; font-size: 12px; }
.knowledge-tabs button.active, .knowledge-tabs button:hover { border-color: var(--line-bright); color: var(--accent); background: rgba(13, 57, 64, .42); }
.knowledge-search-panel, .knowledge-result-list { display: grid; grid-gap: 10px; gap: 10px; }
.knowledge-search-guide { display: grid; grid-gap: 4px; gap: 4px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; padding: 12px 14px; }
.knowledge-search-guide strong { color: var(--text); font-size: 14px; }
.knowledge-search-guide span { color: var(--muted); font-size: 12px; line-height: 1.6; }
.fae-search-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-gap: 8px; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: rgba(6, 13, 24, .36); }
.fae-search-summary div { min-width: 0; display: grid; grid-gap: 4px; gap: 4px; }
.fae-search-summary span { color: var(--muted); font-size: 11px; }
.fae-search-summary strong, .fae-search-summary p { margin: 0; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.knowledge-browser { margin-top: 16px; display: grid; grid-gap: 12px; gap: 12px; }
.knowledge-browser-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.knowledge-roots { display: flex; flex-wrap: wrap; gap: 8px; }
.knowledge-roots button, .knowledge-breadcrumb button { border: 1px solid var(--line); border-radius: 8px; background: rgba(6, 13, 24, .58); color: var(--muted); padding: 7px 10px; font-size: 12px; }
.knowledge-roots button.active, .knowledge-breadcrumb button:hover { border-color: var(--line-bright); color: var(--accent); background: rgba(13, 57, 64, .4); }
.knowledge-breadcrumb { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.knowledge-breadcrumb button::after { content: "/"; margin-left: 7px; color: var(--muted); }
.knowledge-breadcrumb button:last-child::after { content: ""; margin-left: 0; }
.knowledge-browser-grid { display: grid; grid-gap: 8px; gap: 8px; }
.knowledge-folder-row, .knowledge-document-row { width: 100%; min-height: 48px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; grid-gap: 10px; gap: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(6, 13, 24, .44); padding: 9px 11px; text-align: left; }
.knowledge-folder-row:hover, .knowledge-document-row:hover { border-color: rgba(33, 221, 208, .3); background: rgba(13, 57, 64, .24); }
.knowledge-folder-row svg, .knowledge-document-row svg { color: var(--accent); flex-shrink: 0; }
.knowledge-folder-row span, .knowledge-document-main strong { color: var(--text); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-folder-row small, .knowledge-document-main span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.knowledge-document-main { display: grid; grid-gap: 3px; gap: 3px; min-width: 0; }
.compact-button { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.model-selector { margin: 14px 25px 0; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.model-selector select { width: auto; min-width: 190px; height: 38px; padding: 7px 10px; color: var(--accent); border-color: rgba(33, 221, 208, .3); background: rgba(6, 13, 24, .9); }
.primary-button, .secondary-button { border-radius: 9px; padding: 10px 15px; border: 1px solid var(--line-bright); display: inline-flex; align-items: center; gap: 7px; }
.primary-button { background: var(--accent-dark); color: var(--accent); }
.secondary-button { background: transparent; color: #99d7d3; }
.stack-form { display: grid; grid-gap: 9px; gap: 9px; }
.diagnostic-input { display: grid; grid-gap: 14px; gap: 14px; }
.field-grid { display: grid; grid-template-columns: minmax(180px, 240px) minmax(240px, 1fr); grid-gap: 12px; gap: 12px; }
.field-grid label { display: grid; grid-gap: 7px; gap: 7px; color: var(--muted); font-size: 12px; }
.stack-form textarea { min-height: 72px; resize: vertical; }
.stack-form .log-input, .diagnostic-input .log-input { min-height: clamp(320px, 46vh, 620px); line-height: 1.55; font-family: Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; overflow: auto; }
.log-picker { justify-content: center; min-height: 40px; }
.privacy-hint { color: #e6b96a; font-size: 11px; line-height: 1.5; margin: 0; }
.form-error { color: var(--danger); font-size: 12px; margin: 0; }
.log-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.log-stats span { border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.log-stats .ok { color: #63dbb5; border-color: rgba(99, 219, 181, .32); }
.log-stats .danger { color: var(--danger); border-color: rgba(255, 126, 146, .4); }
.log-dropzone { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--line-bright); border-radius: 8px; color: var(--muted); background: rgba(6, 13, 24, .32); cursor: pointer; }
.log-dropzone:hover { color: var(--accent); background: rgba(13, 57, 64, .22); }
.log-dropzone input { display: none; }
.log-upload-progress { display: grid; grid-gap: 7px; gap: 7px; border: 1px solid var(--line); border-radius: 10px; background: rgba(13, 57, 64, .22); padding: 10px 12px; }
.log-upload-progress div { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.log-upload-progress strong { color: var(--text); font-size: 13px; }
.log-upload-bar { display: block; height: 8px; border-radius: 999px; overflow: hidden; background: rgba(148, 163, 184, .18); }
.log-upload-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #63dbb5); transition: width .18s ease; }
.diagnostic-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.feature-cards { display: grid; grid-gap: 10px; gap: 10px; color: var(--muted); font-size: 13px; }
.feature-card { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(6, 13, 24, .42); padding: 10px 12px; line-height: 1.55; }
.feature-card strong { color: var(--text); white-space: nowrap; font-weight: 500; }
.feature-card svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.feature-card-action { flex-wrap: wrap; }
.feature-card-action .secondary-button { margin-left: auto; padding: 7px 11px; font-size: 12px; }
.feature-links { display: flex; flex-wrap: wrap; gap: 9px; }
.feature-cards a { width: -moz-fit-content; width: fit-content; color: var(--accent); }
.feature-links a { border: 1px solid rgba(33, 221, 208, .25); border-radius: 8px; background: rgba(15, 45, 53, .3); padding: 7px 10px; text-decoration: none; font-size: 12px; }

.admin-page { display: grid; grid-gap: 16px; gap: 16px; }
.admin-page-header { display: flex; justify-content: space-between; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.admin-page-header h3 { margin: 3px 0 0; font-size: 18px; color: var(--text); }
.admin-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-gap: 10px; gap: 10px; }
.admin-guide-steps div, .admin-row-detail, .permission-side-panel, .permission-main-panel, .role-section-title { border: 1px solid var(--line); border-radius: 10px; background: rgba(6, 13, 24, .32); padding: 12px; }
.admin-guide-steps strong, .admin-row-detail strong, .role-section-title strong { display: block; color: var(--text); font-size: 13px; }
.admin-guide-steps span, .admin-row-detail span, .role-section-title span, .permission-side-panel p { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 4px; }
.admin-search, .admin-role-picker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.admin-search input { min-width: min(320px, 70vw); }
.admin-form { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; grid-gap: 10px; gap: 10px; align-items: center; }
.admin-toolbar, .admin-role-checks, .admin-inline-checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-role-checks { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.admin-role-checks label, .admin-inline-checks label, .admin-toggle { display: inline-flex; align-items: center; gap: 5px; }
.admin-inline-checks { max-width: 360px; color: var(--muted); font-size: 12px; }
.admin-row-detail { grid-column: 1 / -1; display: grid; grid-gap: 8px; gap: 8px; }
.text-action-button { width: auto !important; padding: 0 10px; white-space: nowrap; font-size: 12px; }
.admin-table { display: grid; grid-gap: 8px; gap: 8px; }
.admin-table-head, .admin-table-row { display: grid; grid-template-columns: 1.2fr 1fr 100px minmax(260px, auto); grid-gap: 12px; gap: 12px; align-items: center; }
.admin-table-head { color: var(--muted); font-size: 12px; padding: 0 12px; }
.admin-table-row, .admin-card, .permission-group { border: 1px solid var(--line); border-radius: 12px; background: rgba(6, 13, 24, .42); padding: 12px; }
.admin-table-row strong, .admin-card h4 { display: block; color: var(--text); margin: 0; }
.admin-table-row small, .admin-card p, .admin-card small, .permission-row small { display: block; color: var(--muted); font-size: 12px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-actions button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #ffffff; color: #3b82f6; }
.admin-actions select { height: 34px; padding: 4px 8px; }
.admin-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); grid-gap: 12px; gap: 12px; }
.admin-card { display: grid; grid-gap: 10px; gap: 10px; }
.role-section-title { display: flex; align-items: center; justify-content: space-between; }
.permission-workspace { display: grid; grid-template-columns: minmax(190px, .7fr) minmax(360px, 2fr) minmax(220px, .9fr); grid-gap: 12px; gap: 12px; align-items: start; }
.permission-side-panel, .permission-main-panel { display: grid; grid-gap: 10px; gap: 10px; }
.permission-side-panel h4, .permission-main-panel h4 { margin: 0; color: var(--text); }
.permission-side-panel small { display: block; color: var(--muted); font-size: 12px; line-height: 1.55; }
.permission-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); grid-gap: 12px; gap: 12px; align-items: start; }
.permission-group { display: grid; grid-gap: 8px; gap: 8px; }
.permission-group h4 { margin: 0 0 4px; color: var(--text); }
.permission-row { min-height: 38px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-gap: 5px 8px; gap: 5px 8px; align-items: center; color: var(--text); }
.permission-row small { grid-column: 2; }
.permission-denied h3 { margin: 0 0 6px; color: var(--danger); }

@media (max-width: 980px) {
  .admin-guide-steps, .permission-workspace { grid-template-columns: 1fr; }
  .admin-table-head { display: none; }
  .admin-table-row { grid-template-columns: 1fr; }
  .admin-actions { justify-content: flex-start; }
}

/* RBAC admin surfaces: light, instructional, and low-risk by default. */
.admin-page .admin-guide-steps div {
  background: #f8fbff;
  border-color: #dbeafe;
}

.admin-page .admin-guide-steps div:nth-child(2) {
  background: #f7fdf9;
  border-color: #bbf7d0;
}

.admin-page .admin-guide-steps div:nth-child(3) {
  background: #fffaf0;
  border-color: #fde68a;
}

.admin-page .admin-table-row,
.admin-page .admin-card,
.admin-page .permission-group,
.admin-page .admin-row-detail,
.admin-page .permission-side-panel,
.admin-page .permission-main-panel,
.admin-page .role-section-title {
  background: #ffffff;
  border-color: #e8edf5;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.admin-page .admin-row-detail {
  background: #f8fafc;
}

.admin-page .permission-side-panel {
  background: #f8fbff;
}

.admin-page .permission-main-panel {
  background: #ffffff;
}

.admin-page .permission-row {
  border-radius: 10px;
  padding: 6px 8px;
}

.admin-page .permission-row:hover,
.admin-page .admin-inline-checks label:hover,
.admin-page .admin-role-checks label:hover {
  background: #f1f5f9;
}

.admin-page .admin-actions button,
.admin-page .text-action-button {
  border-color: #dbeafe;
  background: #eff6ff;
  color: #2563eb;
}

.admin-page .admin-actions button:hover,
.admin-page .text-action-button:hover {
  border-color: #93c5fd;
  background: #dbeafe;
  color: #1d4ed8;
}

.admin-page .form-error {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  color: #c2410c;
  padding: 9px 11px;
}

.signed-user { color: #d4e2ed; font-size: 12px; margin-top: 10px; }
.management-link {
  color: #8edbd5;
  display: block;
  font-size: 12px;
  margin-top: 8px;
  text-decoration: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.management-row { display: flex; align-items: center; gap: 5px; }
.auth-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: #8aa6b8;
  background: #07111c;
}
.login-page { min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 440px);
  grid-gap: clamp(28px, 4vw, 64px);
  gap: clamp(28px, 4vw, 64px);
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  color: var(--text);
  background:
    radial-gradient(circle at 18% 18%, rgba(45, 212, 191, .2), transparent 28%),
    radial-gradient(circle at 78% 8%, rgba(44, 140, 255, .18), transparent 30%),
    radial-gradient(circle at 82% 88%, rgba(45, 212, 191, .12), transparent 26%),
    linear-gradient(135deg, #020817 0%, #06111f 45%, #030712 100%);
  position: relative;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(45, 212, 191, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 212, 191, .06) 1px, transparent 1px),
    linear-gradient(120deg, transparent 0 46%, rgba(44, 140, 255, .06) 47% 48%, transparent 49% 100%);
  background-size: 42px 42px, 42px 42px, 180px 180px;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.88), rgba(0,0,0,.42));
          mask-image: linear-gradient(90deg, rgba(0,0,0,.88), rgba(0,0,0,.42));
}
.login-page::after {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  right: 12%;
  top: 18%;
  border-radius: 999px;
  background: rgba(45, 212, 191, .13);
  filter: blur(72px);
  pointer-events: none;
}
.login-hero, .login-panel { position: relative; z-index: 1; }
.login-hero { display: grid; grid-gap: 22px; gap: 22px; max-width: 920px; }
.login-brand { display: inline-flex; align-items: center; gap: 12px; color: #b9fff7; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.login-logo {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(45, 212, 191, .38);
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: rgba(8, 40, 48, .72);
  box-shadow: inset 0 0 28px rgba(45, 212, 191, .1), 0 0 24px rgba(45, 212, 191, .1);
  font-size: 12px;
}
.login-copy { display: grid; grid-gap: 12px; gap: 12px; }
.login-kicker { margin: 0; color: var(--accent); font-size: 13px; letter-spacing: .08em; }
.login-copy h1 {
  margin: 0;
  color: #e5f4ff;
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 1.08;
  letter-spacing: -.04em;
  white-space: nowrap;
}
.login-subtitle, .login-description {
  max-width: 760px;
  margin: 0;
  color: #9fb4c8;
  line-height: 1.8;
}
.login-subtitle { font-size: clamp(15px, 1.3vw, 18px); color: #c4d7e8; }
.login-description { font-size: 14px; }
.login-insights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 10px;
  gap: 10px;
  max-width: 760px;
}
.login-insights div {
  min-height: 92px;
  border: 1px solid rgba(45, 212, 191, .18);
  border-radius: 14px;
  background: rgba(15, 27, 45, .62);
  padding: 14px;
  display: grid;
  align-content: start;
  grid-gap: 8px;
  gap: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.login-insights strong { color: #e5f4ff; font-size: 15px; }
.login-insights span { color: #8aa4bf; font-size: 12px; line-height: 1.55; }
.login-feature-list {
  max-width: 760px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-gap: 10px;
  gap: 10px;
}
.login-feature-list li {
  border: 1px solid rgba(45, 212, 191, .16);
  border-radius: 12px;
  background: rgba(8, 18, 32, .58);
  color: #b9cde0;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.55;
}
.login-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-gap: 10px;
  gap: 10px;
}
.login-metrics div {
  border: 1px solid rgba(45, 212, 191, .18);
  border-radius: 14px;
  background: rgba(15, 27, 45, .62);
  color: #bceee8;
  padding: 13px 14px;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.login-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-gap: 12px;
  gap: 12px;
}
.login-feature-card {
  min-height: 118px;
  border: 1px solid rgba(45, 212, 191, .18);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(15, 27, 45, .86), rgba(8, 18, 32, .72));
  padding: 17px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .2);
}
.login-feature-card strong { color: #e5f4ff; font-size: 15px; }
.login-feature-card p { margin: 9px 0 0; color: #8aa4bf; font-size: 13px; line-height: 1.7; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-tags span {
  border: 1px solid rgba(45, 212, 191, .24);
  border-radius: 999px;
  color: #98f1e8;
  background: rgba(6, 28, 38, .58);
  padding: 7px 11px;
  font-size: 12px;
}
.login-panel { display: flex; justify-content: center; }
.login-card {
  width: min(420px, 100%);
  background: rgba(15, 27, 45, 0.86);
  border: 1px solid rgba(45, 212, 191, 0.22);
  border-radius: 24px;
  padding: 34px;
  display: grid;
  grid-gap: 12px;
  gap: 12px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .34), inset 0 1px 0 rgba(255, 255, 255, .04);
  -webkit-backdrop-filter: blur(16px);
          backdrop-filter: blur(16px);
}
.login-card-header { display: grid; grid-gap: 6px; gap: 6px; }
.login-card h2 { margin: 0; color: #e5f4ff; font-size: 26px; white-space: nowrap; }
.login-card p, .login-card small { color: #8aa4bf; line-height: 1.7; }
.login-card p { margin: 8px 0 8px; }
.login-note {
  margin: 0;
  border: 1px solid rgba(45, 212, 191, .14);
  border-radius: 12px;
  background: rgba(8, 18, 32, .5);
  padding: 10px 12px;
  font-size: 12px;
}
.login-card small { font-size: 12px; border-top: 1px solid rgba(138, 164, 191, .16); padding-top: 13px; }
.login-card label { color: #b9cde0; font-size: 13px; margin-top: 6px; }
.login-card input {
  height: 46px;
  background: rgba(3, 10, 20, .82);
  border: 1px solid rgba(138, 164, 191, .2);
  border-radius: 12px;
  color: #e5f4ff;
  padding: 0 13px;
}
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover,
.login-card input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e5f4ff;
  caret-color: #e5f4ff;
  box-shadow: 0 0 0 1000px #071521 inset;
  -webkit-transition: background-color 9999s ease-out;
  transition: background-color 9999s ease-out;
}
.login-submit {
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid rgba(45, 212, 191, .52);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(45, 212, 191, .28), rgba(44, 140, 255, .2));
  color: #cffff9;
  font-weight: 600;
  box-shadow: 0 16px 36px rgba(45, 212, 191, .1);
}
.login-submit:hover { border-color: rgba(45, 212, 191, .85); background: linear-gradient(135deg, rgba(45, 212, 191, .36), rgba(44, 140, 255, .24)); }
.login-error {
  color: #ffb3bf;
  border: 1px solid rgba(255, 126, 146, .28);
  border-radius: 10px;
  background: rgba(80, 26, 38, .22);
  padding: 9px 10px;
  font-size: 13px;
}
.login-status {
  color: #9ff3dd;
  border: 1px solid rgba(99, 219, 181, .28);
  border-radius: 10px;
  background: rgba(21, 70, 58, .2);
  padding: 9px 10px;
  font-size: 13px;
}
.stack-form .primary-button { width: -moz-fit-content; width: fit-content; }
.notice { margin: 12px 25px 0; color: var(--accent); font-size: 12px; background: rgba(20, 77, 80, .32); padding: 9px 12px; border-radius: 8px; }
.conversation { min-height: 0; flex: 1 1 auto; overflow: auto; padding: 22px 27px 10px; display: flex; flex-direction: column; gap: 19px; }
.message { display: flex; gap: 13px; max-width: 92%; }
.message.user { margin-left: auto; flex-direction: row-reverse; }
.avatar { width: 33px; height: 33px; border: 1px solid var(--line); border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; color: var(--accent); background: #101e30; font-size: 12px; }
.message.user .avatar { background: rgba(33, 221, 208, .12); }
.message-main { min-width: 0; }
.markdown-block { position: relative; font-size: 14px; line-height: 1.65; color: #c7d7e5; border: 1px solid var(--line); border-radius: 10px; background: #101a29; padding: 13px 17px; overflow: hidden; word-break: break-word; }
.message.user .markdown-block { background: #102b32; border-color: rgba(33, 221, 208, .2); }
.markdown-block p { margin: 0 0 8px; }
.markdown-block p:last-child, .markdown-block ul:last-child, .markdown-block pre:last-child { margin-bottom: 0; }
.markdown-block ul, .markdown-block ol { padding-left: 22px; margin: 8px 0; }
.markdown-block pre { overflow: auto; }
.markdown-block code:not(pre code) { font-family: Consolas, monospace; background: rgba(0,0,0,.28); color: #61e7da; padding: 2px 5px; border-radius: 4px; }
.copy-button { position: absolute; top: -28px; right: 0; display: none; align-items: center; gap: 5px; font-size: 11px; border: 0; color: var(--muted); background: transparent; }
.message:hover .copy-button, .result-section:hover .copy-button { display: flex; }
.model-tag { display: inline-block; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; font-size: 10px; padding: 3px 8px; margin-top: 6px; }
.fallback-note { color: #facc15; border: 1px solid rgba(250, 204, 21, .28); background: rgba(250, 204, 21, .08); border-radius: 10px; padding: 8px 10px; margin: 8px 0 0; font-size: 12px; line-height: 1.6; }
.message-documents { display: grid; grid-gap: 7px; gap: 7px; margin-top: 10px; }
.message-documents-title { color: var(--muted); font-size: 11px; }
.message-document { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border: 1px solid rgba(33, 221, 208, .27); border-radius: 9px; background: rgba(33, 221, 208, .06); color: #93e8df; font-size: 11px; line-height: 1.4; padding: 7px 9px; }
.message-document .document-actions { margin-top: 0; }
.loading { align-items: center; color: var(--accent); }
.spin { animation: rotate 1s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }
.composer { margin: 10px 25px 24px; padding: 11px 14px 12px; border: 1px solid var(--line-bright); border-radius: var(--radius); background: rgba(13, 24, 38, .94); box-shadow: 0 0 24px rgba(33,221,208,.05); display: grid; grid-gap: 8px; gap: 8px; }
.composer-input-row { display: flex; align-items: flex-end; gap: 10px; }
.composer textarea { width: 100%; min-height: 52px; max-height: 140px; resize: none; overflow-y: auto; border: 0; background: transparent; padding: 4px 3px; box-shadow: none; line-height: 1.45; }
.composer-mode { width: -moz-fit-content; width: fit-content; }
.composer-hint { color: var(--muted); font-size: 11px; line-height: 1.4; }
.mobile-hint { display: none; }
.checkbox { color: var(--muted); font-size: 12px; display: flex; gap: 7px; align-items: center; }
.checkbox input { accent-color: var(--accent); }
.send { border: 1px solid var(--line-bright); background: #092e34; color: var(--accent); border-radius: 8px; min-height: 44px; padding: 9px 19px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

.result-section { margin-bottom: 29px; }
.result-section h3 { display: flex; align-items: center; gap: 10px; color: #9bb2c6; font-weight: 500; font-size: 13px; margin: 0 0 15px; }
.result-section h3 svg { color: var(--accent); }
.result-card { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 11px 12px; margin-bottom: 9px; display: grid; grid-gap: 6px; gap: 6px; }
.result-card strong { color: var(--text); font-size: 12px; font-weight: 500; }
.result-card span { color: var(--accent); font-size: 10px; }
.result-card p { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 0; }
.analysis-result { display: grid; grid-gap: 10px; gap: 10px; }
.analysis-report { display: grid; grid-gap: 12px; gap: 12px; }
.analysis-outline { display: grid; grid-gap: 6px; gap: 6px; border: 1px solid rgba(33, 221, 208, .24); border-radius: 9px; background: rgba(13, 57, 64, .22); padding: 10px 11px; }
.analysis-outline strong { color: var(--accent); font-size: 12px; font-weight: 500; }
.analysis-outline span { color: var(--muted); font-size: 11px; }
.analysis-state { display: grid; grid-gap: 8px; gap: 8px; align-items: center; border: 1px solid rgba(33, 221, 208, .28); border-radius: 9px; background: rgba(13, 57, 64, .22); padding: 12px; color: var(--muted); }
.analysis-state svg { color: var(--accent); }
.analysis-state strong { color: var(--text); font-size: 13px; }
.analysis-state p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.analysis-state.error { border-color: rgba(255, 126, 146, .38); background: rgba(80, 26, 38, .22); }
.analysis-state.error strong { color: var(--danger); }
.diagnostic-card { border: 1px solid var(--line); border-radius: 14px; background: rgba(12, 20, 34, .92); padding: 13px 14px; display: grid; grid-gap: 9px; gap: 9px; overflow: hidden; word-break: break-word; }
.diagnostic-card:hover { border-color: rgba(33, 221, 208, .32); }
.diagnostic-card h4 { margin: 0; color: var(--text); font-size: 13px; font-weight: 600; }
.diagnostic-card p, .diagnostic-card li, .diagnostic-card span { color: var(--muted); font-size: 12px; line-height: 1.65; }
.diagnostic-card ul, .diagnostic-card ol { margin: 0; padding-left: 18px; display: grid; grid-gap: 7px; gap: 7px; }
.diagnostic-card li { position: relative; }
.tone-danger { border-color: rgba(255, 126, 146, .35); }
.tone-danger h4 { color: var(--danger); }
.tone-warning { border-color: rgba(230, 185, 106, .35); }
.tone-warning h4, .tone-note h4 { color: #e6b96a; }
.tone-accent h4, .tone-customer h4 { color: var(--accent); }
.status-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.status-card div { display: grid; grid-gap: 3px; gap: 3px; }
.status-card strong { color: var(--muted); font-size: 11px; font-weight: 500; }
.status-card span { color: var(--text); font-size: 12px; }
.status-success { border-color: rgba(99, 219, 181, .35); }
.status-loading { border-color: rgba(33, 221, 208, .42); }
.status-error { border-color: rgba(255, 126, 146, .4); }
.analysis-steps { display: grid; grid-gap: 7px; gap: 7px; }
.step { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(6, 13, 24, .55); color: var(--muted); padding: 8px 10px; font-size: 12px; }
.step span { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(88, 132, 166, .18); color: var(--muted); font-size: 11px; flex-shrink: 0; }
.step.done { color: #9fe0c6; border-color: rgba(99, 219, 181, .24); }
.step.done span { background: rgba(99, 219, 181, .16); color: #63dbb5; }
.step.active { color: var(--accent); border-color: rgba(33, 221, 208, .38); }
.step.failed { color: var(--danger); border-color: rgba(255, 126, 146, .35); }
.step small { margin-left: auto; color: var(--danger); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.risk-grid { display: grid; grid-gap: 6px; gap: 6px; }
.highlighted-log { white-space: pre-wrap; margin: 0; }
.highlighted-log mark { background: rgba(255, 126, 146, .18); color: #ffb0be; border-radius: 4px; padding: 0 3px; }
.copy-mini { margin-left: 6px; border: 1px solid rgba(33, 221, 208, .26); border-radius: 6px; background: rgba(15, 45, 53, .36); color: var(--accent); padding: 2px 6px; font-size: 10px; }
.document-meta { display: grid; grid-gap: 3px; gap: 3px; margin: 3px 0; }
.document-meta span { color: var(--muted); font-size: 11px; }
.document-actions { display: flex; gap: 7px; margin-top: 6px; }
.document-action { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-bright); border-radius: 7px; padding: 5px 9px; color: var(--accent); background: rgba(15, 45, 53, .38); font-size: 11px; text-decoration: none; }
.document-action:hover { background: rgba(20, 77, 80, .55); }
.recommendation-feedback { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.recommendation-feedback button { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; border: 1px solid var(--line); border-radius: 7px; background: rgba(6, 13, 24, .44); color: var(--muted); padding: 5px 8px; font-size: 11px; }
.recommendation-feedback button.active, .recommendation-feedback button:hover:not(:disabled) { color: var(--accent); border-color: var(--line-bright); background: rgba(13, 57, 64, .36); }
.help-tooltip { position: relative; display: inline-flex; vertical-align: middle; color: var(--accent); }
.help-trigger { border: 0; padding: 0; display: inline-flex; background: transparent; color: var(--accent); }
.help-popup { position: fixed; display: grid; grid-gap: 5px; gap: 5px; z-index: 1000; width: min(288px, calc(100vw - 24px)); padding: 12px; border: 1px solid var(--line-bright); border-radius: 9px; background: #0d1d2d; box-shadow: var(--shadow); color: var(--text); }
.help-popup-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.help-popup strong { display: block; color: var(--accent); margin-bottom: 7px; }
.help-popup span:not(.help-popup-header) { font-size: 11px; line-height: 1.5; color: var(--muted); }
.help-popup b { color: var(--text); font-weight: 500; }
.help-close { border: 0; background: transparent; padding: 0 3px; color: var(--muted); font-size: 14px; }
.document-action:disabled { opacity: .45; cursor: not-allowed; }
.result-section .markdown-block { font-size: 12px; padding: 10px 12px; }
.empty { color: #536a7d; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; margin: 0; font-size: 12px; }
.async-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  grid-gap: 10px;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 9px;
  background: rgba(6, 13, 24, .42);
  color: var(--muted);
  padding: 12px;
  font-size: 12px;
  line-height: 1.55;
}
.async-state svg { color: var(--accent); margin-top: 1px; }
.async-state strong { color: var(--text); font-weight: 500; }
.async-state p { margin: 2px 0 0; color: var(--muted); }
.async-state.success { border-color: rgba(99, 219, 181, .34); background: rgba(21, 70, 58, .18); }
.async-state.success svg { color: #63dbb5; }
.async-state.danger { border-color: rgba(255, 126, 146, .38); background: rgba(80, 26, 38, .2); }
.async-state.danger svg, .async-state.danger strong { color: var(--danger); }
.async-state-action { display: flex; justify-content: flex-end; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: -moz-fit-content;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(6, 13, 24, .42);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
}
.status-badge svg { color: currentColor; }
.status-badge.success { color: #63dbb5; border-color: rgba(99, 219, 181, .34); }
.status-badge.danger { color: var(--danger); border-color: rgba(255, 126, 146, .38); }

@media (min-width: 1600px) {
  .context-panel { width: 480px; min-width: 480px; }
  .app-body.logs-mode .context-panel { width: 560px; min-width: 560px; }
}
@media (min-width: 1920px) {
  .context-panel { width: 520px; min-width: 520px; }
  .app-body.logs-mode .context-panel { width: 620px; min-width: 620px; }
}
@media (max-width: 1279px) {
  .app-topbar { grid-template-columns: auto minmax(180px, auto) 1fr; gap: 12px; }
  .topbar-actions .topbar-model, .topbar-actions .topbar-status { display: none; }
  .app-body, .app-body.logs-mode { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: minmax(0, auto) minmax(0, auto); overflow-y: auto; overflow-x: hidden; }
  .primary-nav { grid-column: 1; grid-row: 1 / span 2; position: -webkit-sticky; position: sticky; top: 0; height: calc(100vh - 64px); }
  .secondary-nav { display: none; }
  .main-workspace { grid-column: 2; grid-row: 1; min-height: 58vh; border-right: 0; overflow: visible; }
  .workspace-scroll { overflow: visible; }
  .context-panel, .app-body.logs-mode .context-panel { grid-column: 2; grid-row: 2; width: auto; min-width: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .topbar-actions .topbar-user, .topbar-actions .topbar-link { display: none; }
  .global-search { max-width: none; }
  .field-grid { grid-template-columns: 1fr; }
  .login-page {
    grid-template-columns: 1fr;
    gap: 28px;
    align-items: start;
    padding: 28px 18px calc(28px + env(safe-area-inset-bottom));
  }
  .login-hero { gap: 18px; }
  .login-copy h1 { white-space: normal; font-size: clamp(30px, 8vw, 44px); word-break: keep-all; }
  .login-insights { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .login-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-panel { justify-content: stretch; }
  .login-card { width: 100%; max-width: 520px; margin: 0 auto; }
}
@media (max-width: 767px) {
  html, body { overflow: hidden; }
  .app-topbar { grid-template-columns: auto 1fr auto; height: 64px; padding: 0 12px; }
  .mobile-menu-button { display: grid; }
  .topbar-title strong { font-size: 13px; }
  .topbar-center { display: none; }
  .topbar-actions { justify-content: flex-end; }
  .topbar-actions .topbar-user { display: inline; }
  .app-body, .app-body.logs-mode { display: grid; grid-template-columns: 1fr; grid-template-rows: auto auto; height: calc(100vh - 64px); overflow-y: auto; overflow-x: hidden; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .primary-nav { position: fixed; top: 64px; bottom: 0; left: 0; width: 72px; height: auto; transform: translateX(-100%); transition: .2s; }
  .primary-nav.show { transform: translateX(0); }
  .secondary-nav { display: flex; position: fixed; top: 64px; bottom: 0; left: 72px; width: min(270px, calc(100vw - 72px)); transform: translateX(-130%); transition: .2s; z-index: 29; }
  .secondary-nav.show { transform: translateX(0); }
  .main-workspace { grid-column: 1; grid-row: 1; min-height: auto; overflow: visible; }
  .context-panel, .app-body.logs-mode .context-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    z-index: 55;
    grid-column: auto;
    grid-row: auto;
    width: auto;
    min-width: 0;
    max-height: min(72vh, 620px);
    padding: 0 14px 16px;
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    background: rgba(5, 11, 20, .98);
    transform: translateY(calc(100% + 80px));
    transition: transform .2s ease;
    box-shadow: 0 -18px 42px rgba(0, 0, 0, .36);
  }
  .context-panel.show, .app-body.logs-mode .context-panel.show { transform: translateY(0); }
  .context-drawer-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 -14px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(5, 11, 20, .98);
  }
  .context-drawer-header strong { color: var(--text); font-size: 13px; }
  .context-drawer-header button {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 45, 53, .38);
    color: var(--accent);
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
  .mobile-backdrop.show { position: fixed; inset: 64px 0 0; background: rgba(0, 0, 0, .48); z-index: 20; }
  .workspace-header { min-height: auto; padding: 16px; }
  .workspace-header p { display: block; }
  .workspace-scroll { padding-bottom: calc(174px + env(safe-area-inset-bottom)); }
  .tool-panel, .notice { margin: 14px; padding: 14px; }
  .model-selector { margin: 12px 14px 0; align-items: stretch; flex-direction: column; }
  .model-selector select { width: 100%; }
  .diagnostic-input .log-input { min-height: 300px; }
  .conversation { padding: 16px 14px calc(170px + env(safe-area-inset-bottom)); min-height: 300px; }
  .message { max-width: 100%; }
  .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(58px + env(safe-area-inset-bottom));
    z-index: 50;
    margin: 0;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    background: rgba(5, 11, 20, 0.96);
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
  }
  .composer-input-row { gap: 8px; }
  .composer textarea {
    min-height: 44px;
    max-height: 120px;
    font-size: 16px;
    line-height: 1.35;
    padding: 10px 8px;
  }
  .composer-mode { font-size: 11px; }
  .send { min-width: 44px; min-height: 44px; padding: 0 12px; flex-shrink: 0; }
  .desktop-hint { display: none; }
  .mobile-hint { display: inline; }
  .context-panel, .app-body.logs-mode .context-panel { padding-bottom: 16px; }
  .mobile-context-button {
    position: fixed;
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    z-index: 54;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid var(--line-bright);
    border-radius: 999px;
    background: rgba(13, 57, 64, .92);
    color: var(--accent);
    padding: 0 13px;
    font-size: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .28);
  }
  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(68px, 1fr);
    grid-gap: 2px;
    gap: 2px;
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
    border-top: 1px solid var(--line);
    background: rgba(5, 11, 20, .98);
    -webkit-backdrop-filter: blur(14px);
            backdrop-filter: blur(14px);
  }
  .mobile-tabbar button {
    min-width: 64px;
    min-height: 46px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    grid-gap: 2px;
    gap: 2px;
    font-size: 10px;
    white-space: nowrap;
  }
  .mobile-tabbar button.active {
    border-color: rgba(33, 221, 208, .28);
    background: rgba(13, 57, 64, .58);
    color: var(--accent);
  }
  .document-card, .message-document { width: 100%; overflow: hidden; }
  .document-card strong, .message-document strong { white-space: normal; overflow-wrap: anywhere; }
  .document-actions { width: 100%; }
  .document-action { min-height: 40px; flex: 1 1; justify-content: center; }
  .knowledge-browser-header, .knowledge-roots, .knowledge-document-row .document-actions { width: 100%; }
  .knowledge-folder-row, .knowledge-document-row { grid-template-columns: auto minmax(0, 1fr); }
  .knowledge-folder-row small, .knowledge-document-row .document-actions { grid-column: 2; }
  .knowledge-folder-row span, .knowledge-document-main strong { white-space: normal; overflow-wrap: anywhere; }
  .status-card { grid-template-columns: 1fr; }
  .diagnostic-actions .primary-button, .diagnostic-actions .secondary-button, .search-bar, .search-bar .primary-button { width: 100%; justify-content: center; }
  .search-bar { flex-direction: column; }
  .login-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100dvh;
    padding: 18px 14px calc(24px + env(safe-area-inset-bottom));
  }
  .login-panel { order: 1; }
  .login-hero { order: 2; gap: 14px; }
  .login-brand { white-space: normal; align-items: flex-start; }
  .login-copy h1 { font-size: 30px; line-height: 1.16; }
  .login-subtitle { font-size: 14px; }
  .login-description { font-size: 13px; }
  .login-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-feature-list { gap: 8px; }
  .login-metrics, .login-features { grid-template-columns: 1fr; }
  .login-feature-card { min-height: auto; padding: 14px; }
  .tech-tags { margin-bottom: 24px; }
  .login-card { padding: 24px; border-radius: 20px; }
  .login-card h2 { font-size: 23px; }
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-gap: 10px;
  gap: 10px;
  margin-bottom: 12px;
}

.filter-grid input,
.filter-grid select {
  min-width: 0;
  border: 1px solid var(--line);
  background: #07131d;
  color: var(--text);
  border-radius: 8px;
  padding: 11px 12px;
}

.product-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  grid-gap: 16px;
  gap: 16px;
}

.product-guide-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 10px;
  gap: 10px;
  margin: 12px 0;
}

.product-guide-steps div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 11px 12px;
}

.product-guide-steps strong,
.relation-summary-title strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.product-guide-steps span,
.relation-summary-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.product-list,
.relation-list {
  display: grid;
  grid-gap: 10px;
  gap: 10px;
}

.product-card,
.relation-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #0b1724;
  color: var(--text);
  border-radius: 8px;
  padding: 12px;
}

.product-card.active {
  border-color: var(--accent);
  background: #0a2f33;
}

.product-card strong,
.relation-item strong {
  display: block;
}

.product-card span,
.relation-item span {
  color: var(--muted);
  font-size: 13px;
}

.product-card-meta,
.relation-summary,
.product-spec-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.product-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.product-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.product-relations {
  display: grid;
  grid-gap: 14px;
  gap: 14px;
}

.relation-summary-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
}

.relation-group h4 {
  margin: 0 0 8px;
}

@media (max-width: 760px) {
  .filter-grid,
  .product-layout,
  .product-guide-steps {
    grid-template-columns: 1fr;
  }
}

/* Visual refresh: softer industrial console skin without changing layout or logic. */
:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #ffffff;
  --line: #e5e7eb;
  --line-bright: rgba(59, 130, 246, 0.34);
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent-blue: #3b82f6;
  --accent-dark: #eff6ff;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

body {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 247, 251, 0.94)),
    linear-gradient(rgba(59, 130, 246, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.035) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}

* {
  scrollbar-color: rgba(59, 130, 246, 0.34) rgba(229, 231, 235, 0.68);
}

*::-webkit-scrollbar-track {
  background: rgba(229, 231, 235, 0.68);
}

*::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.34);
  border-radius: 999px;
}

input,
textarea,
select {
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(59, 130, 246, 0.65);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #9ca3af;
}

button,
a,
.document-action,
.product-card,
.relation-item,
.result-card,
.diagnostic-card,
.feature-card,
.knowledge-folder-row,
.knowledge-document-row {
  transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.app-shell {
  background: #f5f7fb;
}

.app-topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom-color: #e5e7eb;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  -webkit-backdrop-filter: blur(16px);
          backdrop-filter: blur(16px);
}

.topbar-title,
.workspace-header h2,
.secondary-header span,
.feature-card strong,
.result-card strong,
.diagnostic-card h4,
.analysis-state strong,
.async-state strong,
.product-card strong,
.relation-item strong {
  color: #1f2937;
}

.topbar-title svg,
.workspace-header h2 svg,
.result-section h3 svg,
.feature-card svg,
.knowledge-folder-row svg,
.knowledge-document-row svg,
.analysis-state svg,
.async-state svg,
.help-trigger,
.help-tooltip,
.status-badge.info {
  color: #3b82f6;
}

.topbar-model,
.topbar-user,
.topbar-link,
.workspace-header p,
.secondary-header small,
.tool-panel-hint,
.composer-hint,
.checkbox,
.result-section h3,
.result-card p,
.diagnostic-card p,
.diagnostic-card li,
.diagnostic-card span,
.document-meta span,
.product-card span,
.relation-item span,
.empty,
.async-state,
.model-tag {
  color: #6b7280;
}

.topbar-link:hover,
.management-link:hover {
  color: #2563eb;
}

.global-search {
  background: #f8fafc;
  border-color: #e5e7eb;
  color: #6b7280;
}

.global-search:focus-within {
  border-color: rgba(59, 130, 246, 0.45);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.quick-question,
.new-session-button,
.history-title button,
.primary-button,
.send,
.document-action,
.copy-mini,
.mobile-context-button {
  border-color: rgba(59, 130, 246, 0.36);
  background: #eff6ff;
  color: #2563eb;
}

.quick-question:hover,
.new-session-button:hover,
.history-title button:hover,
.primary-button:hover:not(:disabled),
.send:hover:not(:disabled),
.document-action:hover:not(:disabled),
.copy-mini:hover,
.mobile-context-button:hover {
  border-color: rgba(37, 99, 235, 0.55);
  background: #dbeafe;
  color: #1d4ed8;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.12);
}

.secondary-button,
.compact-button {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #3b82f6;
}

.secondary-button:hover:not(:disabled),
.compact-button:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.38);
  background: #f8fbff;
  color: #2563eb;
}

button:disabled,
.document-action:disabled {
  opacity: 0.55;
  box-shadow: none;
}

.primary-nav {
  background: #24314f;
  border-right-color: rgba(255, 255, 255, 0.08);
}

.secondary-nav,
.context-panel {
  background: #ffffff;
  border-color: #e5e7eb;
}

.main-workspace {
  background: #f5f7fb;
  border-right-color: #e5e7eb;
}

.module {
  color: #b9c4d6;
}

.module:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.module.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(147, 197, 253, 0.42);
  color: #ffffff;
  box-shadow: inset 4px 0 0 #3b82f6, 0 10px 22px rgba(15, 23, 42, 0.12);
}

.nav-tooltip {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
  box-shadow: var(--shadow);
}

.secondary-menu button,
.history-row,
.language-toggle,
.knowledge-tabs button,
.knowledge-roots button,
.knowledge-breadcrumb button {
  background: #ffffff;
  border-color: transparent;
  color: #64748b;
}

.secondary-menu button:hover,
.knowledge-tabs button:hover,
.knowledge-roots button:hover,
.knowledge-breadcrumb button:hover,
.history-row:hover {
  background: #f1f7ff;
  border-color: rgba(59, 130, 246, 0.18);
  color: #2563eb;
}

.secondary-menu button.active,
.knowledge-tabs button.active,
.knowledge-roots button.active,
.history-row.active {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.3);
  color: #1d4ed8;
  box-shadow: inset 3px 0 0 #3b82f6;
}

.secondary-menu button:disabled,
.secondary-menu button:disabled:hover {
  background: transparent;
  color: #a3acba;
}

.workspace-header {
  background: rgba(255, 255, 255, 0.72);
  border-bottom-color: #edf0f5;
}

.tool-panel,
.composer,
.feature-card,
.result-card,
.diagnostic-card,
.analysis-state,
.analysis-outline,
.async-state,
.knowledge-folder-row,
.knowledge-document-row,
.markdown-block,
.product-card,
.relation-item,
.notice,
.help-popup,
.status-badge,
.login-card,
.login-feature-card,
.login-insights div,
.login-feature-list li,
.login-metrics div,
.tech-tags span {
  background: #ffffff;
  border-color: #e5e7eb;
  box-shadow: var(--shadow);
}

.tool-panel,
.diagnostic-card,
.composer,
.login-card {
  border-radius: 14px;
}

.feature-card,
.result-card,
.analysis-state,
.async-state,
.knowledge-folder-row,
.knowledge-document-row,
.product-card,
.relation-item {
  border-radius: 12px;
}

.feature-card:hover,
.result-card:hover,
.diagnostic-card:hover,
.knowledge-folder-row:hover,
.knowledge-document-row:hover,
.product-card:hover,
.relation-item:hover {
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
}

.markdown-block {
  color: #374151;
  background: #ffffff;
}

.markdown-block code:not(pre code) {
  background: #eff6ff;
  color: #1d4ed8;
}

.composer {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(59, 130, 246, 0.22);
}

.composer textarea {
  background: transparent;
}

.avatar {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #2563eb;
}

.message.user .markdown-block {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.message.assistant .markdown-block {
  background: #ffffff;
}

.notice,
.fallback-note {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #2563eb;
}

.form-error,
.analysis-state.error strong,
.tone-danger h4,
.step.failed,
.step small,
.status-badge.danger,
.async-state.danger svg,
.async-state.danger strong {
  color: #ef4444;
}

.analysis-state.error,
.async-state.danger,
.tone-danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.privacy-hint,
.tone-warning h4,
.tone-note h4,
.fallback-note {
  color: #f59e0b;
}

.tone-warning,
.tone-note {
  background: #fffbeb;
  border-color: #fde68a;
}

.log-stats .ok,
.step.done,
.status-badge.success,
.async-state.success svg {
  color: #22c55e;
}

.status-success,
.async-state.success,
.step.done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.status-loading,
.step.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.step,
.log-stats span,
.model-tag {
  background: #f8fafc;
  border-color: #e5e7eb;
}

.step span {
  background: #e5e7eb;
  color: #64748b;
}

.step.active span {
  background: #dbeafe;
  color: #2563eb;
}

.step.done span {
  background: #dcfce7;
  color: #16a34a;
}

.empty {
  background: #f8fafc;
  border-color: #e5e7eb;
  color: #64748b;
}

.filter-grid input,
.filter-grid select,
.model-selector select {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #1f2937;
}

.quick-chips button,
.feature-links a,
.message-document {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.quick-chips button:hover,
.feature-links a:hover {
  background: #dbeafe;
  border-color: rgba(59, 130, 246, 0.42);
}

.product-card.active {
  background: #eff6ff;
  border-color: #3b82f6;
  box-shadow: inset 3px 0 0 #3b82f6, var(--shadow);
}

.relation-summary span,
.product-spec-grid span,
.product-card-meta span {
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  padding: 4px 8px;
}

.login-page {
  color: #1f2937;
  background:
    radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.12), transparent 28%),
    radial-gradient(circle at 78% 8%, rgba(96, 165, 250, 0.14), transparent 30%),
    linear-gradient(135deg, #f5f7fb 0%, #ffffff 52%, #eef5ff 100%);
}

.login-page::before {
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.045) 1px, transparent 1px);
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.54), rgba(0,0,0,.18));
          mask-image: linear-gradient(90deg, rgba(0,0,0,.54), rgba(0,0,0,.18));
}

.login-page::after {
  background: rgba(59, 130, 246, 0.12);
}

.login-brand,
.login-kicker,
.login-logo {
  color: #2563eb;
}

.login-logo {
  background: #eff6ff;
  border-color: #bfdbfe;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
}

.login-copy h1,
.login-feature-card strong,
.login-insights strong,
.login-card h2 {
  color: #1f2937;
}

.login-subtitle,
.login-description,
.login-card p,
.login-card small,
.login-feature-card p,
.login-insights span,
.login-feature-list li {
  color: #6b7280;
}

.login-metrics div,
.login-insights strong,
.tech-tags span {
  color: #2563eb;
}

.login-note {
  background: #f8fafc;
  border-color: #e5e7eb;
  color: #64748b;
}

@media (max-width: 1080px) {
  .login-page {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
    padding: 32px 22px calc(32px + env(safe-area-inset-bottom));
  }
  .login-hero { max-width: none; }
  .login-panel { justify-content: stretch; }
  .login-card { width: 100%; max-width: 520px; margin: 0 auto; }
  .login-insights { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .login-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100dvh;
    padding: 16px 14px calc(22px + env(safe-area-inset-bottom));
  }
  .login-panel { order: 1; }
  .login-hero { order: 2; gap: 12px; }
  .login-insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-feature-list { gap: 8px; }
  .login-card { padding: 22px; border-radius: 18px; }
  .login-card h2 { font-size: 22px; white-space: normal; }
}

.login-submit {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.18);
}

.login-submit:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
}

.login-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ef4444;
}

.login-status {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

.auth-loading {
  background: #f5f7fb;
  color: #3b82f6;
}

@media (max-width: 767px) {
  .context-panel,
  .app-body.logs-mode .context-panel,
  .composer,
  .mobile-tabbar,
  .context-drawer-header {
    background: rgba(255, 255, 255, 0.98);
    border-color: #e5e7eb;
  }

  .mobile-backdrop.show {
    background: rgba(15, 23, 42, 0.28);
  }

  .mobile-tabbar button.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
  }
}

/* UI polish pass: reduce visual weight and keep the same layout. */
:root {
  --bg: #f6f8fc;
  --line: #e8edf5;
  --line-bright: rgba(59, 130, 246, 0.25);
  --accent-dark: #f1f7ff;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

* {
  transition-duration: 150ms;
  transition-timing-function: ease;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
}

*::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.app-topbar {
  border-bottom-color: #eef2f7;
  gap: 14px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.global-search {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.quick-question {
  background: #f8fbff;
  border-color: #bfdbfe;
  color: #2563eb;
  box-shadow: none;
}

.topbar-actions {
  gap: 10px;
}

.topbar-model,
.topbar-status,
.topbar-user,
.topbar-link {
  color: #64748b;
}

.language-toggle {
  border-radius: 10px;
  border-color: #e2e8f0;
  box-shadow: none;
  padding: 8px 10px;
  color: #64748b;
}

.primary-nav {
  background: #1f2a44;
}

.module {
  color: #9fb0cc;
}

.module:hover {
  background: #2d3b5f;
  color: #dbeafe;
}

.module.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #60a5fa;
  color: #dbeafe;
  box-shadow: inset 3px 0 0 rgba(96, 165, 250, 0.9);
}

.secondary-header span {
  color: #0f172a;
}

.secondary-header small {
  color: #64748b;
}

.secondary-menu button {
  color: #64748b;
}

.secondary-menu button:hover {
  background: #f1f5f9;
  color: #334155;
}

.secondary-menu button.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #dbeafe;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.main-workspace,
.app-shell,
.auth-loading {
  background: #f6f8fc;
}

.tool-panel,
.composer,
.feature-card,
.result-card,
.diagnostic-card,
.analysis-state,
.analysis-outline,
.async-state,
.knowledge-folder-row,
.knowledge-document-row,
.markdown-block,
.product-card,
.relation-item {
  border-color: #e8edf5;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.tool-panel,
.composer,
.diagnostic-card {
  border-radius: 16px;
}

.feature-card,
.result-card,
.analysis-state,
.async-state,
.knowledge-folder-row,
.knowledge-document-row,
.product-card,
.relation-item,
.notice {
  border-radius: 12px;
}

.feature-card:hover,
.result-card:hover,
.diagnostic-card:hover,
.knowledge-folder-row:hover,
.knowledge-document-row:hover,
.product-card:hover,
.relation-item:hover {
  transform: none;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.055);
}

input,
textarea,
select {
  border-radius: 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(59, 130, 246, 0.42);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}

.composer {
  margin-bottom: 18px;
  padding: 9px 12px 10px;
  gap: 6px;
}

.composer textarea {
  min-height: 46px;
  max-height: 118px;
  line-height: 1.38;
}

.checkbox,
.composer-mode {
  color: #475569;
}

.send {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  border-radius: 10px;
}

.send:hover:not(:disabled) {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.send:disabled {
  background: #bfdbfe;
  border-color: #bfdbfe;
  color: #ffffff;
}

@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    overflow: hidden;
  }

  .app-topbar {
    height: 56px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 6px 10px;
  }

  .mobile-menu-button {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .topbar-title {
    min-width: 0;
    gap: 7px;
    overflow: hidden;
  }

  .topbar-title svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
  }

  .topbar-title strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    line-height: 1.2;
  }

  .topbar-actions {
    min-width: 0;
    gap: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .topbar-model,
  .topbar-status,
  .topbar-user,
  .topbar-link {
    display: none !important;
  }

  .topbar-language {
    margin: 0;
    display: block;
    min-width: 0;
  }

  .topbar-language span {
    display: none;
  }

  .topbar-language select {
    width: 88px;
    height: 42px;
    padding: 0 30px 0 12px;
    border-radius: 12px;
    font-size: 15px;
  }

  .mobile-logout-button {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 42px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    color: #3b82f6;
  }

  .app-body,
  .app-body.logs-mode {
    display: block;
    height: calc(100dvh - 56px);
    overflow: hidden;
    padding-bottom: 0;
  }

  .primary-nav {
    top: 56px;
    bottom: 0;
    z-index: 31;
  }

  .secondary-nav {
    top: 56px;
    bottom: 0;
    z-index: 30;
    max-width: calc(100vw - 72px);
  }

  .secondary-scroll {
    padding: 16px 14px;
  }

  .sidebar-footer {
    padding: 14px;
    gap: 10px;
  }

  .management-link {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #ffffff;
    color: #3b82f6;
    margin-top: 0;
  }

  .signed-user {
    margin-top: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-backdrop.show {
    inset: 56px 0 0;
    z-index: 29;
  }

  .main-workspace {
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-right: 0;
  }

  .workspace-header {
    min-height: 92px;
    padding: 14px 16px 12px;
    flex-shrink: 0;
  }

  .workspace-header h2 {
    gap: 8px;
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
  }

  .workspace-header p {
    display: block;
    font-size: 13px;
    line-height: 1.45;
  }

  .workspace-scroll {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: calc(220px + env(safe-area-inset-bottom));
  }

  .model-selector {
    margin: 12px 16px 0;
    gap: 8px;
    align-items: stretch;
    flex-direction: column;
    font-size: 13px;
  }

  .model-selector select {
    width: 100%;
    height: 48px;
    font-size: 15px;
  }

  .conversation {
    min-height: 0;
    padding: 14px 14px calc(236px + env(safe-area-inset-bottom));
    gap: 14px;
    overflow: visible;
  }

  .message {
    max-width: 100%;
    gap: 10px;
    align-items: flex-start;
  }

  .message.user {
    max-width: min(86%, 420px);
    margin-left: auto;
  }

  .message.user .avatar {
    display: none;
  }

  .avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .message-main {
    min-width: 0;
    max-width: 100%;
  }

  .markdown-block {
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.7;
    overflow-wrap: anywhere;
  }

  .message.user .markdown-block {
    border-radius: 14px;
  }

  .composer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    z-index: 50;
    margin: 0;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
    display: grid;
    grid-gap: 8px;
    gap: 8px;
    max-height: 160px;
  }

  .composer-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    align-items: stretch;
    grid-gap: 10px;
    gap: 10px;
  }

  .composer textarea {
    min-height: 46px;
    max-height: 72px;
    padding: 8px 4px;
    font-size: 16px;
    line-height: 1.35;
  }

  .composer-mode {
    width: 100%;
    min-height: 24px;
    font-size: 12px;
  }

  .send {
    width: 82px;
    min-width: 82px;
    min-height: 54px;
    padding: 0;
    border-radius: 12px;
    flex-shrink: 0;
    font-size: 15px;
  }

  .composer-hint {
    min-height: 18px;
    font-size: 12px;
  }

  .desktop-hint {
    display: none;
  }

  .mobile-hint {
    display: inline;
  }

  .mobile-context-button {
    right: 14px;
    bottom: calc(202px + env(safe-area-inset-bottom));
    z-index: 49;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
  }

  .mobile-tabbar {
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(7px + env(safe-area-inset-bottom));
    grid-auto-columns: 72px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .mobile-tabbar::-webkit-scrollbar {
    display: none;
  }

  .mobile-tabbar button {
    min-width: 72px;
    min-height: 50px;
    padding: 4px 6px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
    word-break: keep-all;
  }

  .mobile-tabbar button svg {
    width: 18px;
    height: 18px;
  }

  .context-panel,
  .app-body.logs-mode .context-panel {
    bottom: calc(64px + env(safe-area-inset-bottom));
    max-height: min(70dvh, 580px);
    z-index: 55;
  }

  .tool-panel,
  .notice {
    margin: 12px;
    padding: 14px;
  }

  .document-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-gap: 8px;
    gap: 8px;
  }

  .document-action {
    min-width: 0;
    min-height: 42px;
    justify-content: center;
    padding: 8px 6px;
    gap: 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  .knowledge-browser-header,
  .knowledge-roots {
    width: 100%;
    gap: 8px;
  }

  .knowledge-folder-row,
  .knowledge-document-row {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .knowledge-folder-row small,
  .knowledge-document-row .document-actions {
    grid-column: 2;
  }

  .knowledge-folder-row span,
  .knowledge-document-main strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.context-panel {
  background: #ffffff;
}

.result-section {
  margin-bottom: 24px;
}

.result-section h3 {
  color: #334155;
  font-weight: 650;
  margin-bottom: 12px;
}

.diagnostic-card,
.analysis-state {
  border-radius: 14px;
}

.analysis-report {
  gap: 10px;
}

.step {
  background: #f8fafc;
  border-color: #e8edf5;
}

.step:hover {
  background: #f1f5f9;
}

.step span {
  background: #e2e8f0;
  color: #64748b;
}

.empty {
  border-style: dashed;
  background: #ffffff;
  color: #64748b;
}

