/* === FREELANCE HUB — DESIGN SYSTEM === */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg:        #0d0d0f;
  --bg2:       #141417;
  --bg3:       #1c1c21;
  --border:    #2a2a32;
  --border2:   #3a3a45;
  --text:      #e8e8f0;
  --text2:     #9090a8;
  --text3:     #5a5a70;
  --accent:    #7c6af7;
  --accent2:   #a594ff;
  --green:     #3ecf8e;
  --red:       #f87171;
  --yellow:    #fbbf24;
  --blue:      #60a5fa;
  --sidebar-w: 220px;
  --topbar-h:  56px;
  --radius:    10px;
  --radius-sm: 6px;
  --font:      'Syne', sans-serif;
  --mono:      'DM Mono', monospace;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body { background: var(--bg); color: var(--text); font-family: var(--font); }

/* === LAYOUT === */
#fh-app { display: flex; height: 100vh; overflow: hidden; position: relative; }

#fh-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .3s;
  z-index: 100;
}

#fh-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* === LOGO === */
.fh-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}
.fh-logo-icon {
  font-size: 22px;
  color: var(--accent2);
  line-height: 1;
}
.fh-logo-text {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .03em;
  color: var(--text);
}

/* === NAV === */
.fh-nav { padding: 12px 0; flex: 1; }
.fh-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  transition: all .15s;
  border-left: 2px solid transparent;
}
.fh-nav-item:hover { color: var(--text); background: var(--bg3); }
.fh-nav-item.active { color: var(--accent2); border-left-color: var(--accent2); background: rgba(124,106,247,.08); }
.fh-nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.fh-sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
#fh-live-timer-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--green);
}
.fh-timer-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* === TOPBAR === */
#fh-topbar {
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
#fh-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}
#fh-topbar-title { font-size: 15px; font-weight: 700; flex: 1; }
#fh-today-date { font-family: var(--mono); font-size: 12px; color: var(--text3); }

/* === CONTENT === */
#fh-content { flex: 1; overflow-y: auto; }
.fh-view { display: none; padding: 24px; animation: fadeIn .2s; }
.fh-view.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* === GRID / CARD SYSTEM === */
.fh-grid { display: grid; gap: 16px; }
.fh-grid-2 { grid-template-columns: repeat(2, 1fr); }
.fh-grid-3 { grid-template-columns: repeat(3, 1fr); }
.fh-grid-4 { grid-template-columns: repeat(4, 1fr); }

.fh-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.fh-card-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text3);
  margin-bottom: 10px;
}
.fh-card-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.fh-card-sub { font-size: 12px; color: var(--text3); margin-top: 4px; }

.fh-stat-card { position: relative; overflow: hidden; }
.fh-stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  border-radius: 50%;
  opacity: .08;
  transform: translate(15px,-15px);
}
.fh-stat-income::before { background: var(--green); }
.fh-stat-expense::before { background: var(--red); }
.fh-stat-balance::before { background: var(--accent); }
.fh-stat-time::before { background: var(--blue); }

.fh-income  { color: var(--green) !important; }
.fh-expense { color: var(--red)   !important; }
.fh-accent  { color: var(--accent2) !important; }
.fh-blue    { color: var(--blue)  !important; }

/* === SECTION HEADER === */
.fh-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.fh-section-title { font-size: 16px; font-weight: 700; }

/* === BUTTONS === */
.fh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
}
.fh-btn-primary { background: var(--accent); color: #fff; }
.fh-btn-primary:hover { background: var(--accent2); }
.fh-btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border2); }
.fh-btn-ghost:hover { color: var(--text); background: var(--bg3); }
.fh-btn-danger { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.3); }
.fh-btn-danger:hover { background: rgba(248,113,113,.25); }
.fh-btn-sm { padding: 5px 10px; font-size: 12px; }
.fh-btn-green { background: var(--green); color: #0d0d0f; }
.fh-btn-green:hover { opacity: .9; }

/* === FORMS === */
.fh-form-group { margin-bottom: 14px; }
.fh-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; letter-spacing: .04em; text-transform: uppercase; }
.fh-input, .fh-select, .fh-textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color .15s;
  outline: none;
}
.fh-input:focus, .fh-select:focus, .fh-textarea:focus { border-color: var(--accent); }
.fh-textarea { resize: vertical; min-height: 80px; }
.fh-select { appearance: none; cursor: pointer; }
.fh-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fh-form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* === TABLE === */
.fh-table-wrap { overflow-x: auto; }
.fh-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fh-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
.fh-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.fh-table tr:last-child td { border-bottom: none; }
.fh-table tr:hover td { background: var(--bg3); }
.fh-table-mono { font-family: var(--mono); }

/* === BADGES === */
.fh-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.fh-badge-active   { background: rgba(62,207,142,.15); color: var(--green); }
.fh-badge-paused   { background: rgba(251,191,36,.15); color: var(--yellow); }
.fh-badge-completed{ background: rgba(124,106,247,.15); color: var(--accent2); }
.fh-badge-cancelled{ background: rgba(248,113,113,.15); color: var(--red); }
.fh-badge-income   { background: rgba(62,207,142,.15); color: var(--green); }
.fh-badge-expense  { background: rgba(248,113,113,.15); color: var(--red); }
.fh-badge-freelance{ background: rgba(96,165,250,.15); color: var(--blue); }
.fh-badge-geddego  { background: rgba(251,191,36,.15); color: var(--yellow); }
.fh-badge-personal { background: rgba(124,106,247,.15); color: var(--accent2); }
.fh-badge-todo     { background: rgba(90,90,112,.2); color: var(--text2); }
.fh-badge-in_progress { background: rgba(251,191,36,.15); color: var(--yellow); }
.fh-badge-done     { background: rgba(62,207,142,.15); color: var(--green); }
.fh-badge-high     { background: rgba(248,113,113,.15); color: var(--red); }
.fh-badge-medium   { background: rgba(251,191,36,.15); color: var(--yellow); }
.fh-badge-low      { background: rgba(62,207,142,.15); color: var(--green); }

/* === PROGRESS BAR === */
.fh-progress { background: var(--bg3); border-radius: 4px; height: 6px; overflow: hidden; }
.fh-progress-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s; }
.fh-progress-fill.danger { background: var(--red); }
.fh-progress-fill.ok { background: var(--green); }

/* === PROJECT CARD === */
.fh-project-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.fh-project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  border-radius: 3px 0 0 3px;
}
.fh-project-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.fh-project-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.fh-project-client { font-size: 12px; color: var(--text3); margin-bottom: 12px; }
.fh-project-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text2); margin-top: 10px; flex-wrap: wrap; }
.fh-project-meta span { display: flex; align-items: center; gap: 4px; }

/* === TIMER === */
#fh-timer-display {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: .02em;
  text-align: center;
  padding: 32px 0 24px;
}
#fh-timer-display.running { color: var(--green); }
.fh-timer-controls { display: flex; gap: 12px; justify-content: center; }

/* === CALENDAR === */
.fh-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.fh-cal-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fh-cal-cell {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 70px;
  padding: 6px;
  cursor: pointer;
  transition: border-color .15s;
  font-size: 12px;
}
.fh-cal-cell:hover { border-color: var(--border2); }
.fh-cal-cell.today { border-color: var(--accent); }
.fh-cal-cell.other-month { opacity: .35; }
.fh-cal-cell-num { font-size: 12px; font-weight: 700; color: var(--text2); margin-bottom: 4px; }
.fh-cal-event { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* === KANBAN === */
.fh-kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.fh-kanban-col { background: var(--bg3); border-radius: var(--radius); padding: 12px; }
.fh-kanban-col-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text3); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.fh-task-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.fh-task-card:hover { border-color: var(--border2); }
.fh-task-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.fh-task-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* === MODAL === */
#fh-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
#fh-modal-overlay.fh-hidden { display: none; }
#fh-modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
#fh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
#fh-modal-title { font-size: 15px; font-weight: 700; }
#fh-modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 16px; padding: 4px; }
#fh-modal-close:hover { color: var(--text); }
#fh-modal-body { padding: 20px; }

/* === TOAST === */
#fh-toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.fh-toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: slideIn .25s;
  display: flex; align-items: center; gap: 8px;
}
.fh-toast.success { border-color: var(--green); color: var(--green); }
.fh-toast.error   { border-color: var(--red);   color: var(--red); }
@keyframes slideIn { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:none} }

/* === CHART CONTAINER === */
.fh-chart-wrap { position: relative; }
.fh-chart-wrap canvas { max-height: 240px; }

/* === EMPTY STATE === */
.fh-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text3);
}
.fh-empty-icon { font-size: 36px; margin-bottom: 10px; }
.fh-empty-text { font-size: 14px; margin-bottom: 16px; }

/* === TABS === */
.fh-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg3); border-radius: var(--radius-sm); padding: 4px; }
.fh-tab {
  flex: 1; text-align: center; padding: 7px 10px;
  border-radius: 5px; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--text3); letter-spacing: .04em;
  transition: all .15s; border: none; background: none; font-family: var(--font);
}
.fh-tab.active { background: var(--bg2); color: var(--text); }

/* === FILTER BAR === */
.fh-filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.fh-filter-bar .fh-input, .fh-filter-bar .fh-select { width: auto; flex: 1; min-width: 120px; }

/* === MOBILE === */
@media (max-width: 768px) {
  :root { --sidebar-w: 220px; }
  #fh-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .3s;
    z-index: 200;
  }
  #fh-sidebar.open { transform: none; box-shadow: var(--shadow); }
  #fh-menu-toggle { display: block !important; }
  .fh-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .fh-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .fh-grid-2 { grid-template-columns: 1fr; }
  .fh-kanban { grid-template-columns: 1fr; }
  .fh-form-row { grid-template-columns: 1fr; }
  .fh-form-row-3 { grid-template-columns: 1fr; }
  #fh-timer-display { font-size: 40px; }
  .fh-cal-cell { min-height: 48px; }
  .fh-view { padding: 14px; }
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* === MISC === */
.fh-flex { display: flex; align-items: center; }
.fh-gap { gap: 8px; }
.fh-mb { margin-bottom: 16px; }
.fh-mt { margin-top: 16px; }
.fh-tag {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--text2);
  margin: 2px;
}
.fh-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.fh-overdue { color: var(--red); }
.fh-separator { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.fh-text-mono { font-family: var(--mono); }
.fh-subtle { color: var(--text3); font-size: 12px; }

/* ══════════════════════════════════════════════════════
   WALLET — Tarjetas, Gastos Personales, Cuotas
══════════════════════════════════════════════════════ */

/* Tarjeta física */
.fh-card-visual {
  border-radius: 14px;
  padding: 20px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.fh-card-visual:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,.5); }
.fh-card-visual::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.fh-card-visual::after {
  content: '';
  position: absolute;
  bottom: -40px; right: 20px;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
}
.fh-card-visual-name { font-size: 16px; font-weight: 800; letter-spacing: .04em; }
.fh-card-visual-bank { font-size: 11px; opacity: .7; margin-top: 2px; }
.fh-card-visual-type {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.fh-card-visual-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.fh-card-visual-amount { font-family: var(--mono); font-size: 20px; font-weight: 500; }
.fh-card-visual-amount-label { font-size: 10px; opacity: .7; margin-bottom: 2px; }
.fh-card-visual-dates { text-align: right; font-size: 11px; opacity: .8; line-height: 1.6; }
.fh-card-visual-closing { font-size: 10px; opacity: .6; }

.fh-card-badge-urgent { color: var(--red); font-weight: 700; }
.fh-card-badge-soon   { color: var(--yellow); font-weight: 700; }
.fh-card-badge-ok     { color: var(--green); }

/* Categorías de gastos personales */
.fh-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.fh-cat-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--font);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
}
.fh-cat-btn:hover { border-color: var(--border2); color: var(--text); }
.fh-cat-btn.selected { border-color: var(--accent); color: var(--accent2); background: rgba(124,106,247,.08); }
.fh-cat-btn .fh-cat-icon { font-size: 20px; display: block; margin-bottom: 4px; }

/* Cuotas */
.fh-installment-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color .15s;
}
.fh-installment-card:hover { border-color: var(--border2); }
.fh-installment-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.fh-installment-name { font-size: 14px; font-weight: 700; }
.fh-installment-account {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
}
.fh-installment-meta { display: flex; gap: 16px; font-size: 12px; color: var(--text2); flex-wrap: wrap; margin-top: 8px; }
.fh-installment-meta strong { color: var(--text); }

/* Desglose por categoría — barras horizontales */
.fh-cat-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fh-cat-bar-label { width: 90px; font-size: 12px; color: var(--text2); flex-shrink: 0; text-transform: capitalize; }
.fh-cat-bar-track { flex: 1; background: var(--bg3); border-radius: 4px; height: 8px; overflow: hidden; }
.fh-cat-bar-fill  { height: 100%; border-radius: 4px; background: var(--accent); transition: width .5s; }
.fh-cat-bar-amount { width: 90px; text-align: right; font-family: var(--mono); font-size: 12px; color: var(--text2); flex-shrink: 0; }

@media (max-width: 768px) {
  .fh-cat-grid { grid-template-columns: repeat(4, 1fr); }
  .fh-card-visual-amount { font-size: 16px; }
}
