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

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

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

:root {
  --fb-teal: #003fb8;
  --fb-teal-hover: #00349a;
  --fb-teal-subtle: #dce1ff;
  --fb-bg: #f9f9f9;
  --fb-card-radius: 0;
  --fb-card-shadow: none;
  --fb-card-bg: #fff;
  --fb-border: #c3c5d8;
  --fb-text: #1a1c1c;
  --fb-text-muted: #434655;
  --fb-text-light: #737687;
  --fb-surface: #f9f9f9;
  --fb-surface-lowest: #ffffff;
  --fb-surface-low: #f3f3f3;
  --fb-surface-container: #eeeeee;
  --fb-surface-high: #e8e8e8;
  --fb-surface-highest: #e2e2e2;
  --fb-sidebar-width: 16rem;
  --fb-topbar-height: 3.5rem;
}

body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  margin-bottom: 0;
  background-color: var(--fb-bg);
  color: var(--fb-text);
}

a {
  color: inherit;
}

.material-symbols-outlined {
  direction: ltr;
  display: inline-flex;
  font-size: 24px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
  vertical-align: middle;
}

/* ===========================================
   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;
}

.fb-navbar .dropdown-menu {
  border-radius: 10px;
  border-color: var(--fb-border);
  box-shadow: var(--fb-card-shadow);
  min-width: 220px;
}

.fb-navbar .dropdown-item {
  font-size: 0.88rem;
  padding: 0.55rem 0.85rem;
}

.fb-navbar .dropdown-item:hover,
.fb-navbar .dropdown-item:focus {
  background: rgba(13, 148, 136, 0.08);
  color: var(--fb-teal);
}

/* ===========================================
   App Shell
   =========================================== */
.fb-app-shell {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--fb-bg);
}

.app-topbar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 1050;
  height: var(--fb-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: 1rem;
  background: var(--fb-surface);
  border-bottom: 1px solid var(--fb-border);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  color: var(--fb-text);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-title:hover {
  color: var(--fb-text);
}

.topbar-search {
  position: relative;
}

.topbar-search .material-symbols-outlined {
  position: absolute;
  right: 0.5rem;
  inset-block-start: 50%;
  color: var(--fb-text-muted);
  font-size: 18px;
  transform: translateY(-50%);
}

.topbar-search input {
  width: 16rem;
  height: 2rem;
  border: 0;
  border-bottom: 1px solid var(--fb-border);
  border-radius: 0;
  background: var(--fb-surface-container);
  color: var(--fb-text);
  padding: 0 2rem 0 0.75rem;
  outline: 0;
}

.topbar-search input:focus {
  border-color: var(--fb-teal);
}

.topbar-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fb-text-muted);
  background: transparent;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-icon-btn:hover {
  color: var(--fb-text);
  background: var(--fb-surface-container);
}

.user-avatar {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--fb-border);
  border-radius: 50%;
  background: var(--fb-surface-lowest);
  color: var(--fb-teal);
  font-weight: 700;
}

.app-sidebar {
  position: fixed;
  inset-block: 0;
  right: 0;
  z-index: 1040;
  width: var(--fb-sidebar-width);
  padding-block-start: var(--fb-topbar-height);
  flex-direction: column;
  background: var(--fb-surface-container);
  border-left: 1px solid var(--fb-border);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  padding-block: 1rem;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border-right: 4px solid transparent;
  color: var(--fb-text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.sidebar-link.active {
  color: var(--fb-teal);
  border-right-color: var(--fb-teal);
  background: var(--fb-surface-highest);
  font-weight: 700;
}

.sidebar-icon {
  margin-inline-start: 0.25rem;
}

.app-main {
  min-height: calc(100vh - var(--fb-topbar-height));
  padding: 1.5rem;
  padding-block-start: calc(var(--fb-topbar-height) + 1.5rem);
  background: var(--fb-bg);
}

.app-footer {
  position: relative;
  z-index: 10;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--fb-surface-low);
  border-top: 1px solid var(--fb-border);
  color: var(--fb-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.mobile-nav {
  background: var(--fb-surface-container);
}

.mobile-nav .offcanvas-header {
  border-bottom: 1px solid var(--fb-border);
}

@media (min-width: 768px) {
  .app-main {
    margin-right: var(--fb-sidebar-width);
    padding: 1.5rem;
    padding-block-start: calc(var(--fb-topbar-height) + 1.5rem);
  }

  .app-footer {
    padding-right: calc(var(--fb-sidebar-width) + 1rem);
  }
}

@media (max-width: 575.98px) {
  .app-topbar {
    gap: 0.5rem;
    padding-inline: 0.75rem;
  }

  .topbar-title {
    max-width: 11rem;
    overflow: hidden;
    font-size: 0.98rem;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    gap: 0.25rem;
  }
}

/* ===========================================
   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.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-trip       { background: rgba(15, 82, 186, 0.1);  color: #0f52ba; border-color: rgba(15, 82, 186, 0.2); }
.badge-sale       { background: rgba(34, 139, 34, 0.1);  color: #228b22; border-color: rgba(34, 139, 34, 0.2); }
.badge-collection { background: rgba(60, 179, 113, 0.1); color: #3cb371; border-color: rgba(60, 179, 113, 0.2); }
.badge-payment    { background: rgba(220, 20, 60, 0.1);  color: #dc143c; border-color: rgba(220, 20, 60, 0.2); }
.badge-gas        { background: rgba(255, 140, 0, 0.1);  color: #ff8c00; border-color: rgba(255, 140, 0, 0.2); }
.badge-gas-pay    { background: rgba(178, 34, 34, 0.1);  color: #b22222; border-color: rgba(178, 34, 34, 0.2); }
.badge-expense    { background: rgba(139, 0, 0, 0.1);    color: #8b0000; border-color: rgba(139, 0, 0, 0.2); }
.badge-adjustment { background: rgba(75, 0, 130, 0.1);   color: #4b0082; border-color: rgba(75, 0, 130, 0.2); }

/* ===========================================
   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);
}

/* ===========================================
   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;
}

/* ===========================================
   Home Dashboard
   =========================================== */
.home-dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.home-hero {
  padding-block-end: 1rem;
  border-bottom: 1px solid var(--fb-surface-highest);
}

.home-hero h1 {
  margin: 0 0 0.5rem;
  color: var(--fb-text);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.25;
}

.home-hero p {
  margin: 0;
  color: var(--fb-text-muted);
  font-size: 1rem;
  font-weight: 500;
}

.action-section,
.quick-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.home-section-title {
  margin: 0;
  padding-block-end: 0.5rem;
  border-bottom: 1px solid var(--fb-surface-highest);
  color: var(--fb-text);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}

.action-card {
  position: relative;
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid var(--fb-border);
  background: var(--fb-surface-lowest);
  color: var(--fb-text);
  text-align: right;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.action-card:hover {
  color: var(--fb-text);
  border-color: var(--fb-teal);
  background: var(--fb-surface-container);
}

.action-watermark {
  position: absolute;
  left: -1.5rem;
  right: auto;
  bottom: -1.75rem;
  color: var(--fb-text);
  font-size: 7rem;
  opacity: 0.035;
  pointer-events: none;
}

.action-icon {
  width: 3rem;
  height: 3rem;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  margin-block-end: auto;
  border: 1px solid rgba(0, 63, 184, 0.2);
  background: rgba(0, 63, 184, 0.1);
  color: var(--fb-teal);
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.action-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  width: 100%;
  text-align: right;
}

.action-content strong {
  color: var(--fb-text);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  transition: color 0.15s ease;
}

.action-card:hover .action-content strong {
  color: var(--fb-teal);
}

.action-content span {
  color: var(--fb-text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.activity-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--fb-border);
  background: var(--fb-surface);
}

.activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--fb-surface-highest);
}

.activity-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--fb-text);
  font-size: 1.25rem;
  font-weight: 600;
}

.activity-header h2 .material-symbols-outlined {
  color: var(--fb-teal);
}

.activity-header a {
  color: var(--fb-teal);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
}

.activity-header a:hover {
  text-decoration: underline;
}

.activity-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  text-align: right;
}

.activity-table thead {
  background: var(--fb-surface-low);
  border-bottom: 1px solid var(--fb-surface-highest);
}

.activity-table th {
  padding: 1rem;
  color: var(--fb-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
}

.activity-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--fb-surface-highest);
  color: var(--fb-text);
  font-size: 0.9rem;
  line-height: 1.45;
  vertical-align: middle;
}

.activity-table tr:hover {
  background: var(--fb-surface-lowest);
}

.activity-table tr:last-child td {
  border-bottom: 0;
}

.activity-table .muted-cell {
  color: var(--fb-text-muted);
  font-size: 0.8rem;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 1rem;
}

.quick-link {
  min-width: 10rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--fb-border);
  background: var(--fb-surface);
  color: var(--fb-text);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.quick-link .material-symbols-outlined {
  color: var(--fb-text-muted);
}

.quick-link:hover {
  color: var(--fb-text);
  border-color: var(--fb-teal);
  background: var(--fb-surface-container);
}

.quick-link:hover .material-symbols-outlined {
  color: var(--fb-teal);
}

/* ===========================================
   Registry Pages
   =========================================== */
.registry-page {
  max-width: 1400px;
  width: 100%;
  margin-right: 0;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.registry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--fb-border);
  border-radius: 0.25rem;
  background: var(--fb-surface-lowest);
}

.registry-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.registry-title-icon {
  color: var(--fb-teal);
  font-size: 2rem;
}

.registry-header h1 {
  margin: 0;
  color: var(--fb-text);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.25;
}

.registry-header p {
  margin: 0.25rem 0 0;
  color: var(--fb-text-muted);
  font-size: 0.9rem;
}

.registry-count {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--fb-surface-high);
  color: var(--fb-text-muted);
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.registry-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.registry-primary-action,
.registry-secondary-action,
.registry-ghost-action {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.registry-primary-action {
  background: var(--fb-teal);
  color: #fff;
}

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

.registry-secondary-action {
  background: var(--fb-surface-lowest);
  border-color: var(--fb-border);
  color: var(--fb-text);
}

.registry-secondary-action:hover,
.registry-ghost-action:hover {
  border-color: var(--fb-teal);
  color: var(--fb-teal);
}

.registry-ghost-action {
  background: transparent;
  border-color: var(--fb-border);
  color: var(--fb-text-muted);
}

.registry-panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--fb-border);
  border-radius: 0.25rem;
  background: var(--fb-surface-lowest);
}

.registry-search-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--fb-border);
  background: var(--fb-surface-low);
}

.registry-search {
  position: relative;
  width: min(100%, 42rem);
}

.registry-search .material-symbols-outlined {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  color: var(--fb-text-muted);
  transform: translateY(-50%);
}

.registry-search input {
  width: 100%;
  height: 2.5rem;
  border: 1px solid var(--fb-border);
  border-radius: 0.25rem;
  background: var(--fb-surface-lowest);
  color: var(--fb-text);
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  outline: 0;
}

.registry-search input:focus {
  border-color: var(--fb-teal);
  box-shadow: 0 0 0 1px var(--fb-teal);
}

.registry-select {
  width: min(100%, 18rem);
}

.registry-select select {
  width: 100%;
  height: 2.5rem;
  border: 1px solid var(--fb-border);
  border-radius: 0.25rem;
  background: var(--fb-surface-lowest);
  color: var(--fb-text);
  padding: 0.5rem 0.75rem;
  outline: 0;
}

.registry-select select:focus {
  border-color: var(--fb-teal);
  box-shadow: 0 0 0 1px var(--fb-teal);
}

.registry-form-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--fb-border);
  background: var(--fb-surface-lowest);
}

.registry-form-band:last-child {
  border-bottom: 0;
}

.registry-form-band h2 {
  margin: 0;
  color: var(--fb-text);
  font-size: 1rem;
  font-weight: 700;
}

.registry-form-band p {
  margin: 0.25rem 0 0;
  color: var(--fb-text-muted);
  font-size: 0.85rem;
}

.registry-inline-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.registry-inline-form input {
  width: 13rem;
  height: 2.5rem;
  border: 1px solid var(--fb-border);
  border-radius: 0.25rem;
  background: var(--fb-surface-lowest);
  color: var(--fb-text);
  padding: 0.5rem 0.75rem;
  outline: 0;
}

.registry-inline-form input:focus {
  border-color: var(--fb-teal);
  box-shadow: 0 0 0 1px var(--fb-teal);
}

.treasury-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.treasury-actions-grid .registry-form-band {
  align-items: flex-start;
  flex-direction: column;
  border-bottom: 0;
}

.treasury-actions-grid .registry-form-band + .registry-form-band {
  border-right: 1px solid var(--fb-border);
}

.reports-filter-bar .registry-search {
  width: min(100%, 14rem);
}

.reports-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.reports-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(20rem, 1fr);
  gap: 1rem;
}

.reports-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--fb-border);
  background: var(--fb-surface-low);
}

.reports-panel-header h2 {
  margin: 0;
  color: var(--fb-text);
  font-size: 1rem;
  font-weight: 700;
}

.reports-panel-header span {
  color: var(--fb-text-muted);
  font-size: 0.8rem;
}

.reports-balance-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.reports-balance-columns > div {
  min-width: 0;
  padding: 1rem;
}

.reports-balance-columns > div + div {
  border-right: 1px solid var(--fb-border);
}

.reports-balance-columns h3 {
  margin: 0 0 0.75rem;
  color: var(--fb-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.reports-balance-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reports-balance-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.reports-balance-list a {
  min-width: 0;
  color: var(--fb-text);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.reports-balance-list a:hover {
  color: var(--fb-teal);
}

.reports-balance-list strong {
  color: #ba1a1a;
  direction: ltr;
  font-size: 0.85rem;
  white-space: nowrap;
}

.reports-empty-line {
  margin: 0;
  color: var(--fb-text-muted);
  font-size: 0.85rem;
}

.reports-link-list {
  display: flex;
  flex-direction: column;
}

.reports-link-list a {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--fb-border);
  color: var(--fb-text);
  font-weight: 700;
  text-decoration: none;
}

.reports-link-list a:last-child {
  border-bottom: 0;
}

.reports-link-list a:hover {
  background: var(--fb-surface-highest);
  color: var(--fb-teal);
}

.reports-link-list .material-symbols-outlined {
  color: var(--fb-teal);
}

.registry-table-wrap {
  overflow: visible;
}

.registry-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-collapse: collapse;
  text-align: right;
}

.registry-table thead tr {
  border-bottom: 1px solid var(--fb-border);
  background: var(--fb-surface-low);
}

.registry-table th {
  padding: 0.75rem 1rem;
  color: var(--fb-text);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.registry-table tbody tr {
  min-height: 3.5rem;
  border-bottom: 1px solid var(--fb-border);
  transition: background-color 0.15s ease;
}

.registry-table tbody tr:hover {
  background: var(--fb-surface-highest);
}

.registry-table tbody tr:last-child {
  border-bottom: 0;
}

.registry-table td {
  padding: 0.65rem 1rem;
  color: var(--fb-text);
  font-size: 0.9rem;
  vertical-align: middle;
  white-space: nowrap;
}

.registry-main-cell a {
  color: var(--fb-text);
  font-weight: 700;
  text-decoration: none;
}

.registry-main-cell a:hover {
  color: var(--fb-teal);
}

.registry-muted-cell {
  color: var(--fb-text-muted) !important;
}

.ltr-cell {
  direction: ltr;
  text-align: right;
}

.registry-balance {
  font-weight: 700;
  direction: ltr;
  text-align: right;
}

.registry-balance.is-danger {
  color: #ba1a1a;
}

.registry-balance.is-success {
  color: #137333;
}

.registry-status {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.registry-status.is-active {
  background: #d1fae5;
  color: #047857;
}

.registry-status.is-closed {
  background: var(--fb-surface-high);
  color: var(--fb-text-muted);
}

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

.registry-row-primary,
.registry-row-menu {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.25rem;
  background: rgba(0, 63, 184, 0.06);
  color: var(--fb-teal);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.registry-row-primary:hover {
  color: var(--fb-teal);
  background: rgba(0, 63, 184, 0.1);
}

.registry-row-menu {
  border-color: var(--fb-border);
  background: var(--fb-surface-lowest);
  color: var(--fb-text-muted);
}

.registry-row-menu:hover {
  background: var(--fb-surface-container);
}

.registry-row-menu .material-symbols-outlined {
  font-size: 1rem;
}

.registry-dropdown {
  z-index: 1100;
  border-radius: 0;
  border-color: var(--fb-border);
  box-shadow: none;
}

.registry-dropdown .dropdown-item {
  font-size: 0.85rem;
  text-align: right;
}

.registry-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--fb-text-muted);
  text-align: center;
}

.registry-empty > .material-symbols-outlined {
  color: var(--fb-text-light);
  font-size: 3rem;
}

.registry-empty strong {
  color: var(--fb-text);
  font-size: 1.1rem;
}

.registry-empty p {
  margin: 0;
}

.registry-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.registry-quick-actions a {
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--fb-teal);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--fb-teal);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
}

.registry-quick-actions a:hover {
  background: rgba(0, 63, 184, 0.06);
  color: var(--fb-teal);
}

.registry-quick-actions .material-symbols-outlined {
  font-size: 1.125rem;
}

@media (min-width: 768px) {
  .action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .action-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .home-dashboard {
    gap: 1.5rem;
  }

  .home-hero h1 {
    font-size: 1.65rem;
  }

  .action-card {
    min-height: 9rem;
    padding: 1rem;
  }

  .activity-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-table thead {
    display: none;
  }

  .activity-table,
  .activity-table tbody,
  .activity-table tr,
  .activity-table td {
    display: block;
  }

  .activity-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--fb-surface-highest);
  }

  .activity-table td {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  .activity-table td:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
    color: var(--fb-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .activity-table td:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
  }

  .activity-table td:nth-child(3) {
    grid-column: 1 / -1;
    font-weight: 700;
  }

  .activity-table td:nth-child(4) {
    grid-column: 1 / -1;
    overflow-wrap: anywhere;
  }

  .registry-header {
    align-items: stretch;
    flex-direction: column;
  }

  .registry-header h1 {
    font-size: 1.65rem;
  }

  .registry-primary-action {
    width: 100%;
  }

  .registry-header-actions {
    width: 100%;
  }

  .registry-search-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .registry-search {
    width: 100%;
  }

  .registry-select {
    width: 100%;
  }

  .registry-form-band {
    align-items: stretch;
    flex-direction: column;
  }

  .registry-inline-form,
  .registry-inline-form input {
    width: 100%;
  }

  .treasury-actions-grid {
    grid-template-columns: 1fr;
  }

  .treasury-actions-grid .registry-form-band + .registry-form-band {
    border-top: 1px solid var(--fb-border);
    border-right: 0;
  }

  .reports-metric-grid,
  .reports-section-grid,
  .reports-balance-columns {
    grid-template-columns: 1fr;
  }

  .reports-balance-columns > div + div {
    border-top: 1px solid var(--fb-border);
    border-right: 0;
  }

  .reports-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .registry-secondary-action,
  .registry-ghost-action {
    width: 100%;
  }

  .registry-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .registry-table-wrap {
    overflow-x: visible;
  }

  .registry-table {
    min-width: 0;
  }

  .registry-table thead {
    display: none;
  }

  .registry-table,
  .registry-table tbody,
  .registry-table tr,
  .registry-table td {
    display: block;
    width: 100%;
  }

  .registry-table tbody tr {
    padding: 1rem;
  }

  .registry-table td {
    padding: 0.45rem 0;
    white-space: normal;
  }

  .registry-table td:not(:first-child):not(:last-child) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--fb-surface-highest);
  }

  .registry-table td:not(:first-child):not(:last-child)::before {
    color: var(--fb-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .registry-table td:nth-child(2)::before { content: "صاحب المركب"; }
  .registry-table td:nth-child(3)::before { content: "رقم الهاتف"; }
  .registry-table td:nth-child(4)::before { content: "آخر سرحة"; }
  .registry-table td:nth-child(5)::before { content: ""; }

  .trader-registry-table td:nth-child(2)::before { content: "رقم الهاتف"; }
  .trader-registry-table td:nth-child(3)::before { content: "الرصيد الحالي"; }
  .trader-registry-table td:nth-child(4)::before { content: "آخر حركة"; }

  .fuel-company-registry-table td:nth-child(2)::before { content: "رقم الهاتف"; }
  .fuel-company-registry-table td:nth-child(3)::before { content: "الرصيد الحالي"; }
  .fuel-company-registry-table td:nth-child(4)::before { content: "الحالة"; }

  .journal-registry-table td:nth-child(2)::before { content: "الحركة"; }
  .journal-registry-table td:nth-child(3)::before { content: "الطرف"; }
  .journal-registry-table td:nth-child(4)::before { content: "البيان"; }
  .journal-registry-table td:nth-child(5)::before { content: "قيمة الحركة"; }

  .receipts-registry-table td:nth-child(2)::before { content: "المركب"; }
  .receipts-registry-table td:nth-child(3)::before { content: "عدد الطاولات"; }
  .receipts-registry-table td:nth-child(4)::before { content: "الإجمالي"; }
  .receipts-registry-table td:nth-child(5)::before { content: "العمولة"; }

  .sales-registry-table td:nth-child(2)::before { content: "التاجر"; }
  .sales-registry-table td:nth-child(3)::before { content: "عدد الأصناف"; }
  .sales-registry-table td:nth-child(4)::before { content: "إجمالي الكمية"; }
  .sales-registry-table td:nth-child(5)::before { content: "الإجمالي"; }

  .cash-registry-table td:nth-child(2)::before { content: "البيان"; }
  .cash-registry-table td:nth-child(3)::before { content: "المبلغ"; }
  .cash-registry-table td:nth-child(4)::before { content: "الرصيد"; }
  .cash-registry-table td:nth-child(5)::before { content: "الوقت"; }

  .treasury-registry-table td:nth-child(2)::before { content: "النوع"; }
  .treasury-registry-table td:nth-child(3)::before { content: "المبلغ"; }
  .treasury-registry-table td:nth-child(4)::before { content: "الرصيد بعد الحركة"; }
  .treasury-registry-table td:nth-child(5)::before { content: "البيان"; }

  .reports-summary-table td:nth-child(2)::before { content: "القيمة"; }
  .reports-summary-table td:nth-child(3)::before { content: "ملاحظة"; }

  .registry-main-cell {
    padding-top: 0;
    padding-bottom: 0.75rem;
    font-size: 1rem;
  }

  .registry-table td:last-child {
    padding-bottom: 0;
    border-top: 1px solid var(--fb-surface-highest);
  }

  .registry-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }

  .registry-row-primary,
  .registry-row-menu {
    width: 100%;
  }
}

/* ===========================================
   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; }
}
