/* Tennis Fund — Pro SaaS Financial Interface & Vector Icon Suite */
.tf-app {
  --bg: #f8fafc;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #15803d;
  --brand-hover: #166534;
  --brand-soft: #f0fdf4;
  --brand-line: #bbf7d0;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;
  --pink-bg: #fdf2f8;
  --pink-border: #fbcfe8;
  --pink-text: #9d174d;
  --blue-bg: #eff6ff;
  --blue-border: #bfdbfe;
  --blue-text: #1e40af;
  --gold-bg: #fef08a;
  --gold-border: #fde047;
  --gold-text: #854d0e;
  --radius-card: 16px;
  --radius-control: 10px;
  --shadow-card: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-soft: 0 4px 12px rgba(15, 23, 42, 0.05);
}

body.tf-canvas {
  margin: 0;
  padding: 0;
  background: #f1f5f9;
  min-height: 100vh;
  font-family: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
}

.tf-canvas-main { min-height: 100vh; }
.tf-app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}
.tf-app * { box-sizing: border-box; }

/* SVG Icons */
.tf-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Topbar */
.tf-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
}
.tf-brand-row { display: flex; align-items: center; gap: 14px; }
.tf-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  color: #166534;
}
.tf-brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(6, 78, 59, 0.2));
}
.tf-cycle-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 20px;
  font-size: 13px;
  color: var(--brand);
}
.tf-cycle-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}
.tf-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tf-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-control);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  transition: all .15s ease;
}
.tf-nav a:hover { background: var(--brand-soft); color: var(--brand); }
.tf-nav a.tf-active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.3);
}
.tf-nav a.tf-logout { border: 1px solid var(--line); color: var(--muted); }
.tf-nav a.tf-logout:hover { border-color: var(--danger-line); color: var(--danger); background: var(--danger-soft); }

/* Flash message */
.tf-flash-wrap { margin-bottom: 16px; }
.tf-flash {
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
}
.tf-flash-success { background: #dcfce7; border: 1px solid #86efac; color: #166534; }
.tf-flash-danger { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger); }
.tf-flash-info { background: #e0f2fe; border: 1px solid #bae6fd; color: #0369a1; }

/* Toolbar */
.tf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tf-cycle-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.tf-toolbar-icon { color: var(--muted); display: flex; align-items: center; }
.tf-cycle-select-wrap select {
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.tf-btn-group { display: flex; gap: 10px; }

/* Buttons */
.tf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
}
.tf-btn-primary { background: var(--brand); color: #fff; }
.tf-btn-primary:hover { background: var(--brand-hover); }
.tf-btn-secondary { background: #fff; border: 1px solid var(--line); color: var(--text); }
.tf-btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.tf-btn-sm { height: 32px; padding: 0 10px; font-size: 12px; gap: 4px; }
.tf-btn-block { width: 100%; height: 46px; font-size: 15px; }
.tf-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  color: #475569;
  transition: all .15s;
}
.tf-btn-icon:hover { background: #f1f5f9; color: var(--text); }
.tf-btn-del:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }

/* Metric Cards */
.tf-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.tf-metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.tf-metric-inflow { border-left: 5px solid #ec4899; }
.tf-metric-outflow { border-left: 5px solid #3b82f6; }
.tf-metric-balance { border-left: 5px solid #eab308; background: linear-gradient(135deg, #ffffff 0%, #fefce8 100%); }
.tf-metric-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tf-metric-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.tf-icon-wrap-pink { background: #fdf2f8; color: #db2777; border: 1px solid #fbcfe8; }
.tf-icon-wrap-blue { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.tf-icon-wrap-gold { background: #fef9c3; color: #ca8a04; border: 1px solid #fde047; }
.tf-metric-label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.tf-metric-val { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.tf-metric-sub { font-size: 13px; color: var(--muted); }
.tf-gold-glow { color: #854d0e; }

/* The Spreadsheet Section (Bảng_9 Match) */
.tf-sheet-section {
  margin-bottom: 30px;
}
.tf-sheet-container {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.tf-sheet-header-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: #14532d;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.tf-sheet-tab-icon { display: flex; align-items: center; }
.tf-sheet-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  divide-x: 1px solid #cbd5e1;
}
@media (max-width: 960px) {
  .tf-sheet-columns { grid-template-columns: 1fr; }
}
.tf-sheet-col-inflow { border-right: 1px solid #cbd5e1; }
.tf-col-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .3px;
}
.tf-bar-inflow { background: #fdf2f8; color: #831843; border-bottom: 2px solid #fbcfe8; }
.tf-bar-outflow { background: #eff6ff; color: #1e3a8a; border-bottom: 2px solid #bfdbfe; }
.tf-pill-badge {
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

/* Tables */
.tf-table-wrap { overflow-x: auto; }
.tf-sheet-table, .tf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.tf-sheet-table th, .tf-table th {
  background: #f8fafc;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid #e2e8f0;
}
.tf-sheet-table td, .tf-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.tf-sheet-table tr:hover, .tf-table tr:hover { background: #fafafa; }

/* The Excel Pink & Blue Columns */
.tf-th-pink { background: #fce7f3 !important; color: #831843 !important; text-align: right !important; }
.tf-cell-pink { background: #fdf2f8; text-align: right; color: #9d174d; }
.tf-th-blue { background: #dbeafe !important; color: #1e3a8a !important; text-align: right !important; }
.tf-cell-blue { background: #eff6ff; text-align: right; color: #1e40af; }
.tf-cell-stt { text-align: center; color: var(--muted); font-size: 12px; }
.tf-cell-name { font-size: 13.5px; }
.tf-cell-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tf-cell-note { color: #475569; font-size: 12px; }
.tf-row-initial-fund { background: #fffbeb !important; border-top: 2px dashed #fde047; }

/* Bottom Gold Summary Bar */
.tf-sheet-footer-bar {
  display: grid;
  grid-template-columns: 100px 1fr 1fr 1.2fr;
  background: #fde047;
  border-top: 2px solid #eab308;
  padding: 14px 16px;
  align-items: center;
  font-weight: 700;
  color: #713f12;
}
@media (max-width: 768px) {
  .tf-sheet-footer-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: left;
  }
}
.tf-foot-label { font-size: 16px; font-weight: 800; }
.tf-footer-cell { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.tf-foot-title { color: #854d0e; font-weight: 600; font-size: 13px; text-transform: uppercase; }
.tf-foot-amount { font-size: 16px; font-weight: 800; color: #1e293b; }
.tf-foot-highlight {
  background: #fff;
  padding: 4px 12px;
  border-radius: 8px;
  color: #15803d;
  font-size: 18px;
  border: 1px solid #ca8a04;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

/* Badges & Tags */
.tf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}
.tf-badge-green { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.tf-badge-gray { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.tf-badge-gold { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; margin-left: 6px; font-size: 10px; }
.tf-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* Card components */
.tf-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.tf-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.tf-card-header h2 { margin: 0; font-size: 17px; font-weight: 700; }
.tf-card-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  font-size: 14px;
  text-align: right;
}
.tf-empty-td { text-align: center; padding: 24px !important; color: var(--muted); }

/* Login screen */
.tf-login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}
.tf-login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  padding: 36px 30px;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
  text-align: center;
}
.tf-login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 14px rgba(6, 78, 59, 0.25));
}
.tf-login-header h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; color: #166534; }
.tf-login-sub { margin: 0 0 24px; font-size: 14px; color: var(--muted); }
.tf-input-group {
  position: relative;
  margin-bottom: 18px;
}
.tf-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  display: flex;
  align-items: center;
  pointer-events: none;
}
.tf-input-group input {
  width: 100%;
  height: 48px;
  padding: 0 16px 0 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
  transition: border .15s;
}
.tf-input-group input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15); }

/* Modals */
.tf-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tf-modal.show { display: flex; }
body.tf-modal-open { overflow: hidden; }
.tf-modal-dialog {
  background: #fff;
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  box-shadow: 0 20px 35px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: tfPop .2s ease-out;
}
@keyframes tfPop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.tf-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.tf-modal-header h3 { margin: 0; font-size: 17px; font-weight: 700; }
.tf-modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.tf-modal-body { padding: 20px; max-height: 75vh; overflow-y: auto; }
.tf-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid var(--line);
}
.tf-form-group { margin-bottom: 14px; text-align: left; }
.tf-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.tf-form-group input[type="text"],
.tf-form-group input[type="password"],
.tf-form-group input[type="number"],
.tf-form-group input[type="date"],
.tf-form-group select,
.tf-form-group textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  font-family: inherit;
}
.tf-form-group textarea { height: auto; padding: 10px 12px; }
.tf-form-group input:focus, .tf-form-group select:focus, .tf-form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.15);
}
.tf-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-req { color: var(--danger); font-weight: bold; }
.tf-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
