/* ============================================================
   FREAK CARD — Brand theme
   Aligned with freakminimalism: dark editorial, cyan accent,
   Quicksand, 1px borders, subtle shadows.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --bg-elevated: #141414;
  --bg-alert: rgba(0, 0, 0, 0.9);

  /* Borders */
  --border: #242424;
  --border-strong: #2e2e2e;
  --border-muted: #1a1a1a;
  --border-hover: #3a3a3a;
  --border-secondary: #7f7f7f;

  /* Text */
  --text: #e5e1f2;
  --text-strong: #ffffff;
  --text-default: #ededed;
  --text-muted: #a1a1a1;
  --text-subtle: #7f7f7f;
  --text-faint: #666666;

  /* Accent — cyan/teal brand gradient */
  --accent-from: #00b4db;
  --accent-to: #0083b0;
  --accent-hover-from: #00a1ce;
  --accent-hover-to: #007195;
  --accent: #00b4db;
  --accent-soft: #4fbbd6;
  --accent-glow: rgba(0, 179, 255, 0.45);

  /* States */
  --success: #2ecc71;
  --warning-bg: #241f12;
  --warning-border: #f0b429;
  --warning-text: #f7d37a;
  --info-bg: #0f1e2e;
  --info-border: #1d3a56;
  --info-text: #8ec5ff;
  --danger: #e53e3e;
  --danger-soft: #ff5e5e;

  /* Channel colors (kept consistent with brand external links) */
  --whatsapp: #128c7e;
  --whatsapp-hover: #0f6f63;

  /* Shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.55);

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 72px;
  --max-content: 1200px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 150ms var(--ease);
  --t: 200ms var(--ease);
  --t-slow: 400ms var(--ease);
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: #000;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.78)),
    url('../images/fundo.jpeg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  visibility: hidden;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--text-default);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--text-strong);
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.875rem, 1.5rem + 1.5vw, 2.5rem); font-weight: 500; }
h2 { font-size: 1.625rem; font-weight: 500; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 var(--space-3); }

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.app {
  min-height: 100vh;
  display: flex;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  padding: var(--space-6) var(--space-7);
  max-width: var(--max-content);
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .app-main { margin-left: 0; }
  .app-content { padding: var(--space-5); }
}

@media (max-width: 640px) {
  .app-content { padding: var(--space-4); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1;
  transition: all var(--t);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Keyboard focus — only shown on keyboard navigation, not mouse clicks */
.btn:focus-visible,
.chip:focus-visible,
.nav-item:focus-visible,
.logout-btn:focus-visible,
.lang-switch button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background: linear-gradient(to right, var(--accent-from), var(--accent-to));
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(to right, var(--accent-hover-from), var(--accent-hover-to));
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-strong);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-default);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-secondary);
  color: var(--text-strong);
}

.btn-outline {
  background: transparent;
  color: var(--text-strong);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(229, 62, 62, 0.12);
  color: var(--danger-soft);
  border-color: rgba(229, 62, 62, 0.28);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(229, 62, 62, 0.22);
  color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #d4d4d4;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.input,
input[type="text"].input,
input[type="email"].input,
input[type="password"].input,
input[type="number"].input,
input[type="tel"].input,
input[type="search"].input,
input[type="date"].input,
input[type="url"].input,
textarea.input,
select.input {
  width: 100%;
  background: var(--bg-secondary);
  color: var(--text-default);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  appearance: none;
}

.input::placeholder { color: var(--text-faint); }

.input:hover { border-color: var(--border-hover); }

.input:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(79, 187, 214, 0.18);
}

.input:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Override Chrome's yellow autofill background */
.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus,
.input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--text-strong) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-tertiary) inset !important;
  caret-color: var(--text-strong);
  transition: background-color 9999s ease-in-out 0s;
}

textarea.input {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
  line-height: 1.55;
}

select.input {
  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 fill='%23a1a1a1' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.input-icon {
  position: relative;
}

/* Critical: keep text clear of the absolutely-positioned icon. !important defeats any
   deeper-specificity selector (e.g. autofill shadow rules) trying to reset padding. */
.input-icon .input,
.input-icon input.input,
.input-icon > input {
  padding-left: 44px !important;
}

/* Right-side trailing icon (e.g. eye toggle) gets matching room */
.input-icon .input[data-trailing],
.input-icon .input.has-trailing {
  padding-right: 44px !important;
}

.input-icon > i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
  z-index: 2;
}

.form-help {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-error {
  display: block;
  font-size: 12.5px;
  color: var(--danger-soft);
  margin-top: 6px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: var(--text-default);
}

.checkbox input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  display: inline-grid;
  place-content: center;
  transition: all var(--t-fast);
}

.checkbox input[type="checkbox"]:checked {
  background: linear-gradient(to right, var(--accent-from), var(--accent-to));
  border-color: var(--accent);
}

.checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--t), box-shadow var(--t);
}

.card:hover {
  border-color: var(--border-hover);
}

.card-elevated {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-header h2,
.card-header h3 { margin: 0; }

.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--bg-tertiary);
  color: var(--text-default);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge-accent {
  background: linear-gradient(to right, var(--accent-from), var(--accent-to));
  color: #fff;
  border-color: transparent;
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-color: rgba(240, 180, 41, 0.4);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-color: var(--info-border);
}

.badge-danger {
  background: rgba(229, 62, 62, 0.15);
  color: var(--danger-soft);
  border-color: rgba(229, 62, 62, 0.4);
}

.badge-success {
  background: rgba(46, 204, 113, 0.15);
  color: #5dd896;
  border-color: rgba(46, 204, 113, 0.35);
}

/* ---------- Notice / alerts ---------- */
.notice {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  font-size: 14px;
  color: var(--text-default);
}

.notice i { font-size: 18px; margin-top: 2px; }

.notice-info {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.notice-warning {
  background: var(--warning-bg);
  border-color: rgba(240, 180, 41, 0.4);
  color: var(--warning-text);
}

.notice-danger {
  background: rgba(229, 62, 62, 0.08);
  border-color: rgba(229, 62, 62, 0.4);
  color: var(--danger-soft);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
  transition: transform var(--t);
}

.sidebar-brand {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-brand-logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-brand-logo svg { width: 100%; height: 100%; }

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-text .brand-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-strong);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}

.sidebar-brand-text .brand-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.sidebar-user {
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.user-meta { min-width: 0; flex: 1; }

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-tier {
  font-size: 11px;
  color: var(--accent-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.sidebar-section { display: flex; flex-direction: column; gap: 2px; }

.sidebar-section-title {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-subtle);
  text-transform: uppercase;
  padding: 0 var(--space-3) var(--space-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-default);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 180, 219, 0.14), rgba(0, 131, 176, 0.04));
  color: var(--text-strong);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: linear-gradient(to bottom, var(--accent-from), var(--accent-to));
  border-radius: var(--radius-full);
}

.nav-icon {
  width: 18px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

.nav-text { flex: 1; }

.nav-badge {
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.04em;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.lang-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.lang-switch button {
  flex: 1;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  transition: all var(--t-fast);
}

.lang-switch button:hover { color: var(--text-default); }

.lang-switch button.active {
  background: linear-gradient(to right, var(--accent-from), var(--accent-to));
  color: #fff;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 9px var(--space-3);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast);
  width: 100%;
}

.logout-btn:hover {
  background: rgba(229, 62, 62, 0.12);
  color: var(--danger-soft);
}

.menu-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-strong);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  z-index: 40;
}

@media (max-width: 1024px) {
  .menu-toggle { display: inline-flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { opacity: 1; pointer-events: auto; }
}

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.page-header h1 { margin: 0; }

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.page-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

@media (max-width: 1024px) {
  .page-header { padding-left: 56px; }
}

/* ---------- Member card ---------- */
.member-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1.586 / 1; /* ISO 7810 ID-1 */
  border-radius: 16px;
  background:
    radial-gradient(circle at 80% 20%, rgba(0, 180, 219, 0.35), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(0, 131, 176, 0.4), transparent 55%),
    linear-gradient(135deg, #050505, #1a1a1a);
  border: 1px solid var(--border-hover);
  padding: 22px 24px;
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: 'Quicksand', sans-serif;
}

.member-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 6px
    );
  pointer-events: none;
}

.member-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 1;
}

.member-card-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-card-brand svg { width: 28px; height: 28px; }

.member-card-brand .brand-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.member-card-tier {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-soft);
  padding: 4px 10px;
  border: 1px solid rgba(79, 187, 214, 0.4);
  border-radius: var(--radius-full);
}

.member-card-chip {
  width: 42px;
  height: 32px;
  border-radius: 5px;
  background:
    repeating-linear-gradient(0deg, #d4af37, #d4af37 3px, #c79a30 3px, #c79a30 6px),
    linear-gradient(135deg, #f3d676, #c79a30);
  position: relative;
  z-index: 1;
}

.member-card-number {
  font-family: 'Courier New', monospace;
  font-size: 18px;
  letter-spacing: 3px;
  color: #fff;
  z-index: 1;
}

.member-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.member-card-label {
  color: var(--text-subtle);
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.18em;
  margin-bottom: 3px;
}

.member-card-value {
  color: #fff;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Card flip variant */
.card-flip {
  perspective: 1200px;
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1.586 / 1;
}

.card-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease);
}

/* Hover-flip only on devices with a real pointer; touch screens use the click handler. */
.card-flip.flipped .card-flip-inner { transform: rotateY(180deg); }
@media (hover: hover) {
  .card-flip:hover .card-flip-inner { transform: rotateY(180deg); }
}

.card-flip-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  overflow: hidden;
}

.card-flip-back { transform: rotateY(180deg); }

/* ---------- Stat tiles ---------- */
.stat {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--t);
}

.stat:hover { border-color: var(--border-hover); }

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-trend {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: #5dd896; }
.stat-trend.down { color: var(--danger-soft); }

.stat-icon {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--accent-soft);
  font-size: 14px;
  background: rgba(79, 187, 214, 0.08);
  border-radius: var(--radius);
}

.stat { position: relative; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-auto-lg { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Lists / rows ---------- */
.list { display: flex; flex-direction: column; }

.list-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.list-row:last-child { border-bottom: 0; }

.list-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  display: grid;
  place-items: center;
  color: var(--accent-soft);
  font-size: 14px;
  flex-shrink: 0;
}

.list-main { flex: 1; min-width: 0; }
.list-title { color: var(--text-strong); font-size: 14px; font-weight: 500; }
.list-meta { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.list-trail { color: var(--text-default); font-size: 13.5px; font-weight: 500; }

/* ---------- Auth shell ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-5);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-7);
  box-shadow: var(--shadow-xl);
}

.auth-brand {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-brand svg {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-3);
}

.auth-brand .auth-name {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 500;
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 500;
  margin: 6px 0 4px;
  letter-spacing: -0.01em;
}

.auth-brand p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: 11px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin: var(--space-5) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-foot {
  text-align: center;
  margin-top: var(--space-5);
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-foot a {
  color: var(--accent-soft);
  font-weight: 500;
}

.auth-foot a:hover { color: var(--text-strong); }

/* ---------- Tags / chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-default);
  cursor: pointer;
  transition: all var(--t-fast);
}

.chip:hover { border-color: var(--border-hover); }

.chip.active {
  background: linear-gradient(to right, var(--accent-from), var(--accent-to));
  border-color: transparent;
  color: #fff;
}

/* ---------- Tables ---------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border);
}

table.data tbody td {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-muted);
  color: var(--text-default);
}

table.data tbody tr:hover { background: rgba(255, 255, 255, 0.02); }

/* ---------- Footer ---------- */
.app-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-6) var(--space-5);
  margin-top: var(--space-7);
}

.app-footer-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 12.5px;
  letter-spacing: 0.06em;
}

.footer-brand svg { width: 24px; height: 24px; }

.footer-links {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.footer-links a:hover { color: var(--text-strong); }

.footer-social {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.footer-social a {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  opacity: 0.65;
  transition: opacity var(--t-fast);
}

.footer-social a:hover { opacity: 1; }

.footer-social img { width: 100%; height: 100%; }

.footer-trademark {
  font-size: 11.5px;
  color: var(--text-subtle);
  letter-spacing: 0.08em;
}

/* ---------- QR placeholder ---------- */
.qr-frame {
  background: #fff;
  border-radius: var(--radius);
  padding: var(--space-3);
  display: grid;
  place-items: center;
  width: fit-content;
}

.qr-frame img,
.qr-frame canvas { display: block; }

/* ---------- Loading / skeleton ---------- */
.skel {
  background: linear-gradient(90deg, #141414 0%, #1f1f1f 50%, #141414 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: var(--space-5);
  z-index: 100;
  animation: fadeIn var(--t);
}

.modal {
  width: 100%;
  max-width: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: popIn var(--t);
}

.modal-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body { padding: var(--space-5); }

.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* ---------- Toast notifications ---------- */
.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  max-width: 360px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: slideIn var(--t);
}

.toast-success { border-left-color: #5dd896; }
.toast-error { border-left-color: var(--danger-soft); }
.toast-info { border-left-color: var(--accent); }
.toast-warning { border-left-color: var(--warning-border); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Glow title (brand flourish) ---------- */
.glow-title {
  color: #fff;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.4),
    0 0 18px rgba(0, 179, 255, 0.45);
  animation: glow-pulse 2.8s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { text-shadow: 0 0 6px rgba(255, 255, 255, 0.55), 0 0 18px rgba(0, 179, 255, 0.4); }
  50% { text-shadow: 0 0 4px rgba(255, 255, 255, 0.75), 0 0 28px rgba(0, 179, 255, 0.6); }
}

@media (prefers-reduced-motion: reduce) {
  .glow-title { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

/* ---------- Animations ---------- */
.fade-in { animation: fadeIn var(--t-slow); }
.slide-up { animation: slideUp var(--t-slow); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
