/* ── Ssente Fields shared app styles ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --green: #1a7a4a; --green-l: #22a05e; --green-d: #124d30;
  --gold: #f5b83d; --dark: #0e1a14; --mid: #2b3d31;
  --muted: #6b8070; --light: #f2f7f4; --white: #ffffff;
  --red: #e53e3e; --sidebar: 240px;
}
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--light); color: var(--dark); line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ── LAYOUT ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar); background: var(--dark); color: #fff;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform 0.3s;
}
.sidebar-logo {
  padding: 1.5rem; font-size: 1.3rem; font-weight: 900;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; gap: 0.5rem;
}
.sidebar-logo span { color: var(--gold); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.8rem 1.5rem; color: rgba(255,255,255,0.65);
  font-size: 0.9rem; font-weight: 500; transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(26,122,74,0.2); color: #fff; border-left-color: var(--green-l); }
.nav-item .icon { font-size: 1.1rem; width: 22px; text-align: center; }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.08); }
.user-chip {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem; border-radius: 0.6rem;
  background: rgba(255,255,255,0.06);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--green); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.9rem; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 0.85rem; font-weight: 600; color: #fff; }
.user-role { font-size: 0.72rem; color: rgba(255,255,255,0.5); }
.logout-btn {
  width: 100%; background: none; border: none; color: rgba(255,255,255,0.4);
  font-size: 0.78rem; padding: 0.5rem 1.5rem; text-align: left;
  transition: color 0.15s; margin-top: 0.25rem;
}
.logout-btn:hover { color: #fff; }

/* ── MAIN CONTENT ── */
.main { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid #e8f0ea;
  padding: 1rem 2rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 0.75rem; align-items: center; }
.page-content { padding: 2rem; flex: 1; }

/* ── CARDS ── */
.card {
  background: #fff; border-radius: 1rem; border: 1px solid #e8f0ea;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.card-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid #f0f4f1;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 1.5rem; }

/* ── STAT CARDS ── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff; border-radius: 1rem; padding: 1.5rem;
  border: 1px solid #e8f0ea; box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.stat-card .label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-size: 1.9rem; font-weight: 900; margin: 0.3rem 0; }
.stat-card .delta { font-size: 0.78rem; font-weight: 600; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

/* ── BUTTONS ── */
.btn { padding: 0.6rem 1.2rem; border-radius: 0.5rem; font-size: 0.88rem; font-weight: 600; border: none; transition: all 0.15s; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-l); }
.btn-gold { background: var(--gold); color: var(--dark); }
.btn-gold:hover { background: #f7c95a; }
.btn-outline { background: transparent; border: 1.5px solid #d1e4d8; color: var(--dark); }
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--light); color: var(--dark); }
.btn-danger { background: #fff0f0; color: var(--red); border: 1.5px solid #ffd0d0; }
.btn-danger:hover { background: #ffe0e0; }

/* ── BADGE ── */
.badge { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 2rem; font-size: 0.72rem; font-weight: 700; }
.badge-green { background: rgba(26,122,74,0.1); color: var(--green); }
.badge-gold { background: rgba(245,184,61,0.15); color: #b8860b; }
.badge-red { background: rgba(229,62,62,0.1); color: var(--red); }
.badge-gray { background: #f0f0f0; color: var(--muted); }

/* ── TABLE ── */
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #f0f4f1; }
.table td { padding: 0.9rem 1rem; border-bottom: 1px solid #f7f9f7; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafcfa; }

/* ── FORM ── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.4rem; }
.form-input {
  width: 100%; padding: 0.75rem 1rem; border: 1.5px solid #d1e4d8;
  border-radius: 0.6rem; font-size: 0.95rem; outline: none;
  transition: border-color 0.2s; background: #fff;
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(26,122,74,0.08); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b8070' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem; }

/* ── MODAL ── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 500; align-items: center; justify-content: center; padding: 1rem; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 1.25rem; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; animation: modalIn 0.25s ease; }
.modal-head { padding: 1.5rem; border-bottom: 1px solid #f0f4f1; display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.1rem; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--muted); line-height: 1; }
.modal-body { padding: 1.5rem; }
.modal-foot { padding: 1rem 1.5rem; border-top: 1px solid #f0f4f1; display: flex; justify-content: flex-end; gap: 0.75rem; }
@keyframes modalIn { from { opacity:0; transform: scale(0.94) translateY(12px); } to { opacity:1; transform: none; } }

/* ── PRICE TAG ── */
.price-tag { font-weight: 800; color: var(--green); }
.price-up { color: var(--green); }
.price-down { color: var(--red); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 999;
  background: var(--dark); color: #fff; padding: 0.85rem 1.5rem;
  border-radius: 0.75rem; font-size: 0.9rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.toast.show { transform: none; opacity: 1; }
.toast.success { border-left: 4px solid var(--green-l); }
.toast.error   { border-left: 4px solid var(--red); }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 4rem 2rem; color: var(--muted); }
.empty .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty h3 { font-size: 1.1rem; font-weight: 700; color: var(--dark); margin-bottom: 0.5rem; }
.empty p { font-size: 0.9rem; }

/* ── CURRENCY RATE CHIP ── */
.rate-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 2rem;
  font-size: 0.7rem; font-weight: 600; color: var(--muted);
  background: var(--light); border: 1px solid #d1e4d8;
  white-space: nowrap; cursor: default;
}
.rate-chip.hidden { display: none; }

/* ── CURRENCY SELECT WRAPPER ── */
.currency-select-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }

/* ── MOBILE ── */
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--dark); }
@media(max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
  /* topbar adapts: title can shrink, actions wrap */
  .topbar { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
  .topbar-actions { flex-wrap: wrap; gap: 0.4rem; }
  .topbar-actions .btn-sm { padding: 0.35rem 0.65rem; font-size: 0.75rem; }
  /* hide low-priority topbar items on very small screens */
  @media(max-width: 480px) {
    .topbar-hide-xs { display: none !important; }
  }
}

/* ── PROGRESS BAR ── */
.progress { height: 8px; background: #e8f0ea; border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: 4px; transition: width 0.5s ease; }

/* ── CREDIT RING ── */
.credit-ring { position: relative; width: 120px; height: 120px; }
.credit-ring svg { transform: rotate(-90deg); }
.credit-ring .ring-bg { fill: none; stroke: #e8f0ea; stroke-width: 8; }
.credit-ring .ring-fill { fill: none; stroke: var(--green); stroke-width: 8; stroke-linecap: round; transition: stroke-dasharray 1s ease; }
.credit-ring .ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.credit-ring .ring-score { font-size: 1.4rem; font-weight: 900; color: var(--dark); }
.credit-ring .ring-text { font-size: 0.65rem; color: var(--muted); font-weight: 600; }
