/* TONFY common shell. Application controls remain styled in calculators.css. */
body.tf-ui {
  --tf-blue: #002fa7;
  --tf-navy: #10273f;
  --tf-ink: #203247;
  --tf-muted: #758398;
  --tf-line: #e4e9ef;
  --tf-background: #f3f5f8;
  margin: 0 !important;
  padding: 64px 0 0 224px !important;
  background: var(--tf-background) !important;
  color: var(--tf-ink);
  min-height: 100vh;
  box-sizing: border-box;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
body.tf-page-auth { padding: 0 !important; }
#tf-shell, #tf-search-dialog { font: 13px/1.5 "Microsoft YaHei", "PingFang SC", Arial, sans-serif; color: #203247; }
#tf-shell *, #tf-search-dialog * { box-sizing: border-box; }
#tf-shell a, #tf-search-dialog a { text-decoration: none; }
#tf-shell button, #tf-search-dialog button {
  font: inherit; width: auto; min-width: 0; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none;
  cursor: pointer; color: inherit; text-transform: none;
}
#tf-shell .tf-icon, #tf-search-dialog .tf-icon {
  width: 19px; height: 19px; display: block; flex: 0 0 19px;
  fill: none; stroke: currentColor; stroke-width: 1.65;
  stroke-linecap: round; stroke-linejoin: round;
}
#tf-shell a:focus-visible, #tf-shell button:focus-visible,
#tf-search-dialog a:focus-visible, #tf-search-dialog button:focus-visible,
#tf-search-dialog input:focus-visible { outline: 2px solid #549fda; outline-offset: 3px; }
#tf-shell .tf-sidebar {
  width: 224px; position: fixed; inset: 0 auto 0 0; z-index: 90;
  background: #10273f; color: #a6b6c8; display: flex; flex-direction: column;
}
#tf-shell .tf-brand {
  height: 86px; min-height: 86px; display: flex; align-items: center; gap: 13px;
  padding: 20px 23px; border-bottom: 1px solid #ffffff0e; color: white;
}
#tf-shell .tf-brand img { width: 72px; height: 44px; object-fit: contain; padding: 0; margin: 0; border: 0; }
#tf-shell .tf-brand span { border-left: 1px solid #ffffff30; padding-left: 12px; color: #dce5ef; font-size: 11px; line-height: 1.8; }
#tf-shell .tf-workspace-name { padding: 18px 23px 12px; font-size: 9px; letter-spacing: 1.6px; color: #7d97b0; }
#tf-shell .tf-nav { padding: 0 13px 15px; flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #34506b transparent; }
#tf-shell .tf-nav-link { height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border-radius: 5px; margin: 3px 0; position: relative; color: #a6b6c8; font-size: 12px; line-height: 1.5; }
#tf-shell .tf-nav-link:hover { background: #ffffff09; color: white; }
#tf-shell .tf-nav-link.tf-active { background: #1747a0; color: white; font-weight: 600; }
#tf-shell .tf-nav-link.tf-active::before { content: ""; width: 3px; height: 18px; background: #73d5e8; position: absolute; left: -13px; border-radius: 0 3px 3px 0; }
#tf-shell .tf-nav-section { margin: 21px 13px 7px; font-size: 10px; letter-spacing: 1px; color: #7891aa; }
#tf-shell .tf-sidebar-foot { padding: 17px 23px; border-top: 1px solid #ffffff0e; flex: 0 0 auto; }
#tf-shell .tf-local-status { display: flex; align-items: center; gap: 7px; color: #c2d0df; font-size: 10px; }
#tf-shell .tf-dot { width: 6px; height: 6px; display: inline-block; background: #40c6a3; border-radius: 50%; }
#tf-shell .tf-sidebar-foot p { margin: 7px 0 12px; font-size: 10px; color: #7e95ac; }
#tf-shell .tf-sidebar-foot a { color: #99b0c6; font-size: 10px; display: flex; align-items: center; gap: 10px; }
#tf-shell .tf-sidebar-foot .tf-icon { width: 12px; height: 12px; flex-basis: 12px; }
#tf-shell .tf-topbar { height: 64px; position: fixed; top: 0; left: 224px; right: 0; z-index: 80; background: white; border-bottom: 1px solid #e4e9ef; padding: 0 28px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
#tf-shell .tf-crumb { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 12px; color: #8b98a8; }
#tf-shell .tf-crumb a { color: #8696a9; white-space: nowrap; }
#tf-shell .tf-crumb strong { color: #324b62; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tf-shell .tf-topbar-right { display: flex; align-items: center; gap: 21px; flex-shrink: 0; }
#tf-shell .tf-search-trigger { display: flex; align-items: center; gap: 8px; color: #8090a3; font-size: 11px; }
#tf-shell .tf-search-trigger .tf-icon { width: 16px; height: 16px; flex-basis: 16px; }
#tf-shell #tf-updates-trigger { display: flex; align-items: center; gap: 6px; color: #637991; font-size: 11px; white-space: nowrap; }
#tf-shell #tf-updates-trigger .tf-icon { width: 16px; height: 16px; flex-basis: 16px; }
#tf-shell #tf-updates-trigger:hover { color: #002fa7; }
#tf-shell #tf-updates-trigger.tf-updates-unsaved::after { content: ""; width: 5px; height: 5px; background: #b46d13; border-radius: 50%; }
#tf-shell #tf-updates-status { position: fixed; right: 20px; bottom: 20px; z-index: 2001; width: min(370px,calc(100vw - 40px)); margin: 0; padding: 13px 16px; border: 1px solid #ebd6ab; border-radius: 6px; background: #fff9eb; color: #805419; box-shadow: 0 6px 24px #10273f12; font-size: 12px; line-height: 1.7; }
#tf-shell #tf-updates-status[hidden] { display: none; }
#tf-shell kbd { font: 10px/1.4 Consolas, monospace; border: 1px solid #e4e9ef; border-radius: 3px; padding: 1px 5px; background: white; color: #9ba7b5; }
#tf-shell .tf-platform-label { border: 1px solid #e6edf5; border-radius: 4px; padding: 5px 8px; background: #f2f6fb; color: #6883a1; font-size: 10px; }
#tf-shell .tf-logout { display: flex; align-items: center; gap: 7px; color: #788b9e; font-size: 11px; border-left: 1px solid #e4e9ef; padding-left: 16px; }
#tf-shell .tf-logout .tf-icon { width: 16px; height: 16px; flex-basis: 16px; }
#tf-shell .tf-menu, #tf-shell .tf-shade { display: none; }
#tf-search-dialog.tf-dialog-overlay { position: fixed; inset: 0; z-index: 2000; background: #0a1e357d; display: flex; justify-content: center; align-items: flex-start; padding: min(15vh,120px) 20px 20px; }
#tf-search-dialog .tf-search-dialog { width: 590px; max-width: 100%; max-height: 80vh; background: white; border: 1px solid #dfe6ee; border-radius: 9px; box-shadow: 0 20px 90px #071d3a30; display: flex; flex-direction: column; overflow: hidden; }
#tf-search-dialog .tf-search-head { padding: 19px 21px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #e4e9ef; color: #002fa7; }
#tf-search-dialog input { padding: 4px; margin: 0; min-width: 0; min-height: 0; width: auto; flex: 1; border: 0; border-radius: 0; background: white; color: #203247; box-shadow: none; font: 14px/1.7 "Microsoft YaHei",Arial,sans-serif; }
#tf-search-dialog .tf-close-search { width: 28px; height: 28px; display: grid; place-items: center; color: #7b90a7; }
#tf-search-dialog .tf-search-results { padding: 9px; overflow-y: auto; }
#tf-search-dialog .tf-search-result { display: flex; align-items: center; gap: 13px; padding: 13px; border-radius: 5px; color: #486a89; font-size: 12px; }
#tf-search-dialog .tf-search-result:hover { background: #edf2fc; }
#tf-search-dialog .tf-search-result span { flex: 1; }
#tf-search-dialog .tf-search-result small { display: block; margin-top: 4px; color: #899caf; font-size: 10px; }
#tf-search-dialog .tf-search-foot { padding: 12px 21px; border-top: 1px solid #e4e9ef; background: #fafbfd; font-size: 10px; color: #93a2b3; }
#tf-search-dialog .tf-search-empty { padding: 30px 15px; color: #8595a6; font-size: 12px; }
#tf-updates-dialog {
  box-sizing: border-box; width: min(640px,calc(100vw - 40px)); max-width: none;
  max-height: min(760px,calc(100dvh - 64px)); padding: 0; margin: auto;
  overflow: hidden; border: 1px solid #dce4ee; border-radius: 10px;
  background: #fff; color: #203247; box-shadow: 0 24px 100px #071d3a40;
  font: 13px/1.65 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
#tf-updates-dialog[open] { display: flex; flex-direction: column; }
#tf-updates-dialog::backdrop { background: #10273f91; }
#tf-updates-dialog * { box-sizing: border-box; }
#tf-updates-dialog button { appearance: none; width: auto; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; box-shadow: none; font: inherit; text-transform: none; cursor: pointer; }
#tf-updates-dialog button:focus-visible { outline: 2px solid #549fda; outline-offset: 3px; }
#tf-updates-dialog .tf-icon { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
#tf-updates-dialog .tf-updates-head { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; padding: 25px 28px 0; }
#tf-updates-dialog .tf-updates-mark { display: grid; place-items: center; width: 42px; height: 44px; flex: 0 0 42px; background: #edf2fc; border: 1px solid #dce5fa; border-radius: 6px; color: #002fa7; }
#tf-updates-dialog .tf-updates-eyebrow { margin: 0 0 3px; color: #8796aa; font-size: 9px; letter-spacing: 1.4px; line-height: 1.5; }
#tf-updates-dialog h2 { margin: 0; padding: 0; color: #172b45; font-size: 20px; font-weight: 700; line-height: 1.5; }
#tf-updates-dialog .tf-updates-close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; margin-left: auto; color: #7a8c9f; border-radius: 4px; }
#tf-updates-dialog .tf-updates-close:hover { background: #f1f4f8; color: #203247; }
#tf-updates-dialog #tf-updates-description { margin: 0; padding: 15px 28px 19px; color: #6a7d93; font-size: 12px; line-height: 1.7; flex: 0 0 auto; border-bottom: 1px solid #e4e9ef; }
#tf-updates-dialog .tf-updates-content { min-height: 48px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 0 28px; }
#tf-updates-dialog .tf-update-release { margin: 0; padding: 22px 0; border-bottom: 1px solid #e4e9ef; }
#tf-updates-dialog .tf-update-release:last-child { border-bottom: 0; }
#tf-updates-dialog .tf-update-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; color: #8190a2; font-size: 11px; line-height: 1.5; }
#tf-updates-dialog .tf-update-meta span { background: #edf2fc; color: #1747a0; padding: 3px 7px; border-radius: 3px; font-weight: 600; }
#tf-updates-dialog h3 { margin: 0 0 11px; padding: 0; font-size: 15px; line-height: 1.6; color: #263e57; font-weight: 600; }
#tf-updates-dialog ul { margin: 0; padding: 0 0 0 18px; list-style: disc; color: #556b82; }
#tf-updates-dialog li { margin: 0 0 7px; padding: 0 0 0 2px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.85; }
#tf-updates-dialog li:last-child { margin-bottom: 0; }
#tf-updates-dialog .tf-updates-empty { margin: 0; padding: 22px 0; color: #71859a; font-size: 12px; }
#tf-updates-dialog .tf-updates-retry { margin: 0 0 22px; padding: 6px 12px; border: 1px solid #cbd8ed; border-radius: 4px; color: #002fa7; font-size: 12px; }
#tf-updates-dialog .tf-updates-foot { display: flex; align-items: center; gap: 18px; flex: 0 0 auto; padding: 17px 28px; background: #f8fafc; border-top: 1px solid #e4e9ef; }
#tf-updates-dialog .tf-updates-hint { flex: 1; margin: 0; color: #7f90a4; font-size: 10px; line-height: 1.8; }
#tf-updates-dialog .tf-updates-confirm { flex: 0 0 auto; min-height: 36px; padding: 8px 20px; border-radius: 4px; background: #002fa7; color: #fff; font-size: 12px; font-weight: 600; }
#tf-updates-dialog .tf-updates-confirm:hover { background: #002586; }
@media (max-width: 1100px) {
  #tf-shell .tf-topbar { padding: 0 20px; }
  #tf-shell .tf-platform-label { display: none; }
}
@media (max-width: 900px) {
  body.tf-ui { padding: 58px 0 0 !important; }
  body.tf-page-auth { padding: 0 !important; }
  #tf-shell .tf-sidebar { transform: translateX(-100%); visibility: hidden; }
  #tf-shell.tf-menu-open .tf-sidebar { transform: none; visibility: visible; }
  #tf-shell .tf-topbar { left: 0; height: 58px; padding: 0 16px; }
  #tf-shell .tf-menu { display: grid; width: 27px; height: 30px; place-items: center; color: #415e7b; }
  #tf-shell.tf-menu-open .tf-shade { display: block; position: fixed; inset: 0; width: 100%; height: 100%; background: #071a3070; z-index: 85; }
  #tf-shell .tf-crumb { gap: 9px; }
  #tf-shell .tf-crumb>a, #tf-shell .tf-crumb>span { display: none; }
  #tf-shell .tf-search-trigger span, #tf-shell .tf-search-trigger kbd, #tf-shell .tf-logout span { display: none; }
  #tf-shell .tf-topbar-right { gap: 15px; }
  #tf-shell .tf-logout { padding-left: 12px; }
}
@media (max-width: 520px) {
  #tf-shell .tf-topbar-right { gap: 12px; }
  #tf-shell #tf-updates-trigger span { display: none; }
  #tf-updates-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 32px); border-radius: 8px; }
  #tf-updates-dialog .tf-updates-head { padding: 21px 18px 0; gap: 11px; }
  #tf-updates-dialog h2 { font-size: 18px; }
  #tf-updates-dialog #tf-updates-description { padding: 14px 18px 17px; }
  #tf-updates-dialog .tf-updates-content { padding: 0 18px; }
  #tf-updates-dialog .tf-updates-foot { padding: 15px 18px; gap: 12px; }
  #tf-updates-dialog .tf-updates-confirm { padding: 8px 16px; }
}
@media print {
  body.tf-ui { padding: 0 !important; background: white !important; }
  #tf-shell, #tf-search-dialog, #tf-updates-dialog { display: none !important; }
}

/* Shared assistant identity uses the approved Xiaofei mascot reference. */
.tf-ai-brand { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 10px 0; border: 1px solid #dce5ee; border-radius: 10px; background: #f4f8fc; color: #14344f; }
.tf-ai-brand img { display: block; width: 64px; height: 72px; object-fit: contain; flex: 0 0 auto; }
.tf-ai-brand strong { display: block; font-size: 17px; line-height: 1.6; }
.tf-ai-brand span { display: block; font-size: 12px; color: #536b7d; }

/* Engineering tables keep readable columns inside their own mobile scroller. */
@media (max-width: 800px) {
  body.tf-ui.tf-page-project .wrap .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  body.tf-ui.tf-page-project .wrap .table-wrap table { min-width: 760px; }
  body.tf-ui.tf-page-project .wrap .table-wrap th { white-space: nowrap; }
}
