/* ============================================================
   T-Go Hub UX Theme Pass — Office 365 / Fluent polish
   Scope: visual unification only. No data / flow logic changes.
   Load last after module CSS.
   ============================================================ */

:root{
  --fluent-bg:#FAF9F8;
  --fluent-surface:#FFFFFF;
  --fluent-canvas:#F3F2F1;
  --fluent-subtle:#F8F8F8;
  --fluent-line:#EDEBE9;
  --fluent-line-strong:#D2D0CE;
  --fluent-text:#201F1E;
  --fluent-muted:#605E5C;
  --fluent-blue:#0078D4;
  --fluent-blue-hover:#106EBE;
  --fluent-focus:rgba(0,120,212,.18);
  --fluent-radius:4px;
  --fluent-radius-lg:8px;
  --fluent-shadow-2:0 1.6px 3.6px rgba(0,0,0,.11),0 .3px .9px rgba(0,0,0,.08);
  --fluent-shadow-4:0 3.2px 7.2px rgba(0,0,0,.13),0 .6px 1.8px rgba(0,0,0,.11);
}

/* Global foundation */
body{
  background:var(--fluent-bg);
  color:var(--fluent-text);
  font-family:"Segoe UI","Noto Sans Thai","IBM Plex Sans Thai",-apple-system,BlinkMacSystemFont,sans-serif;
}

/* App shell */
.sidebar,.topbar{
  background:var(--fluent-surface)!important;
  border-color:var(--fluent-line)!important;
}
.sidebar{box-shadow:1px 0 0 rgba(0,0,0,.02)}
.nav-item{
  border-radius:0 4px 4px 0;
  margin:1px 6px 1px 0;
  min-height:36px;
}
.nav-item:hover{background:var(--fluent-canvas)!important}
.nav-item.active{
  background:#EFF6FC!important;
  border-left-color:var(--fluent-blue)!important;
  color:var(--fluent-text)!important;
}
.topbar{
  height:48px!important;
  box-shadow:0 1px 0 rgba(0,0,0,.02);
}
.topbar-search-input{
  border-radius:4px!important;
  background:var(--fluent-canvas)!important;
  height:32px!important;
}
.topbar-search-input:focus{
  background:#fff!important;
  border-color:var(--fluent-blue)!important;
  box-shadow:0 0 0 2px var(--fluent-focus)!important;
}

/* Unified module page structure */
.ph,.cf2-hero,.tc-hero,#temp-main .te-card:first-child,.ta-hero,.hub-hero{
  border-bottom:1px solid var(--fluent-line)!important;
}
.ph{
  background:linear-gradient(135deg,#fff 0%,#F8FBFF 100%)!important;
  padding:22px 24px!important;
  margin:0!important;
  border-radius:0!important;
}
.pt,.cf2-title,#temp-main .te-page-title,.ta-title{
  color:var(--fluent-text)!important;
  font-weight:600!important;
  letter-spacing:-.01em!important;
}
.ps,.cf2-sub,#temp-main .te-page-subtitle,.ta-subtitle{
  color:var(--fluent-muted)!important;
}

/* Command bars / toolbars */
.module-toolbar,.cf2-toolbar,.tc-toolbar,.data-table-toolbar,.te-toolbar,#temp-main .te-toolbar,.ta-toolbar,.ph .bg{
  background:var(--fluent-surface)!important;
  border:1px solid var(--fluent-line)!important;
  border-radius:var(--fluent-radius-lg)!important;
  padding:8px 10px!important;
  box-shadow:none!important;
  align-items:center!important;
  gap:8px!important;
}
.module-toolbar{
  border-left:0!important;
  border-right:0!important;
  border-radius:0!important;
  position:sticky;
  top:48px;
}

/* Buttons */
.btn,#temp-main .te-btn,.cf2-btn,.ta-btn,button.btn{
  min-height:32px;
  border-radius:var(--fluent-radius)!important;
  border:1px solid var(--fluent-line-strong)!important;
  background:#fff!important;
  color:var(--fluent-text)!important;
  font-weight:600!important;
  box-shadow:none!important;
  transition:background .12s,border-color .12s,box-shadow .12s,transform .12s;
}
.btn:hover,#temp-main .te-btn:hover,.cf2-btn:hover,.ta-btn:hover{
  background:var(--fluent-canvas)!important;
  border-color:#C8C6C4!important;
}
.btn:focus-visible,#temp-main .te-btn:focus-visible,.cf2-btn:focus-visible,.ta-btn:focus-visible,
input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:none!important;
  box-shadow:0 0 0 2px var(--fluent-focus)!important;
  border-color:var(--fluent-blue)!important;
}
.btn-primary,.btn-g,#temp-main .te-btn-primary,.cf2-primary,.ta-btn-primary{
  background:var(--fluent-blue)!important;
  color:#fff!important;
  border-color:var(--fluent-blue)!important;
}
.btn-primary:hover,.btn-g:hover,#temp-main .te-btn-primary:hover,.cf2-primary:hover,.ta-btn-primary:hover{
  background:var(--fluent-blue-hover)!important;
  border-color:var(--fluent-blue-hover)!important;
}
.btn-s{
  height:28px!important;
  min-height:28px!important;
  padding:0 10px!important;
  font-size:12px!important;
}
.btn-danger,.btn-danger-soft{
  color:#A80000!important;
  border-color:#F3C6C2!important;
}

/* Tabs / pivots */
.module-tabs,.cf2-tabs,#temp-main .te-tabs,.ta-tabs{
  background:#fff!important;
  border-bottom:1px solid var(--fluent-line)!important;
  padding:0 24px!important;
  gap:0!important;
}
.module-tab,.cf2-tab,#temp-main .te-tab,.ta-tab{
  border-radius:0!important;
  border:0!important;
  border-bottom:2px solid transparent!important;
  background:transparent!important;
  color:var(--fluent-muted)!important;
  font-weight:500!important;
  padding:12px 14px!important;
}
.module-tab:hover,.cf2-tab:hover,#temp-main .te-tab:hover,.ta-tab:hover{
  color:var(--fluent-text)!important;
  background:#fff!important;
}
.module-tab.active,.cf2-tab.on,#temp-main .te-tab.active,.ta-tab.active{
  color:var(--fluent-blue)!important;
  border-bottom-color:var(--fluent-blue)!important;
  font-weight:600!important;
}

/* Cards / panels */
.card,.module-card,.stat-card,.cs-stat,.cf2-panel,.tc-kpis,.data-table,
#temp-main .te-card,#temp-main .te-kpi,.ta-card,.ta-panel,.cs365-card,.cs365-panel{
  background:var(--fluent-surface)!important;
  border:1px solid var(--fluent-line)!important;
  border-radius:var(--fluent-radius-lg)!important;
  box-shadow:0 1px 2px rgba(0,0,0,.04)!important;
}
.card:hover,.module-card:hover,.stat-card:hover,#temp-main .te-card:hover,.ta-card:hover{
  box-shadow:var(--fluent-shadow-4)!important;
  transform:translateY(-1px);
}
.chead,.cf2-panel-h,.cs365-panel-h,.ta-panel-h{
  background:#FBFBFB!important;
  border-bottom:1px solid var(--fluent-line)!important;
  border-radius:var(--fluent-radius-lg) var(--fluent-radius-lg) 0 0!important;
}
.cft{
  border-top:1px solid var(--fluent-line)!important;
  align-items:center!important;
}

/* Tables */
.deal-table,.cf2-table,.tc-table,#temp-main table,.cs365-table,.ta-table{
  width:100%;
  border-collapse:separate!important;
  border-spacing:0!important;
  background:#fff!important;
}
.deal-table thead th,.cf2-table thead th,.tc-table thead th,#temp-main table thead th,.cs365-table th,.ta-table th{
  background:#FAFAFA!important;
  color:var(--fluent-muted)!important;
  border-bottom:1px solid var(--fluent-line)!important;
  font-size:11px!important;
  font-weight:600!important;
  text-transform:uppercase;
  letter-spacing:.04em;
  padding:9px 12px!important;
}
.deal-table tbody td,.cf2-table tbody td,.tc-table tbody td,#temp-main table tbody td,.cs365-table td,.ta-table td{
  border-bottom:1px solid var(--fluent-line)!important;
  padding:11px 12px!important;
  vertical-align:middle!important;
}
.deal-table tbody tr:hover,.cf2-table tbody tr:hover,.tc-table tbody tr:hover,#temp-main table tbody tr:hover,.ta-table tbody tr:hover{
  background:#F8FBFF!important;
}

/* Inputs */
.form-input,.sinp,.cf2-input,.cf2-select,.tc-input,#temp-main input,#temp-main select,#temp-main textarea,.ta-input,.ta-select,input,select,textarea{
  border-radius:var(--fluent-radius)!important;
  border:1px solid var(--fluent-line-strong)!important;
  background:#fff!important;
  min-height:32px;
  font-family:inherit;
}
textarea{min-height:72px}

/* Badges / status */
.badge,.module-badge,.deal-stage,.cf2-pill,.cs365-badge,.ta-badge,#temp-main .te-badge{
  border-radius:999px!important;
  padding:3px 8px!important;
  font-size:11px!important;
  font-weight:700!important;
  border:1px solid transparent;
}
.badge-live,.stage-won,.stage-cleared,.cf2-green{
  background:#DFF6DD!important;
  color:#107C10!important;
}
.badge-dev,.stage-pending,.stage-draft{
  background:#FDE8E8!important;
  color:#C81E1E!important;
}

/* Action rows: fix buttons wrapping across all modules */
.cs-actions,.ta-actions,.te-actions,.cf2-actions,.tc-actions .tc-confirmed-actions,.tc-confirm-wrap{
  display:inline-flex!important;
  flex-wrap:nowrap!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:6px!important;
  white-space:nowrap!important;
}
.cs-actions .btn,.ta-actions .btn,.te-actions .btn,.cf2-actions .btn,.tc-actions .btn,.tc-confirm-wrap .btn{
  display:inline-flex!important;
  width:auto!important;
  min-width:44px!important;
  align-items:center!important;
  justify-content:center!important;
}

/* Modals */
.modal,.modal-card,.temp-modal-card,#temp-main .temp-modal-card,.ta-modal-card{
  border-radius:10px!important;
  border:1px solid var(--fluent-line)!important;
  box-shadow:0 16px 40px rgba(0,0,0,.18)!important;
}
.modal-header,.modal-footer,.temp-modal-card .modal-header,.temp-modal-card .modal-footer,.ta-modal-h,.ta-modal-f{
  background:#FAFAFA!important;
  border-color:var(--fluent-line)!important;
}

/* T-Emp visual integration */
#temp-main{
  background:var(--fluent-bg)!important;
  color:var(--fluent-text)!important;
  font-family:"Segoe UI","Noto Sans Thai",sans-serif!important;
}
#temp-main .te-sidebar{
  background:#fff!important;
  border-right:1px solid var(--fluent-line)!important;
}
#temp-main .te-nav-item{
  border-radius:0 4px 4px 0!important;
  margin-right:6px;
}
#temp-main .te-nav-item.active{
  background:#EFF6FC!important;
  color:var(--fluent-blue)!important;
  border-left-color:var(--fluent-blue)!important;
}
#temp-main .te-kpi-value{
  color:var(--fluent-text)!important;
}

/* T-Cashflow visual integration */
.cf2-wrap,#cashflow-main .cf2-wrap{
  max-width:1500px!important;
  margin:0 auto!important;
}
.cf2-hero,#cashflow-main .tc-hero{
  border-radius:10px!important;
  background:linear-gradient(135deg,#fff 0%,#F8FBFF 100%)!important;
  border:1px solid var(--fluent-line)!important;
  box-shadow:0 1px 2px rgba(0,0,0,.04)!important;
}
.tc-company{
  border-color:var(--fluent-line-strong)!important;
  border-radius:8px!important;
}
.tc-company button.on{
  background:var(--fluent-blue)!important;
}

/* T-Asset iframe host */
.asset-shell,.asset-frame-wrap,#asset-main{
  background:var(--fluent-bg)!important;
}
.asset-card,.asset-iframe-card{
  border:1px solid var(--fluent-line)!important;
  border-radius:10px!important;
  box-shadow:0 1px 2px rgba(0,0,0,.04)!important;
}

/* Empty / notice states */
.empty,.cf2-empty,.cs-notice,.cf-notice,.tc-alert,#temp-main .te-empty,.ta-empty{
  border-radius:8px!important;
  border:1px solid var(--fluent-line)!important;
  background:#fff!important;
  color:var(--fluent-muted)!important;
}

/* Responsive */
@media(max-width:760px){
  .ph{padding:18px 16px!important}
  .module-content,.cs365-content{padding:16px!important}
  .module-tabs,.cf2-tabs,#temp-main .te-tabs,.ta-tabs{padding:0 16px!important}
  .tc-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}


/* T-Project company selector: keep ALL / TA / TT on one row where available */
.tproject-theme .company {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  width: min(100%, 1100px) !important;
  max-width: 1100px !important;
}
@media (max-width: 760px) {
  .tproject-theme .company { grid-template-columns: 1fr !important; }
}

/* V3.46 topbar search icon overlap guard */
.topbar .topbar-search-input{padding-left:42px!important;box-sizing:border-box!important;}
.topbar .topbar-search-icon{left:14px!important;width:16px!important;height:16px!important;z-index:1!important;}
