/* ===========================================
   FishBroker Design System
   =========================================== */

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 16px; }
}

:root {
  --fb-teal: #0d9488;
  --fb-teal-hover: #0f766e;
  --fb-teal-subtle: #ccfbf1;
  --fb-bg: #f4f6f9;
  --fb-card-radius: 12px;
  --fb-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.03);
  --fb-card-bg: #fff;
  --fb-border: #e5e9ef;
  --fb-text: #1e293b;
  --fb-text-muted: #64748b;
  --fb-text-light: #94a3b8;
}

body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  margin-bottom: 60px;
  background-color: var(--fb-bg);
  color: var(--fb-text);
}

/* ===========================================
   Navbar
   =========================================== */
.navbar.fb-navbar {
  background: #fff;
  border-bottom: 1px solid var(--fb-border);
  padding: 0;
  min-height: 56px;
}

.fb-navbar .navbar-brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--fb-text) !important;
  padding: 0.75rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.fb-navbar .navbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--fb-teal), var(--fb-teal-hover));
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.9rem;
}

.fb-navbar .navbar-nav {
  gap: 0.15rem;
}

.fb-navbar .nav-link {
  color: var(--fb-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.fb-navbar .nav-link:hover {
  color: var(--fb-teal);
  background: rgba(13, 148, 136, 0.06);
}

.fb-navbar .nav-link.active {
  color: var(--fb-teal);
  background: rgba(13, 148, 136, 0.08);
  font-weight: 600;
}

.fb-navbar .nav-link i {
  font-size: 1rem;
  vertical-align: -1px;
  margin-left: 0.3rem;
}

/* ===========================================
   Focus States
   =========================================== */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(13, 148, 136, 0.35);
  border-color: var(--fb-teal);
}

/* ===========================================
   Page Shell
   =========================================== */
.page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  gap: 0.75rem;
}

.page-header h3,
.page-header .page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fb-text);
  margin: 0;
}

.page-header .page-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ===========================================
   Cards (unified)
   =========================================== */
.fb-card {
  background: var(--fb-card-bg);
  border-radius: var(--fb-card-radius);
  border: 1px solid var(--fb-border);
  box-shadow: var(--fb-card-shadow);
  padding: 1.25rem;
}

.fb-card-header {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fb-text);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

/* ===========================================
   Summary / KPI Cards
   =========================================== */
.kpi-card {
  background: var(--fb-card-bg);
  border-radius: var(--fb-card-radius);
  padding: 1.25rem;
  box-shadow: var(--fb-card-shadow);
  border: 1px solid var(--fb-border);
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.kpi-card-sales {
  background: linear-gradient(145deg, #f0fdfa 0%, #ffffff 60%);
  border-color: #99f6e4;
}

.kpi-card-balance {
  border-right: 3px solid var(--fb-teal);
}

.kpi-card-treasury {
  border-right: 3px solid #eab308;
}

.kpi-card-secondary {
  background: #f8fafc;
  border-color: #e2e8f0;
  box-shadow: none;
}

.kpi-card-secondary .kpi-value {
  font-size: 1.2rem;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--fb-text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--fb-text);
  letter-spacing: -0.02em;
}

.kpi-value-lg {
  font-size: 2rem;
  font-weight: 800;
  color: var(--fb-teal);
  letter-spacing: -0.03em;
}

/* ===========================================
   Buttons
   =========================================== */
.btn-teal {
  background: var(--fb-teal);
  color: #fff;
  border: none;
  font-weight: 600;
}

.btn-teal:hover {
  background: var(--fb-teal-hover);
  color: #fff;
}

.btn-outline-teal {
  color: var(--fb-teal);
  border-color: var(--fb-teal);
  font-weight: 500;
}

.btn-outline-teal:hover {
  background: var(--fb-teal);
  color: #fff;
}

/* ===========================================
   Teal Utilities
   =========================================== */
.bg-teal { background-color: var(--fb-teal) !important; }
.text-teal { color: var(--fb-teal) !important; }
.bg-teal-subtle { background-color: var(--fb-teal-subtle) !important; }

/* ===========================================
   Tables (unified)
   =========================================== */
.fb-table {
  width: 100%;
  margin-bottom: 0;
  border-color: transparent;
}

.fb-table thead th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  color: var(--fb-text-muted);
  font-size: 0.82rem;
  padding: 0.65rem 0.75rem;
  white-space: nowrap;
}

.fb-table tbody td {
  border-bottom: 1px solid #f1f5f9;
  padding: 0.75rem;
  vertical-align: middle;
  font-size: 0.9rem;
}

.fb-table tbody tr:last-child td {
  border-bottom: none;
}

.fb-table tbody tr:hover {
  background: #f8fafc;
}

.fb-table tfoot td {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  font-weight: 700;
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
}

/* Legacy table refinement */
.table th { white-space: nowrap; }

/* ===========================================
   Forms (unified)
   =========================================== */
.fb-form .form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fb-text);
  margin-bottom: 0.35rem;
}

.fb-form .form-control,
.fb-form .form-select {
  border-radius: 8px;
  border-color: #d1d5db;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
}

.fb-form .form-control:focus,
.fb-form .form-select:focus {
  border-color: var(--fb-teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.fb-form .text-danger {
  font-size: 0.8rem;
}

/* ===========================================
   Filter Bar
   =========================================== */
.filter-bar {
  background: var(--fb-card-bg);
  border: 1px solid var(--fb-border);
  border-radius: var(--fb-card-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.filter-bar .form-label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--fb-text-muted);
  margin-bottom: 0.3rem;
}

.filter-bar .form-control,
.filter-bar .form-select {
  border-radius: 8px;
  border-color: #d1d5db;
  font-size: 0.88rem;
  padding: 0.45rem 0.7rem;
}

/* ===========================================
   Badges & Status
   =========================================== */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.status-open { background: #d1fae5; color: #059669; }
.status-closed { background: #e2e8f0; color: #475569; }

.entry-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-sale { background: #dbeafe; color: #1d4ed8; }
.badge-collection { background: #d1fae5; color: #059669; }
.badge-payment { background: #fef3c7; color: #b45309; }
.badge-expense { background: #fee2e2; color: #dc2626; }
.badge-adjustment { background: #e2e8f0; color: #475569; }

/* ===========================================
   Empty States
   =========================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
}

.empty-state .empty-text {
  color: var(--fb-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* ===========================================
   Section Titles
   =========================================== */
.section-title {
  font-weight: 700;
  color: var(--fb-text);
  font-size: 0.95rem;
}

.section-title i {
  margin-left: 0.35rem;
  color: var(--fb-text-light);
}

/* ===========================================
   Quick Actions (Dashboard)
   =========================================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.6rem;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: #475569;
  padding: 1rem 0.5rem;
  border-radius: var(--fb-card-radius);
  transition: all 0.15s;
  font-size: 0.8rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--fb-border);
}

.quick-action:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  color: var(--fb-teal);
  transform: translateY(-2px);
  border-color: var(--fb-teal-subtle);
}

.quick-action-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

/* ===========================================
   Dashboard Sidebar
   =========================================== */
.dashboard-sidebar {
  background: #fff;
  border-radius: var(--fb-card-radius);
  padding: 1.5rem;
  box-shadow: var(--fb-card-shadow);
  border: 1px solid var(--fb-border);
  position: sticky;
  top: 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--fb-teal) 0%, var(--fb-teal-hover) 100%);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--fb-text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  color: #475569;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: #f0fdfa;
  color: var(--fb-teal);
}

.sidebar-link i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  color: var(--fb-text-light);
}

.sidebar-link:hover i {
  color: var(--fb-teal);
}

/* ===========================================
   Dashboard Activity Card
   =========================================== */
.dashboard-card {
  background: var(--fb-card-bg);
  border-radius: var(--fb-card-radius);
  padding: 1.25rem;
  box-shadow: var(--fb-card-shadow);
  border: 1px solid var(--fb-border);
}

.dashboard-card .table {
  border-color: transparent;
  margin-bottom: 0;
}

.dashboard-card .table thead th {
  border-bottom: 2px solid #e2e8f0;
  font-weight: 600;
  color: var(--fb-text-muted);
  font-size: 0.8rem;
  padding: 0.6rem 0.75rem;
}

.dashboard-card .table tbody td {
  border-bottom: 1px solid #f1f5f9;
  padding: 0.8rem 0.75rem;
  vertical-align: middle;
}

.dashboard-card .table tbody tr:last-child td {
  border-bottom: none;
}

/* ===========================================
   Summary Cards (used across DayBox, DayClosing, Treasury, Reports)
   =========================================== */
.summary-card {
  background: var(--fb-card-bg);
  border-radius: var(--fb-card-radius);
  border: 1px solid var(--fb-border);
  box-shadow: var(--fb-card-shadow);
  padding: 1.25rem;
  text-align: center;
}

.summary-card .summary-label {
  font-size: 0.8rem;
  color: var(--fb-text-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.summary-card .summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fb-text);
}

.summary-card.summary-primary {
  border-bottom: 3px solid var(--fb-teal);
}

.summary-card.summary-primary .summary-value {
  color: var(--fb-teal);
}

/* Report summary block */
.report-summary {
  background: var(--fb-card-bg);
  border-radius: var(--fb-card-radius);
  border: 1px solid var(--fb-border);
  box-shadow: var(--fb-card-shadow);
  padding: 1.25rem;
}

.report-summary .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.report-summary .summary-row + .summary-row {
  border-top: 1px solid #f1f5f9;
}

.report-summary .summary-row strong {
  font-size: 0.88rem;
  color: var(--fb-text);
}

.report-summary .summary-row span {
  font-size: 1rem;
  font-weight: 700;
}

/* ===========================================
   Footer
   =========================================== */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50px;
  line-height: 50px;
  font-size: 0.82rem;
  color: var(--fb-text-light);
}

/* ===========================================
   Print
   =========================================== */
@media print {
  .no-print, .navbar, .footer, .filter-bar { display: none !important; }
  .print-header { display: block !important; }
  body { margin: 0; padding: 0; background: #fff; }
  .fb-card, .card, .summary-card, .report-summary, .kpi-card {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
  }
  .table, .fb-table { border-color: #ccc !important; font-size: 0.85rem; }
  .card, .table, .fb-table { page-break-inside: avoid; }
}