/* ==================================================================
   Texcorp IMS — mobile-first app styling
   Palette drawn from the Texcorp brand: deep ink navy, jet-stream
   blue (the logo's swoosh), paper white, and the invoice's red
   UNPAID accent.
================================================================== */
:root {
  --ink: #0d2b45;            /* deep navy header */
  --ink-2: #123a5e;
  --jet: #1d9bd8;            /* texcorp swoosh blue */
  --jet-soft: #e3f3fb;
  --paper: #f4f6f9;
  --unpaid: #c0111f;         /* invoice badge red */
  --paid: #1a7f4b;
  --radius: 14px;
  --bottom-nav-h: 64px;
}

html, body { background: var(--paper); }
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: #1c2733; }

/* ---------- top bar (desktop) ---------- */
.app-topbar {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink-2) 100%);
  min-height: 60px;
  box-shadow: 0 2px 10px rgba(13,43,69,.25);
}
.app-topbar .nav-link { color: rgba(255,255,255,.78); border-radius: 8px; font-size: .92rem; }
.app-topbar .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.app-topbar .nav-link.active { color: #fff; background: var(--jet); }
.brand-text { color: #fff; font-weight: 600; letter-spacing: .3px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--jet); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  transform: rotate(-20deg);
}

/* ---------- mobile header ---------- */
.mobile-header {
  position: sticky; top: 0; z-index: 1030; height: 56px;
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink-2) 100%);
  padding-top: env(safe-area-inset-top);
  box-shadow: 0 2px 8px rgba(13,43,69,.3);
}
.mobile-title { color: #fff; font-weight: 600; font-size: 1.05rem; }

/* ---------- main area ---------- */
.app-main { min-height: calc(100vh - 56px); padding-bottom: calc(var(--bottom-nav-h) + 24px); }
@media (min-width: 992px) { .app-main { padding-bottom: 32px; } }

/* ---------- bottom nav (mobile app feel) ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid #e6eaef;
  display: flex; align-items: stretch; justify-content: space-around;
  box-shadow: 0 -4px 18px rgba(13,43,69,.10);
}
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; text-decoration: none;
  color: #8795a5; font-size: .68rem; font-weight: 500;
  transition: color .15s;
}
.bottom-nav-item i { font-size: 1.25rem; }
.bottom-nav-item.active { color: var(--jet); }
.bottom-nav-item.active i { transform: translateY(-1px); }
.bottom-nav-fab {
  width: 54px; height: 54px; margin-top: -22px; align-self: center;
  border-radius: 50%; background: var(--jet); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; text-decoration: none; flex: 0 0 54px;
  box-shadow: 0 6px 16px rgba(29,155,216,.45);
  border: 4px solid var(--paper);
}
.bottom-nav-fab:active { transform: scale(.94); color:#fff; }
.bottom-nav-fab:hover { color: #fff; }

/* ---------- cards / stats ---------- */
.card { border: 0; border-radius: var(--radius); box-shadow: 0 2px 10px rgba(13,43,69,.06); }
.stat-card { border-left: 4px solid var(--jet); }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; color: var(--ink); }
.stat-card .stat-label { font-size: .78rem; color: #7b8794; text-transform: uppercase; letter-spacing: .5px; }
.stat-card.danger { border-left-color: var(--unpaid); }
.stat-card.success { border-left-color: var(--paid); }
.stat-card.warning { border-left-color: #d9a106; }

/* ---------- tables -> cards on mobile ---------- */
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: #7b8794; border-bottom-width: 1px; }
.table tbody td { vertical-align: middle; }
@media (max-width: 767.98px) {
  .table-mobile thead { display: none; }
  .table-mobile tbody tr {
    display: block; background: #fff; border-radius: var(--radius);
    margin-bottom: .75rem; padding: .75rem .9rem;
    box-shadow: 0 2px 8px rgba(13,43,69,.06); border: 0;
  }
  .table-mobile tbody td {
    display: flex; justify-content: space-between; align-items: center;
    border: 0; padding: .28rem 0; font-size: .9rem;
  }
  .table-mobile tbody td::before {
    content: attr(data-label);
    font-size: .7rem; text-transform: uppercase; letter-spacing: .5px;
    color: #8795a5; font-weight: 600; margin-right: 1rem;
  }
  .table-mobile tbody td.td-actions { justify-content: flex-end; gap: .35rem; }
  .table-mobile tbody td.td-actions::before { content: none; }
}

/* ---------- buttons ---------- */
.btn-jet { background: var(--jet); border-color: var(--jet); color: #fff; }
.btn-jet:hover { background: #1788bf; border-color: #1788bf; color: #fff; }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); color: #fff; }

/* ---------- invoice preview (mirrors the PDF) ---------- */
.invoice-sheet {
  background: #fff; max-width: 900px; margin: 0 auto;
  padding: clamp(16px, 4vw, 48px);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(13,43,69,.10);
}
.inv-status {
  display: inline-block; padding: .35rem 1.6rem; color: #fff;
  font-weight: 600; font-size: .8rem; letter-spacing: .5px;
}
.inv-status.unpaid, .inv-status.declined { background: var(--unpaid); }
.inv-status.paid, .inv-status.accepted { background: var(--paid); }
.inv-status.partial { background: #d9a106; }
.inv-status.draft, .inv-status.sent, .inv-status.cancelled { background: #5b6b7c; }
.inv-titlebar { background: #ececec; padding: .55rem .9rem; font-size: 1.25rem; font-weight: 700; }
.inv-subbar { background: #f3f3f3; padding: .35rem .9rem; font-size: .85rem; }
.inv-table th { background: #ececec; font-size: .85rem; }
.inv-table td, .inv-table th { border: 1px solid #d9dee4; padding: .5rem .75rem; }
.inv-bank-box { border: 1.5px solid #222; padding: 1rem 1.25rem; max-width: 420px; font-size: .9rem; }
.inv-bank-box .red { color: var(--unpaid); }

/* ---------- line item rows in editor ---------- */
.line-row { background: #fff; border-radius: 10px; }
@media (max-width: 767.98px) {
  .line-row { box-shadow: 0 2px 8px rgba(13,43,69,.06); padding: .75rem; margin-bottom: .75rem; }
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 55%, var(--jet) 140%);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 400px; border-radius: 18px; }

/* ---------- more page grid ---------- */
.more-grid a {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  background: #fff; border-radius: var(--radius); padding: 1.25rem .5rem;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .85rem;
  box-shadow: 0 2px 8px rgba(13,43,69,.06);
}
.more-grid a i { font-size: 1.6rem; color: var(--jet); }
.more-grid a:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
