
:root{
  --bg:#f8f9fa;
  --card:#ffffff;
  --muted:#64748b;
  --muted-light:#94a3b8;
  --border:#e2e8f0;
  --border-light:#f1f5f9;
  --tab:#f8fafc;
  --primary:#3b82f6;
  --primary-hover:#2563eb;
  --primary-dark:#1d4ed8;
  --primary-light:#dbeafe;
  --success:#10b981;
  --success-light:#d1fae5;
  --danger:#ef4444;
  --danger-light:#fee2e2;
  --warning:#f59e0b;
  --warning-light:#fef3c7;
  --shadow:0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-lg:0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl:0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --radius:12px;
  --radius-lg:16px;
  --transition:all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tfir-saas{
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color:#1e293b;
  background: var(--bg);
  min-height: 100vh;
}
.tfir-headerbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  margin: 0 0 32px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-light);
}
.tfir-title{ 
  margin:0; 
  font-size:32px; 
  font-weight:700;
  letter-spacing:-.02em;
  color:#0f172a;
}
.tfir-sub{ 
  color:var(--muted); 
  margin-top:8px; 
  font-size:14px;
  font-weight:500;
}
.tfir-pill{
  border:1px solid var(--border);
  background:var(--card);
  padding:10px 16px;
  border-radius:999px;
  font-size:13px;
  font-weight:600;
  color:#475569;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tfir-pill::before{
  content: '👤';
  font-size: 16px;
}
.tfir-tabs{
  display:flex;
  gap:8px;
  background: var(--card);
  margin-bottom: 32px;
  padding: 6px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.tfir-tab{
  flex:1;
  border:none;
  cursor:pointer;
  padding:14px 20px;
  border-radius: 10px;
  background: transparent;
  color:#64748b;
  font-weight:600;
  font-size: 15px;
  transition: var(--transition);
  position: relative;
}
.tfir-tab:hover{
  background: var(--tab);
  color:#334155;
}
.tfir-tab.active{
  background: var(--primary);
  color:#fff;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}
.tfir-tab.active::after{
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: var(--primary);
  border-radius: 999px;
  display: none;
}
.tfir-panel{ display:none; }
.tfir-panel.active{ 
  display:block;
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tfir-grid{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:20px;
  align-items: start;
}
@media(max-width: 1200px){
  .tfir-grid{ grid-template-columns: 1fr 1fr; }
}
@media(max-width: 768px){
  .tfir-grid{ grid-template-columns: 1fr; }
}
.tfir-grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:20px;
}
@media(max-width: 980px){
  .tfir-grid-2{ grid-template-columns: 1fr; }
}
.tfir-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  height: 100%;
}
.tfir-card:hover{
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.tfir-card-title{
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 20px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}
.tfir-card-title::before{
  content: '';
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 999px;
}
.tfir-label{
  display:block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin: 16px 0 8px;
  letter-spacing: -0.01em;
}
.tfir-label-sm{
  display:block;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
  color: #475569;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
input, select, textarea{
  width:100%;
  padding:12px 16px;
  border:2px solid var(--border);
  border-radius: 10px;
  background:#ffffff;
  outline:none;
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  transition: var(--transition);
  font-family: inherit;
}
input:focus, select:focus, textarea:focus{
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-light);
}
input::placeholder, textarea::placeholder{
  color: #94a3b8;
  font-weight: 400;
}
input:hover, select:hover, textarea:hover{
  border-color: #cbd5e1;
}
textarea{ 
  min-height: 120px; 
  resize: both;
  line-height: 1.6;
}
select{
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 20px;
  padding-right: 40px;
  appearance: none;
}

.tfir-actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}
.tfir-btn{
  background: var(--primary);
  border:none;
  color:#fff;
  padding: 12px 24px;
  border-radius: 10px;
  cursor:pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}
.tfir-btn:hover{ 
  background: var(--primary-hover);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
  transform: translateY(-1px);
}
.tfir-btn:active{
  transform: translateY(0);
}
.tfir-btn-ghost{
  background: #ffffff;
  color:#475569;
  border: 2px solid var(--border);
}
.tfir-btn-ghost:hover{ 
  background:#f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.tfir-btn-success{
  background: var(--success);
  color: #ffffff;
}
.tfir-btn-success:hover{
  background: #059669;
  box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.tfir-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.tfir-tag{
  border:2px solid var(--border);
  background:#f8fafc;
  color:#475569;
  padding: 8px 14px;
  border-radius: 8px;
  cursor:pointer;
  font-weight: 600;
  font-size: 12px;
  transition: var(--transition);
  letter-spacing: -0.01em;
}
.tfir-tag:hover{ 
  background:var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px -1px rgba(59, 130, 246, 0.2);
}

.tfir-list{ margin-top: 10px; }
.tfir-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.tfir-row:last-child{ border-bottom:none; }
.tfir-row-title{ font-weight: 900; }
.tfir-row-sub{ color: var(--muted); font-size: 13px; margin-top: 4px; }
.tfir-row-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.tfir-mini{
  background: var(--primary);
  border:none;
  color:#fff;
  padding: 8px 14px;
  border-radius: 8px;
  cursor:pointer;
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  letter-spacing: -0.01em;
}
.tfir-mini.danger{ 
  background: var(--danger);
}
.tfir-mini:hover{ 
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px -1px rgba(0,0,0,0.2);
}

.tfir-badge{
  display:inline-block;
  margin-left:8px;
  padding: 4px 10px;
  border-radius:8px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
  vertical-align: middle;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.tfir-badge.gray{
  background:#f1f5f9;
  color:#64748b;
}
.tfir-empty{
  color: var(--muted);
  padding: 32px 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
}
.tfir-empty::before{
  content: '📭';
  display: block;
  font-size: 48px;
  margin-bottom: 12px;
}
.tfir-hint{
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  padding: 12px;
  background: var(--tab);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}
.tfir-hint code{
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  color: var(--primary-dark);
}
.tfir-inline{
  display:flex;
  gap:10px;
}
.tfir-inline input{ flex:1; }

.tfir-hidden{ display:none; }

.tfir-form-row{
  display:grid;
  grid-template-columns: 140px 160px 1fr auto;
  gap:10px;
  margin-top: 10px;
}
@media(max-width: 980px){
  .tfir-form-row{ grid-template-columns: 1fr; }
}
.tfir-input-sm{
  width:100%;
  padding: 10px;
  border:1px solid var(--border);
  border-radius: 12px;
  background:#f9fafb;
}

.tfir-mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
.tfir-log{
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background:#fff;
  margin-bottom: 10px;
}
.tfir-log-top{ display:flex; justify-content:space-between; align-items:center; gap:10px; }
.tfir-log-meta{ color:var(--muted); font-size: 12px; }
.tfir-log-body{ margin-top: 8px; color:#111827; font-size:12px; white-space: pre-wrap; word-break: break-word; }

/* === TABLE VIEW PATCH === */
.tfir-table-controls-wrapper{
  margin-bottom: 14px;
}
.tfir-table-controls{
  display:flex;
  gap:10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.tfir-table-search{
  flex:1;
  min-width: 200px;
  padding: 10px 12px;
  border:1px solid var(--border);
  border-radius: 12px;
  background:#f9fafb;
  outline:none;
}
.tfir-table-filter{
  padding: 10px 12px;
  border:1px solid var(--border);
  border-radius: 12px;
  background:#f9fafb;
  outline:none;
  min-width: 160px;
}
.tfir-table-wrapper{
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.tfir-table{
  width:100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tfir-table thead{
  background: #f9fafb;
  border-bottom: 2px solid var(--border);
}
.tfir-table th{
  padding: 12px 14px;
  text-align: left;
  font-weight: 800;
  color: #111827;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tfir-table th:hover{
  background: #f3f4f6;
}
.tfir-table th.sortable::after{
  content: ' ↕';
  opacity: 0.3;
  font-size: 11px;
}
.tfir-table th.sort-asc::after{
  content: ' ↑';
  opacity: 1;
  color: var(--primary);
}
.tfir-table th.sort-desc::after{
  content: ' ↓';
  opacity: 1;
  color: var(--primary);
}
.tfir-table tbody tr{
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.tfir-table tbody tr:hover{
  background: #f9fafb;
}
.tfir-table tbody tr:last-child{
  border-bottom: none;
}
.tfir-table td{
  padding: 12px 14px;
  vertical-align: middle;
}
.tfir-table-actions{
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}
.tfir-table-btn{
  background: var(--primary);
  border:none;
  color:#fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor:pointer;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}
.tfir-table-btn:hover{ filter: brightness(.95); }
.tfir-table-btn.danger{ background: var(--danger); }

.tfir-countdown{
  font-weight: 800;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
}
.tfir-countdown.red{
  background: #fee2e2;
  color: #991b1b;
}
.tfir-countdown.orange{
  background: #ffedd5;
  color: #9a3412;
}
.tfir-countdown.green{
  background: #dcfce7;
  color: #166534;
}
.tfir-countdown.gray{
  background: #f3f4f6;
  color: #4b5563;
}

/* Date Range Filter */
.tfir-date-range-container{
  margin-top: 16px;
  padding: 20px;
  background: #f8f9fa;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
}

.tfir-date-range{
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: space-between;
}

.tfir-date-range-inputs{
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  flex: 1;
}

.tfir-date-input-wrapper{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tfir-date-input-wrapper label{
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.tfir-date-input{
  padding: 12px 16px;
  min-width: 180px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.tfir-date-input:hover{
  border-color: #94a3b8;
}

.tfir-date-input:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.tfir-date-separator{
  color: #64748b;
  font-size: 18px;
  font-weight: 600;
  padding: 0 4px;
  margin-bottom: 12px;
}

.tfir-date-actions{
  display: flex;
  gap: 8px;
  align-items: center;
}

.tfir-date-actions .tfir-btn{
  padding: 12px 20px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Remarks Toggle Button */
.tfir-remarks-toggle{
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.tfir-remarks-toggle:hover{
  background: var(--primary-light);
  transform: scale(1.1);
}

/* Remarks Detail Row */
.tfir-remarks-row td{
  border-top: none !important;
}

/* Pagination */
.tfir-pagination{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.tfir-pagination-info{
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.tfir-pagination-controls{
  display: flex;
  gap: 6px;
  align-items: center;
}
.tfir-pagination-btn{
  background: #fff;
  border: 1px solid var(--border);
  color: #111827;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  transition: all 0.15s;
}
.tfir-pagination-btn:hover:not(:disabled){
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tfir-pagination-btn:disabled{
  opacity: 0.4;
  cursor: not-allowed;
}
.tfir-pagination-btn.active{
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tfir-pagination-pages{
  display: flex;
  gap: 4px;
}
.tfir-page-size{
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Activity Logs Styling */
.tfir-logs-list{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 0;
}
.tfir-log-entry{
  display: flex;
  gap: 12px;
  padding: 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.2s;
}
.tfir-log-entry:hover{
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}
.tfir-log-icon{
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}
.tfir-log-content{
  flex: 1;
  min-width: 0;
}
.tfir-log-message{
  font-weight: 600;
  color: #111827;
  font-size: 14px;
  margin-bottom: 4px;
}
.tfir-log-details{
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.5;
}
.tfir-log-time{
  font-size: 12px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* === END TABLE VIEW PATCH === */

/* === MODAL STYLES === */
.tfir-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: tfirFadeIn 0.2s ease-out;
}

@keyframes tfirFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tfir-modal-content {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: tfirSlideIn 0.3s ease-out;
}

@keyframes tfirSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tfir-modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tfir-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
}

.tfir-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: var(--transition);
}

.tfir-modal-close:hover {
  background: #f1f5f9;
  color: #64748b;
}

.tfir-modal-body {
  padding: 24px;
}

.tfir-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  border-radius: 0 0 var(--radius) var(--radius);
}

.tfir-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  transition: var(--transition);
  margin-bottom: 16px;
}

.tfir-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.tfir-input::placeholder {
  color: #94a3b8;
}

textarea.tfir-input {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}
/* === END MODAL STYLES === */

/* Reschedule banner animation */
@keyframes tfirSlideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

