:root {
  --app-primary: #2563eb;
  --app-primary-dark: #1d4ed8;
  --app-ink: #172033;
  --app-muted: #64748b;
  --app-border: #e2e8f0;
  --app-surface: #ffffff;
  --app-bg: #f4f7fb;
}

* { box-sizing: border-box; }

body.app-body {
  min-height: 100vh;
  color: var(--app-ink);
  background:
    radial-gradient(circle at 0 0, rgba(37, 99, 235, .08), transparent 26rem),
    var(--app-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-navbar {
  background: rgba(15, 23, 42, .96);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 8px 28px rgba(15, 23, 42, .14);
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  border-radius: .8rem;
  box-shadow: 0 8px 20px rgba(37, 99, 235, .35);
}

.brand-copy { line-height: 1.05; }
.brand-copy small { color: #94a3b8; font-size: .68rem; font-weight: 500; letter-spacing: .02em; }

.app-navbar .nav-link {
  color: #cbd5e1;
  border-radius: .65rem;
  font-size: .88rem;
  font-weight: 650;
  padding: .55rem .8rem !important;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .1); }

.language-button {
  color: #fff;
  background: #2563eb;
  border: 1px solid #60a5fa;
  box-shadow: 0 7px 18px rgba(37, 99, 235, .28);
}

.language-button:hover, .language-button:focus { color: #fff; background: #1d4ed8; border-color: #93c5fd; }
.language-code { display: inline-grid; place-items: center; min-width: 1.85rem; height: 1.45rem; border-radius: .4rem; background: rgba(255,255,255,.12); font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
.language-globe { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border: 1px solid currentColor; border-radius: 50%; font-size: .72rem; font-weight: 800; }

.page-shell { padding-top: 2rem; padding-bottom: 3rem; }
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1 { font-size: clamp(1.55rem, 2.5vw, 2.15rem); font-weight: 750; letter-spacing: -.035em; }
.page-heading p { color: var(--app-muted); margin-bottom: 0; }

.card {
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 1.1rem;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .06) !important;
}

.card-body { padding: clamp(1rem, 2.5vw, 1.5rem); }
.filter-card { background: rgba(255, 255, 255, .76); backdrop-filter: blur(12px); }

.btn { border-radius: .72rem; font-weight: 650; padding: .62rem .95rem; }
.btn-sm { border-radius: .55rem; padding: .38rem .65rem; }
.btn-primary { background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark)); border: 0; box-shadow: 0 8px 18px rgba(37, 99, 235, .2); }
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); transform: translateY(-1px); }

.form-control, .form-select {
  min-height: 2.75rem;
  border-color: var(--app-border);
  border-radius: .72rem;
  box-shadow: none;
}
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 .22rem rgba(37, 99, 235, .1); }
.form-label { color: #475569; font-size: .83rem; font-weight: 700; }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .82rem .75rem; border-bottom-color: #edf2f7; }
.table thead th { color: #64748b; background: #f8fafc; border-bottom-width: 1px; font-size: .72rem; letter-spacing: .045em; text-transform: uppercase; white-space: nowrap; }
.table tbody tr { transition: background .15s ease; }
.table tbody tr:hover { --bs-table-accent-bg: #f8fbff; }

.metric-card { overflow: hidden; position: relative; }
.metric-card::after { content: ""; position: absolute; width: 9rem; height: 9rem; right: -4rem; top: -4rem; border-radius: 50%; background: rgba(37, 99, 235, .08); }
.metric-label { color: var(--app-muted); font-size: .78rem; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.metric-value { font-size: 2rem; font-weight: 780; letter-spacing: -.05em; }

.status-badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .32rem .58rem; font-size: .75rem; font-weight: 700; }
.status-badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; }
.status-active { color: #047857; background: #ecfdf5; }
.status-blocked { color: #b91c1c; background: #fef2f2; }
.status-locked { color: #6b7280; background: #f1f5f9; }

.lock-notice { color: #1e40af; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: .9rem; }
.lock-icon { display: inline-grid; flex: 0 0 auto; width: 1.7rem; height: 1.7rem; place-items: center; color: #fff; background: #2563eb; border-radius: 50%; font-size: .8rem; font-weight: 800; }

.entry-total { border: 1px solid #bfdbfe; background: linear-gradient(135deg, #eff6ff, #f8fbff); border-radius: .9rem; }
.location-panel { border: 1px dashed #cbd5e1 !important; background: #f8fafc; border-radius: .9rem !important; }

.qr-access-page { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.qr-access-card { width: min(100%, 520px); overflow: hidden; background: #fff; border-radius: 1.4rem; box-shadow: 0 26px 70px rgba(15, 23, 42, .18); }
.qr-access-head { padding: 2rem 1.5rem; color: #fff; text-align: center; background: linear-gradient(145deg, #0f172a, #1d4ed8); }
.qr-access-head h1 { margin: .5rem 0 .25rem; font-size: clamp(1.55rem, 6vw, 2.1rem); font-weight: 800; letter-spacing: -.03em; }
.qr-access-head p { margin: 0; color: #dbeafe; }
.qr-access-body { padding: clamp(1.4rem, 5vw, 2.25rem); }
.qr-access-body h2 { margin-bottom: .2rem; font-size: 1.25rem; font-weight: 800; }
.gps-state { display: flex; align-items: center; gap: .55rem; color: #64748b; font-size: .82rem; }
.gps-dot { width: .65rem; height: .65rem; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 .25rem #f1f5f9; }
.gps-ready { color: #047857; }.gps-ready .gps-dot { background: #10b981; box-shadow: 0 0 0 .25rem #d1fae5; }
.gps-warning { color: #b45309; }.gps-warning .gps-dot { background: #f59e0b; box-shadow: 0 0 0 .25rem #fef3c7; }

.modal-content { border: 0; border-radius: 1.15rem; box-shadow: 0 24px 70px rgba(15, 23, 42, .2); }
.modal-header, .modal-footer { border-color: #eef2f7; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-shell { width: min(100%, 980px); overflow: hidden; border-radius: 1.4rem; background: #fff; box-shadow: 0 28px 75px rgba(15, 23, 42, .16); }
.login-visual { min-height: 560px; padding: 3.2rem; color: #fff; background: linear-gradient(145deg, #0f172a 0%, #172554 55%, #1d4ed8 130%); position: relative; overflow: hidden; }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); }
.login-visual::before { width: 24rem; height: 24rem; right: -10rem; top: -8rem; }
.login-visual::after { width: 16rem; height: 16rem; left: -8rem; bottom: -7rem; }
.login-form-panel { padding: clamp(2rem, 6vw, 4rem); }
.login-language-picker { padding: .9rem; background: #f8fafc; border: 1px solid #dbe4f0; border-radius: .9rem; }
.language-picker-title { display: flex; align-items: center; gap: .45rem; margin-bottom: .7rem; color: #475569; font-size: .78rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.language-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.language-option { display: flex; align-items: center; gap: .5rem; min-height: 2.65rem; padding: .5rem .65rem; color: #334155; background: #fff; border: 1px solid #dbe4f0; border-radius: .68rem; text-decoration: none; transition: all .16s ease; }
.language-option strong { display: grid; place-items: center; min-width: 1.8rem; height: 1.55rem; color: #475569; background: #eef2f7; border-radius: .4rem; font-size: .7rem; letter-spacing: .04em; }
.language-option span { overflow: hidden; font-size: .82rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.language-option:hover { color: #1d4ed8; border-color: #93c5fd; transform: translateY(-1px); }
.language-option.active { color: #fff; background: linear-gradient(135deg, #2563eb, #1d4ed8); border-color: #2563eb; box-shadow: 0 7px 16px rgba(37, 99, 235, .2); }
.language-option.active strong { color: #1d4ed8; background: #fff; }

@media (max-width: 991.98px) {
  .app-navbar .navbar-collapse { padding-top: .8rem; }
  .app-navbar .navbar-nav { gap: .25rem !important; }
}

@media (max-width: 767.98px) {
  .page-shell { padding-top: 1.25rem; }
  .login-visual { min-height: 220px; padding: 2rem; }
  .login-visual .display-6 { font-size: 1.65rem; }
  .table > :not(caption) > * > * { padding: .7rem .55rem; }
}
