/* ===== 利刃 v60 · 全局小字号 + 横向自动换行 + 防裁切 =====
   目标(老板这一轮定的三条):
   1. 所有界面文字(含功能按钮、记录区、键盘记录、表格)统一压成小字号
   2. 横向位置不够时自动换行,禁止用省略号 / 裁切 / 强制不换行糊弄
   3. 任何按钮和显示内容都不许被框边切掉
   这一层最后加载,靠 !important + 提高选择器权重压掉前面各层的写死值。 */

:root {
  --kk-fs60: 11.5px;
  --kk-fs60-s: 10.5px;
  --kk-fs60-xs: 9.5px;
}

/* ---------- 1. 全局小字号 ---------- */
main { font-size: var(--kk-fs60) !important; }
main [class~="text-sm"],
main [class~="text-base"],
main [class*="text-[13px]"],
main [class*="text-[14px]"] { font-size: var(--kk-fs60) !important; line-height: 1.35 !important; }
main [class~="text-xs"],
main [class*="text-[11px]"],
main [class*="text-[12px]"] { font-size: var(--kk-fs60-s) !important; line-height: 1.3 !important; }
main [class~="text-lg"] { font-size: 12.5px !important; line-height: 1.3 !important; }
main [class~="text-xl"] { font-size: 13.5px !important; line-height: 1.3 !important; }
main [class~="text-2xl"] { font-size: 15px !important; line-height: 1.28 !important; }
main [class~="text-3xl"] { font-size: 17px !important; line-height: 1.25 !important; }
main h1 { font-size: 15px !important; }
main h2 { font-size: 13.5px !important; }
main h3 { font-size: 12.5px !important; }
main h4 { font-size: 12px !important; }

/* 输入类控件跟着小字走,但行高留够,不被框边切 */
main button,
main input,
main textarea,
main select { font-size: var(--kk-fs60) !important; }
main button span,
main button div { font-size: inherit !important; }

/* ---------- 2. 横向不够就换行:干掉 truncate / 省略号 / nowrap ---------- */
main .truncate,
main [class*="truncate"],
main [class*="text-ellipsis"] {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100% !important;
}
main [class*="whitespace-nowrap"] { white-space: normal !important; }
main td,
main th,
main dd,
main dt,
main label,
main p { white-space: normal !important; overflow-wrap: anywhere !important; word-break: break-word !important; }

/* 长串(哈希 / 包名 / 账号 / IP)一律允许在任意位置断行,不再溢出 */
main b,
main i,
main u,
main s,
main em,
main strong,
main small {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  max-width: 100%;
}

/* ---------- 3. 按钮 / 标签一律不裁切 ---------- */
main button {
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
  line-height: 1.28 !important;
  min-width: 0;
}
main button > * { white-space: normal !important; }
/* 图标按钮(只有一个 svg)保持方块原样,别被文字规则撑歪 */
main button > svg:only-child { flex: 0 0 auto; }

/* Tab 头:不横向挤成一团、也不裁字,放不下直接换行 */
main [role="tablist"] {
  flex-wrap: wrap !important;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
  row-gap: 3px;
}
main [role="tablist"] button { height: auto !important; min-height: 24px !important; }

/* 页头信息行 / 设备信息条:原来写死 38px + overflow:hidden,内容一多就纵向切字 —— 改成按内容撑开 */
main div.flex-1.min-w-0.flex.items-center.gap-x-4 {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
  flex-wrap: wrap !important;
  min-height: 30px !important;
  row-gap: 2px;
}
main div.flex-1.min-w-0.flex.items-center.gap-x-4 > span {
  white-space: normal !important;
  max-width: 100%;
}
main div.flex.items-center.gap-3.w-full.font-normal.overflow-x-auto {
  flex-wrap: wrap !important;
  overflow: visible !important;
  row-gap: 3px;
}

/* 表格:行高按内容走,长文本折行,不再一行切一半 */
main table { table-layout: auto !important; }
main table td,
main table th { white-space: normal !important; vertical-align: middle; }
main div.flex-1.overflow-auto.min-h-0 > table tbody tr { height: auto !important; min-height: 30px; }

/* 设备卡:标题 / 字段一律折行,不再一行截断 */
main .kk-dev-card [class*="truncate"],
main .kk-dev-card span { overflow-wrap: anywhere !important; }

/* ---------- 4. 记录区(注入记录 / 密码记录 / 键盘记录)小字 + 折行 ---------- */
main .kk-mini .kk-row { font-size: var(--kk-fs60-s) !important; line-height: 1.3 !important; }
main .kk-mini .kk-row i,
main .kk-mini .kk-row u,
main .kk-mini .kk-row s {
  white-space: normal !important;
  word-break: break-all !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere !important;
}
main .kk-mini .kk-row s { opacity: .75; }

/* 备注框:横向拉满设备卡空出来的那一段(名字右边、状态徽章左边),
   长备注单行完整可见,不再被 230px 的窄框截断 */
html body.kkf.kkf main .kk-dev-card [data-slot="card-content"] > div:nth-child(3) > div.kk-notewrap {
  left: 0 !important;
  right: 230px !important;
  width: auto !important;
  top: -21px !important;
  height: 17px !important;
  min-height: 17px !important;
  max-height: 17px !important;
}
html body.kkf.kkf main .kk-dev-card textarea.kk-note-box,
main .kk-dev-card textarea.kk-note-box {
  width: 100% !important;
  height: 17px !important;
  min-height: 17px !important;
  max-height: 17px !important;
  line-height: 16px !important;
  font-size: var(--kk-fs60) !important;
  white-space: pre !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  text-overflow: clip !important;
  resize: none !important;
}

/* 自建备注框(详情页信息条)同样小字、不裁字 */
#kk-note-in {
  font-size: var(--kk-fs60) !important;
  line-height: 1.3 !important;
  height: 20px !important;
  text-overflow: clip !important;
}

/* ---------- 5. 侧栏 / 弹窗里的小字 ---------- */
main aside,
[role="dialog"],
[role="dialog"] * { font-size: var(--kk-fs60) !important; }
[role="dialog"] button { height: auto !important; min-height: 26px !important; }
