/* ════════════════════════════════════════════════════════════════
   Navrex — App surface (dashboard, strategies, portfolio, forms)

   A design system that extends the landing page (`lp-*` in main.css):
   the same navy/cyan palette, rounded cards, soft shadows, pill controls
   and uppercase micro-labels — applied to data-dense, authenticated pages.
   Brand tokens (--navy, --cyan, --bg-light, --nb-border …) come from main.css.
   ════════════════════════════════════════════════════════════════ */

:root {
  --app-ink:      var(--navy);                 /* headings */
  --app-text:     #334155;                 /* body copy */
  --app-muted:    #64748b;                 /* secondary copy */
  --app-faint:    #9aafc9;                 /* micro-labels / captions */
  --app-line:     #EDF1F7;                 /* hairline borders */
  --app-line-2:   #E4EAF3;                 /* stronger dividers */
  --app-surface:  #ffffff;
  --app-bg:       var(--bg-light);
  --app-shadow:   0 10px 34px rgba(13, 39, 80, 0.07);
  --app-shadow-sm:0 4px 16px rgba(13, 39, 80, 0.06);
  --app-mono:     'SF Mono', 'Fira Code', ui-monospace, 'Courier New', monospace;

  --app-pos:      #15915b;                 /* gains */
  --app-neg:      #d64550;                 /* losses */
}

/* ── Page shell ────────────────────────────────────────────────── */
/* grow to fill the space above the footer, so the footer sits flush at the
   bottom of the viewport on short pages (sticky-footer) instead of leaving a
   full-height grey block with the footer stranded below it */
main:has(> .app-shell) {
  display: flex;
  flex-direction: column;
}

.app-shell {
  flex: 1 0 auto;
  background: var(--app-bg);
  padding: 44px 0 88px;
  position: relative;
  overflow: hidden;
}

/* soft brand glow, echoing the landing hero */
.app-shell::before {
  content: '';
  position: absolute;
  top: -180px; right: -160px;
  width: 620px; height: 620px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(32, 196, 232, 0.08) 0%, transparent 66%);
  pointer-events: none;
}

.app-shell > .container,
.app-shell > .container-lg { position: relative; z-index: 1; }

/* ── Page header ───────────────────────────────────────────────── */
.app-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.app-head__main { min-width: 0; }

.app-back {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--app-muted);
  text-decoration: none;
  margin-bottom: 0.85rem;
  transition: color 0.15s ease, gap 0.15s ease;
}

.app-back svg { width: 15px; height: 15px; }
.app-back:hover { color: var(--cyan); gap: 0.5rem; }

.app-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.6rem;
}

.app-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(32, 196, 232, 0.18);
}

.app-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--app-ink);
  letter-spacing: -0.035em;
  line-height: 1.1;
  margin: 0;
}

.app-subtitle {
  font-size: 0.98rem;
  color: var(--app-muted);
  line-height: 1.6;
  margin: 0.5rem 0 0;
}

.app-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* header meta badges (status, base currency …) */
.app-metarow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

/* ── Buttons (small variants on top of lp-btn-*) ───────────────── */
.lp-btn-primary.lp-btn-sm,
.lp-btn-ghost.lp-btn-sm,
.app-btn-danger.lp-btn-sm {
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
}

.app-btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 1.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #e35d67 0%, var(--app-neg) 100%);
  border: none;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(214, 69, 80, 0.28);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.app-btn-danger:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }

/* ── Stat tiles ────────────────────────────────────────────────── */
.app-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.app-stat {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: var(--app-shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.app-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow);
  border-color: var(--cyan-border);
}

.app-stat__ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--cyan);
}

.app-stat__ico svg { width: 21px; height: 21px; }

.app-stat__ico--soft {
  background: linear-gradient(135deg, rgba(32, 196, 232, 0.18), rgba(32, 196, 232, 0.07));
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
}

.app-stat__body { min-width: 0; }

.app-stat__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--app-faint);
  margin-bottom: 0.3rem;
}

.app-stat__value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--app-ink);
  letter-spacing: -0.02em;
  line-height: 1;
}

.app-stat__value small {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--app-faint);
  margin-left: 0.15rem;
}

/* ── Cards ─────────────────────────────────────────────────────── */
.app-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 18px;
  box-shadow: var(--app-shadow);
  overflow: hidden;
}

.app-card + .app-card { margin-top: 1.5rem; }

.app-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--app-line);
}

.app-card__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--app-ink);
  letter-spacing: -0.01em;
  margin: 0;
}

.app-card__title svg { width: 18px; height: 18px; color: var(--cyan); }

.app-card__body { padding: 1.5rem; }
.app-card__body--flush { padding: 0; }

.app-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 0.55rem;
  border-radius: 999px;
  background: var(--app-bg);
  border: 1px solid var(--app-line-2);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--app-muted);
}

.app-card__note {
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.6;
  margin: 1.1rem 0 0;
}

.app-card__foot {
  padding: 1.05rem 1.5rem;
  border-top: 1px solid var(--app-line);
  background: #FAFCFE;
}

.app-card__foot .app-card__note { margin: 0; }

.app-none {
  font-size: 0.9rem;
  color: var(--app-muted);
  margin: 0;
}

/* ── Tables ────────────────────────────────────────────────────── */
.app-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.app-table thead th {
  text-align: left;
  padding: 0.7rem 1.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--app-faint);
  background: #FAFCFE;
  border-bottom: 1px solid var(--app-line);
  white-space: nowrap;
}

.app-table tbody td {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--app-line);
  color: var(--app-text);
  vertical-align: middle;
}

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

.app-table tbody tr { transition: background 0.12s ease; }
.app-table tbody tr:hover { background: rgba(32, 196, 232, 0.04); }

/* right-alignment is all a numeric column needs in the header. the rest of .num
   is data typography, and unscoped it also matched thead th — two classes
   outrank "class + two elements", so numeric headers were silently taking the
   body's size, colour and mono face while the others kept the header's */
.app-table thead th.num { text-align: right; }

.app-table tbody .num {
  text-align: right;
  font-family: var(--app-mono);
  font-size: 0.85rem;
  color: var(--app-ink);
  white-space: nowrap;
}

.app-table .app-t-name {
  font-weight: 700;
  color: var(--app-ink);
}

.app-table .app-t-sym {
  font-family: var(--app-mono);
  font-weight: 600;
  color: var(--app-text);
}

.app-table .app-t-time {
  font-family: var(--app-mono);
  font-size: 0.8rem;
  color: var(--app-muted);
  white-space: nowrap;
}

.app-table td.app-t-muted { color: var(--app-muted); font-size: 0.85rem; }

/* a cell whose value reads as one token — a date range, a term. left to wrap it
   breaks after every hyphen and stretches the whole row */
.app-table .app-t-nowrap { white-space: nowrap; }

/* row actions, right-aligned so the column costs the width of the icons only */
.app-table .app-t-actions {
  white-space: nowrap;
  text-align: right;
}

/* icon-only row action. the label lives in title/aria-label, so it stays
   reachable without spending a column on two words per row */
.app-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--app-muted);
  transition: color 0.15s ease, background 0.15s ease;
}

.app-iconbtn + .app-iconbtn { margin-left: 0.15rem; }

.app-iconbtn svg {
  width: 16px;
  height: 16px;
}

.app-iconbtn:hover {
  color: var(--app-ink);
  background: var(--app-line);
}

.app-iconbtn--danger:hover {
  color: var(--app-neg);
  background: rgba(214, 69, 80, 0.09);
}

/* venue logo beside its name. not scoped to .app-table — the same pair renders
   on the deposit delete page. the logo is optional, so the name must sit the
   same way with or without it */
.app-venue {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.app-venue__ico {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

.app-table__note-row td {
  padding-top: 0 !important;
  border-bottom: none !important;
  color: var(--app-muted);
  font-size: 0.82rem;
}

.app-link {
  color: var(--app-ink);
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-link:hover { color: var(--cyan); }

/* numeric sign coloring */
.pnl-pos { color: var(--app-pos) !important; }
.pnl-neg { color: var(--app-neg) !important; }

/* ── Badges (pills) ────────────────────────────────────────────── */
.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.3;
  white-space: nowrap;
}

.app-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.app-badge--plain::before { display: none; }

.app-badge--success { background: rgba(21, 145, 91, 0.11);  color: var(--app-pos); }
.app-badge--danger  { background: rgba(214, 69, 80, 0.11);  color: #cc3a45; }
.app-badge--muted   { background: #EEF2F8;                  color: var(--app-muted); }
.app-badge--warning { background: rgba(217, 119, 6, 0.12);  color: #b26a05; }
.app-badge--info    { background: var(--cyan-dim);          color: #0a7ea4; }
.app-badge--navy    { background: rgba(13, 39, 80, 0.07);   color: var(--navy); }

/* ── Chips (fees, misc) ────────────────────────────────────────── */
.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: var(--app-bg);
  border: 1px solid var(--app-line-2);
  font-family: var(--app-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--app-ink);
}

.app-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ── Empty state ───────────────────────────────────────────────── */
.app-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.app-empty__ico {
  width: 56px; height: 56px;
  border-radius: 16px;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(32, 196, 232, 0.16), rgba(32, 196, 232, 0.05));
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
}

.app-empty__ico svg { width: 26px; height: 26px; }

.app-empty__title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--app-ink);
  margin: 0 0 0.35rem;
}

.app-empty__text {
  font-size: 0.9rem;
  color: var(--app-muted);
  line-height: 1.6;
  margin: 0 auto 1.25rem;
  max-width: 380px;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.app-form-wrap {
  max-width: 620px;
  margin: 0 auto;
}

.app-form-card {
  background: var(--app-surface);
  border: 1px solid var(--app-line);
  border-radius: 18px;
  box-shadow: var(--app-shadow);
  padding: 2rem 2.1rem;
}

.app-form .app-field { margin-bottom: 1.35rem; }
.app-form .app-field:last-of-type { margin-bottom: 0; }

.app-form .app-label,
.app-form label:not(.form-check-label) {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--app-ink);
  margin-bottom: 0.5rem;
}

.app-form .form-control,
.app-form .form-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #D8E1EC;
  background: #fff;
  padding: 0.7rem 0.95rem;
  font-size: 0.95rem;
  color: var(--app-text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

/* custom chevron only on selects — leave native pickers/spinners on
   datetime-local and number inputs untouched */
.app-form .form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.4rem;
}

.app-form textarea.form-control { min-height: 84px; resize: vertical; }

.app-form .form-control:focus,
.app-form .form-select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(32, 196, 232, 0.14);
}

.app-form .form-control::placeholder { color: #aab7c8; }

.app-help {
  font-size: 0.8rem;
  color: var(--app-muted);
  line-height: 1.5;
  margin-top: 0.4rem;
}

.app-field-error {
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  color: var(--app-neg);
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

.app-form-error {
  background: rgba(214, 69, 80, 0.08);
  border: 1px solid rgba(214, 69, 80, 0.25);
  color: #c0343f;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 1.35rem;
}

.app-form-error ul { margin: 0; padding-left: 1.1rem; }

.app-form-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--app-line);
}

/* checkbox rows */
.app-form .form-check { display: flex; align-items: center; gap: 0.5rem; }
.app-form .form-check-input {
  width: 1.1rem; height: 1.1rem;
  border-radius: 5px;
  border: 1px solid #C3D0DF;
  cursor: pointer;
}
.app-form .form-check-input:checked { background-color: var(--cyan); border-color: var(--cyan); }
.app-form .form-check-input:focus { box-shadow: 0 0 0 4px rgba(32, 196, 232, 0.14); }

/* confirm-delete summary list */
.app-deflist {
  list-style: none;
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--app-bg);
  border: 1px solid var(--app-line-2);
  border-radius: 12px;
  display: grid;
  gap: 0.5rem;
}

.app-deflist li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.88rem;
}

.app-deflist .k { color: var(--app-muted); font-weight: 600; }
.app-deflist .v { font-family: var(--app-mono); color: var(--app-ink); text-align: right; }

/* ── Pagination ────────────────────────────────────────────────── */
.app-pager {
  display: flex;
  justify-content: center;
  gap: 0.3rem;
  margin: 1.5rem 0 1.75rem;
  padding: 0 1.5rem;
  flex-wrap: wrap;
}

.app-pager a,
.app-pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--app-line-2);
  background: #fff;
  color: var(--app-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.app-pager a:hover { border-color: var(--cyan-border); background: var(--cyan-dim); color: var(--navy); }
.app-pager .is-active { background: linear-gradient(135deg, var(--navy), var(--navy-mid)); border-color: transparent; color: #fff; }
.app-pager .is-disabled { opacity: 0.45; pointer-events: none; }

/* ── Section subhead inside light shell ────────────────────────── */
.app-section-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-faint);
  margin: 0 0 1rem;
}

.app-section-label span { flex-shrink: 0; }
.app-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--app-line-2);
}

/* ── Quick-action list (personal dashboard) ────────────────────── */
.app-quick {
  display: grid;
  gap: 0.75rem;
}

.app-quick__item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.95rem 1.1rem;
  border-radius: 14px;
  border: 1px solid var(--app-line);
  background: #fff;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.app-quick__item:hover {
  transform: translateY(-2px);
  box-shadow: var(--app-shadow-sm);
  border-color: var(--cyan-border);
}

.app-quick__ico {
  width: 40px; height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: var(--cyan);
}

.app-quick__ico svg { width: 19px; height: 19px; }

.app-quick__text { min-width: 0; flex: 1; }
.app-quick__title { font-size: 0.95rem; font-weight: 700; color: var(--app-ink); }
.app-quick__sub { font-size: 0.8rem; color: var(--app-muted); margin-top: 0.1rem; }

.app-quick__arrow { color: var(--app-faint); flex-shrink: 0; transition: transform 0.18s ease, color 0.18s ease; }
.app-quick__arrow svg { width: 18px; height: 18px; }
.app-quick__item:hover .app-quick__arrow { color: var(--cyan); transform: translateX(3px); }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .app-shell { padding: 32px 0 64px; }
  .app-title { font-size: 1.6rem; }
  .app-head { align-items: flex-start; }
  .app-actions { width: 100%; }
  .app-actions .lp-btn-primary,
  .app-actions .lp-btn-ghost { flex: 1; justify-content: center; }
  .app-card__head { padding: 1rem 1.15rem; }
  .app-card__body { padding: 1.15rem; }
  .app-table thead th,
  .app-table tbody td { padding-left: 1.15rem; padding-right: 1.15rem; }
  .app-form-card { padding: 1.5rem 1.35rem; }
  .app-form-actions { flex-direction: column; }
  .app-form-actions .lp-btn-primary,
  .app-form-actions .lp-btn-ghost,
  .app-form-actions .app-btn-danger { width: 100%; justify-content: center; }
}
