/* =========================================================================
 * T-Cashflow V3.74 — CSS (Office 365 style: clean, blue, white, gray)
 * ========================================================================= */

/* ---------- Wrapper ---------- */
.tcashflow-theme .tcf-wrap {
  background: #fafbfc;
  min-height: 100%;
  padding: 0;
  font-family: 'IBM Plex Sans Thai', 'Segoe UI', sans-serif;
  color: #2d2c2a;
}

/* ---------- Header ---------- */
.tcf-header {
  background: linear-gradient(180deg, #F3F8FD 0%, #EBF4FC 100%);
  padding: 14px 24px;
  border-bottom: 1px solid #d9e6f2;
}
.tcf-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tcf-icon {
  font-size: 22px;
  font-style: normal;
}
.tcf-title {
  font-size: 18px;
  font-weight: 600;
  color: #0C447C;
}
.tcf-subtitle {
  font-size: 14px;
  color: #5F5E5A;
}
.tcf-version {
  margin-left: auto;
  font-size: 11px;
  color: #888;
  background: white;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid #e0e0e0;
}

/* ---------- Tabs ---------- */
.tcf-tabs {
  background: white;
  border-bottom: 1px solid #e8e8e8;
  padding: 0 16px;
  display: flex;
  gap: 4px;
}
.tcf-tab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  color: #5F5E5A;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.tcf-tab:hover { color: #185FA5; background: #f5f9fd; }
.tcf-tab.active {
  color: #185FA5;
  border-bottom-color: #185FA5;
  font-weight: 500;
}
.tcf-tab-count {
  color: #888;
  font-weight: 400;
  font-size: 12px;
}

/* ---------- Body ---------- */
.tcf-body { padding: 0 16px 24px; }

/* ---------- Toolbar ---------- */
.tcf-toolbar {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 12px 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tcf-search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
  display: flex;
  align-items: center;
}
.tcf-search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  color: #888;
  pointer-events: none;
}
.tcf-search-box input {
  width: 100%;
  padding: 6px 10px 6px 32px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.tcf-search-box input:focus { border-color: #185FA5; }

.tcf-month, .tcf-select-sm {
  padding: 6px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  outline: none;
}
.tcf-month:focus, .tcf-select-sm:focus { border-color: #185FA5; }

.tcf-toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.tcf-btn, .tcf-btn-primary {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid #d0d7de;
  background: white;
  color: #2d2c2a;
  transition: all 0.15s;
  font-family: inherit;
}
.tcf-btn:hover { background: #f3f4f6; }
.tcf-btn-primary {
  background: #185FA5;
  color: white;
  border-color: #185FA5;
  font-weight: 500;
}
.tcf-btn-primary:hover { background: #0C447C; }

/* ---------- Summary ---------- */
.tcf-summary {
  background: #f6f8fa;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 12px;
  color: #5F5E5A;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tcf-summary b { color: #2d2c2a; font-weight: 600; }
.tcf-sep { color: #c0c0c0; }

/* ---------- Table ---------- */
.tcf-table-wrap {
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  overflow-x: auto;
}
.tcf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 1400px;
}
.tcf-table thead {
  background: #F3F8FD;
  position: sticky;
  top: 0;
  z-index: 1;
}
.tcf-table th {
  padding: 9px 8px;
  text-align: left;
  font-weight: 500;
  color: #0C447C;
  border-bottom: 1px solid #d9e6f2;
  white-space: nowrap;
}
.tcf-table td {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.tcf-table tbody tr:hover { background: #fafbfc; }

/* Column widths & alignment */
.tcf-c-elig { width: 36px; text-align: center; }
.tcf-c-seq { width: 40px; color: #888; }
.tcf-c-date { width: 80px; white-space: nowrap; }
.tcf-c-ta { width: 70px; }
.tcf-c-iv { width: 130px; font-family: 'Segoe UI', monospace; font-size: 11.5px; }
.tcf-c-cust { min-width: 180px; }
.tcf-c-method { width: 130px; }
.tcf-c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tcf-c-wt { width: 110px; }
.tcf-c-act { width: 70px; text-align: center; white-space: nowrap; }
.tcf-rcv { font-weight: 500; color: #0F6E56; }
.tcf-com { font-weight: 500; color: #185FA5; }

.tcf-cust-name { font-size: 12.5px; }
.tcf-cust-sub { font-size: 11px; color: #888; margin-top: 2px; }

/* Badges */
.tcf-badge {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 50%;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}
.tcf-badge.ok     { background: #d4f4e8; color: #0F6E56; }
.tcf-badge.warn   { background: #fef3d4; color: #854F0B; }
.tcf-badge.danger { background: #fce8e8; color: #A32D2D; }
.tcf-badge.muted  { background: #f0f0f0; color: #888; }

/* Payment pills */
.tcf-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}
.tcf-pill.cash     { background: #f1efe8; color: #444441; }
.tcf-pill.transfer { background: #e1f5ee; color: #0F6E56; }
.tcf-pill.cheque   { background: #faeeda; color: #854F0B; }
.tcf-pill.muted    { background: #f5f5f5; color: #aaa; }
.tcf-pill.wt-policy    { background: #e6f1fb; color: #0C447C; }
.tcf-pill.wt-direct    { background: #eaf3de; color: #3B6D11; }
.tcf-pill.wt-outsource { background: #fbeaf0; color: #993556; }

.tcf-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  font-size: 13px;
  margin: 0 1px;
}
.tcf-icon-btn:hover { background: #f0f4f8; border-color: #d0d7de; }

/* ---------- Empty / Loading ---------- */
.tcf-empty, .tcf-loading, .tcf-deny {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  color: #5F5E5A;
}
.tcf-empty-icon { font-size: 48px; margin-bottom: 12px; }
.tcf-empty-title { font-size: 16px; font-weight: 500; color: #2d2c2a; margin-bottom: 4px; }
.tcf-empty-sub { font-size: 13px; color: #888; }
.tcf-loading { font-size: 14px; }
.tcf-deny { color: #A32D2D; font-size: 15px; }

/* ---------- Placeholder tabs ---------- */
.tcf-placeholder {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border: 1px dashed #d0d7de;
  border-radius: 8px;
  margin-top: 16px;
}
.tcf-placeholder-icon { font-size: 56px; margin-bottom: 16px; }
.tcf-placeholder-title { font-size: 18px; font-weight: 500; color: #185FA5; margin-bottom: 12px; }
.tcf-placeholder-sub {
  font-size: 13px;
  color: #5F5E5A;
  line-height: 1.8;
  max-width: 500px;
  margin: 0 auto 20px;
  text-align: left;
}
.tcf-placeholder-tag {
  display: inline-block;
  background: #fef3d4;
  color: #854F0B;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 12px;
}

/* ---------- Modal ---------- */
.tcf-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tcf-modal {
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.tcf-modal-header {
  padding: 14px 20px;
  background: #F3F8FD;
  border-bottom: 1px solid #d9e6f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  color: #0C447C;
  font-size: 15px;
  border-radius: 8px 8px 0 0;
}
.tcf-modal-close {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #888;
  padding: 4px 8px;
}
.tcf-modal-close:hover { color: #A32D2D; }
.tcf-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.tcf-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: #fafbfc;
  border-radius: 0 0 8px 8px;
}

.tcf-form-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed #e8e8e8;
}
.tcf-form-section:last-child { border-bottom: none; }
.tcf-section-title {
  font-size: 13px;
  font-weight: 500;
  color: #185FA5;
  margin-bottom: 10px;
}
.tcf-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 10px;
}
.tcf-span2 { grid-column: span 2; }
.tcf-span3 { grid-column: span 3; }
.tcf-field { display: flex; flex-direction: column; }
.tcf-field label {
  font-size: 11px;
  color: #5F5E5A;
  margin-bottom: 3px;
  font-weight: 500;
}
.tcf-field input,
.tcf-field select,
.tcf-field textarea {
  padding: 6px 10px;
  border: 1px solid #d0d7de;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: white;
}
.tcf-field input:focus,
.tcf-field select:focus,
.tcf-field textarea:focus { border-color: #185FA5; }
.tcf-field textarea { resize: vertical; min-height: 50px; }

.tcf-com-note {
  margin-top: 8px;
  font-size: 11px;
  color: #5F5E5A;
  background: #fff8e1;
  padding: 6px 10px;
  border-radius: 4px;
  border-left: 3px solid #EF9F27;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .tcf-form-grid { grid-template-columns: 1fr 1fr; }
  .tcf-span2, .tcf-span3 { grid-column: span 2; }
  .tcf-toolbar { gap: 6px; }
  .tcf-search-box { width: 100%; min-width: 0; }
}
