/* CashProof.app — Global dark premium theme */

:root {
  --cp-teal: #0d9488;
  --cp-cyan: #0891b2;
  --cp-bg: #0f172a;
  --cp-bg2: #1e293b;
  --cp-card: rgba(255,255,255,.05);
  --cp-card-border: rgba(255,255,255,.1);
  --cp-text: #e2e8f0;
  --cp-heading: #ffffff;
  --cp-muted: #94a3b8;
  --cp-body: #cbd5e1;
  --cp-border: #334155;
  --cp-input-bg: #0f172a;
  --cp-teal-glow: rgba(13,148,136,.25);
  --cp-teal-light: #5eead4;
  --cp-white05: rgba(255,255,255,.05);
  --cp-white10: rgba(255,255,255,.1);
  --cp-white15: rgba(255,255,255,.15);
}

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

body {
  background: var(--cp-bg);
  color: var(--cp-body);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cp-teal-light); text-decoration: none; }
a:hover { color: #99f6e4; }

/* ── Nav ───────────────────────────────────────── */
.cp-nav {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid var(--cp-white10);
  background: rgba(15,23,42,.85);
  backdrop-filter: blur(12px);
}
.cp-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; max-width: 1100px; margin: 0 auto; padding: 0 20px;
}
.cp-nav-logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff;
}
.cp-nav-icon {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--cp-teal), var(--cp-cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .8rem; color: #fff;
  box-shadow: 0 4px 12px var(--cp-teal-glow);
}
.cp-nav-title { font-size: .9rem; font-weight: 700; color: #fff; }
.cp-nav-sub { font-size: .7rem; color: var(--cp-muted); }
.cp-nav-links {
  display: flex; align-items: center; gap: 8px;
}
.cp-nav-links a {
  color: var(--cp-body); font-size: .85rem; font-weight: 500;
  padding: 6px 14px; border-radius: 10px; transition: all .2s;
  text-decoration: none;
}
.cp-nav-links a:hover { color: #fff; background: var(--cp-white05); }
.cp-nav-links a.active { color: var(--cp-teal-light); background: rgba(13,148,136,.1); }

/* ── Buttons ───────────────────────────────────── */
.btn-cp {
  display: inline-block; padding: 10px 22px; border-radius: 12px;
  font-weight: 700; font-size: .9rem; transition: all .2s;
  cursor: pointer; border: none; text-align: center; text-decoration: none;
}
.btn-cp-primary {
  background: linear-gradient(135deg, var(--cp-teal), var(--cp-cyan));
  color: #fff; box-shadow: 0 4px 16px var(--cp-teal-glow);
}
.btn-cp-primary:hover {
  transform: translateY(-1px); box-shadow: 0 8px 24px var(--cp-teal-glow); color: #fff;
}
.btn-cp-ghost {
  border: 1px solid var(--cp-white15); color: var(--cp-text);
  background: transparent;
}
.btn-cp-ghost:hover { background: var(--cp-white05); color: #fff; }
.btn-cp-danger {
  border: 1px solid rgba(239,68,68,.3); color: #fca5a5;
  background: rgba(239,68,68,.1);
}
.btn-cp-danger:hover { background: rgba(239,68,68,.2); color: #fecaca; }
.btn-cp-sm { padding: 6px 14px; font-size: .8rem; border-radius: 10px; }
.btn-cp-w100 { width: 100%; }

/* ── Cards ─────────────────────────────────────── */
.cp-card {
  background: var(--cp-card); border: 1px solid var(--cp-card-border);
  border-radius: 18px; padding: 24px; margin-bottom: 16px;
}
.cp-card h5 { color: var(--cp-heading); font-weight: 700; margin-bottom: 16px; }

/* ── Forms ─────────────────────────────────────── */
.cp-label { display: block; font-weight: 600; font-size: .85rem; color: var(--cp-body); margin-bottom: 6px; }
.cp-input {
  width: 100%; padding: 10px 14px; border-radius: 12px;
  background: var(--cp-input-bg); border: 1px solid var(--cp-border);
  color: var(--cp-text); font-size: .9rem; transition: border-color .2s;
}
.cp-input:focus { outline: none; border-color: var(--cp-teal); box-shadow: 0 0 0 3px var(--cp-teal-glow); }
.cp-input::placeholder { color: var(--cp-muted); }
select.cp-input { appearance: none; cursor: pointer; }
.cp-form-text { font-size: .8rem; color: var(--cp-muted); margin-top: 4px; }
.cp-form-group { margin-bottom: 16px; }
.cp-checkbox { display: flex; align-items: center; gap: 8px; }
.cp-checkbox input[type="checkbox"] { accent-color: var(--cp-teal); width: 16px; height: 16px; }
.cp-checkbox label { font-size: .85rem; color: var(--cp-body); cursor: pointer; }

/* ── Info Box ──────────────────────────────────── */
.cp-info-box {
  background: rgba(13,148,136,.08); border: 1px solid rgba(13,148,136,.2);
  border-radius: 12px; padding: 12px 16px; font-size: .85rem; color: var(--cp-body);
}
.cp-info-box code { color: var(--cp-teal-light); font-weight: 700; background: transparent; }

/* ── Tables ────────────────────────────────────── */
.cp-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cp-table th {
  background: rgba(13,148,136,.12); color: var(--cp-teal-light);
  padding: 10px 12px; text-align: left; font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--cp-card-border);
}
.cp-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--cp-white05);
  color: var(--cp-body); vertical-align: middle;
}
.cp-table tr:hover { background: var(--cp-white05); }
.cp-table code { color: var(--cp-teal-light); background: transparent; font-size: .8rem; }

/* ── Badges ────────────────────────────────────── */
.cp-badge {
  display: inline-flex; padding: 3px 10px; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.cp-badge-ok { background: rgba(34,197,94,.15); color: #4ade80; }
.cp-badge-warn { background: rgba(234,179,8,.15); color: #facc15; }
.cp-badge-err { background: rgba(239,68,68,.15); color: #f87171; }
.cp-badge-info { background: rgba(8,145,178,.15); color: #67e8f9; }
.cp-badge-muted { background: var(--cp-white05); color: var(--cp-muted); }

/* ── Stat Cards ────────────────────────────────── */
.cp-stat {
  background: var(--cp-card); border: 1px solid var(--cp-card-border);
  border-radius: 16px; padding: 16px; text-align: center;
}
.cp-stat .num { font-size: 1.6rem; font-weight: 800; }
.cp-stat .label { font-size: .75rem; color: var(--cp-muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.cp-stat-teal .num { color: var(--cp-teal-light); }
.cp-stat-green .num { color: #4ade80; }
.cp-stat-red .num { color: #f87171; }
.cp-stat-yellow .num { color: #facc15; }

/* ── Usage Bars ────────────────────────────────── */
.cp-usage-bar { height: 6px; border-radius: 3px; background: var(--cp-white10); overflow: hidden; }
.cp-usage-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--cp-teal), var(--cp-cyan)); transition: width .3s; }

/* ── Plan Cards ────────────────────────────────── */
.cp-plan {
  border: 1px solid var(--cp-card-border); border-radius: 16px;
  padding: 24px; text-align: center; transition: all .2s;
  background: var(--cp-card);
  display: flex; flex-direction: column;
}
.cp-plan:hover { border-color: rgba(94,234,212,.3); transform: translateY(-2px); }
.cp-plan.featured {
  border-color: rgba(94,234,212,.4);
  background: linear-gradient(to bottom, rgba(13,148,136,.1), rgba(8,145,178,.05));
  box-shadow: 0 8px 32px rgba(13,148,136,.12);
}
.cp-plan.current { border-color: var(--cp-teal); }
.cp-plan h6 { color: var(--cp-heading); font-weight: 700; }
.cp-plan-price { font-size: 2.2rem; font-weight: 800; color: var(--cp-teal-light); margin: 12px 0; }
.cp-plan-price small { font-size: .9rem; color: var(--cp-muted); font-weight: 400; }
.cp-plan ul { list-style: none; padding: 0; margin: 16px 0 0; }
.cp-plan ul li {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; color: var(--cp-body); padding: 5px 0; text-align: left;
}
.cp-plan ul li::before {
  content: '✓'; font-size: .7rem; font-weight: 800; color: var(--cp-teal);
  flex-shrink: 0; line-height: 1;
}

/* ── Filter Bar ────────────────────────────────── */
.cp-filter-bar {
  background: var(--cp-card); border: 1px solid var(--cp-card-border);
  border-radius: 14px; padding: 14px 18px; margin-bottom: 16px;
}
.cp-filter-bar label { font-size: .8rem; font-weight: 600; color: var(--cp-muted); display: block; margin-bottom: 4px; }
.cp-filter-bar .cp-input { padding: 7px 12px; font-size: .85rem; }

/* ── Quick Buttons ─────────────────────────────── */
.cp-quick-btn {
  padding: 5px 14px; border-radius: 8px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--cp-white15); color: var(--cp-body);
  background: transparent; cursor: pointer; transition: all .2s;
}
.cp-quick-btn:hover { background: var(--cp-white05); color: #fff; }
.cp-quick-btn.active { background: var(--cp-teal); border-color: var(--cp-teal); color: #fff; }

/* ── Charts ────────────────────────────────────── */
.cp-chart { position: relative; height: 250px; }

/* ── Detail Rows ───────────────────────────────── */
.detail-row { display: none; }
.detail-row td { padding: 14px 20px !important; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-section h6 { font-weight: 700; color: var(--cp-teal-light); border-bottom: 1px solid var(--cp-white10); padding-bottom: 6px; margin-bottom: 8px; font-size: .85rem; }
.detail-denom { display: flex; justify-content: space-between; padding: 2px 0; font-size: .85rem; }

/* ── Discrepancy highlight ─────────────────────── */
.cp-table tr.discrepancy { background: rgba(239,68,68,.08); }
.cp-table tr.discrepancy:hover { background: rgba(239,68,68,.12); }

/* ── Centered page layout ─────────────────────── */
.cp-center {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
}
.cp-center-card {
  background: var(--cp-card); border: 1px solid var(--cp-card-border);
  border-radius: 20px; padding: 40px; max-width: 440px; width: 100%;
  backdrop-filter: blur(8px);
}
.cp-center-card.wide { max-width: 520px; }
.cp-center-card.x-wide { max-width: 640px; }

/* ── Brand header ──────────────────────────────── */
.cp-brand { text-align: center; margin-bottom: 28px; }
.cp-brand-icon {
  width: 48px; height: 48px; border-radius: 16px;
  background: linear-gradient(135deg, var(--cp-teal), var(--cp-cyan));
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #fff;
  box-shadow: 0 4px 16px var(--cp-teal-glow); margin-bottom: 12px;
}
.cp-brand h1 { font-size: 1.4rem; font-weight: 800; color: var(--cp-heading); }
.cp-brand p { color: var(--cp-muted); font-size: .9rem; margin-top: 4px; }

/* ── Content container ─────────────────────────── */
.cp-content { max-width: 700px; margin: 0 auto; padding: 24px 20px; }
.cp-content.narrow { max-width: 550px; }
.cp-content.wide { max-width: 1100px; }

/* ── Footer ────────────────────────────────────── */
.cp-footer {
  border-top: 1px solid var(--cp-white10);
  padding: 20px; text-align: center;
  font-size: .8rem; color: var(--cp-muted);
}
.cp-footer a { color: var(--cp-muted); margin: 0 6px; }
.cp-footer a:hover { color: #fff; }

/* ── Onboarding Steps ──────────────────────────── */
.cp-step {
  display: flex; align-items: center; gap: 16px;
  padding: 16px; border-radius: 14px; margin-bottom: 10px;
  transition: all .2s;
}
.cp-step:hover { background: var(--cp-white05); }
.cp-step-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.cp-step-done .cp-step-icon { background: rgba(34,197,94,.15); color: #4ade80; }
.cp-step-todo .cp-step-icon { background: var(--cp-white05); color: var(--cp-muted); }
.cp-step-current .cp-step-icon {
  background: linear-gradient(135deg, var(--cp-teal), var(--cp-cyan));
  color: #fff; box-shadow: 0 4px 12px var(--cp-teal-glow);
}
.cp-step h5 { margin: 0; font-weight: 700; font-size: .95rem; color: var(--cp-heading); }
.cp-step p { margin: 0; font-size: .85rem; color: var(--cp-muted); }

/* ── Alerts (for flash messages before toasts.js converts them) ── */
.alert { padding: 10px 16px; border-radius: 10px; font-size: .9rem; margin-bottom: 12px; }
.alert-success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.alert-danger { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.alert-warning { background: rgba(234,179,8,.12); color: #facc15; border: 1px solid rgba(234,179,8,.2); }
.alert-info { background: rgba(8,145,178,.12); color: #67e8f9; border: 1px solid rgba(8,145,178,.2); }

/* ── Grid helpers ──────────────────────────────── */
.cp-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cp-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.cp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cp-grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cp-row { display: flex; gap: 12px; }
.cp-row > * { flex: 1; }
.cp-flex-between { display: flex; justify-content: space-between; align-items: center; }

/* ── Language Switcher ─────────────────────────── */
.cp-lang a { color: var(--cp-muted); margin: 0 4px; font-size: .8rem; }
.cp-lang a:hover { color: #fff; }
.cp-lang a.active { color: var(--cp-teal-light); font-weight: 700; }

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .cp-grid-2, .cp-grid-3 { grid-template-columns: 1fr; }
  .cp-grid-4, .cp-grid-5 { grid-template-columns: 1fr 1fr; }
  .cp-nav-links { display: none; }
  .cp-stat .num { font-size: 1.3rem; }
  .cp-chart { height: 200px; }
  .cp-center-card { padding: 28px 20px; }
  .detail-grid { grid-template-columns: 1fr; }
  .cp-row { flex-direction: column; }

  /* Mobile touch targets */
  .btn-cp { min-height: 48px; }
  .btn-cp-sm { min-height: 44px; }
  .cp-input { min-height: 48px; font-size: 16px; } /* prevents iOS zoom */

  /* Mobile envelope cards */
  .cp-card { padding: 16px; }
  .cp-table td, .cp-table th { padding: 8px 10px; font-size: .8rem; }

  /* Sticky bottom action bar */
  .mobile-sticky { position: sticky; bottom: 0; background: linear-gradient(to top, var(--cp-bg) 80%, transparent); padding: 12px 0 4px; z-index: 10; }
}

/* ── Loading skeleton ──────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--cp-border) 25%, transparent 50%, var(--cp-border) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 6px;
  min-height: 20px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Mobile improvements for cash_count.html ───── */
@media (max-width: 576px) {
  .denom-row { grid-template-columns: 100px 1fr 70px !important; gap: 6px !important; }
  .denom-img-wrap img.banknote { width: 90px !important; }
  .denom-img-wrap img.coin-img { width: 60px !important; height: 60px !important; }
  .denom-input { font-size: 1.4rem !important; padding: 12px 8px !important; }
  .submit-btn { font-size: 1.1rem !important; padding: 16px !important; }
  .staff-btn { min-height: 48px !important; font-size: 1rem !important; }
}
