:root{
  --yoko-blue-light:#e6eff8;

  --bg:#00000000;
  --panel:#ffffff;
  --text:#003366;
  --muted:#5a6b80;
  --chat-bg:#f6f8fb;
  --btn-bg:#e6eff8;
  --chat-border:#d0d7e3;
  --btn-border:#1a61a5;
  --btn-high:#1a61a5;
  --btn-low:#ffffff;
  --logo-yellow:#f9e300;

  --danger:#b42318;
  --success:#067647;
  --warn:#b54708;
}

*{box-sizing:border-box}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14px/1.4 "Noto Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  min-height:100vh;
  display:grid;
  place-items:center;
}

.wrap{
  width:min(1520px,100%);
  min-height:100vh;
  display:flex;
  flex-direction:column;
  padding:16px;
}

.card{
  background:var(--yoko-blue-light);
  border:1px solid var(--panel);
  border-radius:14px;
  display:flex;
  flex-direction:column;
  min-height:100%;
  overflow:hidden;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}

/* Header matches index.html */
.header{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 16px;
  background:var(--btn-high);
  color:var(--btn-low);
  font-weight:600;
}

.header-logo{
  width:24px;height:24px;
  display:flex;align-items:center;justify-content:center;
  flex:0 0 auto;
}
.header-logo svg{width:100%;height:100%;display:block}
.logo-icon{fill:var(--logo-yellow)}

.header-titles{
  display:flex;
  flex-direction:column;
  gap:1px;
  min-width:0;
}
.header-title{
  font-size:20px;line-height:1.3;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.header-subtitle{
  font-size:14px;font-weight:500;opacity:.92;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}

.header-right{
  margin-left:auto;
  display:flex;align-items:center;gap:10px;
}

.login-chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:4px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.28);
  background:rgba(255,255,255,.10);
  color:var(--btn-low);
  font-weight:600;
  user-select:none;
}

.btn{
  border:1px solid var(--btn-border);
  background:var(--btn-bg);
  color:var(--btn-high);
  border-radius:999px;
  padding:7px 12px;
  cursor:pointer;
  font-weight:700;
  user-select:none;
  display:inline-flex;align-items:center;gap:8px;
  text-decoration:none;
}
.btn.primary{
  background:var(--btn-high);
  color:var(--btn-low);
  border-color:var(--btn-high);
}
.btn:active{transform:translateY(1px)}

.panel{
  background:var(--panel);
  border:1px solid var(--chat-border);
  border-radius:14px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.panel-hd{
  padding:12px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--chat-border);
  background:#fff;
}

.panel-hd .title{
  font-weight:800;
  font-size:13px;
  letter-spacing:.2px;
  display:inline-flex;
  align-items:center;
  gap:10px;
}
.panel-hd .title i{color:var(--btn-high)}

.panel-bd{
  padding:14px;
  overflow:auto;
  flex:1;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;

  height:32px;
  padding:0 14px;

  border-radius:999px;
  border:1px solid transparent;

  font-weight:800;
  font-size:13px;
  line-height:1;
  white-space:nowrap;
}

.badge.ok{border-color:rgba(6,118,71,.25);background:rgba(6,118,71,.06);color:var(--success)}
.badge.new{border-color:rgba(26,97,165,.25);background:rgba(26,97,165,.06);color:var(--btn-high)}
.badge.warn{border-color:rgba(181,71,8,.22);background:rgba(181,71,8,.06);color:var(--warn)}

.hint{font-size:12px;color:var(--muted)}
.muted{color:var(--muted)}

.footer-bar{
  padding:10px 14px;
  background:#fff;
  border-top:1px solid var(--chat-border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}

/* Folder tree */
.tree{font-size:13px;color:var(--text)}
.tree .caret{
  width:18px;height:18px;border-radius:8px;
  border:1px solid transparent;
  display:inline-flex;align-items:center;justify-content:center;
  color:var(--btn-high);flex:0 0 auto;
}
.tree .caret:hover{background:rgba(26,97,165,.08);border-color:rgba(26,97,165,.18)}
.tree .children.collapsed{display:none}

.path-pill{
  display:inline-flex;align-items:center;gap:8px;
  border:1px solid #d6e0ee;background:#f6f8fb;color:#274766;
  border-radius:999px;padding:6px 10px;font-weight:800;font-size:12px;
}

/* ===== Workspace views ===== */
.view{display:none; min-height:0}
.view.active{display:block}

/* Repository workspace (full width upload) */
.repo-upload-shell{
  display:flex;
  flex-direction:column;
  min-height:660px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid var(--chat-border);
  background:#fff;
}

.repo-upload-top{
  padding:12px 14px;
  display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--chat-border);
  background:#fff;
}
.repo-upload-top .title{
  font-weight:900;
  display:inline-flex;align-items:center;gap:10px;
}
.repo-upload-top .title i{color:var(--btn-high)}
.repo-upload-body{
  padding:14px;
  flex:1;
  background:#fff;
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
}

.dropzone{
  border:1.5px dashed #b6c4d9;
  border-radius:14px;
  padding:16px;
  background:#fff;
  display:grid;
  gap:10px;
}
.dropzone.dragover{border-color:var(--btn-high);box-shadow:0 0 0 3px rgba(26,97,165,.12)}
.dz-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.dz-title{display:inline-flex;align-items:center;gap:10px;font-weight:800}
.dz-title i{color:var(--btn-high)}
.file-input{display:none}

.notice{
  display:none;
  padding:10px 12px;border-radius:12px;
  border:1px solid rgba(180,35,24,.18);
  background:rgba(180,35,24,.06);
  color:var(--danger);font-weight:800;
}
.notice.show{display:block}

.table-wrap{
  margin-top:4px;
  border:1px solid var(--chat-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;

  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.table-scroll{
  flex:1;
  min-height:0;
  overflow:auto;
  max-height: 500px;
  -webkit-overflow-scrolling:touch;
  background:#fff;
}
table{
  width:100%;
  min-width: 1040px;          /* keep horizontal scroll */
  border-collapse: separate;  /* IMPORTANT for sticky header reliability */
  border-spacing: 0;          /* keep it looking like collapsed borders */
  font-size:12.6px;
}
thead th{
  position: sticky;           /* make header stick */
  top: 0;                     /* stick to top of .table-scroll */
  z-index: 3;                 /* stay above table cells */
  text-align:left;
  padding:10px 10px;
  background:#f8fafc;         /* must be solid or it will look transparent */
  border-bottom:1px solid var(--chat-border);
  color:#223b5a;
  font-weight:800;
  white-space:nowrap;
}

tbody td{
  padding:10px 10px;
  border-top:1px solid #eef2f7;
  background:#fff;
  vertical-align:top;
  white-space:nowrap;
}
/* Allow document name to wrap, others stay compact */
td.doccell{white-space:normal; min-width: 260px;}
td.industrycell{min-width: 220px;}
td.catcell{min-width: 170px;}
td.uploadbycell{min-width: 120px;}
td.datecell{min-width: 170px;}
td.vercell{min-width: 90px;}
td.actioncell{min-width: 60px; text-align:right;}

.select{
  padding:8px 10px;border-radius:12px;border:1px solid var(--chat-border);
  background:#fff;color:var(--text);
  font-weight:800;font-size:12.6px;
  outline:none;
  max-width: 100%;
}
.select:focus{border-color:var(--btn-high);box-shadow:0 0 0 2px #004b9d29}

.icon-btn{
  width:35px;height:35px;
  border-radius:10px;
  border:1px solid var(--chat-border);
  background:#fff;
  cursor:pointer;
  color:var(--btn-high);
  display:inline-flex;align-items:center;justify-content:center;
  text-decoration:none;
}

.icon-btn.disabled{
  opacity:.45;
  pointer-events:none;
  cursor:not-allowed;
}

.icon-btn:hover{background:var(--yoko-blue-light)}

/* Chat */
.chat-shell{
  display:flex;
  flex-direction:column;
  height:660px;
  min-height:660px;
  border-radius:14px;
  overflow:hidden;
  border:1px solid var(--chat-border);
  background:#fff;
}
.chat-top{
  padding:12px 14px;
  display:flex;align-items:center;justify-content:space-between;
  border-bottom:1px solid var(--chat-border);
  background:#fff;
}
.chat-top .title{
  font-weight:900;
  display:inline-flex;align-items:center;gap:10px;
}
.chat-top .title i{color:var(--btn-high)}
.chat-body{
  flex:1;
  padding:14px;
  overflow:auto;
  background:var(--chat-bg);
  display:flex;
  flex-direction:column;
  gap:10px;
}
.msg{
  max-width: 86%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--chat-border);
  background:#fff;
  box-shadow:0 2px 10px rgba(0,0,0,.04);
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* If your JS wraps content in <div class="msg-content"> */
.msg .msg-content{
  max-width:100%;
  overflow-wrap:anywhere;
  word-break:break-word;
}

/* Assistant markdown headers */
.msg.ai h1{font-size:1.25rem; margin:.4em 0 .25em; line-height:1.2;}
.msg.ai h2{font-size:1.10rem; margin:.4em 0 .25em; line-height:1.2;}
.msg.ai h3{font-size:1.00rem; margin:.35em 0 .2em; line-height:1.2;}

/* Assistant lists */
.msg.ai ul{margin:.35em 0 .35em 1.2em; padding:0;}
.msg.ai li{margin:.15em 0;}

.msg.user{
  margin-left:auto;
  background:rgba(26,97,165,.08);
  border-color:rgba(26,97,165,.22);
}
.msg.ai{margin-right:auto}
.msg .meta{
  font-size:11px;
  font-weight:900;
  color:#274766;
  margin-bottom:6px;
  display:flex;align-items:center;gap:8px;
}
.chat-input{
  padding:10px;
  border-top:1px solid var(--chat-border);
  background:#fff;
  display:flex;
  gap:10px;
  align-items:center;
}
.chat-input textarea{
  flex:1;
  resize:none;
  height:44px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--chat-border);
  outline:none;
  font: 13px/1.35 "Noto Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
}
.chat-input textarea:focus{
  border-color:var(--btn-high);
  box-shadow:0 0 0 2px #004b9d29;
}

/* Report */
.report-wrap{
  min-height:660px;
  height:660px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.report-prompts{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:14px;
}

.prompt-box{
  border:1px solid var(--chat-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  display:flex;
  flex-direction:column;
  min-height:180px;
}
.prompt-box .hd{
  padding:10px 12px;
  border-bottom:1px solid var(--chat-border);
  font-weight:900;
  display:flex;align-items:center;gap:10px;
}
.prompt-box .hd i{color:var(--btn-high)}
.prompt-box textarea{
  flex:1;
  border:none;
  outline:none;
  padding:12px;
  resize:none;
  background:#fff;
  font: 13px/1.45 "Noto Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
}

.report-editor{
  border:1px solid var(--chat-border);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  display:flex;
  flex-direction:column;
  min-height:420px;
  flex:1;
  min-height:0;
}

.report-editor .hd{
  padding:10px 12px;
  border-bottom:1px solid var(--chat-border);
  font-weight:900;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.report-editor .hd .left{
  display:inline-flex;
  align-items:center;
  gap:10px;
}
.report-editor .hd .right{
  display:flex;
  align-items:center;
  gap:10px;
}

.report-editor .hd i{ color: var(--btn-high); }

.report-editor .bd{
  padding:0;
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}

/* TinyMCE in Report Editor */
.report-editor .tox{
  border:none !important;
  border-radius:0 !important;
  box-shadow:none !important;
  font-family:"Noto Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
}
.report-editor .tox-tinymce{
  height:100% !important;
}
.report-editor .tox .tox-editor-header{
  border-bottom:1px solid var(--chat-border) !important;
  background:#f8fafc !important;
}
.report-editor .tox .tox-edit-area__iframe{
  background:#fff !important;
}

/* Editor area */
#reportEditor.editor{
  flex:1;
  min-height:0;
}

/* Report input bar */
.report-editor .inputbar{
  padding:10px;
  border-top:1px solid var(--chat-border);
  display:flex;
  gap:10px;
  align-items:center;
  background:#fff;
}

.report-editor input{
  flex:1;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--chat-border);
  outline:none;
  font:13px/1.35 "Noto Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--text);
}

.report-editor input:focus{
  border-color:var(--btn-high);
  box-shadow:0 0 0 2px #004b9d29;
}

@media (max-width: 980px){
  .shell{grid-template-columns:1fr}
  .panel{min-height:auto}
  .report-prompts{grid-template-columns:1fr}
}

.workspace-spinner{
  display:none;
  color:var(--btn-high);
  font-size:16px;
}

.workspace-spinner.show{
  display:inline-flex;
}

.workspace-spinner i{
  animation: spin 1s linear infinite;
}

@keyframes spin{
  from{ transform:rotate(0deg); }
  to{ transform:rotate(360deg); }
}

.embedded-table table {
  table-layout: fixed;
  width: max-content;
}

.embedded-table .summarycell {
  min-width: 320px;
  max-width: 320px;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}

.embedded-table .summarycell .badge{
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hover popover */
.embedded-table .summarycell::after {
  content: attr(data-summary);
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;

  width: 320px;
  max-height: 500px;
  overflow-y: auto;

  background: #ffffff;
  border: 1px solid #d0d7e3;
  border-radius: 8px;
  padding: 12px;

  box-shadow: 0 8px 24px rgba(0,0,0,0.15);

  white-space: normal;
  color: var(--text);

  opacity: 0;
  pointer-events: none;
}

.embedded-table .summarycell:hover::after {
  opacity: 1;
}

#tableHeader th{
  cursor: pointer;
  user-select: none;
}

#tableHeader th:hover{
  background: var(--yoko-blue-light);
}

.badge.status{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 30px;              /* equal height for all */
  padding: 6px 14px;             /* horizontal pill padding */

  font-size: 13px;
  font-weight: 700;
  line-height: 1;

  border-radius: 999px;          /* pill shape */
  border: 1.5px solid transparent;

  white-space: nowrap;
}

/* ERROR */
.badge.status.is-danger{
  background: #fff1f2;           /* soft red */
  border-color: #f0a5a5;
  color: var(--danger);
}

/* EMBEDDED */
.badge.status.is-success{
  background: #ecfdf3;           /* soft green */
  border-color: #9bd5c0;
  color: var(--success);
}

/* DEACTIVATED / EMBEDDING */
.badge.status.is-warn{
  background: #fffaeb;           /* soft amber */
  border-color: #f5c37a;
  color: var(--warn);
}

@media print{
  .report-editor .inputbar,
  .report-editor .hd .right { display:none !important; }
  body { background:#fff !important; }
  .wrap, .card, .shell { box-shadow:none !important; }
}

.chat-table-wrap{margin-top:8px}
.chat-table-title{font-weight:800; margin-bottom:8px}
.chat-table-scroll{overflow:auto; max-height:360px; border:1px solid var(--chat-border); border-radius:12px}
.chat-table{width:100%; border-collapse:collapse; background:#fff}

/* keep headers compact, allow cells to wrap */
.chat-table th{
  padding:10px 12px;
  border-bottom:1px solid var(--chat-border);
  text-align:left;
  white-space:nowrap;
  position:sticky;
  top:0;
  background:var(--chat-bg);
  z-index:1;
}

.chat-table td{
  padding:10px 12px;
  border-bottom:1px solid var(--chat-border);
  text-align:left;
  white-space:normal;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.chat-table-foot{margin-top:8px; color:var(--muted); font-size:12px}

.chat-acc-bd{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.chat-action.disabled{
  opacity:.55;
  cursor:default;
}

.chat-action i{
  width:16px;
  text-align:center;
}

.shell{
  position: relative;
  display:grid;
  grid-template-columns: 320px 1fr;
  gap:14px;
  padding:14px;
  background:var(--chat-bg);
  border-top:1px solid var(--chat-border);
  flex:1;
  transition:grid-template-columns .25s ease, gap .25s ease;
}

/* menu toggle button in Menu header */
.menu-toggle-btn{
  width:34px;
  height:34px;
  border:none;
  background:transparent;
  color:var(--btn-high);
  border-radius:10px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  padding:0;
  flex:0 0 34px;
}

.menu-toggle-btn:hover{
  background:var(--yoko-blue-light);
}

/* collapsed state */
.shell.menu-collapsed{
  grid-template-columns: 60px 1fr;
  gap:14px;
}

/* keep the menu column, only hide its content */
.shell.menu-collapsed .menu-panel{
  width:60px;
  min-width:60px;
  overflow:hidden;
}

.shell.menu-collapsed .menu-panel .panel-bd{
  display:none;
}

.shell.menu-collapsed .menu-panel .title span{
  display:none;
}

.shell.menu-collapsed .menu-panel .title{
  justify-content:center;
}

/* floating restore button */
.menu-expand-btn{
  display:none;
  position:absolute;
  top:14px;
  left:14px;
  z-index:20;

  width:34px;
  height:34px;
  border:none;
  background:transparent;
  color:var(--btn-high);
  border-radius:10px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  font-size:16px;
  padding:0;
}

.menu-expand-btn:hover{
  background:var(--yoko-blue-light);
}

/* ===== Premium sidebar style ===== */

/* menu panel shell */
.menu-panel{
  background: transparent;
  border: none;
  box-shadow: none;
}

.menu-panel .panel-hd{
  border-bottom: none;
  background: transparent;
  padding-bottom: 8px;
}

.menu-panel .panel-bd{
  background: transparent;
  padding-top: 6px;
}

/* menu list spacing */
.menu-list{
  display:grid;
  gap:8px;
  margin-top:8px;
}

/* clean sidebar buttons */
.menu-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:11px 12px;
  border:none;
  border-radius:12px;
  background:transparent;
  cursor:pointer;
  user-select:none;
  font-weight:800;
  color:var(--text);
  box-shadow:none;
  transition:background .18s ease, color .18s ease, transform .18s ease;
}

.menu-item i{
  color:var(--btn-high);
  width:18px;
  text-align:center;
  opacity:.95;
}

.menu-item:hover{
  background:rgba(26,97,165,.08);
}

.menu-item:active{
  transform:translateY(1px);
}

/* active item = subtle SaaS highlight */
.menu-item.active{
  background:rgba(26,97,165,.08);
  border:none;
  box-shadow:none;
}

.menu-sub{
  font-size:12px;
  font-weight:700;
  color:var(--muted);
  margin-left:auto;
}

/* repository accordion cleaner */
.repo-accordion{
  display:none;
  margin:2px 0 4px 28px;
  padding-left:10px;
  border:none;
  border-radius:0;
  overflow:visible;
  background:transparent;
}

.repo-accordion.show{
  display:block;
}

.repo-acc-bd{
  padding:6px 0 0 0;
  max-height:420px;
  overflow:auto;
}

/* cleaner tree */
.tree .node{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 8px;
  border-radius:10px;
  cursor:pointer;
  user-select:none;
  border:none;
}

.tree .node:hover{
  background:rgba(26,97,165,.07);
}

.tree .node.active{
  background:rgba(26,97,165,.10);
  border:none;
}

.tree .children{
  margin-left:18px;
  padding-left:8px;
  border-left:1px solid rgba(26,97,165,.14);
}

/* chat submenu match the same style */
.chat-accordion{
  margin:2px 0 4px 28px;
  padding-left:10px;
  border-left:1px solid rgba(26,97,165,.14);
}

.chat-action{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:10px;
  cursor:pointer;
  color:var(--text);
  background:transparent;
  border:none;
  transition:background .18s ease;
}

.chat-action:hover{
  background:rgba(26,97,165,.07);
}

/* collapsed menu still looks centered */
.shell.menu-collapsed .menu-panel .panel-hd{
  padding-left:12px;
  padding-right:12px;
}

.shell.menu-collapsed .menu-item{
  justify-content:center;
  padding-left:0;
  padding-right:0;
}

.shell.menu-collapsed .menu-item span,
.shell.menu-collapsed .repo-accordion,
.shell.menu-collapsed .chat-accordion{
  display:none !important;
}