/* ============================================================
   styles.css — perabeats Card Log Design System
   Spec §5: Dark theme, brand tokens, Poppins + Inter
   ============================================================ */

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

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg-base: #0A0A0A;
  --bg-surface: #161616;
  --bg-surface-raised: #1F1F1F;
  --border-subtle: #2A2A2A;
  --text-primary: #F5F5F5;
  --text-secondary: #9CA3AF;
  --brand-red: #E4202C;
  --status-confirmed: #22C55E;
  --status-pending: #F5A623;
  --status-newbie: #A855F7;
  --status-neutral: #6B7280;
  --status-lost: #E4202C;
  --status-transfer: #3B82F6; /* blue — regular member-to-member transfers */

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.5);
  --transition: 0.18s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  /* pan-y: vertical scroll only, blocks horizontal pan + pinch-zoom */
  touch-action: pan-y;
  overflow-x: hidden;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.view {
  display: none;
  flex: 1;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Nav ─────────────────────────────────────────────────────── */
.app-nav {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 8px;
  /* No overflow:hidden here — that would clip the user dropdown that hangs below the nav */
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-logo img {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.nav-logo-text {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-logo-text span {
  color: var(--brand-red);
}

.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: var(--bg-surface-raised);
}

.nav-tab.active {
  color: var(--text-primary);
  background: var(--bg-surface-raised);
}

.nav-tab.active::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-red);
  border-radius: 2px 2px 0 0;
}

.nav-tab {
  position: relative;
}

.nav-badge {
  background: var(--brand-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 4px 12px 4px 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition);
  user-select: none;
}

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

/* ── User dropdown ───────────────────────────────────────── */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
  animation: fadeUp 0.15s ease;
  overflow: hidden;
}

.user-dropdown-info {
  padding: 14px 16px;
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
  text-align: left;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Login Screen ────────────────────────────────────────────── */
#view-login {
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 50% 0%, rgba(228, 32, 44, 0.08) 0%, transparent 65%);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.4s ease both;
}

.login-logo {
  height: 40px;   /* wordmark is wide — 40px height is enough */
  width: auto;
  max-width: 220px;
  margin: 0 auto 28px;
}

.login-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 32px;
}

#g-signin-btn {
  display: flex;
  justify-content: center;
}

/* Loading state shown while authCheck is in flight */
#login-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}
#login-loading.visible { display: flex; }
#login-loading .spinner {
  width: 28px;
  height: 28px;
  border-width: 2.5px;
}

.login-error {
  margin-top: 20px;
  background: rgba(228, 32, 44, 0.12);
  border: 1px solid rgba(228, 32, 44, 0.3);
  color: #F87171;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  display: none;
}

.login-error.visible {
  display: block;
}

/* ── Cards & Tables ─────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* Spacing between sibling cards is handled per-use-site via inline margin-top
   to avoid ghost gaps from display:none siblings matching the + combinator. */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.section-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.0625rem;
}

/* Device table */
.device-table {
  width: 100%;
  border-collapse: collapse;
}

.device-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.device-table td {
  padding: 14px 12px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.device-table tr:last-child td {
  border-bottom: none;
}

.device-table tr {
  cursor: pointer;
  transition: background var(--transition);
}

.device-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.device-table tr.status-lost td,
.device-table tr.status-damaged td {
  opacity: 0.65;
}

.device-label {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

/* ── Status Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-confirmed {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-confirmed);
}

.badge-pending {
  background: rgba(245, 166, 35, 0.15);
  color: var(--status-pending);
}

.badge-newbie {
  background: rgba(168, 85, 247, 0.15);
  color: var(--status-newbie);
}

.badge-neutral {
  background: rgba(107, 114, 128, 0.15);
  color: var(--status-neutral);
}

.badge-lost {
  background: rgba(228, 32, 44, 0.15);
  color: var(--status-lost);
}

.badge-damaged {
  background: rgba(228, 32, 44, 0.15);
  color: var(--status-lost);
}

.badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--status-confirmed);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--brand-red);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #c91c27;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

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

.btn-danger {
  background: #b91c1c;
  color: #fff;
  border: none;
}

.btn-danger:hover:not(:disabled) {
  background: #991b1b;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
  min-height: 36px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  padding: 8px;
  min-height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 11px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(228, 32, 44, 0.15);
}

.form-control::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

select.form-control {
  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 d='M1 1l5 5 5-5' stroke='%239CA3AF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-surface-raised);
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 560px) {
  .modal-overlay {
    align-items: center;
  }
}

.modal {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(40px);
  transition: transform 0.25s ease;
}

@media (min-width: 560px) {
  .modal {
    border-radius: var(--radius-lg);
    transform: translateY(16px);
  }
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 1.0625rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  min-width: 32px;
  min-height: 32px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-footer .btn {
  flex: 1;
}

/* ── Timeline (History) ─────────────────────────────────────── */
/*  Flex-row approach: dot column + content column.             */
/*  The vertical line is drawn via ::before on each item,       */
/*  connecting from the dot downward, so alignment is perfect.  */
.timeline {
  list-style: none;
  overflow: hidden;
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding-bottom: 24px;
  position: relative;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

/* Vertical connector line — starts below the dot and goes down */
.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 7px;
  /* half of dot width (16px / 2 - 1px) */
  top: 22px;
  /* dot top (4px) + dot height (16px) + 2px gap */
  bottom: 0;
  width: 2px;
  background: var(--border-subtle);
}

.timeline-dot-col {
  flex-shrink: 0;
  width: 16px;
  padding-top: 4px;
  position: relative;
  z-index: 1;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.timeline-content {
  flex: 1;
  min-width: 0;
  /* critical: lets flex child shrink below content size */
}

.dot-confirmed {
  background: var(--status-confirmed);
}

.dot-pending {
  background: var(--status-pending);
}

.dot-newbie {
  background: var(--status-newbie);
}

.dot-neutral {
  background: var(--status-neutral);
}

.dot-lost {
  background: var(--status-lost);
}

.dot-damaged {
  background: var(--status-lost);
}

.dot-added {
  background: var(--text-secondary);
}

/* Blue: regular member-to-member transfers */
.dot-transfer {
  background: var(--status-transfer);
}

.badge-transfer {
  background: rgba(59, 130, 246, 0.15);
  color: var(--status-transfer);
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.timeline-desc {
  font-size: 0.875rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: left;
  /* always left — badges must not centre on mobile */
}

/* Timeline badges may contain long names — allow wrapping, keep left-aligned */
.timeline-desc .badge {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: left;
  display: inline-flex;
  align-items: flex-start;
  /* text aligns to top when wrapped */
  line-height: 1.4;
  max-width: 100%;
  /* constrain to parent width so text wraps instead of overflowing */
}

.timeline-note {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 3px;
  overflow-wrap: break-word;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* TXN ID shown below every timeline entry for admin reference */
.timeline-txn {
  font-size: 0.68rem;
  color: var(--text-secondary);
  opacity: 0.45;
  margin-top: 5px;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.02em;
}

/* ── Pending Actions Card ───────────────────────────────────── */
#pending-content {
  overflow-x: hidden;
}

/* guard against wide content */
.pending-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  /* stack on mobile by default */
  gap: 12px;
  margin-bottom: 10px;
  animation: fadeUp 0.2s ease both;
  overflow: hidden;
  /* belt-and-braces overflow guard */
}

.pending-item:last-child {
  margin-bottom: 0;
}

.pending-info {
  flex: 1;
  min-width: 0;
}

.pending-info p {
  font-size: 0.875rem;
  margin-bottom: 4px;
  overflow-wrap: break-word;
}

.pending-info small {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: block;
}

.pending-actions {
  display: flex;
  gap: 8px;
}

.pending-actions .btn {
  flex: 1;
}

/* full-width equal buttons on mobile */

/* Subtle auto-poll timestamp */
.pending-timestamp {
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.55;
  text-align: right;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* ── Skeleton Loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-raised) 25%, rgba(255, 255, 255, 0.05) 50%, var(--bg-surface-raised) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 16px;
  margin-bottom: 8px;
}

.skeleton.wide {
  width: 80%;
}

.skeleton.med {
  width: 55%;
}

.skeleton.short {
  width: 35%;
}

.skeleton.tall {
  height: 44px;
  margin-bottom: 12px;
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 0.9375rem;
}

/* ── Toast ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.875rem;
  min-width: 240px;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.2s ease;
  pointer-events: auto;
}

.toast.success {
  border-left-color: var(--status-confirmed);
}

.toast.error {
  border-left-color: var(--brand-red);
}

.toast.info {
  border-left-color: var(--status-pending);
}

/* ── Saving overlay ─────────────────────────────────────────── */
.saving-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.saving-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.saving-box {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 600;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--brand-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── View padding ───────────────────────────────────────────── */
.view-body {
  padding: 24px 0 40px;
  flex: 1;
  overflow-x: hidden;
}

/* Global overflow guard */
html,
body {
  overflow-x: hidden;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {

  /* Hide logo text, keep only the logo image — saves ~80px */
  .nav-logo-text {
    display: none;
  }

  /* Tabs shrink to icon-only */
  .nav-tabs .nav-tab span.tab-label {
    display: none;
  }

  .nav-tabs .nav-tab {
    padding: 8px 10px;
    min-width: 40px;
  }

  .nav-tabs {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  /* Forms */
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  /* Login */
  .login-card {
    padding: 36px 24px;
    margin: 16px;
  }

  /* Container: override only horizontal padding — do NOT use shorthand here
     because shorthand `padding: 0 12px` would also zero out view-body's 24px top padding */
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Table on mobile: hide capacity & note cols */
  .device-table th:nth-child(3),
  .device-table td:nth-child(3),
  .device-table th:nth-child(6),
  .device-table td:nth-child(6) {
    display: none;
  }

  /* Toast */
  #toast-container {
    right: 12px;
    bottom: 12px;
  }

  /* Pending cards */
  .pending-item {
    padding: 12px 14px;
  }

  /* Remove badge wrapping — let overflow-wrap handle it instead */
  .badge {
    white-space: nowrap;
  }

  /* Gap: all views already get 24px from .view-body padding — no extra margin needed */
  /* History: space between back-button row and the card below it */
  #view-history .view-body>div:first-child {
    margin-bottom: 8px;
  }
}

@media (min-width: 601px) and (max-width: 768px) {
  .nav-tabs .nav-tab {
    padding: 8px 10px;
  }

  /* Show logo text but shrink it */
  .nav-logo-text {
    font-size: 0.875rem;
  }
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

  100% {
    background-position: -100% 0;
  }
}

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

/* ── Device cards (mobile) ───────────────────────────────── */
.device-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-card-row {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.device-card-row:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.02);
}

.device-card-row.status-lost,
.device-card-row.status-damaged {
  opacity: 0.65;
}

.device-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 8px;
}

.device-card-bottom {
  display: flex;
  flex-direction: column; /* stack type+capacity and holder text on separate lines */
  gap: 3px;
}
.device-card-bottom span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* truncate with … instead of wrapping */
  font-size: .8rem;
  color: var(--text-secondary);
}

.device-card-note {
  margin-top: 6px;
}

/* ── Device menu info rows ───────────────────────────────── */
.device-menu-info {
  margin-bottom: 4px;
}

.device-menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: .875rem;
  gap: 12px;
}

.device-menu-row:last-child {
  border-bottom: none;
}

.device-menu-row .text-muted {
  font-size: .8rem;
  flex-shrink: 0;
}

/* ── Table wrap (horizontal scroll on mobile) ───────────── */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Icon sizing ─────────────────────────────────────────── */
.icon {
  vertical-align: middle;
  flex-shrink: 0;
}

/* ── Misc helpers ───────────────────────────────────────── */
.text-muted {
  color: var(--text-secondary);
}

.text-red {
  color: var(--brand-red);
}

.text-green {
  color: var(--status-confirmed);
}

.font-heading {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.hidden {
  display: none !important;
}

.admin-only {
  display: none;
}

body.is-admin .admin-only {
  display: block;
}

body.is-admin .admin-only.flex {
  display: flex;
}

/* ── Footer ─────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 20px 16px 32px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.5;
  letter-spacing: 0.01em;
  user-select: none;
}