/* ==========================================================================
   Qrios Helper — theme v2
   Brand-locked palette (Light Green #18C67F / Dark Green #00331E /
   Regular Green #006941 / Vanilla #FFF6E5), executed with more confidence:
   a tighter type scale, a real elevation system, and one signature move
   (the pulsing signal ring on the logo mark) instead of scattered effects.
   ========================================================================== */

:root {
  --brand-light-green:   #18C67F;
  --brand-dark-green:    #00331E;
  --brand-regular-green: #006941;
  --brand-vanilla:       #FFF6E5;
  --brand-black:         #000000;
  --brand-white:         #FFFFFF;

  --ink:         var(--brand-dark-green);
  --ink-muted:   #4E5F55;
  --paper:       var(--brand-vanilla);
  --surface:     var(--brand-white);
  --border:      #E6DBC2;
  --signal:      var(--brand-light-green);
  --signal-hover: #14A96D;
  --signal-dim:  #E1F6EC;
  --signal-ink:  var(--brand-regular-green);

  --success: var(--brand-regular-green);
  --danger:  #B3382C;
  --warning: #A9720A;
  --info:    #245E82;

  --font-display: "Noto Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Noto Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;

  --shadow-sm: 0 1px 2px rgba(0,51,30,0.06);
  --shadow-md: 0 6px 20px rgba(0,51,30,0.10);
  --shadow-lg: 0 16px 40px rgba(0,51,30,0.16);

  --bs-primary: var(--signal);
  --bs-primary-rgb: 24, 198, 127;
  --bs-success: var(--success);
  --bs-success-rgb: 0, 105, 65;
  --bs-danger: var(--danger);
  --bs-danger-rgb: 179, 56, 44;
  --bs-warning: var(--warning);
  --bs-warning-rgb: 169, 114, 10;
  --bs-secondary: var(--ink-muted);
  --bs-secondary-rgb: 78, 95, 85;
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-font-family: var(--font-body);
  --bs-border-color: var(--border);
  --bs-border-radius: 10px;
  --bs-border-radius-sm: 8px;
  --bs-border-radius-lg: 14px;
  --bs-link-color: var(--signal-ink);
  --bs-link-hover-color: var(--ink);
}

@media (prefers-reduced-motion: no-preference) {
  body { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-body);
  font-feature-settings: "tnum" 1; /* tabular numerals for amounts/tables */
}

h1, h2, h3, h4, h5, h6, .card-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h3 { font-size: 1.55rem; }

code, .mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================================
   Navbar — crisp boundary, not a blur effect. The rule line is real
   structure: it's the edge between "chrome" and "content."
   ========================================================================== */
.navbar {
  background: var(--brand-dark-green) !important;
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--signal);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ---- Signature element: the pulsing signal ring ----
   One deliberate, restrained animation tied to the brand's actual
   meaning (connectivity). Fires a few times on load, then rests. */
.brand-mark-wrap {
  position: relative;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark-wrap img {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}
.brand-mark-wrap::before,
.brand-mark-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--signal);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .brand-mark-wrap::before {
    animation: signal-ring 3.2s ease-out 0.2s 3;
  }
  .brand-mark-wrap::after {
    animation: signal-ring 3.2s ease-out 1.6s 3;
  }
}
@keyframes signal-ring {
  0%   { transform: scale(0.7); opacity: 0.55; }
  70%  { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}

.navbar .nav-link {
  color: rgba(255,255,255,0.72) !important;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.42rem 0.8rem !important;
  border-radius: 8px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.navbar .nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.navbar-text { color: rgba(255,255,255,0.62) !important; font-size: 0.85rem; }

.navbar .dropdown-menu {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: 10px;
}

/* ==========================================================================
   Cards — a real elevation system (rest / hover), functional accent bar
   instead of decorative gradient wash.
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-body { padding: 1.3rem; }
.card-title { font-size: 1.05rem; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem; }

/* Optional accent bar for stat/summary cards — apply .card--accent */
.card--accent {
  border-top: 3px solid var(--signal);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--signal-dim);
  color: var(--signal-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 18px; height: 18px; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table { --bs-table-bg: transparent; }
.table thead th {
  font-family: var(--font-display);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border-bottom-width: 2px;
  border-bottom-color: var(--border);
  font-weight: 700;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-accent-bg: rgba(0,51,30,0.025);
}
.table td, .table th { vertical-align: middle; }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
  font-weight: 600;
  font-size: 0.74rem;
  padding: 0.42em 0.7em;
  border-radius: 6px;
  letter-spacing: 0.01em;
}

/* ==========================================================================
   Buttons — solid, confident fills. No gradients: the brand doesn't use
   them, and reaching for one here would be a default, not a choice.
   ========================================================================== */
.btn {
  font-weight: 600;
  border-radius: var(--bs-border-radius);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--signal-hover);
  --bs-btn-hover-border-color: var(--signal-hover);
}
.btn-primary:active { transform: translateY(1px); }
.btn-outline-primary {
  --bs-btn-color: var(--signal-ink);
  --bs-btn-border-color: var(--signal);
  --bs-btn-hover-bg: var(--signal);
  --bs-btn-hover-border-color: var(--signal);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 8px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 0.2rem var(--signal-dim);
}

/* ==========================================================================
   Toasts
   ========================================================================== */
#toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(360px, calc(100vw - 2rem));
}

.qr-toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ink-muted);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 0.9rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(16px);
  animation: toast-in 0.25s ease forwards;
}
@media (prefers-reduced-motion: reduce) {
  .qr-toast { transform: none; animation: toast-in-reduced 0.2s ease forwards; }
}
@keyframes toast-in { to { opacity: 1; transform: translateX(0); } }
@keyframes toast-in-reduced { to { opacity: 1; } }
.qr-toast.is-leaving { animation: toast-out 0.2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

.qr-toast--success { border-left-color: var(--success); }
.qr-toast--danger  { border-left-color: var(--danger); }
.qr-toast--warning { border-left-color: var(--warning); }
.qr-toast--info,
.qr-toast--secondary { border-left-color: var(--info); }

.qr-toast__icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 0.1rem; }
.qr-toast--success .qr-toast__icon { color: var(--success); }
.qr-toast--danger .qr-toast__icon { color: var(--danger); }
.qr-toast--warning .qr-toast__icon { color: var(--warning); }
.qr-toast--info .qr-toast__icon,
.qr-toast--secondary .qr-toast__icon { color: var(--info); }

.qr-toast__body { font-size: 0.875rem; color: var(--ink); flex: 1; line-height: 1.4; }
.qr-toast__close { background: none; border: none; color: var(--ink-muted); cursor: pointer; padding: 0; line-height: 1; font-size: 1.1rem; }
.qr-toast__close:hover { color: var(--ink); }
.qr-toast__progress { position: absolute; bottom: 0; left: 0; height: 3px; background: currentColor; opacity: 0.25; animation: toast-progress linear forwards; }
@keyframes toast-progress { from { width: 100%; } to { width: 0%; } }
@media (prefers-reduced-motion: reduce) { .qr-toast__progress { display: none; } }
