/* KYBond UI Infrastructure v15 · Public API v1
   Shared semantic primitives for KYBond Flask/static pages and newer apps.
   New pages should use ky-* / data-ky-* interfaces directly.
   Legacy class auto-mapping is migration compatibility only, not a new-page API.
   Business CSS owns page-specific layout/density; this layer owns cross-page semantics. */
:root{
  --ky-control-h:36px;
  --ky-control-h-mobile:42px;
  --ky-component-page:1440px;
  --ky-component-line:var(--ky-line,#aaa8a0);
  --ky-component-line-soft:var(--ky-line-soft,#d9d6cf);
  --ky-component-orange:var(--ky-orange,#ff7a00);
  --ky-component-orange-soft:var(--ky-orange-soft,#fff0e1);
  --ky-component-ink:var(--ky-ink,#111);
  --ky-component-muted:var(--ky-muted,#66645f);
  --ky-component-paper:var(--ky-paper,#efeee8);
  --ky-component-surface:var(--ky-surface,#fff);
  --ky-component-mono:var(--ky-mono,"SFMono-Regular",Consolas,"Liberation Mono",monospace);
  --ky-component-sans:var(--ky-sans,Inter,"PingFang SC","Microsoft YaHei",Arial,sans-serif);
}

/* PageShell / PageHeader */
.ky-page-shell{
  width:min(100%,var(--ky-component-page));
  margin-inline:auto;
  min-width:0;
}
.ky-page-header{
  position:relative;
  overflow:hidden;
  color:#fff;
  background-color:#080808;
  background-image:
    linear-gradient(#ffffff08 1px,transparent 1px),
    linear-gradient(90deg,#ffffff08 1px,transparent 1px);
  background-size:24px 24px;
  border-bottom:5px solid var(--ky-component-orange);
}
.ky-page-header::after{
  content:"";
  position:absolute;
  pointer-events:none;
  inset:0;
  background:linear-gradient(90deg,rgba(8,8,8,.05),transparent 18%,transparent 82%,rgba(8,8,8,.05));
}
.ky-page-header>*{position:relative;z-index:1}
.ky-page-header :where(.eyebrow,.rank-kicker,.monitor-kicker){
  color:var(--ky-component-orange);
  font-family:var(--ky-component-mono);
  letter-spacing:1.2px;
}
.ky-page-header h1{
  color:#fff;
  font-weight:900;
  letter-spacing:-.035em;
}
.ky-page-header :where(.lede,p){
  color:#c9c7c0;
}

/* InfoGrid */
.ky-info-grid{min-width:0}
.ky-info-grid>.ky-info-item{
  min-width:0;
  background:var(--ky-component-surface);
  border-color:var(--ky-component-line-soft);
  box-shadow:none;
}
.ky-info-item>strong{
  font-variant-numeric:tabular-nums;
}
.ky-info-item :where(span,small){
  color:var(--ky-component-muted);
}

/* Filters / segmented selector */
.ky-filter-surface :where(input,select){min-height:var(--ky-control-h)}
.ky-filter-control :where(input,select){min-height:var(--ky-control-h)}
.ky-filter-control :where(.control-label){
  color:var(--ky-component-muted);
  font:850 9px/1.2 var(--ky-component-mono);
  letter-spacing:.55px;
}
.ky-filter-control :where(input,select):focus{border-color:var(--ky-component-orange)!important}
.ky-segmented{
  display:flex;
  align-items:stretch;
  min-height:var(--ky-control-h);
  border:1px solid var(--ky-component-line);
  background:#fff;
}
.ky-segmented>button{
  min-height:calc(var(--ky-control-h) - 2px);
  padding:0 11px;
  border:0;
  border-right:1px solid var(--ky-component-line);
  border-radius:0;
  background:#fff;
  color:#2c2b28;
  font:850 10px/1 var(--ky-component-sans);
  white-space:nowrap;
}
.ky-segmented>button:last-child{border-right:0}
.ky-segmented>button:is(.active,[aria-pressed="true"]){
  background:#111;
  color:var(--ky-component-orange);
}
.ky-segmented>button:hover:not(.active):not([aria-pressed="true"]){
  background:var(--ky-component-orange-soft);
}
.ky-segmented--scroll{overflow-x:auto;scrollbar-width:none}
.ky-segmented--scroll::-webkit-scrollbar{display:none}

/* Status / JobStatus */
.ky-status,.ky-job-status{
  display:inline-flex;
  align-items:center;
  width:max-content;
  max-width:100%;
  min-height:24px;
  padding:3px 7px;
  border:1px solid #c9c6bf;
  border-radius:0;
  background:#f3f2ee;
  color:#4c4a45;
  font:850 9px/1.2 var(--ky-component-sans);
  white-space:nowrap;
}
.ky-status[data-ky-tone="success"],.ky-job-status[data-ky-tone="success"]{
  border-color:#9bcdbd;background:#eaf6f1;color:#0b7550;
}
.ky-status[data-ky-tone="warning"],.ky-job-status[data-ky-tone="warning"]{
  border-color:#e4c782;background:#fff5d9;color:#8a5a00;
}
.ky-status[data-ky-tone="danger"],.ky-job-status[data-ky-tone="danger"]{
  border-color:#e0a0a0;background:#fff0f0;color:#a52f2f;
}
.ky-status[data-ky-tone="processing"],.ky-job-status[data-ky-tone="processing"]{
  border-color:#e7b98e;background:var(--ky-component-orange-soft);color:#914500;
}
.ky-status[data-ky-tone="info"],.ky-job-status[data-ky-tone="info"]{
  border-color:#b9c5d2;background:#f1f4f7;color:#3c4d5f;
}
.ky-status[data-ky-tone="neutral"],.ky-job-status[data-ky-tone="neutral"]{
  border-color:#cfccc5;background:#f4f3f0;color:#5b5953;
}
.ky-job-status::before{
  content:"";
  width:6px;height:6px;
  margin-right:6px;
  background:currentColor;
  border-radius:50%;
  opacity:.85;
}
.ky-job-status[data-ky-tone="processing"]::before{animation:ky-status-pulse 1.4s ease-in-out infinite}
@keyframes ky-status-pulse{50%{opacity:.2}}

/* DataTable / pagination / empty states */
.ky-data-table-wrap{width:100%;overflow:auto;background:#fff;scrollbar-width:thin}
.ky-data-table{width:100%;border-collapse:collapse;background:#fff}
.ky-data-table th{background:#090909!important;color:#fff!important}
.ky-data-table :is(.ky-number,.rank-number,.numeric-column){
  text-align:right;
  font-variant-numeric:tabular-nums;
}
.ky-data-table tbody tr:hover td{background:var(--ky-component-orange-soft)}
.ky-pagination{display:flex;align-items:center;justify-content:space-between;gap:10px}
.ky-pagination>div:last-child{display:flex;align-items:center;gap:6px}
.ky-empty-state,.ky-error-state,.ky-loading-state{
  min-height:92px;
  display:grid;
  place-items:center;
  padding:20px;
  border:1px dashed #c7c4bc;
  background:#f8f7f3;
  color:var(--ky-component-muted);
  text-align:center;
  font-size:12px;
  line-height:1.6;
}
.ky-error-state{border-color:#d8a4a4;background:#fff5f5;color:#a52f2f}

/* Modal / Drawer */
.ky-dialog-layer{
  position:fixed;
  z-index:13000;
  inset:0;
}
.ky-dialog-panel{
  border:1px solid #6f6d67;
  border-top:5px solid var(--ky-component-orange);
  border-radius:0!important;
  background:var(--ky-component-surface);
  box-shadow:0 18px 56px rgba(0,0,0,.26);
  color:var(--ky-component-ink);
}
.ky-drawer-panel{
  position:fixed;
  z-index:13010;
  top:0;right:0;bottom:0;
  width:min(560px,94vw);
  overflow:auto;
  border-left:1px solid var(--ky-component-line);
  border-top:5px solid var(--ky-component-orange);
  background:var(--ky-component-surface);
  box-shadow:-18px 0 48px rgba(0,0,0,.2);
}
.ky-dialog-panel :where(button,.action-btn),
.ky-drawer-panel :where(button,.action-btn){
  border-radius:0!important;
}

/* JobLog */
.ky-job-log{
  width:100%;
  max-height:min(52vh,520px);
  overflow:auto;
  margin:0;
  padding:12px 14px;
  border:1px solid #343434;
  border-left:4px solid var(--ky-component-orange);
  background:#0c0c0c;
  color:#e9e7df;
  font:500 11px/1.65 var(--ky-component-mono);
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.ky-job-log-inline{
  display:block;
  margin-top:5px;
  padding-left:8px;
  border-left:3px solid #c7c3ba;
  color:#56534c;
  font:600 10px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}

/* Shared compact action row */
.ky-action-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
}

@media(max-width:760px){
  .ky-page-shell{width:100%}
  .ky-page-header::after{display:none}
  .ky-filter-surface :where(input,select),.ky-filter-control :where(input,select){
    min-height:var(--ky-control-h-mobile);
  }
  .ky-segmented{min-height:var(--ky-control-h-mobile)}
  .ky-segmented>button{min-height:calc(var(--ky-control-h-mobile) - 2px)}
  .ky-pagination{align-items:stretch;flex-direction:column}
  .ky-pagination>div:last-child{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  .ky-pagination button{min-height:40px}
  .ky-dialog-layer{
    padding:0!important;
  }
  .ky-dialog-panel{
    width:100vw!important;
    max-width:none!important;
    height:100dvh!important;
    max-height:100dvh!important;
    margin:0!important;
    border-width:0!important;
    border-top:5px solid var(--ky-component-orange)!important;
  }
  .ky-drawer-panel{width:100vw}
}
@media(prefers-reduced-motion:reduce){
  .ky-job-status[data-ky-tone="processing"]::before{animation:none}
}

/* Drawer behavior + shared detail anatomy */
body.ky-overlay-open{overflow:hidden}
.ky-dialog-layer[hidden]{display:none!important}
.ky-dialog-layer{
  background:rgba(0,0,0,.48);
}
.ky-drawer-backdrop{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border:0;
  padding:0;
  background:transparent;
  cursor:default;
}
.ky-drawer-panel{
  display:flex;
  flex-direction:column;
}
.ky-drawer-header{
  position:sticky;
  z-index:2;
  top:0;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:20px 22px 18px;
  border-bottom:1px solid var(--ky-component-line);
  background:#fff;
}
.ky-drawer-header small{
  display:block;
  color:var(--ky-component-muted);
  font:800 9px/1.3 var(--ky-component-mono);
  letter-spacing:.8px;
}
.ky-drawer-header h2{
  margin:6px 0 0;
  font-size:22px;
  line-height:1.25;
  overflow-wrap:anywhere;
}
.ky-drawer-close{
  min-width:40px;
  min-height:36px;
  border:1px solid var(--ky-component-line);
  background:#fff;
  color:#111;
  font-weight:850;
}
.ky-drawer-close:hover{border-color:#111;background:#111;color:#fff}
.ky-drawer-body{
  display:grid;
  gap:18px;
  padding:20px 22px 28px;
  overflow:auto;
}
.ky-drawer-section{
  min-width:0;
}
.ky-drawer-section>h3{
  margin:0 0 10px;
  color:#111;
  font-size:14px;
}
.ky-detail-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-top:1px solid var(--ky-component-line);
  border-left:1px solid var(--ky-component-line);
}
.ky-detail-grid>div{
  min-width:0;
  padding:10px 12px;
  border-right:1px solid var(--ky-component-line);
  border-bottom:1px solid var(--ky-component-line);
  background:#fff;
}
.ky-detail-grid span,.ky-detail-grid small{
  display:block;
  color:var(--ky-component-muted);
  font:800 8px/1.3 var(--ky-component-mono);
  letter-spacing:.45px;
}
.ky-detail-grid strong,.ky-detail-grid code{
  display:block;
  margin-top:5px;
  color:#222;
  font-size:11px;
  line-height:1.55;
  overflow-wrap:anywhere;
}
.ky-inline-action{
  display:inline-flex;
  align-items:center;
  width:max-content;
  min-height:28px;
  margin-top:6px;
  padding:0;
  border:0;
  border-bottom:1px solid currentColor;
  background:transparent;
  color:#5f5c55;
  font-size:10px;
  font-weight:850;
  cursor:pointer;
}
.ky-inline-action:hover,.ky-inline-action:focus-visible{color:var(--ky-component-orange)}
@media(max-width:760px){
  .ky-drawer-header{padding:16px}
  .ky-drawer-body{padding:16px 14px 24px}
  .ky-detail-grid{grid-template-columns:1fr 1fr}
}
@media(max-width:420px){
  .ky-detail-grid{grid-template-columns:1fr}
}

/* Workflow v3: UploadPanel / FilePreview / Loading / Error / Retry / TaskAction */
.ky-workflow-panel{
  position:relative;
  min-width:0;
}
.ky-workflow-panel[aria-busy="true"]{
  cursor:progress;
}
.ky-upload-dropzone{
  position:relative;
  transition:border-color .14s ease,background .14s ease,opacity .14s ease;
}
.ky-upload-dropzone:is(:hover,.is-dragging,.dragging){
  border-color:var(--ky-component-orange)!important;
  background:#fff!important;
}
.ky-workflow-panel[aria-busy="true"] .ky-upload-dropzone{
  opacity:.62;
  pointer-events:none;
}
.ky-workflow-panel[aria-busy="true"] .ky-upload-dropzone::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-1px;
  height:3px;
  overflow:hidden;
  background:linear-gradient(90deg,transparent 0,var(--ky-component-orange) 35%,transparent 70%);
  background-size:220% 100%;
  animation:ky-workflow-loading 1.05s linear infinite;
}
@keyframes ky-workflow-loading{to{background-position:-220% 0}}

.ky-workflow-statusbar{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 10px;
  min-width:0;
}
.ky-workflow-status{
  min-width:0;
  display:flex;
  align-items:flex-start;
  gap:7px;
  color:var(--ky-component-muted);
  font-size:12px;
  line-height:1.5;
  overflow-wrap:anywhere;
}
.ky-workflow-status::before{
  content:"";
  flex:0 0 auto;
  width:7px;height:7px;
  margin-top:.42em;
  border-radius:50%;
  background:#9a9892;
}
.ky-workflow-status[data-ky-state="ready"]{color:#5b4b15}
.ky-workflow-status[data-ky-state="ready"]::before{background:#b58a18}
.ky-workflow-status[data-ky-state="loading"]{color:#914500}
.ky-workflow-status[data-ky-state="loading"]::before{
  background:var(--ky-component-orange);
  animation:ky-status-pulse 1.15s ease-in-out infinite;
}
.ky-workflow-status[data-ky-state="success"]{color:#0b7550}
.ky-workflow-status[data-ky-state="success"]::before{background:#0b7550}
.ky-workflow-status[data-ky-state="error"]{color:#a52f2f}
.ky-workflow-status[data-ky-state="error"]::before{background:#b42318}
.ky-workflow-status[data-ky-state="warning"]{color:#8a5a00}
.ky-workflow-status[data-ky-state="warning"]::before{background:#b58a18}

.ky-file-preview-list{
  display:grid;
  gap:6px;
  min-width:0;
}
.ky-file-preview-item{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:10px;
  align-items:center;
  min-width:0;
  padding:8px 10px;
  border:1px solid var(--ky-component-line-soft);
  background:#fff;
}
.ky-file-preview-item strong{
  min-width:0;
  overflow-wrap:anywhere;
  font-size:11px;
  line-height:1.4;
}
.ky-file-preview-item span{
  color:var(--ky-component-muted);
  font:750 10px/1.2 var(--ky-component-mono);
  white-space:nowrap;
}
.ky-file-preview-item small{
  grid-column:1/-1;
  color:var(--ky-component-muted);
  font-size:10px;
  line-height:1.35;
}

.ky-task-action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:30px;
  padding:0 9px;
  border:1px solid var(--ky-component-line);
  border-radius:0!important;
  background:#fff;
  color:#222;
  font:800 10px/1.2 var(--ky-component-sans);
  text-decoration:none!important;
  cursor:pointer;
}
.ky-task-action:hover,.ky-task-action:focus-visible{
  border-color:#111;
  background:#111;
  color:#fff;
}
.ky-task-action[data-ky-action="primary"]{
  border-color:#111;
  background:#111;
  color:#fff;
}
.ky-task-action[data-ky-action="primary"]:hover{
  border-color:var(--ky-component-orange);
  background:var(--ky-component-orange);
  color:#111;
}
.ky-task-action[data-ky-action="retry"]{
  border-color:#d4a1a1;
  color:#9f2e2e;
  background:#fff8f8;
}
.ky-task-action[data-ky-action="retry"]:hover{
  border-color:#9f2e2e;
  background:#9f2e2e;
  color:#fff;
}
.ky-task-action[data-ky-action="secondary"]{
  background:#fff;
}
.ky-task-action:disabled{
  opacity:.42;
  cursor:not-allowed;
}
.ky-task-action:disabled:hover{
  border-color:var(--ky-component-line);
  background:#fff;
  color:#222;
}

.ky-retry-action[hidden]{display:none!important}

@media(max-width:760px){
  .ky-task-action{min-height:40px;padding-inline:12px}
  .ky-workflow-statusbar{align-items:stretch}
}
@media(prefers-reduced-motion:reduce){
  .ky-workflow-panel[aria-busy="true"] .ky-upload-dropzone::after,
  .ky-workflow-status[data-ky-state="loading"]::before{animation:none}
}

/* Infrastructure v4: Toast / ConfirmDialog / SearchFilter / DetailSection */
.ky-toast-region{
  position:fixed;
  z-index:15000;
  right:18px;
  bottom:18px;
  width:min(360px,calc(100vw - 28px));
  display:grid;
  gap:8px;
  pointer-events:none;
}
.ky-toast{
  pointer-events:auto;
  display:grid;
  grid-template-columns:8px minmax(0,1fr) auto;
  gap:10px;
  align-items:start;
  padding:12px 12px 12px 0;
  border:1px solid #9d9a92;
  background:#fff;
  box-shadow:0 12px 34px rgba(0,0,0,.18);
}
.ky-toast::before{
  content:"";
  align-self:stretch;
  background:#77736b;
}
.ky-toast[data-ky-tone="success"]::before{background:#0b7550}
.ky-toast[data-ky-tone="warning"]::before{background:#b58a18}
.ky-toast[data-ky-tone="danger"]::before{background:#b42318}
.ky-toast[data-ky-tone="info"]::before{background:var(--ky-component-orange)}
.ky-toast__copy{min-width:0}
.ky-toast__copy strong{
  display:block;
  color:#111;
  font-size:12px;
  line-height:1.35;
}
.ky-toast__copy p{
  margin:3px 0 0;
  color:#5f5c55;
  font-size:11px;
  line-height:1.5;
  overflow-wrap:anywhere;
}
.ky-toast__close{
  width:28px;
  min-height:28px;
  padding:0;
  border:0;
  background:transparent;
  color:#666;
  font-size:16px;
  cursor:pointer;
}
.ky-toast__close:hover{color:#111}

.ky-confirm-layer{
  position:fixed;
  z-index:15100;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  background:rgba(0,0,0,.48);
}
.ky-confirm-layer[hidden]{display:none!important}
.ky-confirm{
  width:min(460px,100%);
  border:1px solid #6f6d67;
  border-top:5px solid var(--ky-component-orange);
  background:#fff;
  box-shadow:0 18px 56px rgba(0,0,0,.26);
}
.ky-confirm__body{padding:20px 22px}
.ky-confirm__eyebrow{
  color:var(--ky-component-orange);
  font:850 9px/1.2 var(--ky-component-mono);
  letter-spacing:.8px;
}
.ky-confirm h2{
  margin:7px 0 8px;
  color:#111;
  font-size:20px;
  line-height:1.3;
}
.ky-confirm p{
  margin:0;
  color:#5f5c55;
  font-size:12px;
  line-height:1.65;
}
.ky-confirm__actions{
  display:flex;
  justify-content:flex-end;
  gap:8px;
  padding:12px 22px 18px;
  border-top:1px solid var(--ky-component-line-soft);
}

.ky-search-input{
  width:100%;
  min-width:0;
  min-height:var(--ky-control-h);
  border:1px solid var(--ky-component-line);
  border-radius:0!important;
  background:#fff;
}
.ky-search-input:focus{
  border-color:var(--ky-component-orange)!important;
}
.ky-search-input::-webkit-search-cancel-button{cursor:pointer}

.ky-detail-section{
  min-width:0;
  border:1px solid var(--ky-component-line);
  background:#fff;
}
.ky-section-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:18px;
  padding-bottom:10px;
  border-bottom:1px solid var(--ky-component-line-soft);
}
.ky-section-head :where(.panel-kicker,.section-kicker){
  color:var(--ky-component-orange);
  font:850 9px/1.2 var(--ky-component-mono);
  letter-spacing:.75px;
}
.ky-section-head h2{
  margin:5px 0 0;
  color:#111;
  font-size:19px;
  line-height:1.25;
}
.ky-detail-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-top:1px solid var(--ky-component-line-soft);
  border-left:1px solid var(--ky-component-line-soft);
}
.ky-detail-list>div{
  min-width:0;
  padding:10px 12px;
  border-right:1px solid var(--ky-component-line-soft);
  border-bottom:1px solid var(--ky-component-line-soft);
}
.ky-detail-list>div>span{
  display:block;
  color:var(--ky-component-muted);
  font:800 8px/1.3 var(--ky-component-mono);
  letter-spacing:.45px;
}
.ky-detail-list>div>strong{
  display:block;
  margin-top:5px;
  color:#222;
  font-size:11px;
  line-height:1.55;
  overflow-wrap:anywhere;
}

@media(max-width:760px){
  .ky-toast-region{
    left:14px;
    right:14px;
    bottom:14px;
    width:auto;
  }
  .ky-confirm-layer{padding:0}
  .ky-confirm{
    width:100%;
    align-self:end;
    border-left:0;
    border-right:0;
    border-bottom:0;
  }
  .ky-confirm__actions{
    display:grid;
    grid-template-columns:1fr 1fr;
  }
  .ky-search-input{min-height:var(--ky-control-h-mobile)}
  .ky-section-head{align-items:flex-start;flex-direction:column}
  .ky-detail-list{grid-template-columns:1fr 1fr}
}
@media(max-width:420px){
  .ky-detail-list{grid-template-columns:1fr}
}

/* Migration helpers v5: project desk / private mail */
.ky-pagination[data-ky-pagination="full"] .project-page-buttons{
  display:flex;
  align-items:center;
  gap:6px;
}
.ky-pagination[data-ky-pagination="full"] .project-page-buttons button{
  min-width:64px;
}
.ky-filter-surface.controls{
  display:grid;
  gap:12px;
}
.ky-filter-surface.controls .control-block{
  min-width:0;
}
.mail-list .ky-task-action{
  font-size:11px;
}
@media(max-width:760px){
  .ky-pagination[data-ky-pagination="full"] .project-page-buttons{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    width:100%;
  }
  .ky-pagination[data-ky-pagination="full"] .project-page-buttons button{
    min-width:0;
  }
}

.ky-pagination button:disabled{
  opacity:.42;
  cursor:not-allowed;
  background:#e8e6df;
  color:#aaa79f;
}

/* LoadingOverlay */
.ky-loading-overlay{
  position:fixed;
  z-index:11000;
  inset:0;
  display:grid;
  place-content:center;
  gap:14px;
  color:#fff;
  background:rgba(5,5,5,.95);
  font:800 11px/1.3 var(--ky-component-mono);
  letter-spacing:.9px;
  text-transform:uppercase;
}
.ky-loading-overlay[aria-hidden="true"]{display:none!important}
.ky-loading-overlay :where(.loading-mask__bar,.ky-loading-overlay__bar){
  position:relative;
  width:min(280px,72vw);
  height:4px;
  overflow:hidden;
  background:#353535;
}
.ky-loading-overlay :where(.loading-mask__bar,.ky-loading-overlay__bar)::after{
  content:"";
  position:absolute;
  inset:0 auto 0 -40%;
  width:40%;
  background:var(--ky-component-orange);
  animation:ky-overlay-loading 1s ease-in-out infinite;
}
@keyframes ky-overlay-loading{
  50%{transform:translateX(250%)}
  100%{transform:translateX(500%)}
}
@media(prefers-reduced-motion:reduce){
  .ky-loading-overlay :where(.loading-mask__bar,.ky-loading-overlay__bar)::after{
    animation:none;
    inset:0;
    width:100%;
  }
}

/* Preserve mature density on the regulatory-actions segmented controls. */
.exchange-tabs.ky-segmented,
.type-filter.ky-segmented{
  min-height:39px;
}
.exchange-tabs.ky-segmented>button,
.type-filter.ky-segmented>button{
  min-height:37px;
}

/* Notice */
.ky-notice{
  min-width:0;
  padding:12px 14px;
  border:1px solid #c9c6bf;
  border-left:4px solid #77736b;
  background:#f8f7f3;
  color:#4e4b45;
  font-size:12px;
  line-height:1.65;
}
.ky-notice[data-ky-tone="success"]{
  border-color:#9bcdbd;
  border-left-color:#0b7550;
  background:#eef8f4;
  color:#165f49;
}
.ky-notice[data-ky-tone="warning"]{
  border-color:#e4c782;
  border-left-color:#b58a18;
  background:#fff8e6;
  color:#745317;
}
.ky-notice[data-ky-tone="danger"]{
  border-color:#e0a0a0;
  border-left-color:#b42318;
  background:#fff3f1;
  color:#8e2d24;
}
.ky-notice[data-ky-tone="info"]{
  border-color:#e7b98e;
  border-left-color:var(--ky-component-orange);
  background:#fff8ef;
  color:#5c442f;
}
.ky-notice :where(button,a){
  color:inherit;
  font-weight:850;
}
.ky-notice details{margin-top:8px}
.ky-notice summary{cursor:pointer;font-weight:800}

/* Native DialogSurface */
.ky-modal-surface{
  border-radius:0!important;
  border-top-color:var(--ky-component-orange)!important;
}
.ky-modal-surface::backdrop{
  background:rgba(0,0,0,.68);
}
.ky-modal-head{
  border-bottom-color:var(--ky-component-line)!important;
  background:#fff;
}
.ky-modal-close:focus-visible{
  outline:2px solid var(--ky-component-orange);
  outline-offset:2px;
}

/* RecordCard / DataCard */
:where(.ky-record-card){
  min-width:0;
  border:1px solid var(--ky-component-line);
  background:#fff;
}
:where(.ky-record-card__head){
  min-width:0;
  padding:14px 16px;
  border-bottom:1px solid var(--ky-component-line-soft);
  background:#f6f5f0;
}
:where(.ky-record-card__body){
  min-width:0;
  padding:15px 16px;
}
:where(.ky-record-title){
  min-width:0;
  color:#111;
  font-weight:900;
  overflow-wrap:anywhere;
}
:where(.ky-record-meta){
  min-width:0;
  color:var(--ky-component-muted);
  font:750 9px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}
:where(.ky-record-chip){
  display:inline-flex;
  align-items:center;
  min-height:24px;
  padding:4px 7px;
  border:1px solid #bbb8b0;
  background:#fff;
  color:#55524c;
  font:850 9px/1 var(--ky-component-mono);
  white-space:nowrap;
}
:where(.ky-record-chip)[data-ky-tone="primary"]{
  border-color:#111;
  background:#111;
  color:var(--ky-component-orange);
}
:where(.ky-record-chip)[data-ky-tone="success"]{
  border-color:#9bcdbd;
  background:#eef8f4;
  color:#0b7550;
}
:where(.ky-record-chip)[data-ky-tone="warning"]{
  border-color:#e4c782;
  background:#fff8e6;
  color:#8a5a00;
}

:where(.ky-data-card){
  min-width:0;
  padding:12px 13px;
  border:1px solid var(--ky-component-line-soft);
  background:#fcfbf8;
}
:where(.ky-data-card__head){
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:start;
  min-width:0;
}
:where(.ky-data-card__title){
  min-width:0;
  color:#111;
  font-weight:850;
  overflow-wrap:anywhere;
}
:where(.ky-data-card__meta){
  margin-top:5px;
  color:var(--ky-component-muted);
  font:750 9px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}

@media(max-width:760px){
  :where(.ky-record-card__head){padding:14px}
  :where(.ky-record-card__body){padding:14px}
  :where(.ky-data-card__head){grid-template-columns:1fr}
}

/* Timeline / EventCard / Source-EvidenceCard */
:where(.ky-timeline){
  position:relative;
  margin:2px 0 0 5px;
  border-left:1px solid var(--ky-component-line);
}
:where(.ky-event-card){
  position:relative;
  min-width:0;
  padding:0 0 18px 22px;
}
:where(.ky-event-card:last-child){padding-bottom:0}
:where(.ky-event-card)::before{
  content:"";
  position:absolute;
  left:-5px;
  top:2px;
  width:9px;
  height:9px;
  box-sizing:border-box;
  border:2px solid var(--ky-component-orange);
  background:#fff;
}
:where(.ky-event-card time){
  display:block;
  color:#888;
  font:800 8px/1.2 var(--ky-component-mono);
}
:where(.ky-event-card strong){
  display:block;
  margin-top:5px;
  color:#111;
  font-size:11px;
  line-height:1.45;
}
:where(.ky-event-card__change){
  margin-top:5px;
  color:#5e5c56;
  font-size:9px;
  line-height:1.6;
  overflow-wrap:anywhere;
}
:where(.ky-event-card__summary){
  display:inline-flex;
  max-width:100%;
  margin-top:6px;
  padding:4px 7px;
  border:1px solid #d5b38f;
  background:#fff6ec;
  color:#744115;
  font-size:9px;
  font-weight:850;
  line-height:1.35;
  overflow-wrap:anywhere;
}
:where(.ky-event-card__updates){
  margin-top:7px;
  border-top:1px dashed #ccc7bd;
}
:where(.ky-event-card__updates-list){
  margin-top:5px;
  padding:7px 9px;
  border:1px solid #dedbd3;
  background:#f7f6f1;
}
:where(.ky-event-card__update){
  display:grid;
  grid-template-columns:126px minmax(0,1fr);
  gap:8px;
  padding:4px 0;
  color:#66625b;
  font-size:9px;
  line-height:1.5;
}

:where(.ky-evidence-card){
  min-width:0;
  padding:9px 10px;
  border:1px solid #d2c4b7;
  background:#fffaf5;
}
:where(.ky-evidence-card__head){
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
:where(.ky-evidence-card__title){
  min-width:0;
  color:#2b251f;
  font-size:10.5px;
  line-height:1.5;
  font-weight:850;
  overflow-wrap:anywhere;
}
:where(.ky-evidence-card__badge){
  flex:0 0 auto;
  padding:3px 6px;
  border:1px solid #e2b88f;
  background:#fff2e5;
  color:#8a4300;
  font-size:8px;
  font-weight:900;
  line-height:1.3;
}
:where(.ky-evidence-card__meta){
  margin-top:6px;
  color:var(--ky-component-muted);
  font:750 9px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}
:where(.ky-evidence-card__excerpt){
  margin-top:6px;
  color:#666057;
  font-size:9.5px;
  line-height:1.65;
}
:where(.ky-evidence-card__link){
  display:inline-block;
  margin-top:6px;
  color:#6d3c12;
  font-size:9px;
  font-weight:850;
  text-underline-offset:2px;
}

:where(.ky-source-card){
  min-width:0;
  padding:9px 10px;
  border:1px solid var(--ky-component-line-soft);
  background:#faf9f5;
}
:where(.ky-source-card__meta){
  color:var(--ky-component-muted);
  font:750 9px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}
:where(.ky-source-card__link){
  display:inline-flex;
  margin-left:8px;
  color:#6d3c12;
  font-size:9px;
  font-weight:850;
}

@media(max-width:760px){
  :where(.ky-event-card__update){grid-template-columns:1fr;gap:3px}
  :where(.ky-evidence-card__head){flex-direction:column}
  :where(.ky-evidence-card__badge){align-self:flex-start}
}

:where(.ky-source-card + .ky-source-card){margin-top:6px}

/* Metadata / Chip / SourceLink / ExpandableSection */
:where(.ky-meta-line){
  min-width:0;
  color:var(--ky-component-muted);
  font:750 9px/1.55 var(--ky-component-mono);
  overflow-wrap:anywhere;
}
:where(.ky-chip-group){
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
:where(.ky-chip){
  display:inline-flex;
  align-items:center;
  min-height:22px;
  padding:3px 6px;
  border:1px solid #d6d1c7;
  background:#efede8;
  color:#59544c;
  font-size:8.5px;
  font-weight:850;
  line-height:1.2;
}
:where(.ky-chip)[data-ky-tone="primary"]{
  border-color:#111;
  background:#111;
  color:var(--ky-component-orange);
}
:where(.ky-chip)[data-ky-tone="warning"]{
  border-color:#d5b28e;
  background:#fff4e9;
  color:#5d3a18;
}
:where(.ky-chip)[data-ky-tone="success"]{
  border-color:#9bcdbd;
  background:#eef8f4;
  color:#0b7550;
}

:where(.ky-source-link){
  display:inline-flex;
  align-items:center;
  gap:4px;
  width:max-content;
  max-width:100%;
  color:#5b350f;
  border-bottom:1px solid currentColor;
  text-decoration:none;
  font-size:9px;
  font-weight:850;
  line-height:1.45;
  overflow-wrap:anywhere;
}
:where(.ky-source-link):hover{
  color:var(--ky-component-orange);
}
:where(.ky-source-link)[data-ky-external="true"]::after{
  content:"↗";
  font-family:var(--ky-component-mono);
  font-size:.9em;
}

:where(.ky-expandable){
  min-width:0;
  border-top:1px solid var(--ky-component-line-soft);
}
:where(.ky-expandable)>summary{
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 0;
  color:#555;
  cursor:pointer;
  font-size:10px;
  font-weight:850;
  line-height:1.45;
}
:where(.ky-expandable)>summary::-webkit-details-marker{display:none}
:where(.ky-expandable)>summary::after{
  content:"+";
  flex:0 0 auto;
  color:#777;
  font:900 14px/1 var(--ky-component-mono);
}
:where(.ky-expandable[open])>summary::after{
  content:"−";
  color:var(--ky-component-orange);
}
:where(.ky-expandable__content){
  min-width:0;
  padding:10px 11px;
  border:1px solid var(--ky-component-line-soft);
  background:#fff;
  color:#5d5951;
  font-size:10.5px;
  line-height:1.75;
  overflow-wrap:anywhere;
}

:where(.ky-metadata-grid){
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  border:1px solid var(--ky-component-line);
  background:#fff;
}
:where(.ky-metadata-item){
  min-width:0;
  min-height:78px;
  margin:0;
  padding:15px;
  border-right:1px solid var(--ky-component-line-soft);
  border-bottom:1px solid var(--ky-component-line-soft);
}
:where(.ky-metadata-item:nth-child(3n)){border-right:0}
:where(.ky-metadata-item)>span{
  display:block;
  color:var(--ky-component-muted);
  font:700 9px/1.4 var(--ky-component-mono);
}
:where(.ky-metadata-item)>strong{
  display:block;
  margin-top:8px;
  color:#222;
  font-size:12px;
  line-height:1.5;
  overflow-wrap:anywhere;
}

@media(max-width:760px){
  :where(.ky-metadata-grid){grid-template-columns:1fr}
  :where(.ky-metadata-item){min-height:0;border-right:0}
  :where(.ky-source-link){font-size:10px}
}

/* CopyButton / Tooltip / InlineActions / Breadcrumb / SectionHeader */
:where(.ky-copy-button){
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:26px;
  margin-top:7px;
  padding:0 7px;
  border:1px solid var(--ky-component-line);
  border-radius:0;
  background:#fff;
  color:#55524c;
  font:850 8px/1 var(--ky-component-mono);
  cursor:pointer;
}
:where(.ky-copy-button):hover,
:where(.ky-copy-button):focus-visible{
  border-color:var(--ky-component-orange);
  color:#8a4300;
  background:#fff8ef;
}
:where(.ky-copy-button)[data-ky-copy-state="done"]{
  border-color:#9bcdbd;
  background:#eef8f4;
  color:#0b7550;
}

:where([data-ky-tooltip]){
  position:relative;
}
:where([data-ky-tooltip]):is(:hover,:focus-visible)::after{
  content:attr(data-ky-tooltip);
  position:absolute;
  z-index:16000;
  left:50%;
  bottom:calc(100% + 7px);
  transform:translateX(-50%);
  width:max-content;
  max-width:min(260px,70vw);
  padding:6px 8px;
  border:1px solid #444;
  background:#111;
  color:#fff;
  font:750 9px/1.45 var(--ky-component-sans);
  white-space:normal;
  box-shadow:0 7px 18px rgba(0,0,0,.18);
  pointer-events:none;
}
:where([data-ky-tooltip]):is(:hover,:focus-visible)::before{
  content:"";
  position:absolute;
  z-index:16001;
  left:50%;
  bottom:calc(100% + 2px);
  width:8px;
  height:8px;
  transform:translateX(-50%) rotate(45deg);
  background:#111;
  pointer-events:none;
}

:where(.ky-inline-actions){
  display:flex;
  align-items:center;
  gap:8px 12px;
  flex-wrap:wrap;
  min-width:0;
}
:where(.ky-inline-actions)>:is(a,button){
  flex:0 0 auto;
}

:where(.ky-breadcrumb){
  display:flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:10px 16px;
  border-bottom:1px solid var(--ky-component-line);
  background:#f5f4ef;
  color:#5f5c55;
  font-size:11px;
  line-height:1.45;
}
:where(.ky-breadcrumb) a{
  color:#393631;
  text-decoration:none;
  font-weight:850;
}
:where(.ky-breadcrumb) a:hover,
:where(.ky-breadcrumb) a:focus-visible{
  color:#8a4300;
  text-decoration:underline;
  text-decoration-color:var(--ky-component-orange);
  text-underline-offset:3px;
}
:where(.ky-breadcrumb__sep){
  color:#a29f97;
  font-family:var(--ky-component-mono);
}

:where(.ky-section-header){
  min-width:0;
}
:where(.ky-section-header)>*{
  min-width:0;
}
:where(.ky-section-header) :is(h2,h3){
  overflow-wrap:anywhere;
}
:where(.ky-section-header-meta){
  color:var(--ky-component-muted);
  font:800 9px/1.45 var(--ky-component-mono);
}

@media(max-width:760px){
  :where(.ky-copy-button){
    min-height:34px;
    padding-inline:10px;
    font-size:9px;
  }
  :where([data-ky-tooltip])::after,
  :where([data-ky-tooltip])::before{
    display:none!important;
  }
  :where(.ky-inline-actions){
    gap:8px;
  }
  :where(.ky-breadcrumb){
    min-height:44px;
    padding:10px 12px;
    overflow-x:auto;
    white-space:nowrap;
    scrollbar-width:none;
  }
  :where(.ky-breadcrumb)::-webkit-scrollbar{display:none}
  :where(.ky-section-header){
    align-items:flex-start!important;
    flex-direction:column!important;
    gap:8px!important;
  }
  :where(.ky-section-header-meta){
    width:100%;
  }
}
