@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-7px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ambient-drift { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(24px,-18px,0) scale(1.08); } }
@keyframes hero-glow { 0%,100% { transform: translateX(-35%) rotate(18deg); opacity: .08; } 50% { transform: translateX(90%) rotate(18deg); opacity: .16; } }
@keyframes scan-pulse { 0%,100% { box-shadow: 0 16px 40px #050d2b50, 0 0 0 0 #69b7ff45; } 50% { box-shadow: 0 18px 46px #050d2b55, 0 0 0 12px #69b7ff00; } }
@keyframes soft-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes logo-breathe { 0%,100% { box-shadow: 0 7px 18px #315bd542; } 50% { box-shadow: 0 8px 24px #315bd56b; } }
@keyframes view-reveal { from { opacity: 0; transform: translateY(14px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes card-arrive { from { opacity: 0; transform: translateY(18px) scale(.975); } to { opacity: 1; transform: none; } }
@keyframes toast-spring { 0% { opacity:0; transform:translateY(18px) scale(.94); } 65% { transform:translateY(-3px) scale(1.01); } 100% { opacity:1; transform:none; } }
@keyframes attention-ring { 0%,100% { box-shadow:0 0 0 0 #f39a4b00; } 50% { box-shadow:0 0 0 5px #f39a4b18; } }
@keyframes nav-icon-in { 0% { transform:scale(.7) translateY(4px); } 65% { transform:scale(1.14) translateY(-2px); } 100% { transform:none; } }
@keyframes progress-flow { from { background-position:0 0; } to { background-position:32px 0; } }

main > section:not([hidden]) { animation: view-reveal .38s cubic-bezier(.2,.75,.25,1) both; }
.account-menu:not([hidden]) { transform-origin: top right; animation: menu-in .18s ease-out both; }
dialog[open] { animation: dialog-in .22s ease-out both; }
dialog[open]::backdrop { animation: backdrop-in .2s ease-out both; }

button, .card, input, select, textarea, .timeline article, .stats article {
  transition: color .18s ease, background-color .18s ease, border-color .18s ease,
              box-shadow .18s ease, transform .18s ease, opacity .18s ease;
}
button:active { transform: scale(.97); }
input:focus, select:focus, textarea:focus { outline: none; border-color: #5e887f; box-shadow: 0 0 0 3px #5e887f26; }
.card:hover { transform: translateY(-3px); }
.equipment-grid:not(.empty) .card { animation: card-arrive .42s cubic-bezier(.18,.78,.25,1) both; animation-delay:var(--delay,0ms); }
.issues-list .issue-card,.users-list .user-row,.option-list>div,.chat-list-row { animation:card-arrive .36s cubic-bezier(.18,.78,.25,1) both; animation-delay:var(--delay,0ms); }
.timeline article:hover { border-color: #b9c9c3; transform: translateX(3px); }
.stats article:hover { background: #fbfcfa; }
.stats article { animation: soft-pop .4s cubic-bezier(.2,.8,.2,1) both; }
.stats article:nth-child(2) { animation-delay: .07s; }
.stats article:nth-child(3) { animation-delay: .14s; }
.timeline article { animation: fade-up .3s ease-out both; }
.timeline article:nth-child(2) { animation-delay: .04s; }
.timeline article:nth-child(3) { animation-delay: .08s; }
.timeline article:nth-child(4) { animation-delay: .12s; }

.primary { position: relative; overflow: hidden; }
.primary::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 25%, #fff3 48%, transparent 70%);
  transform: translateX(-130%); transition: transform .55s ease;
}
.primary:hover::after { transform: translateX(130%); }
.primary:hover { transform:translateY(-1px); }
.brand > span { animation: logo-breathe 4s ease-in-out infinite; }
.scan-button { animation: scan-pulse 2.6s ease-in-out infinite; }
.scan-button span { transition: transform .25s ease; }
.scan-button:hover span { transform: scale(1.12) rotate(8deg); }
nav button { position: relative; }
nav button::after {
  content: ''; position: absolute; right: 18%; bottom: 3px; left: 18%; height: 2px;
  border-radius: 3px; background: currentColor; transform: scaleX(0); transition: transform .22s ease;
}
nav button.active::after { transform: scaleX(1); }
nav button.active::before { animation:nav-icon-in .35s cubic-bezier(.2,.85,.25,1); }

.card::after {
  content:''; position:absolute; inset:0; pointer-events:none; opacity:0;
  background:radial-gradient(280px circle at var(--pointer-x,50%) var(--pointer-y,50%),#4b8dff13,transparent 55%);
  transition:opacity .25s ease;
}
.card:hover::after { opacity:1; }
.attention-card .equipment-attention { animation:attention-ring 2.8s ease-in-out infinite; }
#toast.show { animation:toast-spring .38s cubic-bezier(.16,.85,.3,1) both; }
.level-track i { background-size:32px 100%; animation:progress-flow 1.8s linear infinite; }
.equipment-photo:active img { transform:scale(.98); }
.photo-viewer[open] img { animation:view-reveal .3s ease-out both; }

@media (hover:hover) {
  .card:hover { transform:translateY(-5px) scale(1.008); box-shadow:0 18px 42px #1a326a1a; }
  button:not(:disabled):hover { transform:translateY(-1px); }
  button:not(:disabled):active { transform:translateY(0) scale(.97); }
}

.toolbar .search { overflow: hidden; }
.toolbar .search input {
  min-width: 0; min-height: 0; height: 100%; margin: 0; padding: 0 10px;
  border: 0; border-radius: 0; outline: 0; background: transparent; box-shadow: none;
}
.account-button { min-height: 40px; height: 40px; padding: 7px 12px; line-height: 1; }
.password-field { display: block; position: relative; margin-top: 6px; }
.password-field input { margin-top: 0 !important; padding-right: 48px; }
.password-eye { position: absolute; top: 50%; right: 5px; width: 39px; min-height: 36px; padding: 0; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.password-eye:active { transform: translateY(-50%) scale(.94); }
.password-eye.visible { color: var(--ink); }
.password-eye svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card { padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.settings-card h2 { margin: 0 0 18px; font: 26px Georgia, serif; }
.option-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.option-list { display: grid; gap: 7px; margin-top: 18px; }
.option-list > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px 9px 13px; border-radius: 8px; background: var(--paper); }
.option-list .icon { min-width: 34px; min-height: 34px; }
.user-actions { display: flex; gap: 6px; }
.user-actions button { padding: 9px; font-size: 13px; }
.user-row { grid-template-columns: 44px 1fr 210px 190px; }
.pending-user { border-color: #d9a26f; background: #fffaf4; }

@media (max-width: 760px) {
  .account-button { min-height: 38px; height: 38px; padding: 6px 9px; border-radius: 9px; font-size: 14px; }
  .toolbar .search input { font-size: 16px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card { padding: 17px; }
  .option-form { grid-template-columns: 1fr; }
  .user-actions { grid-column: 1/-1; }
  .user-actions button { flex: 1; }
  .equipment-grid .card { animation: fade-up .25s ease-out both; }
  .equipment-grid .card:nth-child(2) { animation-delay: .035s; }
  .equipment-grid .card:nth-child(3) { animation-delay: .07s; }
  .equipment-grid .card:nth-child(4) { animation-delay: .105s; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
